File tree 2 files changed +37
-0
lines changed
2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -88,11 +88,13 @@ module.exports = {
88
88
const type = funcObject . events [ 0 ] . event . eventType ;
89
89
const path = funcObject . events [ 0 ] . event . path ; //eslint-disable-line
90
90
const resource = funcObject . events [ 0 ] . event . resource ;
91
+ const failurePolicy = funcObject . events [ 0 ] . event . failurePolicy ;
91
92
92
93
funcTemplate . properties . eventTrigger = { } ;
93
94
funcTemplate . properties . eventTrigger . eventType = type ;
94
95
if ( path ) funcTemplate . properties . eventTrigger . path = path ;
95
96
funcTemplate . properties . eventTrigger . resource = resource ;
97
+ if ( failurePolicy ) funcTemplate . properties . eventTrigger . failurePolicy = failurePolicy ;
96
98
}
97
99
98
100
this . serverless . service . provider . compiledConfigurationTemplate . resources . push ( funcTemplate ) ;
Original file line number Diff line number Diff line change @@ -568,6 +568,20 @@ describe('CompileFunctions', () => {
568
568
} ,
569
569
] ,
570
570
} ,
571
+ func3 : {
572
+ handler : 'func3' ,
573
+ events : [
574
+ {
575
+ event : {
576
+ eventType : 'foo' ,
577
+ resource : 'some-resource' ,
578
+ failurePolicy : {
579
+ retry : { } ,
580
+ } ,
581
+ } ,
582
+ } ,
583
+ ] ,
584
+ } ,
571
585
} ;
572
586
573
587
const compiledResources = [
@@ -608,6 +622,27 @@ describe('CompileFunctions', () => {
608
622
labels : { } ,
609
623
} ,
610
624
} ,
625
+ {
626
+ type : 'gcp-types/cloudfunctions-v1:projects.locations.functions' ,
627
+ name : 'my-service-dev-func3' ,
628
+ properties : {
629
+ entryPoint : 'func3' ,
630
+ parent : 'projects/myProject/locations/us-central1' ,
631
+ runtime : 'nodejs8' ,
632
+ function : 'my-service-dev-func3' ,
633
+ availableMemoryMb : 256 ,
634
+ timeout : '60s' ,
635
+ sourceArchiveUrl : 'gs://sls-my-service-dev-12345678/some-path/artifact.zip' ,
636
+ eventTrigger : {
637
+ eventType : 'foo' ,
638
+ resource : 'some-resource' ,
639
+ failurePolicy : {
640
+ retry : { } ,
641
+ } ,
642
+ } ,
643
+ labels : { } ,
644
+ } ,
645
+ } ,
611
646
] ;
612
647
613
648
return googlePackage . compileFunctions ( ) . then ( ( ) => {
You can’t perform that action at this time.
0 commit comments