latitudesh-python-sdk 0.0.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of latitudesh-python-sdk might be problematic. Click here for more details.

Files changed (206) hide show
  1. latitudesh_python_sdk/__init__.py +18 -0
  2. latitudesh_python_sdk/_hooks/__init__.py +5 -0
  3. latitudesh_python_sdk/_hooks/registration.py +13 -0
  4. latitudesh_python_sdk/_hooks/sdkhooks.py +76 -0
  5. latitudesh_python_sdk/_hooks/types.py +106 -0
  6. latitudesh_python_sdk/_version.py +15 -0
  7. latitudesh_python_sdk/apikeys.py +802 -0
  8. latitudesh_python_sdk/basesdk.py +366 -0
  9. latitudesh_python_sdk/billing.py +210 -0
  10. latitudesh_python_sdk/events_sdk.py +240 -0
  11. latitudesh_python_sdk/firewalls_sdk.py +1640 -0
  12. latitudesh_python_sdk/httpclient.py +136 -0
  13. latitudesh_python_sdk/ipaddresses_sdk.py +448 -0
  14. latitudesh_python_sdk/models/__init__.py +1927 -0
  15. latitudesh_python_sdk/models/api_key.py +81 -0
  16. latitudesh_python_sdk/models/apierror.py +22 -0
  17. latitudesh_python_sdk/models/assign_server_virtual_networkop.py +43 -0
  18. latitudesh_python_sdk/models/bandwidth_packages.py +67 -0
  19. latitudesh_python_sdk/models/bandwidth_plan.py +72 -0
  20. latitudesh_python_sdk/models/bandwidth_plans.py +15 -0
  21. latitudesh_python_sdk/models/billing_usage.py +158 -0
  22. latitudesh_python_sdk/models/create_api_key.py +40 -0
  23. latitudesh_python_sdk/models/create_firewall_assignmentop.py +61 -0
  24. latitudesh_python_sdk/models/create_firewallop.py +69 -0
  25. latitudesh_python_sdk/models/create_ipmi_sessionop.py +16 -0
  26. latitudesh_python_sdk/models/create_projectop.py +79 -0
  27. latitudesh_python_sdk/models/create_server_actionop.py +69 -0
  28. latitudesh_python_sdk/models/create_server_out_of_bandop.py +61 -0
  29. latitudesh_python_sdk/models/create_server_reinstallop.py +140 -0
  30. latitudesh_python_sdk/models/create_serverop.py +173 -0
  31. latitudesh_python_sdk/models/create_tagop.py +50 -0
  32. latitudesh_python_sdk/models/create_virtual_networkop.py +72 -0
  33. latitudesh_python_sdk/models/custom_tag.py +54 -0
  34. latitudesh_python_sdk/models/delete_api_keyop.py +16 -0
  35. latitudesh_python_sdk/models/delete_firewall_assignmentop.py +25 -0
  36. latitudesh_python_sdk/models/delete_firewallop.py +18 -0
  37. latitudesh_python_sdk/models/delete_project_ssh_keyop.py +23 -0
  38. latitudesh_python_sdk/models/delete_project_user_dataop.py +23 -0
  39. latitudesh_python_sdk/models/delete_projectop.py +18 -0
  40. latitudesh_python_sdk/models/delete_storage_filesystemsop.py +16 -0
  41. latitudesh_python_sdk/models/delete_virtual_networks_assignmentsop.py +16 -0
  42. latitudesh_python_sdk/models/delete_vpn_sessionop.py +16 -0
  43. latitudesh_python_sdk/models/deploy_config.py +74 -0
  44. latitudesh_python_sdk/models/destroy_serverop.py +31 -0
  45. latitudesh_python_sdk/models/destroy_tagop.py +16 -0
  46. latitudesh_python_sdk/models/destroy_team_memberop.py +18 -0
  47. latitudesh_python_sdk/models/destroy_virtual_machineop.py +16 -0
  48. latitudesh_python_sdk/models/destroy_virtual_networkop.py +18 -0
  49. latitudesh_python_sdk/models/error_object.py +49 -0
  50. latitudesh_python_sdk/models/events.py +90 -0
  51. latitudesh_python_sdk/models/filesystem_data.py +53 -0
  52. latitudesh_python_sdk/models/firewall.py +71 -0
  53. latitudesh_python_sdk/models/firewall_server.py +50 -0
  54. latitudesh_python_sdk/models/firewalls.py +26 -0
  55. latitudesh_python_sdk/models/get_bandwidth_plansop.py +33 -0
  56. latitudesh_python_sdk/models/get_billing_usageop.py +46 -0
  57. latitudesh_python_sdk/models/get_eventsop.py +98 -0
  58. latitudesh_python_sdk/models/get_firewall_assignmentsop.py +18 -0
  59. latitudesh_python_sdk/models/get_firewallop.py +18 -0
  60. latitudesh_python_sdk/models/get_ipop.py +33 -0
  61. latitudesh_python_sdk/models/get_ipsop.py +91 -0
  62. latitudesh_python_sdk/models/get_planop.py +16 -0
  63. latitudesh_python_sdk/models/get_plans_operating_systemop.py +19 -0
  64. latitudesh_python_sdk/models/get_plansop.py +125 -0
  65. latitudesh_python_sdk/models/get_project_ssh_keyop.py +37 -0
  66. latitudesh_python_sdk/models/get_project_ssh_keysop.py +33 -0
  67. latitudesh_python_sdk/models/get_project_user_dataop.py +38 -0
  68. latitudesh_python_sdk/models/get_project_users_dataop.py +46 -0
  69. latitudesh_python_sdk/models/get_projectsop.py +76 -0
  70. latitudesh_python_sdk/models/get_regionop.py +18 -0
  71. latitudesh_python_sdk/models/get_role_idop.py +16 -0
  72. latitudesh_python_sdk/models/get_rolesop.py +19 -0
  73. latitudesh_python_sdk/models/get_server_deploy_configop.py +18 -0
  74. latitudesh_python_sdk/models/get_server_out_of_bandop.py +18 -0
  75. latitudesh_python_sdk/models/get_serverop.py +33 -0
  76. latitudesh_python_sdk/models/get_serversop.py +156 -0
  77. latitudesh_python_sdk/models/get_storage_filesystemsop.py +22 -0
  78. latitudesh_python_sdk/models/get_traffic_consumptionop.py +45 -0
  79. latitudesh_python_sdk/models/get_traffic_quotaop.py +20 -0
  80. latitudesh_python_sdk/models/get_user_profileop.py +19 -0
  81. latitudesh_python_sdk/models/get_virtual_networkop.py +32 -0
  82. latitudesh_python_sdk/models/get_virtual_networks_assignmentsop.py +40 -0
  83. latitudesh_python_sdk/models/get_virtual_networksop.py +40 -0
  84. latitudesh_python_sdk/models/get_vpn_sessionsop.py +70 -0
  85. latitudesh_python_sdk/models/index_virtual_machineop.py +22 -0
  86. latitudesh_python_sdk/models/ip_address.py +122 -0
  87. latitudesh_python_sdk/models/ip_addresses.py +15 -0
  88. latitudesh_python_sdk/models/ipmi_session.py +53 -0
  89. latitudesh_python_sdk/models/list_firewallsop.py +20 -0
  90. latitudesh_python_sdk/models/membership.py +63 -0
  91. latitudesh_python_sdk/models/operating_systems.py +57 -0
  92. latitudesh_python_sdk/models/out_of_band_connection.py +88 -0
  93. latitudesh_python_sdk/models/patch_current_teamop.py +91 -0
  94. latitudesh_python_sdk/models/patch_storage_filesystemsop.py +79 -0
  95. latitudesh_python_sdk/models/patch_user_profileop.py +88 -0
  96. latitudesh_python_sdk/models/plan.py +15 -0
  97. latitudesh_python_sdk/models/plan_data.py +206 -0
  98. latitudesh_python_sdk/models/post_api_keyop.py +19 -0
  99. latitudesh_python_sdk/models/post_project_ssh_keyop.py +81 -0
  100. latitudesh_python_sdk/models/post_project_user_dataop.py +68 -0
  101. latitudesh_python_sdk/models/post_storage_filesystemsop.py +63 -0
  102. latitudesh_python_sdk/models/post_team_membersop.py +54 -0
  103. latitudesh_python_sdk/models/post_teamop.py +67 -0
  104. latitudesh_python_sdk/models/post_vpn_sessionop.py +63 -0
  105. latitudesh_python_sdk/models/project.py +130 -0
  106. latitudesh_python_sdk/models/project_include.py +72 -0
  107. latitudesh_python_sdk/models/projects.py +15 -0
  108. latitudesh_python_sdk/models/put_project_ssh_keyop.py +87 -0
  109. latitudesh_python_sdk/models/put_project_user_dataop.py +76 -0
  110. latitudesh_python_sdk/models/put_vpn_sessionop.py +16 -0
  111. latitudesh_python_sdk/models/region.py +50 -0
  112. latitudesh_python_sdk/models/region_resource_data.py +37 -0
  113. latitudesh_python_sdk/models/regions.py +50 -0
  114. latitudesh_python_sdk/models/role.py +15 -0
  115. latitudesh_python_sdk/models/role_data.py +35 -0
  116. latitudesh_python_sdk/models/security.py +25 -0
  117. latitudesh_python_sdk/models/server.py +54 -0
  118. latitudesh_python_sdk/models/server_action.py +52 -0
  119. latitudesh_python_sdk/models/server_data.py +219 -0
  120. latitudesh_python_sdk/models/server_exit_rescue_modeop.py +16 -0
  121. latitudesh_python_sdk/models/server_lockop.py +16 -0
  122. latitudesh_python_sdk/models/server_rescue.py +22 -0
  123. latitudesh_python_sdk/models/server_schedule_deletion.py +44 -0
  124. latitudesh_python_sdk/models/server_schedule_deletionop.py +16 -0
  125. latitudesh_python_sdk/models/server_start_rescue_modeop.py +16 -0
  126. latitudesh_python_sdk/models/server_unlockop.py +16 -0
  127. latitudesh_python_sdk/models/server_unschedule_deletionop.py +16 -0
  128. latitudesh_python_sdk/models/servers.py +26 -0
  129. latitudesh_python_sdk/models/show_virtual_machineop.py +16 -0
  130. latitudesh_python_sdk/models/ssh_key.py +15 -0
  131. latitudesh_python_sdk/models/ssh_key_data.py +55 -0
  132. latitudesh_python_sdk/models/storage_plan.py +36 -0
  133. latitudesh_python_sdk/models/storage_plans.py +15 -0
  134. latitudesh_python_sdk/models/team.py +74 -0
  135. latitudesh_python_sdk/models/team_include.py +43 -0
  136. latitudesh_python_sdk/models/team_members.py +51 -0
  137. latitudesh_python_sdk/models/teams.py +26 -0
  138. latitudesh_python_sdk/models/traffic.py +133 -0
  139. latitudesh_python_sdk/models/traffic_quota.py +106 -0
  140. latitudesh_python_sdk/models/update_api_key.py +48 -0
  141. latitudesh_python_sdk/models/update_api_keyop.py +41 -0
  142. latitudesh_python_sdk/models/update_firewallop.py +89 -0
  143. latitudesh_python_sdk/models/update_plans_bandwidthop.py +50 -0
  144. latitudesh_python_sdk/models/update_projectop.py +95 -0
  145. latitudesh_python_sdk/models/update_server_deploy_configop.py +122 -0
  146. latitudesh_python_sdk/models/update_serverop.py +69 -0
  147. latitudesh_python_sdk/models/update_tagop.py +74 -0
  148. latitudesh_python_sdk/models/update_virtual_networkop.py +67 -0
  149. latitudesh_python_sdk/models/user.py +59 -0
  150. latitudesh_python_sdk/models/user_data.py +15 -0
  151. latitudesh_python_sdk/models/user_data_properties.py +46 -0
  152. latitudesh_python_sdk/models/user_include.py +52 -0
  153. latitudesh_python_sdk/models/user_team.py +61 -0
  154. latitudesh_python_sdk/models/user_teams.py +26 -0
  155. latitudesh_python_sdk/models/user_update.py +37 -0
  156. latitudesh_python_sdk/models/virtual_machine.py +25 -0
  157. latitudesh_python_sdk/models/virtual_machine_payload.py +41 -0
  158. latitudesh_python_sdk/models/virtual_machine_plans.py +180 -0
  159. latitudesh_python_sdk/models/virtual_network.py +103 -0
  160. latitudesh_python_sdk/models/virtual_network1.py +84 -0
  161. latitudesh_python_sdk/models/virtual_network_assignment.py +37 -0
  162. latitudesh_python_sdk/models/virtual_network_assignments.py +29 -0
  163. latitudesh_python_sdk/models/virtual_networks.py +26 -0
  164. latitudesh_python_sdk/models/vpn_session_data_with_password.py +77 -0
  165. latitudesh_python_sdk/models/vpn_session_with_password.py +18 -0
  166. latitudesh_python_sdk/operatingsystems_sdk.py +188 -0
  167. latitudesh_python_sdk/plans.py +1178 -0
  168. latitudesh_python_sdk/privatenetworks.py +1672 -0
  169. latitudesh_python_sdk/projects_sdk.py +864 -0
  170. latitudesh_python_sdk/py.typed +1 -0
  171. latitudesh_python_sdk/regions_sdk.py +376 -0
  172. latitudesh_python_sdk/roles.py +374 -0
  173. latitudesh_python_sdk/sdk.py +214 -0
  174. latitudesh_python_sdk/sdkconfiguration.py +57 -0
  175. latitudesh_python_sdk/servers_sdk.py +3810 -0
  176. latitudesh_python_sdk/sshkeys.py +1050 -0
  177. latitudesh_python_sdk/storage.py +820 -0
  178. latitudesh_python_sdk/tags.py +786 -0
  179. latitudesh_python_sdk/teams_sdk.py +596 -0
  180. latitudesh_python_sdk/teamsmembers.py +578 -0
  181. latitudesh_python_sdk/traffic_sdk.py +400 -0
  182. latitudesh_python_sdk/types/__init__.py +21 -0
  183. latitudesh_python_sdk/types/basemodel.py +39 -0
  184. latitudesh_python_sdk/userdata_sdk.py +1052 -0
  185. latitudesh_python_sdk/userprofile.py +596 -0
  186. latitudesh_python_sdk/utils/__init__.py +101 -0
  187. latitudesh_python_sdk/utils/annotations.py +55 -0
  188. latitudesh_python_sdk/utils/enums.py +34 -0
  189. latitudesh_python_sdk/utils/eventstreaming.py +238 -0
  190. latitudesh_python_sdk/utils/forms.py +202 -0
  191. latitudesh_python_sdk/utils/headers.py +136 -0
  192. latitudesh_python_sdk/utils/logger.py +27 -0
  193. latitudesh_python_sdk/utils/metadata.py +118 -0
  194. latitudesh_python_sdk/utils/queryparams.py +205 -0
  195. latitudesh_python_sdk/utils/requestbodies.py +66 -0
  196. latitudesh_python_sdk/utils/retries.py +217 -0
  197. latitudesh_python_sdk/utils/security.py +192 -0
  198. latitudesh_python_sdk/utils/serializers.py +219 -0
  199. latitudesh_python_sdk/utils/url.py +155 -0
  200. latitudesh_python_sdk/utils/values.py +137 -0
  201. latitudesh_python_sdk/virtualmachines.py +772 -0
  202. latitudesh_python_sdk/vpnsessions.py +818 -0
  203. latitudesh_python_sdk-0.0.6.dist-info/LICENSE +21 -0
  204. latitudesh_python_sdk-0.0.6.dist-info/METADATA +730 -0
  205. latitudesh_python_sdk-0.0.6.dist-info/RECORD +206 -0
  206. latitudesh_python_sdk-0.0.6.dist-info/WHEEL +4 -0
