@@ -6,22 +6,37 @@ export type RetryStrategyResource = RetryStrategy
66export function valueForRetryStrategy ( genfile : GeneratedFile , strategy ?: RetryStrategyResource | null ) : Value {
77 genfile . namedImport ( 'RetryStrategyBuilder' , 'checkly/constructs' )
88
9- function buildCommonOptions (
9+ function buildBaseBackoffSecondsOption (
1010 options : RetryStrategyOptions ,
1111 builder : ObjectValueBuilder ,
1212 ) : void {
1313 if ( options . baseBackoffSeconds ) {
1414 builder . number ( 'baseBackoffSeconds' , options . baseBackoffSeconds )
1515 }
16+ }
1617
18+ function buildMaxRetriesOption (
19+ options : RetryStrategyOptions ,
20+ builder : ObjectValueBuilder ,
21+ ) : void {
1722 if ( options . maxRetries ) {
1823 builder . number ( 'maxRetries' , options . maxRetries )
1924 }
25+ }
2026
27+ function buildMaxDurationSecondsOption (
28+ options : RetryStrategyOptions ,
29+ builder : ObjectValueBuilder ,
30+ ) : void {
2131 if ( options . maxDurationSeconds ) {
2232 builder . number ( 'maxDurationSeconds' , options . maxDurationSeconds )
2333 }
34+ }
2435
36+ function buildSameRegionOption (
37+ options : RetryStrategyOptions ,
38+ builder : ObjectValueBuilder ,
39+ ) : void {
2540 if ( options . sameRegion !== undefined ) {
2641 builder . boolean ( 'sameRegion' , options . sameRegion )
2742 }
@@ -40,6 +55,16 @@ export function valueForRetryStrategy (genfile: GeneratedFile, strategy?: RetryS
4055 }
4156 }
4257
58+ function buildCommonOptions (
59+ options : RetryStrategyOptions ,
60+ builder : ObjectValueBuilder ,
61+ ) : void {
62+ buildBaseBackoffSecondsOption ( options , builder )
63+ buildMaxRetriesOption ( options , builder )
64+ buildMaxDurationSecondsOption ( options , builder )
65+ buildSameRegionOption ( options , builder )
66+ }
67+
4368 if ( strategy === null || strategy === undefined ) {
4469 return expr ( ident ( 'RetryStrategyBuilder' ) , builder => {
4570 builder . member ( ident ( 'noRetries' ) )
@@ -77,6 +102,16 @@ export function valueForRetryStrategy (genfile: GeneratedFile, strategy?: RetryS
77102 } )
78103 } )
79104 } )
105+ case 'SINGLE' :
106+ return expr ( ident ( 'RetryStrategyBuilder' ) , builder => {
107+ builder . member ( ident ( 'singleRetry' ) )
108+ builder . call ( builder => {
109+ builder . object ( builder => {
110+ buildBaseBackoffSecondsOption ( strategy , builder )
111+ buildSameRegionOption ( strategy , builder )
112+ } )
113+ } )
114+ } )
80115 case 'NO_RETRIES' :
81116 return expr ( ident ( 'RetryStrategyBuilder' ) , builder => {
82117 builder . member ( ident ( 'noRetries' ) )
0 commit comments