@@ -10,6 +10,9 @@ import {
1010import type { DefaultValues } from '../../../bridge'
1111import type {
1212 Container ,
13+ ContainerHealthCheckSpec ,
14+ ContainerHealthCheckSpecHTTPProbe ,
15+ ContainerHealthCheckSpecTCPProbe ,
1316 ContainerScalingOption ,
1417 CreateContainerRequest ,
1518 CreateCronRequest ,
@@ -43,6 +46,53 @@ import type {
4346 UpdateTriggerRequestSqsClientConfig ,
4447} from './types.gen'
4548
49+ const unmarshalContainerHealthCheckSpecHTTPProbe = (
50+ data : unknown ,
51+ ) : ContainerHealthCheckSpecHTTPProbe => {
52+ if ( ! isJSONObject ( data ) ) {
53+ throw new TypeError (
54+ `Unmarshalling the type 'ContainerHealthCheckSpecHTTPProbe' failed as data isn't a dictionary.` ,
55+ )
56+ }
57+
58+ return {
59+ path : data . path ,
60+ } as ContainerHealthCheckSpecHTTPProbe
61+ }
62+
63+ const unmarshalContainerHealthCheckSpecTCPProbe = (
64+ data : unknown ,
65+ ) : ContainerHealthCheckSpecTCPProbe => {
66+ if ( ! isJSONObject ( data ) ) {
67+ throw new TypeError (
68+ `Unmarshalling the type 'ContainerHealthCheckSpecTCPProbe' failed as data isn't a dictionary.` ,
69+ )
70+ }
71+
72+ return { } as ContainerHealthCheckSpecTCPProbe
73+ }
74+
75+ const unmarshalContainerHealthCheckSpec = (
76+ data : unknown ,
77+ ) : ContainerHealthCheckSpec => {
78+ if ( ! isJSONObject ( data ) ) {
79+ throw new TypeError (
80+ `Unmarshalling the type 'ContainerHealthCheckSpec' failed as data isn't a dictionary.` ,
81+ )
82+ }
83+
84+ return {
85+ failureThreshold : data . failure_threshold ,
86+ http : data . http
87+ ? unmarshalContainerHealthCheckSpecHTTPProbe ( data . http )
88+ : undefined ,
89+ interval : data . interval ,
90+ tcp : data . tcp
91+ ? unmarshalContainerHealthCheckSpecTCPProbe ( data . tcp )
92+ : undefined ,
93+ } as ContainerHealthCheckSpec
94+ }
95+
4696const unmarshalContainerScalingOption = (
4797 data : unknown ,
4898) : ContainerScalingOption => {
@@ -54,6 +104,7 @@ const unmarshalContainerScalingOption = (
54104
55105 return {
56106 concurrentRequestsThreshold : data . concurrent_requests_threshold ,
107+ cpuUsageThreshold : data . cpu_usage_threshold ,
57108 } as ContainerScalingOption
58109}
59110
@@ -84,6 +135,9 @@ export const unmarshalContainer = (data: unknown): Container => {
84135 domainName : data . domain_name ,
85136 environmentVariables : data . environment_variables ,
86137 errorMessage : data . error_message ,
138+ healthCheck : data . health_check
139+ ? unmarshalContainerHealthCheckSpec ( data . health_check )
140+ : undefined ,
87141 httpOption : data . http_option ,
88142 id : data . id ,
89143 localStorageLimit : data . local_storage_limit ,
@@ -362,6 +416,42 @@ export const unmarshalListTriggersResponse = (
362416 } as ListTriggersResponse
363417}
364418
419+ const marshalContainerHealthCheckSpecHTTPProbe = (
420+ request : ContainerHealthCheckSpecHTTPProbe ,
421+ defaults : DefaultValues ,
422+ ) : Record < string , unknown > => ( {
423+ path : request . path ,
424+ } )
425+
426+ const marshalContainerHealthCheckSpecTCPProbe = (
427+ request : ContainerHealthCheckSpecTCPProbe ,
428+ defaults : DefaultValues ,
429+ ) : Record < string , unknown > => ( { } )
430+
431+ const marshalContainerHealthCheckSpec = (
432+ request : ContainerHealthCheckSpec ,
433+ defaults : DefaultValues ,
434+ ) : Record < string , unknown > => ( {
435+ failure_threshold : request . failureThreshold ,
436+ interval : request . interval ,
437+ ...resolveOneOf ( [
438+ {
439+ param : 'http' ,
440+ value :
441+ request . http !== undefined
442+ ? marshalContainerHealthCheckSpecHTTPProbe ( request . http , defaults )
443+ : undefined ,
444+ } ,
445+ {
446+ param : 'tcp' ,
447+ value :
448+ request . tcp !== undefined
449+ ? marshalContainerHealthCheckSpecTCPProbe ( request . tcp , defaults )
450+ : undefined ,
451+ } ,
452+ ] ) ,
453+ } )
454+
365455const marshalContainerScalingOption = (
366456 request : ContainerScalingOption ,
367457 defaults : DefaultValues ,
@@ -371,6 +461,7 @@ const marshalContainerScalingOption = (
371461 param : 'concurrent_requests_threshold' ,
372462 value : request . concurrentRequestsThreshold ,
373463 } ,
464+ { param : 'cpu_usage_threshold' , value : request . cpuUsageThreshold } ,
374465 ] ) ,
375466} )
376467
@@ -389,6 +480,10 @@ export const marshalCreateContainerRequest = (
389480 cpu_limit : request . cpuLimit ,
390481 description : request . description ,
391482 environment_variables : request . environmentVariables ,
483+ health_check :
484+ request . healthCheck !== undefined
485+ ? marshalContainerHealthCheckSpec ( request . healthCheck , defaults )
486+ : undefined ,
392487 http_option : request . httpOption ,
393488 local_storage_limit : request . localStorageLimit ,
394489 max_concurrency : request . maxConcurrency ,
@@ -539,6 +634,10 @@ export const marshalUpdateContainerRequest = (
539634 cpu_limit : request . cpuLimit ,
540635 description : request . description ,
541636 environment_variables : request . environmentVariables ,
637+ health_check :
638+ request . healthCheck !== undefined
639+ ? marshalContainerHealthCheckSpec ( request . healthCheck , defaults )
640+ : undefined ,
542641 http_option : request . httpOption ,
543642 local_storage_limit : request . localStorageLimit ,
544643 max_concurrency : request . maxConcurrency ,
0 commit comments