1010 resolve_one_of ,
1111)
1212from .types import (
13+ ContainerHealthCheckSpecHTTPProbe ,
14+ ContainerHealthCheckSpecTCPProbe ,
15+ ContainerHealthCheckSpec ,
1316 ContainerScalingOption ,
1417 SecretHashedValue ,
1518 Container ,
4548)
4649
4750
51+ def unmarshal_ContainerHealthCheckSpecHTTPProbe (
52+ data : Any ,
53+ ) -> ContainerHealthCheckSpecHTTPProbe :
54+ if not isinstance (data , dict ):
55+ raise TypeError (
56+ "Unmarshalling the type 'ContainerHealthCheckSpecHTTPProbe' failed as data isn't a dictionary."
57+ )
58+
59+ args : Dict [str , Any ] = {}
60+
61+ field = data .get ("path" , None )
62+ if field is not None :
63+ args ["path" ] = field
64+
65+ return ContainerHealthCheckSpecHTTPProbe (** args )
66+
67+
68+ def unmarshal_ContainerHealthCheckSpecTCPProbe (
69+ data : Any ,
70+ ) -> ContainerHealthCheckSpecTCPProbe :
71+ if not isinstance (data , dict ):
72+ raise TypeError (
73+ "Unmarshalling the type 'ContainerHealthCheckSpecTCPProbe' failed as data isn't a dictionary."
74+ )
75+
76+ args : Dict [str , Any ] = {}
77+
78+ return ContainerHealthCheckSpecTCPProbe (** args )
79+
80+
81+ def unmarshal_ContainerHealthCheckSpec (data : Any ) -> ContainerHealthCheckSpec :
82+ if not isinstance (data , dict ):
83+ raise TypeError (
84+ "Unmarshalling the type 'ContainerHealthCheckSpec' failed as data isn't a dictionary."
85+ )
86+
87+ args : Dict [str , Any ] = {}
88+
89+ field = data .get ("failure_threshold" , None )
90+ if field is not None :
91+ args ["failure_threshold" ] = field
92+
93+ field = data .get ("http" , None )
94+ if field is not None :
95+ args ["http" ] = unmarshal_ContainerHealthCheckSpecHTTPProbe (field )
96+ else :
97+ args ["http" ] = None
98+
99+ field = data .get ("tcp" , None )
100+ if field is not None :
101+ args ["tcp" ] = unmarshal_ContainerHealthCheckSpecTCPProbe (field )
102+ else :
103+ args ["tcp" ] = None
104+
105+ field = data .get ("interval" , None )
106+ if field is not None :
107+ args ["interval" ] = field
108+ else :
109+ args ["interval" ] = None
110+
111+ return ContainerHealthCheckSpec (** args )
112+
113+
48114def unmarshal_ContainerScalingOption (data : Any ) -> ContainerScalingOption :
49115 if not isinstance (data , dict ):
50116 raise TypeError (
@@ -59,6 +125,12 @@ def unmarshal_ContainerScalingOption(data: Any) -> ContainerScalingOption:
59125 else :
60126 args ["concurrent_requests_threshold" ] = None
61127
128+ field = data .get ("cpu_usage_threshold" , None )
129+ if field is not None :
130+ args ["cpu_usage_threshold" ] = field
131+ else :
132+ args ["cpu_usage_threshold" ] = None
133+
62134 return ContainerScalingOption (** args )
63135
64136
@@ -133,22 +205,6 @@ def unmarshal_Container(data: Any) -> Container:
133205 if field is not None :
134206 args ["registry_image" ] = field
135207
136- field = data .get ("max_concurrency" , None )
137- if field is not None :
138- args ["max_concurrency" ] = field
139-
140- field = data .get ("domain_name" , None )
141- if field is not None :
142- args ["domain_name" ] = field
143-
144- field = data .get ("protocol" , None )
145- if field is not None :
146- args ["protocol" ] = field
147-
148- field = data .get ("port" , None )
149- if field is not None :
150- args ["port" ] = field
151-
152208 field = data .get ("timeout" , None )
153209 if field is not None :
154210 args ["timeout" ] = field
@@ -167,6 +223,22 @@ def unmarshal_Container(data: Any) -> Container:
167223 else :
168224 args ["description" ] = None
169225
226+ field = data .get ("max_concurrency" , None )
227+ if field is not None :
228+ args ["max_concurrency" ] = field
229+
230+ field = data .get ("domain_name" , None )
231+ if field is not None :
232+ args ["domain_name" ] = field
233+
234+ field = data .get ("protocol" , None )
235+ if field is not None :
236+ args ["protocol" ] = field
237+
238+ field = data .get ("port" , None )
239+ if field is not None :
240+ args ["port" ] = field
241+
170242 field = data .get ("secret_environment_variables" , None )
171243 if field is not None :
172244 args ["secret_environment_variables" ] = (
@@ -197,6 +269,12 @@ def unmarshal_Container(data: Any) -> Container:
197269 else :
198270 args ["scaling_option" ] = None
199271
272+ field = data .get ("health_check" , None )
273+ if field is not None :
274+ args ["health_check" ] = unmarshal_ContainerHealthCheckSpec (field )
275+ else :
276+ args ["health_check" ] = None
277+
200278 field = data .get ("created_at" , None )
201279 if field is not None :
202280 args ["created_at" ] = parser .isoparse (field ) if isinstance (field , str ) else field
@@ -690,6 +768,50 @@ def unmarshal_ListTriggersResponse(data: Any) -> ListTriggersResponse:
690768 return ListTriggersResponse (** args )
691769
692770
771+ def marshal_ContainerHealthCheckSpecHTTPProbe (
772+ request : ContainerHealthCheckSpecHTTPProbe ,
773+ defaults : ProfileDefaults ,
774+ ) -> Dict [str , Any ]:
775+ output : Dict [str , Any ] = {}
776+
777+ if request .path is not None :
778+ output ["path" ] = request .path
779+
780+ return output
781+
782+
783+ def marshal_ContainerHealthCheckSpecTCPProbe (
784+ request : ContainerHealthCheckSpecTCPProbe ,
785+ defaults : ProfileDefaults ,
786+ ) -> Dict [str , Any ]:
787+ output : Dict [str , Any ] = {}
788+
789+ return output
790+
791+
792+ def marshal_ContainerHealthCheckSpec (
793+ request : ContainerHealthCheckSpec ,
794+ defaults : ProfileDefaults ,
795+ ) -> Dict [str , Any ]:
796+ output : Dict [str , Any ] = {}
797+ output .update (
798+ resolve_one_of (
799+ [
800+ OneOfPossibility ("http" , request .http ),
801+ OneOfPossibility ("tcp" , request .tcp ),
802+ ]
803+ ),
804+ )
805+
806+ if request .failure_threshold is not None :
807+ output ["failure_threshold" ] = request .failure_threshold
808+
809+ if request .interval is not None :
810+ output ["interval" ] = request .interval
811+
812+ return output
813+
814+
693815def marshal_ContainerScalingOption (
694816 request : ContainerScalingOption ,
695817 defaults : ProfileDefaults ,
@@ -702,6 +824,7 @@ def marshal_ContainerScalingOption(
702824 "concurrent_requests_threshold" ,
703825 request .concurrent_requests_threshold ,
704826 ),
827+ OneOfPossibility ("cpu_usage_threshold" , request .cpu_usage_threshold ),
705828 ]
706829 ),
707830 )
@@ -792,6 +915,11 @@ def marshal_CreateContainerRequest(
792915 request .scaling_option , defaults
793916 )
794917
918+ if request .health_check is not None :
919+ output ["health_check" ] = marshal_ContainerHealthCheckSpec (
920+ request .health_check , defaults
921+ )
922+
795923 return output
796924
797925
@@ -1036,6 +1164,11 @@ def marshal_UpdateContainerRequest(
10361164 request .scaling_option , defaults
10371165 )
10381166
1167+ if request .health_check is not None :
1168+ output ["health_check" ] = marshal_ContainerHealthCheckSpec (
1169+ request .health_check , defaults
1170+ )
1171+
10391172 return output
10401173
10411174
0 commit comments