@@ -0,0 +1,1640 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from .basesdk import BaseSDK
4
+ from latitudesh_python_sdk import models, utils
5
+ from latitudesh_python_sdk._hooks import HookContext
6
+ from latitudesh_python_sdk.types import OptionalNullable, UNSET
7
+ from latitudesh_python_sdk.utils import get_security_from_env
8
+ from typing import Any, Mapping, Optional, Union
9
+
10
+
11
+ class FirewallsSDK(BaseSDK):
12
+ def create(
13
+ self,
14
+ *,
15
+ data: Union[
16
+ models.CreateFirewallFirewallsData,
17
+ models.CreateFirewallFirewallsDataTypedDict,
18
+ ],
19
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
20
+ server_url: Optional[str] = None,
21
+ timeout_ms: Optional[int] = None,
22
+ http_headers: Optional[Mapping[str, str]] = None,
23
+ ) -> models.Firewall:
24
+ r"""Create a firewall
25
+
26
+ Create a firewall
27
+
28
+ :param data:
29
+ :param retries: Override the default retry configuration for this method
30
+ :param server_url: Override the default server URL for this method
31
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
32
+ :param http_headers: Additional headers to set or replace on requests.
33
+ """
34
+ base_url = None
35
+ url_variables = None
36
+ if timeout_ms is None:
37
+ timeout_ms = self.sdk_configuration.timeout_ms
38
+
39
+ if server_url is not None:
40
+ base_url = server_url
41
+ else:
42
+ base_url = self._get_url(base_url, url_variables)
43
+
44
+ request = models.CreateFirewallFirewallsRequestBody(
45
+ data=utils.get_pydantic_model(data, models.CreateFirewallFirewallsData),
46
+ )
47
+
48
+ req = self._build_request(
49
+ method="POST",
50
+ path="/firewalls",
51
+ base_url=base_url,
52
+ url_variables=url_variables,
53
+ request=request,
54
+ request_body_required=True,
55
+ request_has_path_params=False,
56
+ request_has_query_params=True,
57
+ user_agent_header="user-agent",
58
+ accept_header_value="application/vnd.api+json",
59
+ http_headers=http_headers,
60
+ security=self.sdk_configuration.security,
61
+ get_serialized_body=lambda: utils.serialize_request_body(
62
+ request, False, False, "json", models.CreateFirewallFirewallsRequestBody
63
+ ),
64
+ timeout_ms=timeout_ms,
65
+ )
66
+
67
+ if retries == UNSET:
68
+ if self.sdk_configuration.retry_config is not UNSET:
69
+ retries = self.sdk_configuration.retry_config
70
+
71
+ retry_config = None
72
+ if isinstance(retries, utils.RetryConfig):
73
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
74
+
75
+ http_res = self.do_request(
76
+ hook_ctx=HookContext(
77
+ base_url=base_url or "",
78
+ operation_id="create-firewall",
79
+ oauth2_scopes=[],
80
+ security_source=get_security_from_env(
81
+ self.sdk_configuration.security, models.Security
82
+ ),
83
+ ),
84
+ request=req,
85
+ error_status_codes=["422", "4XX", "5XX"],
86
+ retry_config=retry_config,
87
+ )
88
+
89
+ response_data: Any = None
90
+ if utils.match_response(http_res, "201", "application/vnd.api+json"):
91
+ return utils.unmarshal_json(http_res.text, models.Firewall)
92
+ if utils.match_response(http_res, "422", "application/vnd.api+json"):
93
+ response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
94
+ raise models.ErrorObject(data=response_data)
95
+ if utils.match_response(http_res, "4XX", "*"):
96
+ http_res_text = utils.stream_to_text(http_res)
97
+ raise models.APIError(
98
+ "API error occurred", http_res.status_code, http_res_text, http_res
99
+ )
100
+ if utils.match_response(http_res, "5XX", "*"):
101
+ http_res_text = utils.stream_to_text(http_res)
102
+ raise models.APIError(
103
+ "API error occurred", http_res.status_code, http_res_text, http_res
104
+ )
105
+
106
+ content_type = http_res.headers.get("Content-Type")
107
+ http_res_text = utils.stream_to_text(http_res)
108
+ raise models.APIError(
109
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
110
+ http_res.status_code,
111
+ http_res_text,
112
+ http_res,
113
+ )
114
+
115
+ async def create_async(
116
+ self,
117
+ *,
118
+ data: Union[
119
+ models.CreateFirewallFirewallsData,
120
+ models.CreateFirewallFirewallsDataTypedDict,
121
+ ],
122
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
123
+ server_url: Optional[str] = None,
124
+ timeout_ms: Optional[int] = None,
125
+ http_headers: Optional[Mapping[str, str]] = None,
126
+ ) -> models.Firewall:
127
+ r"""Create a firewall
128
+
129
+ Create a firewall
130
+
131
+ :param data:
132
+ :param retries: Override the default retry configuration for this method
133
+ :param server_url: Override the default server URL for this method
134
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
135
+ :param http_headers: Additional headers to set or replace on requests.
136
+ """
137
+ base_url = None
138
+ url_variables = None
139
+ if timeout_ms is None:
140
+ timeout_ms = self.sdk_configuration.timeout_ms
141
+
142
+ if server_url is not None:
143
+ base_url = server_url
144
+ else:
145
+ base_url = self._get_url(base_url, url_variables)
146
+
147
+ request = models.CreateFirewallFirewallsRequestBody(
148
+ data=utils.get_pydantic_model(data, models.CreateFirewallFirewallsData),
149
+ )
150
+
151
+ req = self._build_request_async(
152
+ method="POST",
153
+ path="/firewalls",
154
+ base_url=base_url,
155
+ url_variables=url_variables,
156
+ request=request,
157
+ request_body_required=True,
158
+ request_has_path_params=False,
159
+ request_has_query_params=True,
160
+ user_agent_header="user-agent",
161
+ accept_header_value="application/vnd.api+json",
162
+ http_headers=http_headers,
163
+ security=self.sdk_configuration.security,
164
+ get_serialized_body=lambda: utils.serialize_request_body(
165
+ request, False, False, "json", models.CreateFirewallFirewallsRequestBody
166
+ ),
167
+ timeout_ms=timeout_ms,
168
+ )
169
+
170
+ if retries == UNSET:
171
+ if self.sdk_configuration.retry_config is not UNSET:
172
+ retries = self.sdk_configuration.retry_config
173
+
174
+ retry_config = None
175
+ if isinstance(retries, utils.RetryConfig):
176
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
177
+
178
+ http_res = await self.do_request_async(
179
+ hook_ctx=HookContext(
180
+ base_url=base_url or "",
181
+ operation_id="create-firewall",
182
+ oauth2_scopes=[],
183
+ security_source=get_security_from_env(
184
+ self.sdk_configuration.security, models.Security
185
+ ),
186
+ ),
187
+ request=req,
188
+ error_status_codes=["422", "4XX", "5XX"],
189
+ retry_config=retry_config,
190
+ )
191
+
192
+ response_data: Any = None
193
+ if utils.match_response(http_res, "201", "application/vnd.api+json"):
194
+ return utils.unmarshal_json(http_res.text, models.Firewall)
195
+ if utils.match_response(http_res, "422", "application/vnd.api+json"):
196
+ response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
197
+ raise models.ErrorObject(data=response_data)
198
+ if utils.match_response(http_res, "4XX", "*"):
199
+ http_res_text = await utils.stream_to_text_async(http_res)
200
+ raise models.APIError(
201
+ "API error occurred", http_res.status_code, http_res_text, http_res
202
+ )
203
+ if utils.match_response(http_res, "5XX", "*"):
204
+ http_res_text = await utils.stream_to_text_async(http_res)
205
+ raise models.APIError(
206
+ "API error occurred", http_res.status_code, http_res_text, http_res
207
+ )
208
+
209
+ content_type = http_res.headers.get("Content-Type")
210
+ http_res_text = await utils.stream_to_text_async(http_res)
211
+ raise models.APIError(
212
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
213
+ http_res.status_code,
214
+ http_res_text,
215
+ http_res,
216
+ )
217
+
218
+ def list(
219
+ self,
220
+ *,
221
+ filter_project: Optional[str] = None,
222
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
223
+ server_url: Optional[str] = None,
224
+ timeout_ms: Optional[int] = None,
225
+ http_headers: Optional[Mapping[str, str]] = None,
226
+ ) -> models.Firewalls:
227
+ r"""List firewalls
228
+
229
+ List firewalls
230
+
231
+ :param filter_project:
232
+ :param retries: Override the default retry configuration for this method
233
+ :param server_url: Override the default server URL for this method
234
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
235
+ :param http_headers: Additional headers to set or replace on requests.
236
+ """
237
+ base_url = None
238
+ url_variables = None
239
+ if timeout_ms is None:
240
+ timeout_ms = self.sdk_configuration.timeout_ms
241
+
242
+ if server_url is not None:
243
+ base_url = server_url
244
+ else:
245
+ base_url = self._get_url(base_url, url_variables)
246
+
247
+ request = models.ListFirewallsRequest(
248
+ filter_project=filter_project,
249
+ )
250
+
251
+ req = self._build_request(
252
+ method="GET",
253
+ path="/firewalls",
254
+ base_url=base_url,
255
+ url_variables=url_variables,
256
+ request=request,
257
+ request_body_required=False,
258
+ request_has_path_params=False,
259
+ request_has_query_params=True,
260
+ user_agent_header="user-agent",
261
+ accept_header_value="application/vnd.api+json",
262
+ http_headers=http_headers,
263
+ security=self.sdk_configuration.security,
264
+ timeout_ms=timeout_ms,
265
+ )
266
+
267
+ if retries == UNSET:
268
+ if self.sdk_configuration.retry_config is not UNSET:
269
+ retries = self.sdk_configuration.retry_config
270
+
271
+ retry_config = None
272
+ if isinstance(retries, utils.RetryConfig):
273
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
274
+
275
+ http_res = self.do_request(
276
+ hook_ctx=HookContext(
277
+ base_url=base_url or "",
278
+ operation_id="list-firewalls",
279
+ oauth2_scopes=[],
280
+ security_source=get_security_from_env(
281
+ self.sdk_configuration.security, models.Security
282
+ ),
283
+ ),
284
+ request=req,
285
+ error_status_codes=["4XX", "5XX"],
286
+ retry_config=retry_config,
287
+ )
288
+
289
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
290
+ return utils.unmarshal_json(http_res.text, models.Firewalls)
291
+ if utils.match_response(http_res, "4XX", "*"):
292
+ http_res_text = utils.stream_to_text(http_res)
293
+ raise models.APIError(
294
+ "API error occurred", http_res.status_code, http_res_text, http_res
295
+ )
296
+ if utils.match_response(http_res, "5XX", "*"):
297
+ http_res_text = utils.stream_to_text(http_res)
298
+ raise models.APIError(
299
+ "API error occurred", http_res.status_code, http_res_text, http_res
300
+ )
301
+
302
+ content_type = http_res.headers.get("Content-Type")
303
+ http_res_text = utils.stream_to_text(http_res)
304
+ raise models.APIError(
305
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
306
+ http_res.status_code,
307
+ http_res_text,
308
+ http_res,
309
+ )
310
+
311
+ async def list_async(
312
+ self,
313
+ *,
314
+ filter_project: Optional[str] = None,
315
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
316
+ server_url: Optional[str] = None,
317
+ timeout_ms: Optional[int] = None,
318
+ http_headers: Optional[Mapping[str, str]] = None,
319
+ ) -> models.Firewalls:
320
+ r"""List firewalls
321
+
322
+ List firewalls
323
+
324
+ :param filter_project:
325
+ :param retries: Override the default retry configuration for this method
326
+ :param server_url: Override the default server URL for this method
327
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
328
+ :param http_headers: Additional headers to set or replace on requests.
329
+ """
330
+ base_url = None
331
+ url_variables = None
332
+ if timeout_ms is None:
333
+ timeout_ms = self.sdk_configuration.timeout_ms
334
+
335
+ if server_url is not None:
336
+ base_url = server_url
337
+ else:
338
+ base_url = self._get_url(base_url, url_variables)
339
+
340
+ request = models.ListFirewallsRequest(
341
+ filter_project=filter_project,
342
+ )
343
+
344
+ req = self._build_request_async(
345
+ method="GET",
346
+ path="/firewalls",
347
+ base_url=base_url,
348
+ url_variables=url_variables,
349
+ request=request,
350
+ request_body_required=False,
351
+ request_has_path_params=False,
352
+ request_has_query_params=True,
353
+ user_agent_header="user-agent",
354
+ accept_header_value="application/vnd.api+json",
355
+ http_headers=http_headers,
356
+ security=self.sdk_configuration.security,
357
+ timeout_ms=timeout_ms,
358
+ )
359
+
360
+ if retries == UNSET:
361
+ if self.sdk_configuration.retry_config is not UNSET:
362
+ retries = self.sdk_configuration.retry_config
363
+
364
+ retry_config = None
365
+ if isinstance(retries, utils.RetryConfig):
366
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
367
+
368
+ http_res = await self.do_request_async(
369
+ hook_ctx=HookContext(
370
+ base_url=base_url or "",
371
+ operation_id="list-firewalls",
372
+ oauth2_scopes=[],
373
+ security_source=get_security_from_env(
374
+ self.sdk_configuration.security, models.Security
375
+ ),
376
+ ),
377
+ request=req,
378
+ error_status_codes=["4XX", "5XX"],
379
+ retry_config=retry_config,
380
+ )
381
+
382
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
383
+ return utils.unmarshal_json(http_res.text, models.Firewalls)
384
+ if utils.match_response(http_res, "4XX", "*"):
385
+ http_res_text = await utils.stream_to_text_async(http_res)
386
+ raise models.APIError(
387
+ "API error occurred", http_res.status_code, http_res_text, http_res
388
+ )
389
+ if utils.match_response(http_res, "5XX", "*"):
390
+ http_res_text = await utils.stream_to_text_async(http_res)
391
+ raise models.APIError(
392
+ "API error occurred", http_res.status_code, http_res_text, http_res
393
+ )
394
+
395
+ content_type = http_res.headers.get("Content-Type")
396
+ http_res_text = await utils.stream_to_text_async(http_res)
397
+ raise models.APIError(
398
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
399
+ http_res.status_code,
400
+ http_res_text,
401
+ http_res,
402
+ )
403
+
404
+ def get(
405
+ self,
406
+ *,
407
+ firewall_id: str,
408
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
409
+ server_url: Optional[str] = None,
410
+ timeout_ms: Optional[int] = None,
411
+ http_headers: Optional[Mapping[str, str]] = None,
412
+ ) -> models.Firewall:
413
+ r"""Retrieve Firewall
414
+
415
+ Retrieve a firewall
416
+
417
+ :param firewall_id: The Firewall ID
418
+ :param retries: Override the default retry configuration for this method
419
+ :param server_url: Override the default server URL for this method
420
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
421
+ :param http_headers: Additional headers to set or replace on requests.
422
+ """
423
+ base_url = None
424
+ url_variables = None
425
+ if timeout_ms is None:
426
+ timeout_ms = self.sdk_configuration.timeout_ms
427
+
428
+ if server_url is not None:
429
+ base_url = server_url
430
+ else:
431
+ base_url = self._get_url(base_url, url_variables)
432
+
433
+ request = models.GetFirewallRequest(
434
+ firewall_id=firewall_id,
435
+ )
436
+
437
+ req = self._build_request(
438
+ method="GET",
439
+ path="/firewalls/{firewall_id}",
440
+ base_url=base_url,
441
+ url_variables=url_variables,
442
+ request=request,
443
+ request_body_required=False,
444
+ request_has_path_params=True,
445
+ request_has_query_params=True,
446
+ user_agent_header="user-agent",
447
+ accept_header_value="application/vnd.api+json",
448
+ http_headers=http_headers,
449
+ security=self.sdk_configuration.security,
450
+ timeout_ms=timeout_ms,
451
+ )
452
+
453
+ if retries == UNSET:
454
+ if self.sdk_configuration.retry_config is not UNSET:
455
+ retries = self.sdk_configuration.retry_config
456
+
457
+ retry_config = None
458
+ if isinstance(retries, utils.RetryConfig):
459
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
460
+
461
+ http_res = self.do_request(
462
+ hook_ctx=HookContext(
463
+ base_url=base_url or "",
464
+ operation_id="get-firewall",
465
+ oauth2_scopes=[],
466
+ security_source=get_security_from_env(
467
+ self.sdk_configuration.security, models.Security
468
+ ),
469
+ ),
470
+ request=req,
471
+ error_status_codes=["404", "4XX", "5XX"],
472
+ retry_config=retry_config,
473
+ )
474
+
475
+ response_data: Any = None
476
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
477
+ return utils.unmarshal_json(http_res.text, models.Firewall)
478
+ if utils.match_response(http_res, "404", "application/vnd.api+json"):
479
+ response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
480
+ raise models.ErrorObject(data=response_data)
481
+ if utils.match_response(http_res, "4XX", "*"):
482
+ http_res_text = utils.stream_to_text(http_res)
483
+ raise models.APIError(
484
+ "API error occurred", http_res.status_code, http_res_text, http_res
485
+ )
486
+ if utils.match_response(http_res, "5XX", "*"):
487
+ http_res_text = utils.stream_to_text(http_res)
488
+ raise models.APIError(
489
+ "API error occurred", http_res.status_code, http_res_text, http_res
490
+ )
491
+
492
+ content_type = http_res.headers.get("Content-Type")
493
+ http_res_text = utils.stream_to_text(http_res)
494
+ raise models.APIError(
495
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
496
+ http_res.status_code,
497
+ http_res_text,
498
+ http_res,
499
+ )
500
+
501
+ async def get_async(
502
+ self,
503
+ *,
504
+ firewall_id: str,
505
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
506
+ server_url: Optional[str] = None,
507
+ timeout_ms: Optional[int] = None,
508
+ http_headers: Optional[Mapping[str, str]] = None,
509
+ ) -> models.Firewall:
510
+ r"""Retrieve Firewall
511
+
512
+ Retrieve a firewall
513
+
514
+ :param firewall_id: The Firewall ID
515
+ :param retries: Override the default retry configuration for this method
516
+ :param server_url: Override the default server URL for this method
517
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
518
+ :param http_headers: Additional headers to set or replace on requests.
519
+ """
520
+ base_url = None
521
+ url_variables = None
522
+ if timeout_ms is None:
523
+ timeout_ms = self.sdk_configuration.timeout_ms
524
+
525
+ if server_url is not None:
526
+ base_url = server_url
527
+ else:
528
+ base_url = self._get_url(base_url, url_variables)
529
+
530
+ request = models.GetFirewallRequest(
531
+ firewall_id=firewall_id,
532
+ )
533
+
534
+ req = self._build_request_async(
535
+ method="GET",
536
+ path="/firewalls/{firewall_id}",
537
+ base_url=base_url,
538
+ url_variables=url_variables,
539
+ request=request,
540
+ request_body_required=False,
541
+ request_has_path_params=True,
542
+ request_has_query_params=True,
543
+ user_agent_header="user-agent",
544
+ accept_header_value="application/vnd.api+json",
545
+ http_headers=http_headers,
546
+ security=self.sdk_configuration.security,
547
+ timeout_ms=timeout_ms,
548
+ )
549
+
550
+ if retries == UNSET:
551
+ if self.sdk_configuration.retry_config is not UNSET:
552
+ retries = self.sdk_configuration.retry_config
553
+
554
+ retry_config = None
555
+ if isinstance(retries, utils.RetryConfig):
556
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
557
+
558
+ http_res = await self.do_request_async(
559
+ hook_ctx=HookContext(
560
+ base_url=base_url or "",
561
+ operation_id="get-firewall",
562
+ oauth2_scopes=[],
563
+ security_source=get_security_from_env(
564
+ self.sdk_configuration.security, models.Security
565
+ ),
566
+ ),
567
+ request=req,
568
+ error_status_codes=["404", "4XX", "5XX"],
569
+ retry_config=retry_config,
570
+ )
571
+
572
+ response_data: Any = None
573
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
574
+ return utils.unmarshal_json(http_res.text, models.Firewall)
575
+ if utils.match_response(http_res, "404", "application/vnd.api+json"):
576
+ response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
577
+ raise models.ErrorObject(data=response_data)
578
+ if utils.match_response(http_res, "4XX", "*"):
579
+ http_res_text = await utils.stream_to_text_async(http_res)
580
+ raise models.APIError(
581
+ "API error occurred", http_res.status_code, http_res_text, http_res
582
+ )
583
+ if utils.match_response(http_res, "5XX", "*"):
584
+ http_res_text = await utils.stream_to_text_async(http_res)
585
+ raise models.APIError(
586
+ "API error occurred", http_res.status_code, http_res_text, http_res
587
+ )
588
+
589
+ content_type = http_res.headers.get("Content-Type")
590
+ http_res_text = await utils.stream_to_text_async(http_res)
591
+ raise models.APIError(
592
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
593
+ http_res.status_code,
594
+ http_res_text,
595
+ http_res,
596
+ )
597
+
598
+ def update(
599
+ self,
600
+ *,
601
+ firewall_id: str,
602
+ data: Union[
603
+ models.UpdateFirewallFirewallsData,
604
+ models.UpdateFirewallFirewallsDataTypedDict,
605
+ ],
606
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
607
+ server_url: Optional[str] = None,
608
+ timeout_ms: Optional[int] = None,
609
+ http_headers: Optional[Mapping[str, str]] = None,
610
+ ) -> models.Firewall:
611
+ r"""Update Firewall
612
+
613
+ Update a firewall
614
+
615
+ :param firewall_id: The Firewall ID
616
+ :param data:
617
+ :param retries: Override the default retry configuration for this method
618
+ :param server_url: Override the default server URL for this method
619
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
620
+ :param http_headers: Additional headers to set or replace on requests.
621
+ """
622
+ base_url = None
623
+ url_variables = None
624
+ if timeout_ms is None:
625
+ timeout_ms = self.sdk_configuration.timeout_ms
626
+
627
+ if server_url is not None:
628
+ base_url = server_url
629
+ else:
630
+ base_url = self._get_url(base_url, url_variables)
631
+
632
+ request = models.UpdateFirewallRequest(
633
+ firewall_id=firewall_id,
634
+ request_body=models.UpdateFirewallFirewallsRequestBody(
635
+ data=utils.get_pydantic_model(data, models.UpdateFirewallFirewallsData),
636
+ ),
637
+ )
638
+
639
+ req = self._build_request(
640
+ method="PATCH",
641
+ path="/firewalls/{firewall_id}",
642
+ base_url=base_url,
643
+ url_variables=url_variables,
644
+ request=request,
645
+ request_body_required=True,
646
+ request_has_path_params=True,
647
+ request_has_query_params=True,
648
+ user_agent_header="user-agent",
649
+ accept_header_value="application/vnd.api+json",
650
+ http_headers=http_headers,
651
+ security=self.sdk_configuration.security,
652
+ get_serialized_body=lambda: utils.serialize_request_body(
653
+ request.request_body,
654
+ False,
655
+ False,
656
+ "json",
657
+ models.UpdateFirewallFirewallsRequestBody,
658
+ ),
659
+ timeout_ms=timeout_ms,
660
+ )
661
+
662
+ if retries == UNSET:
663
+ if self.sdk_configuration.retry_config is not UNSET:
664
+ retries = self.sdk_configuration.retry_config
665
+
666
+ retry_config = None
667
+ if isinstance(retries, utils.RetryConfig):
668
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
669
+
670
+ http_res = self.do_request(
671
+ hook_ctx=HookContext(
672
+ base_url=base_url or "",
673
+ operation_id="update-firewall",
674
+ oauth2_scopes=[],
675
+ security_source=get_security_from_env(
676
+ self.sdk_configuration.security, models.Security
677
+ ),
678
+ ),
679
+ request=req,
680
+ error_status_codes=["404", "422", "4XX", "5XX"],
681
+ retry_config=retry_config,
682
+ )
683
+
684
+ response_data: Any = None
685
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
686
+ return utils.unmarshal_json(http_res.text, models.Firewall)
687
+ if utils.match_response(http_res, ["404", "422"], "application/vnd.api+json"):
688
+ response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
689
+ raise models.ErrorObject(data=response_data)
690
+ if utils.match_response(http_res, "4XX", "*"):
691
+ http_res_text = utils.stream_to_text(http_res)
692
+ raise models.APIError(
693
+ "API error occurred", http_res.status_code, http_res_text, http_res
694
+ )
695
+ if utils.match_response(http_res, "5XX", "*"):
696
+ http_res_text = utils.stream_to_text(http_res)
697
+ raise models.APIError(
698
+ "API error occurred", http_res.status_code, http_res_text, http_res
699
+ )
700
+
701
+ content_type = http_res.headers.get("Content-Type")
702
+ http_res_text = utils.stream_to_text(http_res)
703
+ raise models.APIError(
704
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
705
+ http_res.status_code,
706
+ http_res_text,
707
+ http_res,
708
+ )
709
+
710
+ async def update_async(
711
+ self,
712
+ *,
713
+ firewall_id: str,
714
+ data: Union[
715
+ models.UpdateFirewallFirewallsData,
716
+ models.UpdateFirewallFirewallsDataTypedDict,
717
+ ],
718
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
719
+ server_url: Optional[str] = None,
720
+ timeout_ms: Optional[int] = None,
721
+ http_headers: Optional[Mapping[str, str]] = None,
722
+ ) -> models.Firewall:
723
+ r"""Update Firewall
724
+
725
+ Update a firewall
726
+
727
+ :param firewall_id: The Firewall ID
728
+ :param data:
729
+ :param retries: Override the default retry configuration for this method
730
+ :param server_url: Override the default server URL for this method
731
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
732
+ :param http_headers: Additional headers to set or replace on requests.
733
+ """
734
+ base_url = None
735
+ url_variables = None
736
+ if timeout_ms is None:
737
+ timeout_ms = self.sdk_configuration.timeout_ms
738
+
739
+ if server_url is not None:
740
+ base_url = server_url
741
+ else:
742
+ base_url = self._get_url(base_url, url_variables)
743
+
744
+ request = models.UpdateFirewallRequest(
745
+ firewall_id=firewall_id,
746
+ request_body=models.UpdateFirewallFirewallsRequestBody(
747
+ data=utils.get_pydantic_model(data, models.UpdateFirewallFirewallsData),
748
+ ),
749
+ )
750
+
751
+ req = self._build_request_async(
752
+ method="PATCH",
753
+ path="/firewalls/{firewall_id}",
754
+ base_url=base_url,
755
+ url_variables=url_variables,
756
+ request=request,
757
+ request_body_required=True,
758
+ request_has_path_params=True,
759
+ request_has_query_params=True,
760
+ user_agent_header="user-agent",
761
+ accept_header_value="application/vnd.api+json",
762
+ http_headers=http_headers,
763
+ security=self.sdk_configuration.security,
764
+ get_serialized_body=lambda: utils.serialize_request_body(
765
+ request.request_body,
766
+ False,
767
+ False,
768
+ "json",
769
+ models.UpdateFirewallFirewallsRequestBody,
770
+ ),
771
+ timeout_ms=timeout_ms,
772
+ )
773
+
774
+ if retries == UNSET:
775
+ if self.sdk_configuration.retry_config is not UNSET:
776
+ retries = self.sdk_configuration.retry_config
777
+
778
+ retry_config = None
779
+ if isinstance(retries, utils.RetryConfig):
780
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
781
+
782
+ http_res = await self.do_request_async(
783
+ hook_ctx=HookContext(
784
+ base_url=base_url or "",
785
+ operation_id="update-firewall",
786
+ oauth2_scopes=[],
787
+ security_source=get_security_from_env(
788
+ self.sdk_configuration.security, models.Security
789
+ ),
790
+ ),
791
+ request=req,
792
+ error_status_codes=["404", "422", "4XX", "5XX"],
793
+ retry_config=retry_config,
794
+ )
795
+
796
+ response_data: Any = None
797
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
798
+ return utils.unmarshal_json(http_res.text, models.Firewall)
799
+ if utils.match_response(http_res, ["404", "422"], "application/vnd.api+json"):
800
+ response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
801
+ raise models.ErrorObject(data=response_data)
802
+ if utils.match_response(http_res, "4XX", "*"):
803
+ http_res_text = await utils.stream_to_text_async(http_res)
804
+ raise models.APIError(
805
+ "API error occurred", http_res.status_code, http_res_text, http_res
806
+ )
807
+ if utils.match_response(http_res, "5XX", "*"):
808
+ http_res_text = await utils.stream_to_text_async(http_res)
809
+ raise models.APIError(
810
+ "API error occurred", http_res.status_code, http_res_text, http_res
811
+ )
812
+
813
+ content_type = http_res.headers.get("Content-Type")
814
+ http_res_text = await utils.stream_to_text_async(http_res)
815
+ raise models.APIError(
816
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
817
+ http_res.status_code,
818
+ http_res_text,
819
+ http_res,
820
+ )
821
+
822
+ def delete(
823
+ self,
824
+ *,
825
+ firewall_id: str,
826
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
827
+ server_url: Optional[str] = None,
828
+ timeout_ms: Optional[int] = None,
829
+ http_headers: Optional[Mapping[str, str]] = None,
830
+ ):
831
+ r"""Delete Firewall
832
+
833
+ Delete a firewall
834
+
835
+ :param firewall_id: The Firewall ID
836
+ :param retries: Override the default retry configuration for this method
837
+ :param server_url: Override the default server URL for this method
838
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
839
+ :param http_headers: Additional headers to set or replace on requests.
840
+ """
841
+ base_url = None
842
+ url_variables = None
843
+ if timeout_ms is None:
844
+ timeout_ms = self.sdk_configuration.timeout_ms
845
+
846
+ if server_url is not None:
847
+ base_url = server_url
848
+ else:
849
+ base_url = self._get_url(base_url, url_variables)
850
+
851
+ request = models.DeleteFirewallRequest(
852
+ firewall_id=firewall_id,
853
+ )
854
+
855
+ req = self._build_request(
856
+ method="DELETE",
857
+ path="/firewalls/{firewall_id}",
858
+ base_url=base_url,
859
+ url_variables=url_variables,
860
+ request=request,
861
+ request_body_required=False,
862
+ request_has_path_params=True,
863
+ request_has_query_params=True,
864
+ user_agent_header="user-agent",
865
+ accept_header_value="application/vnd.api+json",
866
+ http_headers=http_headers,
867
+ security=self.sdk_configuration.security,
868
+ timeout_ms=timeout_ms,
869
+ )
870
+
871
+ if retries == UNSET:
872
+ if self.sdk_configuration.retry_config is not UNSET:
873
+ retries = self.sdk_configuration.retry_config
874
+
875
+ retry_config = None
876
+ if isinstance(retries, utils.RetryConfig):
877
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
878
+
879
+ http_res = self.do_request(
880
+ hook_ctx=HookContext(
881
+ base_url=base_url or "",
882
+ operation_id="delete-firewall",
883
+ oauth2_scopes=[],
884
+ security_source=get_security_from_env(
885
+ self.sdk_configuration.security, models.Security
886
+ ),
887
+ ),
888
+ request=req,
889
+ error_status_codes=["404", "422", "4XX", "5XX"],
890
+ retry_config=retry_config,
891
+ )
892
+
893
+ response_data: Any = None
894
+ if utils.match_response(http_res, "204", "*"):
895
+ return
896
+ if utils.match_response(http_res, ["404", "422"], "application/vnd.api+json"):
897
+ response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
898
+ raise models.ErrorObject(data=response_data)
899
+ if utils.match_response(http_res, "4XX", "*"):
900
+ http_res_text = utils.stream_to_text(http_res)
901
+ raise models.APIError(
902
+ "API error occurred", http_res.status_code, http_res_text, http_res
903
+ )
904
+ if utils.match_response(http_res, "5XX", "*"):
905
+ http_res_text = utils.stream_to_text(http_res)
906
+ raise models.APIError(
907
+ "API error occurred", http_res.status_code, http_res_text, http_res
908
+ )
909
+
910
+ content_type = http_res.headers.get("Content-Type")
911
+ http_res_text = utils.stream_to_text(http_res)
912
+ raise models.APIError(
913
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
914
+ http_res.status_code,
915
+ http_res_text,
916
+ http_res,
917
+ )
918
+
919
+ async def delete_async(
920
+ self,
921
+ *,
922
+ firewall_id: str,
923
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
924
+ server_url: Optional[str] = None,
925
+ timeout_ms: Optional[int] = None,
926
+ http_headers: Optional[Mapping[str, str]] = None,
927
+ ):
928
+ r"""Delete Firewall
929
+
930
+ Delete a firewall
931
+
932
+ :param firewall_id: The Firewall ID
933
+ :param retries: Override the default retry configuration for this method
934
+ :param server_url: Override the default server URL for this method
935
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
936
+ :param http_headers: Additional headers to set or replace on requests.
937
+ """
938
+ base_url = None
939
+ url_variables = None
940
+ if timeout_ms is None:
941
+ timeout_ms = self.sdk_configuration.timeout_ms
942
+
943
+ if server_url is not None:
944
+ base_url = server_url
945
+ else:
946
+ base_url = self._get_url(base_url, url_variables)
947
+
948
+ request = models.DeleteFirewallRequest(
949
+ firewall_id=firewall_id,
950
+ )
951
+
952
+ req = self._build_request_async(
953
+ method="DELETE",
954
+ path="/firewalls/{firewall_id}",
955
+ base_url=base_url,
956
+ url_variables=url_variables,
957
+ request=request,
958
+ request_body_required=False,
959
+ request_has_path_params=True,
960
+ request_has_query_params=True,
961
+ user_agent_header="user-agent",
962
+ accept_header_value="application/vnd.api+json",
963
+ http_headers=http_headers,
964
+ security=self.sdk_configuration.security,
965
+ timeout_ms=timeout_ms,
966
+ )
967
+
968
+ if retries == UNSET:
969
+ if self.sdk_configuration.retry_config is not UNSET:
970
+ retries = self.sdk_configuration.retry_config
971
+
972
+ retry_config = None
973
+ if isinstance(retries, utils.RetryConfig):
974
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
975
+
976
+ http_res = await self.do_request_async(
977
+ hook_ctx=HookContext(
978
+ base_url=base_url or "",
979
+ operation_id="delete-firewall",
980
+ oauth2_scopes=[],
981
+ security_source=get_security_from_env(
982
+ self.sdk_configuration.security, models.Security
983
+ ),
984
+ ),
985
+ request=req,
986
+ error_status_codes=["404", "422", "4XX", "5XX"],
987
+ retry_config=retry_config,
988
+ )
989
+
990
+ response_data: Any = None
991
+ if utils.match_response(http_res, "204", "*"):
992
+ return
993
+ if utils.match_response(http_res, ["404", "422"], "application/vnd.api+json"):
994
+ response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
995
+ raise models.ErrorObject(data=response_data)
996
+ if utils.match_response(http_res, "4XX", "*"):
997
+ http_res_text = await utils.stream_to_text_async(http_res)
998
+ raise models.APIError(
999
+ "API error occurred", http_res.status_code, http_res_text, http_res
1000
+ )
1001
+ if utils.match_response(http_res, "5XX", "*"):
1002
+ http_res_text = await utils.stream_to_text_async(http_res)
1003
+ raise models.APIError(
1004
+ "API error occurred", http_res.status_code, http_res_text, http_res
1005
+ )
1006
+
1007
+ content_type = http_res.headers.get("Content-Type")
1008
+ http_res_text = await utils.stream_to_text_async(http_res)
1009
+ raise models.APIError(
1010
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1011
+ http_res.status_code,
1012
+ http_res_text,
1013
+ http_res,
1014
+ )
1015
+
1016
+ def assign(
1017
+ self,
1018
+ *,
1019
+ firewall_id: str,
1020
+ data: Union[
1021
+ models.CreateFirewallAssignmentFirewallsData,
1022
+ models.CreateFirewallAssignmentFirewallsDataTypedDict,
1023
+ ],
1024
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1025
+ server_url: Optional[str] = None,
1026
+ timeout_ms: Optional[int] = None,
1027
+ http_headers: Optional[Mapping[str, str]] = None,
1028
+ ) -> models.FirewallServer:
1029
+ r"""Firewall Assignment
1030
+
1031
+ Assign a server to a firewall
1032
+
1033
+ :param firewall_id: The Firewall ID
1034
+ :param data:
1035
+ :param retries: Override the default retry configuration for this method
1036
+ :param server_url: Override the default server URL for this method
1037
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1038
+ :param http_headers: Additional headers to set or replace on requests.
1039
+ """
1040
+ base_url = None
1041
+ url_variables = None
1042
+ if timeout_ms is None:
1043
+ timeout_ms = self.sdk_configuration.timeout_ms
1044
+
1045
+ if server_url is not None:
1046
+ base_url = server_url
1047
+ else:
1048
+ base_url = self._get_url(base_url, url_variables)
1049
+
1050
+ request = models.CreateFirewallAssignmentRequest(
1051
+ firewall_id=firewall_id,
1052
+ request_body=models.CreateFirewallAssignmentFirewallsRequestBody(
1053
+ data=utils.get_pydantic_model(
1054
+ data, models.CreateFirewallAssignmentFirewallsData
1055
+ ),
1056
+ ),
1057
+ )
1058
+
1059
+ req = self._build_request(
1060
+ method="POST",
1061
+ path="/firewalls/{firewall_id}/assignments",
1062
+ base_url=base_url,
1063
+ url_variables=url_variables,
1064
+ request=request,
1065
+ request_body_required=True,
1066
+ request_has_path_params=True,
1067
+ request_has_query_params=True,
1068
+ user_agent_header="user-agent",
1069
+ accept_header_value="application/vnd.api+json",
1070
+ http_headers=http_headers,
1071
+ security=self.sdk_configuration.security,
1072
+ get_serialized_body=lambda: utils.serialize_request_body(
1073
+ request.request_body,
1074
+ False,
1075
+ False,
1076
+ "json",
1077
+ models.CreateFirewallAssignmentFirewallsRequestBody,
1078
+ ),
1079
+ timeout_ms=timeout_ms,
1080
+ )
1081
+
1082
+ if retries == UNSET:
1083
+ if self.sdk_configuration.retry_config is not UNSET:
1084
+ retries = self.sdk_configuration.retry_config
1085
+
1086
+ retry_config = None
1087
+ if isinstance(retries, utils.RetryConfig):
1088
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1089
+
1090
+ http_res = self.do_request(
1091
+ hook_ctx=HookContext(
1092
+ base_url=base_url or "",
1093
+ operation_id="create-firewall-assignment",
1094
+ oauth2_scopes=[],
1095
+ security_source=get_security_from_env(
1096
+ self.sdk_configuration.security, models.Security
1097
+ ),
1098
+ ),
1099
+ request=req,
1100
+ error_status_codes=["403", "404", "409", "422", "4XX", "5XX"],
1101
+ retry_config=retry_config,
1102
+ )
1103
+
1104
+ response_data: Any = None
1105
+ if utils.match_response(http_res, "201", "application/vnd.api+json"):
1106
+ return utils.unmarshal_json(http_res.text, models.FirewallServer)
1107
+ if utils.match_response(
1108
+ http_res, ["403", "404", "409", "422"], "application/vnd.api+json"
1109
+ ):
1110
+ response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
1111
+ raise models.ErrorObject(data=response_data)
1112
+ if utils.match_response(http_res, "4XX", "*"):
1113
+ http_res_text = utils.stream_to_text(http_res)
1114
+ raise models.APIError(
1115
+ "API error occurred", http_res.status_code, http_res_text, http_res
1116
+ )
1117
+ if utils.match_response(http_res, "5XX", "*"):
1118
+ http_res_text = utils.stream_to_text(http_res)
1119
+ raise models.APIError(
1120
+ "API error occurred", http_res.status_code, http_res_text, http_res
1121
+ )
1122
+
1123
+ content_type = http_res.headers.get("Content-Type")
1124
+ http_res_text = utils.stream_to_text(http_res)
1125
+ raise models.APIError(
1126
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1127
+ http_res.status_code,
1128
+ http_res_text,
1129
+ http_res,
1130
+ )
1131
+
1132
+ async def assign_async(
1133
+ self,
1134
+ *,
1135
+ firewall_id: str,
1136
+ data: Union[
1137
+ models.CreateFirewallAssignmentFirewallsData,
1138
+ models.CreateFirewallAssignmentFirewallsDataTypedDict,
1139
+ ],
1140
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1141
+ server_url: Optional[str] = None,
1142
+ timeout_ms: Optional[int] = None,
1143
+ http_headers: Optional[Mapping[str, str]] = None,
1144
+ ) -> models.FirewallServer:
1145
+ r"""Firewall Assignment
1146
+
1147
+ Assign a server to a firewall
1148
+
1149
+ :param firewall_id: The Firewall ID
1150
+ :param data:
1151
+ :param retries: Override the default retry configuration for this method
1152
+ :param server_url: Override the default server URL for this method
1153
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1154
+ :param http_headers: Additional headers to set or replace on requests.
1155
+ """
1156
+ base_url = None
1157
+ url_variables = None
1158
+ if timeout_ms is None:
1159
+ timeout_ms = self.sdk_configuration.timeout_ms
1160
+
1161
+ if server_url is not None:
1162
+ base_url = server_url
1163
+ else:
1164
+ base_url = self._get_url(base_url, url_variables)
1165
+
1166
+ request = models.CreateFirewallAssignmentRequest(
1167
+ firewall_id=firewall_id,
1168
+ request_body=models.CreateFirewallAssignmentFirewallsRequestBody(
1169
+ data=utils.get_pydantic_model(
1170
+ data, models.CreateFirewallAssignmentFirewallsData
1171
+ ),
1172
+ ),
1173
+ )
1174
+
1175
+ req = self._build_request_async(
1176
+ method="POST",
1177
+ path="/firewalls/{firewall_id}/assignments",
1178
+ base_url=base_url,
1179
+ url_variables=url_variables,
1180
+ request=request,
1181
+ request_body_required=True,
1182
+ request_has_path_params=True,
1183
+ request_has_query_params=True,
1184
+ user_agent_header="user-agent",
1185
+ accept_header_value="application/vnd.api+json",
1186
+ http_headers=http_headers,
1187
+ security=self.sdk_configuration.security,
1188
+ get_serialized_body=lambda: utils.serialize_request_body(
1189
+ request.request_body,
1190
+ False,
1191
+ False,
1192
+ "json",
1193
+ models.CreateFirewallAssignmentFirewallsRequestBody,
1194
+ ),
1195
+ timeout_ms=timeout_ms,
1196
+ )
1197
+
1198
+ if retries == UNSET:
1199
+ if self.sdk_configuration.retry_config is not UNSET:
1200
+ retries = self.sdk_configuration.retry_config
1201
+
1202
+ retry_config = None
1203
+ if isinstance(retries, utils.RetryConfig):
1204
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1205
+
1206
+ http_res = await self.do_request_async(
1207
+ hook_ctx=HookContext(
1208
+ base_url=base_url or "",
1209
+ operation_id="create-firewall-assignment",
1210
+ oauth2_scopes=[],
1211
+ security_source=get_security_from_env(
1212
+ self.sdk_configuration.security, models.Security
1213
+ ),
1214
+ ),
1215
+ request=req,
1216
+ error_status_codes=["403", "404", "409", "422", "4XX", "5XX"],
1217
+ retry_config=retry_config,
1218
+ )
1219
+
1220
+ response_data: Any = None
1221
+ if utils.match_response(http_res, "201", "application/vnd.api+json"):
1222
+ return utils.unmarshal_json(http_res.text, models.FirewallServer)
1223
+ if utils.match_response(
1224
+ http_res, ["403", "404", "409", "422"], "application/vnd.api+json"
1225
+ ):
1226
+ response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
1227
+ raise models.ErrorObject(data=response_data)
1228
+ if utils.match_response(http_res, "4XX", "*"):
1229
+ http_res_text = await utils.stream_to_text_async(http_res)
1230
+ raise models.APIError(
1231
+ "API error occurred", http_res.status_code, http_res_text, http_res
1232
+ )
1233
+ if utils.match_response(http_res, "5XX", "*"):
1234
+ http_res_text = await utils.stream_to_text_async(http_res)
1235
+ raise models.APIError(
1236
+ "API error occurred", http_res.status_code, http_res_text, http_res
1237
+ )
1238
+
1239
+ content_type = http_res.headers.get("Content-Type")
1240
+ http_res_text = await utils.stream_to_text_async(http_res)
1241
+ raise models.APIError(
1242
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1243
+ http_res.status_code,
1244
+ http_res_text,
1245
+ http_res,
1246
+ )
1247
+
1248
+ def list_assignments(
1249
+ self,
1250
+ *,
1251
+ firewall_id: str,
1252
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1253
+ server_url: Optional[str] = None,
1254
+ timeout_ms: Optional[int] = None,
1255
+ http_headers: Optional[Mapping[str, str]] = None,
1256
+ ) -> models.FirewallServer:
1257
+ r"""Firewall Assignments
1258
+
1259
+ List servers assigned to a firewall
1260
+
1261
+ :param firewall_id: The Firewall ID
1262
+ :param retries: Override the default retry configuration for this method
1263
+ :param server_url: Override the default server URL for this method
1264
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1265
+ :param http_headers: Additional headers to set or replace on requests.
1266
+ """
1267
+ base_url = None
1268
+ url_variables = None
1269
+ if timeout_ms is None:
1270
+ timeout_ms = self.sdk_configuration.timeout_ms
1271
+
1272
+ if server_url is not None:
1273
+ base_url = server_url
1274
+ else:
1275
+ base_url = self._get_url(base_url, url_variables)
1276
+
1277
+ request = models.GetFirewallAssignmentsRequest(
1278
+ firewall_id=firewall_id,
1279
+ )
1280
+
1281
+ req = self._build_request(
1282
+ method="GET",
1283
+ path="/firewalls/{firewall_id}/assignments",
1284
+ base_url=base_url,
1285
+ url_variables=url_variables,
1286
+ request=request,
1287
+ request_body_required=False,
1288
+ request_has_path_params=True,
1289
+ request_has_query_params=True,
1290
+ user_agent_header="user-agent",
1291
+ accept_header_value="application/vnd.api+json",
1292
+ http_headers=http_headers,
1293
+ security=self.sdk_configuration.security,
1294
+ timeout_ms=timeout_ms,
1295
+ )
1296
+
1297
+ if retries == UNSET:
1298
+ if self.sdk_configuration.retry_config is not UNSET:
1299
+ retries = self.sdk_configuration.retry_config
1300
+
1301
+ retry_config = None
1302
+ if isinstance(retries, utils.RetryConfig):
1303
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1304
+
1305
+ http_res = self.do_request(
1306
+ hook_ctx=HookContext(
1307
+ base_url=base_url or "",
1308
+ operation_id="get-firewall-assignments",
1309
+ oauth2_scopes=[],
1310
+ security_source=get_security_from_env(
1311
+ self.sdk_configuration.security, models.Security
1312
+ ),
1313
+ ),
1314
+ request=req,
1315
+ error_status_codes=["404", "4XX", "5XX"],
1316
+ retry_config=retry_config,
1317
+ )
1318
+
1319
+ response_data: Any = None
1320
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
1321
+ return utils.unmarshal_json(http_res.text, models.FirewallServer)
1322
+ if utils.match_response(http_res, "404", "application/vnd.api+json"):
1323
+ response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
1324
+ raise models.ErrorObject(data=response_data)
1325
+ if utils.match_response(http_res, "4XX", "*"):
1326
+ http_res_text = utils.stream_to_text(http_res)
1327
+ raise models.APIError(
1328
+ "API error occurred", http_res.status_code, http_res_text, http_res
1329
+ )
1330
+ if utils.match_response(http_res, "5XX", "*"):
1331
+ http_res_text = utils.stream_to_text(http_res)
1332
+ raise models.APIError(
1333
+ "API error occurred", http_res.status_code, http_res_text, http_res
1334
+ )
1335
+
1336
+ content_type = http_res.headers.get("Content-Type")
1337
+ http_res_text = utils.stream_to_text(http_res)
1338
+ raise models.APIError(
1339
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1340
+ http_res.status_code,
1341
+ http_res_text,
1342
+ http_res,
1343
+ )
1344
+
1345
+ async def list_assignments_async(
1346
+ self,
1347
+ *,
1348
+ firewall_id: str,
1349
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1350
+ server_url: Optional[str] = None,
1351
+ timeout_ms: Optional[int] = None,
1352
+ http_headers: Optional[Mapping[str, str]] = None,
1353
+ ) -> models.FirewallServer:
1354
+ r"""Firewall Assignments
1355
+
1356
+ List servers assigned to a firewall
1357
+
1358
+ :param firewall_id: The Firewall ID
1359
+ :param retries: Override the default retry configuration for this method
1360
+ :param server_url: Override the default server URL for this method
1361
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1362
+ :param http_headers: Additional headers to set or replace on requests.
1363
+ """
1364
+ base_url = None
1365
+ url_variables = None
1366
+ if timeout_ms is None:
1367
+ timeout_ms = self.sdk_configuration.timeout_ms
1368
+
1369
+ if server_url is not None:
1370
+ base_url = server_url
1371
+ else:
1372
+ base_url = self._get_url(base_url, url_variables)
1373
+
1374
+ request = models.GetFirewallAssignmentsRequest(
1375
+ firewall_id=firewall_id,
1376
+ )
1377
+
1378
+ req = self._build_request_async(
1379
+ method="GET",
1380
+ path="/firewalls/{firewall_id}/assignments",
1381
+ base_url=base_url,
1382
+ url_variables=url_variables,
1383
+ request=request,
1384
+ request_body_required=False,
1385
+ request_has_path_params=True,
1386
+ request_has_query_params=True,
1387
+ user_agent_header="user-agent",
1388
+ accept_header_value="application/vnd.api+json",
1389
+ http_headers=http_headers,
1390
+ security=self.sdk_configuration.security,
1391
+ timeout_ms=timeout_ms,
1392
+ )
1393
+
1394
+ if retries == UNSET:
1395
+ if self.sdk_configuration.retry_config is not UNSET:
1396
+ retries = self.sdk_configuration.retry_config
1397
+
1398
+ retry_config = None
1399
+ if isinstance(retries, utils.RetryConfig):
1400
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1401
+
1402
+ http_res = await self.do_request_async(
1403
+ hook_ctx=HookContext(
1404
+ base_url=base_url or "",
1405
+ operation_id="get-firewall-assignments",
1406
+ oauth2_scopes=[],
1407
+ security_source=get_security_from_env(
1408
+ self.sdk_configuration.security, models.Security
1409
+ ),
1410
+ ),
1411
+ request=req,
1412
+ error_status_codes=["404", "4XX", "5XX"],
1413
+ retry_config=retry_config,
1414
+ )
1415
+
1416
+ response_data: Any = None
1417
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
1418
+ return utils.unmarshal_json(http_res.text, models.FirewallServer)
1419
+ if utils.match_response(http_res, "404", "application/vnd.api+json"):
1420
+ response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
1421
+ raise models.ErrorObject(data=response_data)
1422
+ if utils.match_response(http_res, "4XX", "*"):
1423
+ http_res_text = await utils.stream_to_text_async(http_res)
1424
+ raise models.APIError(
1425
+ "API error occurred", http_res.status_code, http_res_text, http_res
1426
+ )
1427
+ if utils.match_response(http_res, "5XX", "*"):
1428
+ http_res_text = await utils.stream_to_text_async(http_res)
1429
+ raise models.APIError(
1430
+ "API error occurred", http_res.status_code, http_res_text, http_res
1431
+ )
1432
+
1433
+ content_type = http_res.headers.get("Content-Type")
1434
+ http_res_text = await utils.stream_to_text_async(http_res)
1435
+ raise models.APIError(
1436
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1437
+ http_res.status_code,
1438
+ http_res_text,
1439
+ http_res,
1440
+ )
1441
+
1442
+ def delete_assignment(
1443
+ self,
1444
+ *,
1445
+ firewall_id: str,
1446
+ assignment_id: str,
1447
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1448
+ server_url: Optional[str] = None,
1449
+ timeout_ms: Optional[int] = None,
1450
+ http_headers: Optional[Mapping[str, str]] = None,
1451
+ ):
1452
+ r"""Delete Firewall Assignment
1453
+
1454
+ Remove a server from a firewall
1455
+
1456
+ :param firewall_id: The Firewall ID
1457
+ :param assignment_id: The Assignment ID
1458
+ :param retries: Override the default retry configuration for this method
1459
+ :param server_url: Override the default server URL for this method
1460
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1461
+ :param http_headers: Additional headers to set or replace on requests.
1462
+ """
1463
+ base_url = None
1464
+ url_variables = None
1465
+ if timeout_ms is None:
1466
+ timeout_ms = self.sdk_configuration.timeout_ms
1467
+
1468
+ if server_url is not None:
1469
+ base_url = server_url
1470
+ else:
1471
+ base_url = self._get_url(base_url, url_variables)
1472
+
1473
+ request = models.DeleteFirewallAssignmentRequest(
1474
+ firewall_id=firewall_id,
1475
+ assignment_id=assignment_id,
1476
+ )
1477
+
1478
+ req = self._build_request(
1479
+ method="DELETE",
1480
+ path="/firewalls/{firewall_id}/assignments/{assignment_id}",
1481
+ base_url=base_url,
1482
+ url_variables=url_variables,
1483
+ request=request,
1484
+ request_body_required=False,
1485
+ request_has_path_params=True,
1486
+ request_has_query_params=True,
1487
+ user_agent_header="user-agent",
1488
+ accept_header_value="application/vnd.api+json",
1489
+ http_headers=http_headers,
1490
+ security=self.sdk_configuration.security,
1491
+ timeout_ms=timeout_ms,
1492
+ )
1493
+
1494
+ if retries == UNSET:
1495
+ if self.sdk_configuration.retry_config is not UNSET:
1496
+ retries = self.sdk_configuration.retry_config
1497
+
1498
+ retry_config = None
1499
+ if isinstance(retries, utils.RetryConfig):
1500
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1501
+
1502
+ http_res = self.do_request(
1503
+ hook_ctx=HookContext(
1504
+ base_url=base_url or "",
1505
+ operation_id="delete-firewall-assignment",
1506
+ oauth2_scopes=[],
1507
+ security_source=get_security_from_env(
1508
+ self.sdk_configuration.security, models.Security
1509
+ ),
1510
+ ),
1511
+ request=req,
1512
+ error_status_codes=["403", "404", "4XX", "5XX"],
1513
+ retry_config=retry_config,
1514
+ )
1515
+
1516
+ response_data: Any = None
1517
+ if utils.match_response(http_res, "204", "*"):
1518
+ return
1519
+ if utils.match_response(http_res, ["403", "404"], "application/vnd.api+json"):
1520
+ response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
1521
+ raise models.ErrorObject(data=response_data)
1522
+ if utils.match_response(http_res, "4XX", "*"):
1523
+ http_res_text = utils.stream_to_text(http_res)
1524
+ raise models.APIError(
1525
+ "API error occurred", http_res.status_code, http_res_text, http_res
1526
+ )
1527
+ if utils.match_response(http_res, "5XX", "*"):
1528
+ http_res_text = utils.stream_to_text(http_res)
1529
+ raise models.APIError(
1530
+ "API error occurred", http_res.status_code, http_res_text, http_res
1531
+ )
1532
+
1533
+ content_type = http_res.headers.get("Content-Type")
1534
+ http_res_text = utils.stream_to_text(http_res)
1535
+ raise models.APIError(
1536
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1537
+ http_res.status_code,
1538
+ http_res_text,
1539
+ http_res,
1540
+ )
1541
+
1542
+ async def delete_assignment_async(
1543
+ self,
1544
+ *,
1545
+ firewall_id: str,
1546
+ assignment_id: str,
1547
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1548
+ server_url: Optional[str] = None,
1549
+ timeout_ms: Optional[int] = None,
1550
+ http_headers: Optional[Mapping[str, str]] = None,
1551
+ ):
1552
+ r"""Delete Firewall Assignment
1553
+
1554
+ Remove a server from a firewall
1555
+
1556
+ :param firewall_id: The Firewall ID
1557
+ :param assignment_id: The Assignment ID
1558
+ :param retries: Override the default retry configuration for this method
1559
+ :param server_url: Override the default server URL for this method
1560
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1561
+ :param http_headers: Additional headers to set or replace on requests.
1562
+ """
1563
+ base_url = None
1564
+ url_variables = None
1565
+ if timeout_ms is None:
1566
+ timeout_ms = self.sdk_configuration.timeout_ms
1567
+
1568
+ if server_url is not None:
1569
+ base_url = server_url
1570
+ else:
1571
+ base_url = self._get_url(base_url, url_variables)
1572
+
1573
+ request = models.DeleteFirewallAssignmentRequest(
1574
+ firewall_id=firewall_id,
1575
+ assignment_id=assignment_id,
1576
+ )
1577
+
1578
+ req = self._build_request_async(
1579
+ method="DELETE",
1580
+ path="/firewalls/{firewall_id}/assignments/{assignment_id}",
1581
+ base_url=base_url,
1582
+ url_variables=url_variables,
1583
+ request=request,
1584
+ request_body_required=False,
1585
+ request_has_path_params=True,
1586
+ request_has_query_params=True,
1587
+ user_agent_header="user-agent",
1588
+ accept_header_value="application/vnd.api+json",
1589
+ http_headers=http_headers,
1590
+ security=self.sdk_configuration.security,
1591
+ timeout_ms=timeout_ms,
1592
+ )
1593
+
1594
+ if retries == UNSET:
1595
+ if self.sdk_configuration.retry_config is not UNSET:
1596
+ retries = self.sdk_configuration.retry_config
1597
+
1598
+ retry_config = None
1599
+ if isinstance(retries, utils.RetryConfig):
1600
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1601
+
1602
+ http_res = await self.do_request_async(
1603
+ hook_ctx=HookContext(
1604
+ base_url=base_url or "",
1605
+ operation_id="delete-firewall-assignment",
1606
+ oauth2_scopes=[],
1607
+ security_source=get_security_from_env(
1608
+ self.sdk_configuration.security, models.Security
1609
+ ),
1610
+ ),
1611
+ request=req,
1612
+ error_status_codes=["403", "404", "4XX", "5XX"],
1613
+ retry_config=retry_config,
1614
+ )
1615
+
1616
+ response_data: Any = None
1617
+ if utils.match_response(http_res, "204", "*"):
1618
+ return
1619
+ if utils.match_response(http_res, ["403", "404"], "application/vnd.api+json"):
1620
+ response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
1621
+ raise models.ErrorObject(data=response_data)
1622
+ if utils.match_response(http_res, "4XX", "*"):
1623
+ http_res_text = await utils.stream_to_text_async(http_res)
1624
+ raise models.APIError(
1625
+ "API error occurred", http_res.status_code, http_res_text, http_res
1626
+ )
1627
+ if utils.match_response(http_res, "5XX", "*"):
1628
+ http_res_text = await utils.stream_to_text_async(http_res)
1629
+ raise models.APIError(
1630
+ "API error occurred", http_res.status_code, http_res_text, http_res
1631
+ )
1632
+
1633
+ content_type = http_res.headers.get("Content-Type")
1634
+ http_res_text = await utils.stream_to_text_async(http_res)
1635
+ raise models.APIError(
1636
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1637
+ http_res.status_code,
1638
+ http_res_text,
1639
+ http_res,
1640
+ )