10
10
resolve_one_of ,
11
11
)
12
12
from .types import (
13
+ ContainerHealthCheckSpecHTTPProbe ,
14
+ ContainerHealthCheckSpecTCPProbe ,
15
+ ContainerHealthCheckSpec ,
13
16
ContainerScalingOption ,
14
17
SecretHashedValue ,
15
18
Container ,
45
48
)
46
49
47
50
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
+
48
114
def unmarshal_ContainerScalingOption (data : Any ) -> ContainerScalingOption :
49
115
if not isinstance (data , dict ):
50
116
raise TypeError (
@@ -139,22 +205,6 @@ def unmarshal_Container(data: Any) -> Container:
139
205
if field is not None :
140
206
args ["registry_image" ] = field
141
207
142
- field = data .get ("max_concurrency" , None )
143
- if field is not None :
144
- args ["max_concurrency" ] = field
145
-
146
- field = data .get ("domain_name" , None )
147
- if field is not None :
148
- args ["domain_name" ] = field
149
-
150
- field = data .get ("protocol" , None )
151
- if field is not None :
152
- args ["protocol" ] = field
153
-
154
- field = data .get ("port" , None )
155
- if field is not None :
156
- args ["port" ] = field
157
-
158
208
field = data .get ("timeout" , None )
159
209
if field is not None :
160
210
args ["timeout" ] = field
@@ -173,6 +223,22 @@ def unmarshal_Container(data: Any) -> Container:
173
223
else :
174
224
args ["description" ] = None
175
225
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
+
176
242
field = data .get ("secret_environment_variables" , None )
177
243
if field is not None :
178
244
args ["secret_environment_variables" ] = (
@@ -203,6 +269,12 @@ def unmarshal_Container(data: Any) -> Container:
203
269
else :
204
270
args ["scaling_option" ] = None
205
271
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
+
206
278
field = data .get ("created_at" , None )
207
279
if field is not None :
208
280
args ["created_at" ] = parser .isoparse (field ) if isinstance (field , str ) else field
@@ -696,6 +768,50 @@ def unmarshal_ListTriggersResponse(data: Any) -> ListTriggersResponse:
696
768
return ListTriggersResponse (** args )
697
769
698
770
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
+
699
815
def marshal_ContainerScalingOption (
700
816
request : ContainerScalingOption ,
701
817
defaults : ProfileDefaults ,
@@ -799,6 +915,11 @@ def marshal_CreateContainerRequest(
799
915
request .scaling_option , defaults
800
916
)
801
917
918
+ if request .health_check is not None :
919
+ output ["health_check" ] = marshal_ContainerHealthCheckSpec (
920
+ request .health_check , defaults
921
+ )
922
+
802
923
return output
803
924
804
925
@@ -1043,6 +1164,11 @@ def marshal_UpdateContainerRequest(
1043
1164
request .scaling_option , defaults
1044
1165
)
1045
1166
1167
+ if request .health_check is not None :
1168
+ output ["health_check" ] = marshal_ContainerHealthCheckSpec (
1169
+ request .health_check , defaults
1170
+ )
1171
+
1046
1172
return output
1047
1173
1048
1174
0 commit comments