@@ -6,27 +6,52 @@ 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 }
2843 }
2944
45+ function buildCommonOptions (
46+ options : RetryStrategyOptions ,
47+ builder : ObjectValueBuilder ,
48+ ) : void {
49+ buildBaseBackoffSecondsOption ( options , builder )
50+ buildMaxRetriesOption ( options , builder )
51+ buildMaxDurationSecondsOption ( options , builder )
52+ buildSameRegionOption ( options , builder )
53+ }
54+
3055 if ( strategy === null || strategy === undefined ) {
3156 return expr ( ident ( 'RetryStrategyBuilder' ) , builder => {
3257 builder . member ( ident ( 'noRetries' ) )
@@ -64,6 +89,16 @@ export function valueForRetryStrategy (genfile: GeneratedFile, strategy?: RetryS
6489 } )
6590 } )
6691 } )
92+ case 'SINGLE' :
93+ return expr ( ident ( 'RetryStrategyBuilder' ) , builder => {
94+ builder . member ( ident ( 'singleRetry' ) )
95+ builder . call ( builder => {
96+ builder . object ( builder => {
97+ buildBaseBackoffSecondsOption ( strategy , builder )
98+ buildSameRegionOption ( strategy , builder )
99+ } )
100+ } )
101+ } )
67102 case 'NO_RETRIES' :
68103 return expr ( ident ( 'RetryStrategyBuilder' ) , builder => {
69104 builder . member ( ident ( 'noRetries' ) )
0 commit comments