latitudesh-python-sdk 1.1.0__py3-none-any.whl → 2.0.1__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 (93) hide show
  1. latitudesh_python_sdk/_hooks/types.py +7 -0
  2. latitudesh_python_sdk/_version.py +6 -4
  3. latitudesh_python_sdk/apikeys.py +73 -156
  4. latitudesh_python_sdk/basesdk.py +16 -24
  5. latitudesh_python_sdk/billing.py +13 -32
  6. latitudesh_python_sdk/events_sdk.py +11 -34
  7. latitudesh_python_sdk/firewalls_sdk.py +105 -264
  8. latitudesh_python_sdk/httpclient.py +6 -16
  9. latitudesh_python_sdk/ipaddresses_sdk.py +29 -68
  10. latitudesh_python_sdk/models/__init__.py +2586 -1126
  11. latitudesh_python_sdk/models/apierror.py +30 -14
  12. latitudesh_python_sdk/models/assign_server_virtual_networkop.py +2 -2
  13. latitudesh_python_sdk/models/{bandwidth_plan.py → bandwidth_plan_data.py} +9 -9
  14. latitudesh_python_sdk/models/bandwidth_plans.py +14 -3
  15. latitudesh_python_sdk/models/custom_tag.py +15 -0
  16. latitudesh_python_sdk/models/custom_tag_data.py +54 -0
  17. latitudesh_python_sdk/models/custom_tags.py +26 -0
  18. latitudesh_python_sdk/models/delete_ssh_keyop.py +16 -0
  19. latitudesh_python_sdk/models/delete_user_dataop.py +16 -0
  20. latitudesh_python_sdk/models/deploy_config.py +11 -6
  21. latitudesh_python_sdk/models/error_object.py +11 -6
  22. latitudesh_python_sdk/models/event_data.py +98 -0
  23. latitudesh_python_sdk/models/events.py +16 -1
  24. latitudesh_python_sdk/models/filesystem_data.py +4 -0
  25. latitudesh_python_sdk/models/firewall.py +15 -0
  26. latitudesh_python_sdk/models/firewall_assignment_data.py +50 -0
  27. latitudesh_python_sdk/models/firewall_assignments.py +29 -0
  28. latitudesh_python_sdk/models/firewall_data.py +71 -0
  29. latitudesh_python_sdk/models/firewall_server.py +4 -1
  30. latitudesh_python_sdk/models/firewalls.py +7 -7
  31. latitudesh_python_sdk/models/get_firewall_assignmentsop.py +3 -3
  32. latitudesh_python_sdk/models/get_ssh_keyop.py +30 -0
  33. latitudesh_python_sdk/models/get_ssh_keysop.py +22 -0
  34. latitudesh_python_sdk/models/get_traffic_consumptionop.py +8 -4
  35. latitudesh_python_sdk/models/get_user_dataop.py +31 -0
  36. latitudesh_python_sdk/models/get_users_dataop.py +35 -0
  37. latitudesh_python_sdk/models/latitudesherror.py +26 -0
  38. latitudesh_python_sdk/models/no_response_error.py +13 -0
  39. latitudesh_python_sdk/models/operating_system_data.py +65 -0
  40. latitudesh_python_sdk/models/operating_systems.py +15 -0
  41. latitudesh_python_sdk/models/out_of_band_connection.py +4 -4
  42. latitudesh_python_sdk/models/patch_user_dataop.py +69 -0
  43. latitudesh_python_sdk/models/post_ssh_keyop.py +58 -0
  44. latitudesh_python_sdk/models/post_user_dataop.py +45 -0
  45. latitudesh_python_sdk/models/project_include.py +3 -0
  46. latitudesh_python_sdk/models/put_ssh_keyop.py +80 -0
  47. latitudesh_python_sdk/models/region_resource_data.py +4 -4
  48. latitudesh_python_sdk/models/responsevalidationerror.py +25 -0
  49. latitudesh_python_sdk/models/role.py +11 -0
  50. latitudesh_python_sdk/models/server.py +11 -6
  51. latitudesh_python_sdk/models/server_data.py +14 -3
  52. latitudesh_python_sdk/models/server_region_resource_data.py +40 -0
  53. latitudesh_python_sdk/models/{ssh_key.py → ssh_keys.py} +13 -2
  54. latitudesh_python_sdk/models/storage_plan_data.py +47 -0
  55. latitudesh_python_sdk/models/storage_plans.py +14 -3
  56. latitudesh_python_sdk/models/update_serverop.py +58 -10
  57. latitudesh_python_sdk/models/user_data.py +11 -0
  58. latitudesh_python_sdk/models/virtual_network.py +30 -6
  59. latitudesh_python_sdk/models/virtual_network1.py +15 -0
  60. latitudesh_python_sdk/models/virtual_network_assignment.py +41 -0
  61. latitudesh_python_sdk/models/virtual_network_assignment_data.py +68 -0
  62. latitudesh_python_sdk/models/virtual_network_assignments.py +5 -5
  63. latitudesh_python_sdk/models/virtual_network_data.py +88 -0
  64. latitudesh_python_sdk/models/virtual_networks.py +3 -3
  65. latitudesh_python_sdk/operatingsystems_sdk.py +13 -32
  66. latitudesh_python_sdk/plans.py +99 -214
  67. latitudesh_python_sdk/privatenetworks.py +131 -290
  68. latitudesh_python_sdk/projects_sdk.py +79 -158
  69. latitudesh_python_sdk/regions_sdk.py +25 -66
  70. latitudesh_python_sdk/roles.py +25 -64
  71. latitudesh_python_sdk/sdk.py +110 -73
  72. latitudesh_python_sdk/sdkconfiguration.py +0 -7
  73. latitudesh_python_sdk/servers_sdk.py +305 -646
  74. latitudesh_python_sdk/sshkeys_sdk.py +1856 -0
  75. latitudesh_python_sdk/storage.py +41 -120
  76. latitudesh_python_sdk/tags.py +67 -146
  77. latitudesh_python_sdk/teams_sdk.py +41 -100
  78. latitudesh_python_sdk/teamsmembers.py +37 -96
  79. latitudesh_python_sdk/traffic_sdk.py +37 -76
  80. latitudesh_python_sdk/userdata_sdk.py +959 -149
  81. latitudesh_python_sdk/userprofile.py +37 -100
  82. latitudesh_python_sdk/utils/__init__.py +131 -46
  83. latitudesh_python_sdk/utils/forms.py +49 -28
  84. latitudesh_python_sdk/utils/serializers.py +3 -2
  85. latitudesh_python_sdk/utils/unmarshal_json_response.py +24 -0
  86. latitudesh_python_sdk/virtualmachines.py +71 -140
  87. latitudesh_python_sdk/vpnsessions.py +93 -172
  88. {latitudesh_python_sdk-1.1.0.dist-info → latitudesh_python_sdk-2.0.1.dist-info}/METADATA +76 -43
  89. {latitudesh_python_sdk-1.1.0.dist-info → latitudesh_python_sdk-2.0.1.dist-info}/RECORD +91 -67
  90. {latitudesh_python_sdk-1.1.0.dist-info → latitudesh_python_sdk-2.0.1.dist-info}/WHEEL +1 -1
  91. latitudesh_python_sdk/models/storage_plan.py +0 -36
  92. latitudesh_python_sdk/sshkeys.py +0 -1050
  93. {latitudesh_python_sdk-1.1.0.dist-info → latitudesh_python_sdk-2.0.1.dist-info}/LICENSE +0 -0
@@ -0,0 +1,1856 @@
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 latitudesh_python_sdk.utils.unmarshal_json_response import unmarshal_json_response
9
+ from typing import Mapping, Optional, Union
10
+ from typing_extensions import deprecated
11
+
12
+
13
+ class SSHKeysSDK(BaseSDK):
14
+ @deprecated(
15
+ "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
16
+ )
17
+ def list_for_project(
18
+ self,
19
+ *,
20
+ project_id: str,
21
+ filter_tags: Optional[str] = None,
22
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
23
+ server_url: Optional[str] = None,
24
+ timeout_ms: Optional[int] = None,
25
+ http_headers: Optional[Mapping[str, str]] = None,
26
+ ) -> models.SSHKeys:
27
+ r"""List all Project SSH Keys
28
+
29
+ List all SSH Keys in the project. These keys can be used to access servers after deploy and reinstall actions.
30
+
31
+
32
+ :param project_id: Project ID or Slug
33
+ :param filter_tags: The tags ids to filter by, separated by comma, e.g. `filter[tags]=tag_1,tag_2`will return ssh keys with `tag_1` AND `tag_2`
34
+ :param retries: Override the default retry configuration for this method
35
+ :param server_url: Override the default server URL for this method
36
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
37
+ :param http_headers: Additional headers to set or replace on requests.
38
+ """
39
+ base_url = None
40
+ url_variables = None
41
+ if timeout_ms is None:
42
+ timeout_ms = self.sdk_configuration.timeout_ms
43
+
44
+ if server_url is not None:
45
+ base_url = server_url
46
+ else:
47
+ base_url = self._get_url(base_url, url_variables)
48
+
49
+ request = models.GetProjectSSHKeysRequest(
50
+ project_id=project_id,
51
+ filter_tags=filter_tags,
52
+ )
53
+
54
+ req = self._build_request(
55
+ method="GET",
56
+ path="/projects/{project_id}/ssh_keys",
57
+ base_url=base_url,
58
+ url_variables=url_variables,
59
+ request=request,
60
+ request_body_required=False,
61
+ request_has_path_params=True,
62
+ request_has_query_params=True,
63
+ user_agent_header="user-agent",
64
+ accept_header_value="application/vnd.api+json",
65
+ http_headers=http_headers,
66
+ security=self.sdk_configuration.security,
67
+ timeout_ms=timeout_ms,
68
+ )
69
+
70
+ if retries == UNSET:
71
+ if self.sdk_configuration.retry_config is not UNSET:
72
+ retries = self.sdk_configuration.retry_config
73
+
74
+ retry_config = None
75
+ if isinstance(retries, utils.RetryConfig):
76
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
77
+
78
+ http_res = self.do_request(
79
+ hook_ctx=HookContext(
80
+ config=self.sdk_configuration,
81
+ base_url=base_url or "",
82
+ operation_id="get-project-ssh-keys",
83
+ oauth2_scopes=[],
84
+ security_source=get_security_from_env(
85
+ self.sdk_configuration.security, models.Security
86
+ ),
87
+ ),
88
+ request=req,
89
+ error_status_codes=["4XX", "5XX"],
90
+ retry_config=retry_config,
91
+ )
92
+
93
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
94
+ return unmarshal_json_response(models.SSHKeys, http_res)
95
+ if utils.match_response(http_res, "4XX", "*"):
96
+ http_res_text = utils.stream_to_text(http_res)
97
+ raise models.APIError("API error occurred", http_res, http_res_text)
98
+ if utils.match_response(http_res, "5XX", "*"):
99
+ http_res_text = utils.stream_to_text(http_res)
100
+ raise models.APIError("API error occurred", http_res, http_res_text)
101
+
102
+ raise models.APIError("Unexpected response received", http_res)
103
+
104
+ @deprecated(
105
+ "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
106
+ )
107
+ async def list_for_project_async(
108
+ self,
109
+ *,
110
+ project_id: str,
111
+ filter_tags: Optional[str] = None,
112
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
113
+ server_url: Optional[str] = None,
114
+ timeout_ms: Optional[int] = None,
115
+ http_headers: Optional[Mapping[str, str]] = None,
116
+ ) -> models.SSHKeys:
117
+ r"""List all Project SSH Keys
118
+
119
+ List all SSH Keys in the project. These keys can be used to access servers after deploy and reinstall actions.
120
+
121
+
122
+ :param project_id: Project ID or Slug
123
+ :param filter_tags: The tags ids to filter by, separated by comma, e.g. `filter[tags]=tag_1,tag_2`will return ssh keys with `tag_1` AND `tag_2`
124
+ :param retries: Override the default retry configuration for this method
125
+ :param server_url: Override the default server URL for this method
126
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
127
+ :param http_headers: Additional headers to set or replace on requests.
128
+ """
129
+ base_url = None
130
+ url_variables = None
131
+ if timeout_ms is None:
132
+ timeout_ms = self.sdk_configuration.timeout_ms
133
+
134
+ if server_url is not None:
135
+ base_url = server_url
136
+ else:
137
+ base_url = self._get_url(base_url, url_variables)
138
+
139
+ request = models.GetProjectSSHKeysRequest(
140
+ project_id=project_id,
141
+ filter_tags=filter_tags,
142
+ )
143
+
144
+ req = self._build_request_async(
145
+ method="GET",
146
+ path="/projects/{project_id}/ssh_keys",
147
+ base_url=base_url,
148
+ url_variables=url_variables,
149
+ request=request,
150
+ request_body_required=False,
151
+ request_has_path_params=True,
152
+ request_has_query_params=True,
153
+ user_agent_header="user-agent",
154
+ accept_header_value="application/vnd.api+json",
155
+ http_headers=http_headers,
156
+ security=self.sdk_configuration.security,
157
+ timeout_ms=timeout_ms,
158
+ )
159
+
160
+ if retries == UNSET:
161
+ if self.sdk_configuration.retry_config is not UNSET:
162
+ retries = self.sdk_configuration.retry_config
163
+
164
+ retry_config = None
165
+ if isinstance(retries, utils.RetryConfig):
166
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
167
+
168
+ http_res = await self.do_request_async(
169
+ hook_ctx=HookContext(
170
+ config=self.sdk_configuration,
171
+ base_url=base_url or "",
172
+ operation_id="get-project-ssh-keys",
173
+ oauth2_scopes=[],
174
+ security_source=get_security_from_env(
175
+ self.sdk_configuration.security, models.Security
176
+ ),
177
+ ),
178
+ request=req,
179
+ error_status_codes=["4XX", "5XX"],
180
+ retry_config=retry_config,
181
+ )
182
+
183
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
184
+ return unmarshal_json_response(models.SSHKeys, http_res)
185
+ if utils.match_response(http_res, "4XX", "*"):
186
+ http_res_text = await utils.stream_to_text_async(http_res)
187
+ raise models.APIError("API error occurred", http_res, http_res_text)
188
+ if utils.match_response(http_res, "5XX", "*"):
189
+ http_res_text = await utils.stream_to_text_async(http_res)
190
+ raise models.APIError("API error occurred", http_res, http_res_text)
191
+
192
+ raise models.APIError("Unexpected response received", http_res)
193
+
194
+ @deprecated(
195
+ "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
196
+ )
197
+ def create(
198
+ self,
199
+ *,
200
+ project_id: str,
201
+ data: Union[
202
+ models.PostProjectSSHKeySSHKeysData,
203
+ models.PostProjectSSHKeySSHKeysDataTypedDict,
204
+ ],
205
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
206
+ server_url: Optional[str] = None,
207
+ timeout_ms: Optional[int] = None,
208
+ http_headers: Optional[Mapping[str, str]] = None,
209
+ ) -> models.PostProjectSSHKeyResponseBody:
210
+ r"""Create a Project SSH Key
211
+
212
+ Allow you create SSH Keys in a project. These keys can be used to access servers after deploy and reinstall actions.
213
+
214
+
215
+ :param project_id: Project ID or Slug
216
+ :param data:
217
+ :param retries: Override the default retry configuration for this method
218
+ :param server_url: Override the default server URL for this method
219
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
220
+ :param http_headers: Additional headers to set or replace on requests.
221
+ """
222
+ base_url = None
223
+ url_variables = None
224
+ if timeout_ms is None:
225
+ timeout_ms = self.sdk_configuration.timeout_ms
226
+
227
+ if server_url is not None:
228
+ base_url = server_url
229
+ else:
230
+ base_url = self._get_url(base_url, url_variables)
231
+
232
+ request = models.PostProjectSSHKeyRequest(
233
+ project_id=project_id,
234
+ request_body=models.PostProjectSSHKeySSHKeysRequestBody(
235
+ data=utils.get_pydantic_model(
236
+ data, models.PostProjectSSHKeySSHKeysData
237
+ ),
238
+ ),
239
+ )
240
+
241
+ req = self._build_request(
242
+ method="POST",
243
+ path="/projects/{project_id}/ssh_keys",
244
+ base_url=base_url,
245
+ url_variables=url_variables,
246
+ request=request,
247
+ request_body_required=True,
248
+ request_has_path_params=True,
249
+ request_has_query_params=True,
250
+ user_agent_header="user-agent",
251
+ accept_header_value="application/vnd.api+json",
252
+ http_headers=http_headers,
253
+ security=self.sdk_configuration.security,
254
+ get_serialized_body=lambda: utils.serialize_request_body(
255
+ request.request_body,
256
+ False,
257
+ False,
258
+ "json",
259
+ models.PostProjectSSHKeySSHKeysRequestBody,
260
+ ),
261
+ timeout_ms=timeout_ms,
262
+ )
263
+
264
+ if retries == UNSET:
265
+ if self.sdk_configuration.retry_config is not UNSET:
266
+ retries = self.sdk_configuration.retry_config
267
+
268
+ retry_config = None
269
+ if isinstance(retries, utils.RetryConfig):
270
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
271
+
272
+ http_res = self.do_request(
273
+ hook_ctx=HookContext(
274
+ config=self.sdk_configuration,
275
+ base_url=base_url or "",
276
+ operation_id="post-project-ssh-key",
277
+ oauth2_scopes=[],
278
+ security_source=get_security_from_env(
279
+ self.sdk_configuration.security, models.Security
280
+ ),
281
+ ),
282
+ request=req,
283
+ error_status_codes=["400", "422", "4XX", "5XX"],
284
+ retry_config=retry_config,
285
+ )
286
+
287
+ if utils.match_response(http_res, "201", "application/vnd.api+json"):
288
+ return unmarshal_json_response(
289
+ models.PostProjectSSHKeyResponseBody, http_res
290
+ )
291
+ if utils.match_response(http_res, ["400", "422", "4XX"], "*"):
292
+ http_res_text = utils.stream_to_text(http_res)
293
+ raise models.APIError("API error occurred", http_res, http_res_text)
294
+ if utils.match_response(http_res, "5XX", "*"):
295
+ http_res_text = utils.stream_to_text(http_res)
296
+ raise models.APIError("API error occurred", http_res, http_res_text)
297
+
298
+ raise models.APIError("Unexpected response received", http_res)
299
+
300
+ @deprecated(
301
+ "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
302
+ )
303
+ async def create_async(
304
+ self,
305
+ *,
306
+ project_id: str,
307
+ data: Union[
308
+ models.PostProjectSSHKeySSHKeysData,
309
+ models.PostProjectSSHKeySSHKeysDataTypedDict,
310
+ ],
311
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
312
+ server_url: Optional[str] = None,
313
+ timeout_ms: Optional[int] = None,
314
+ http_headers: Optional[Mapping[str, str]] = None,
315
+ ) -> models.PostProjectSSHKeyResponseBody:
316
+ r"""Create a Project SSH Key
317
+
318
+ Allow you create SSH Keys in a project. These keys can be used to access servers after deploy and reinstall actions.
319
+
320
+
321
+ :param project_id: Project ID or Slug
322
+ :param data:
323
+ :param retries: Override the default retry configuration for this method
324
+ :param server_url: Override the default server URL for this method
325
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
326
+ :param http_headers: Additional headers to set or replace on requests.
327
+ """
328
+ base_url = None
329
+ url_variables = None
330
+ if timeout_ms is None:
331
+ timeout_ms = self.sdk_configuration.timeout_ms
332
+
333
+ if server_url is not None:
334
+ base_url = server_url
335
+ else:
336
+ base_url = self._get_url(base_url, url_variables)
337
+
338
+ request = models.PostProjectSSHKeyRequest(
339
+ project_id=project_id,
340
+ request_body=models.PostProjectSSHKeySSHKeysRequestBody(
341
+ data=utils.get_pydantic_model(
342
+ data, models.PostProjectSSHKeySSHKeysData
343
+ ),
344
+ ),
345
+ )
346
+
347
+ req = self._build_request_async(
348
+ method="POST",
349
+ path="/projects/{project_id}/ssh_keys",
350
+ base_url=base_url,
351
+ url_variables=url_variables,
352
+ request=request,
353
+ request_body_required=True,
354
+ request_has_path_params=True,
355
+ request_has_query_params=True,
356
+ user_agent_header="user-agent",
357
+ accept_header_value="application/vnd.api+json",
358
+ http_headers=http_headers,
359
+ security=self.sdk_configuration.security,
360
+ get_serialized_body=lambda: utils.serialize_request_body(
361
+ request.request_body,
362
+ False,
363
+ False,
364
+ "json",
365
+ models.PostProjectSSHKeySSHKeysRequestBody,
366
+ ),
367
+ timeout_ms=timeout_ms,
368
+ )
369
+
370
+ if retries == UNSET:
371
+ if self.sdk_configuration.retry_config is not UNSET:
372
+ retries = self.sdk_configuration.retry_config
373
+
374
+ retry_config = None
375
+ if isinstance(retries, utils.RetryConfig):
376
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
377
+
378
+ http_res = await self.do_request_async(
379
+ hook_ctx=HookContext(
380
+ config=self.sdk_configuration,
381
+ base_url=base_url or "",
382
+ operation_id="post-project-ssh-key",
383
+ oauth2_scopes=[],
384
+ security_source=get_security_from_env(
385
+ self.sdk_configuration.security, models.Security
386
+ ),
387
+ ),
388
+ request=req,
389
+ error_status_codes=["400", "422", "4XX", "5XX"],
390
+ retry_config=retry_config,
391
+ )
392
+
393
+ if utils.match_response(http_res, "201", "application/vnd.api+json"):
394
+ return unmarshal_json_response(
395
+ models.PostProjectSSHKeyResponseBody, http_res
396
+ )
397
+ if utils.match_response(http_res, ["400", "422", "4XX"], "*"):
398
+ http_res_text = await utils.stream_to_text_async(http_res)
399
+ raise models.APIError("API error occurred", http_res, http_res_text)
400
+ if utils.match_response(http_res, "5XX", "*"):
401
+ http_res_text = await utils.stream_to_text_async(http_res)
402
+ raise models.APIError("API error occurred", http_res, http_res_text)
403
+
404
+ raise models.APIError("Unexpected response received", http_res)
405
+
406
+ @deprecated(
407
+ "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
408
+ )
409
+ def get(
410
+ self,
411
+ *,
412
+ project_id: str,
413
+ ssh_key_id: str,
414
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
415
+ server_url: Optional[str] = None,
416
+ timeout_ms: Optional[int] = None,
417
+ http_headers: Optional[Mapping[str, str]] = None,
418
+ ) -> models.GetProjectSSHKeyResponseBody:
419
+ r"""Retrieve a Project SSH Key
420
+
421
+ List all SSH Keys in the project. These keys can be used to access servers after deploy and reinstall actions.
422
+
423
+
424
+ :param project_id: Project ID or Slug
425
+ :param ssh_key_id:
426
+ :param retries: Override the default retry configuration for this method
427
+ :param server_url: Override the default server URL for this method
428
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
429
+ :param http_headers: Additional headers to set or replace on requests.
430
+ """
431
+ base_url = None
432
+ url_variables = None
433
+ if timeout_ms is None:
434
+ timeout_ms = self.sdk_configuration.timeout_ms
435
+
436
+ if server_url is not None:
437
+ base_url = server_url
438
+ else:
439
+ base_url = self._get_url(base_url, url_variables)
440
+
441
+ request = models.GetProjectSSHKeyRequest(
442
+ project_id=project_id,
443
+ ssh_key_id=ssh_key_id,
444
+ )
445
+
446
+ req = self._build_request(
447
+ method="GET",
448
+ path="/projects/{project_id}/ssh_keys/{ssh_key_id}",
449
+ base_url=base_url,
450
+ url_variables=url_variables,
451
+ request=request,
452
+ request_body_required=False,
453
+ request_has_path_params=True,
454
+ request_has_query_params=True,
455
+ user_agent_header="user-agent",
456
+ accept_header_value="application/vnd.api+json",
457
+ http_headers=http_headers,
458
+ security=self.sdk_configuration.security,
459
+ timeout_ms=timeout_ms,
460
+ )
461
+
462
+ if retries == UNSET:
463
+ if self.sdk_configuration.retry_config is not UNSET:
464
+ retries = self.sdk_configuration.retry_config
465
+
466
+ retry_config = None
467
+ if isinstance(retries, utils.RetryConfig):
468
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
469
+
470
+ http_res = self.do_request(
471
+ hook_ctx=HookContext(
472
+ config=self.sdk_configuration,
473
+ base_url=base_url or "",
474
+ operation_id="get-project-ssh-key",
475
+ oauth2_scopes=[],
476
+ security_source=get_security_from_env(
477
+ self.sdk_configuration.security, models.Security
478
+ ),
479
+ ),
480
+ request=req,
481
+ error_status_codes=["4XX", "5XX"],
482
+ retry_config=retry_config,
483
+ )
484
+
485
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
486
+ return unmarshal_json_response(
487
+ models.GetProjectSSHKeyResponseBody, http_res
488
+ )
489
+ if utils.match_response(http_res, "4XX", "*"):
490
+ http_res_text = utils.stream_to_text(http_res)
491
+ raise models.APIError("API error occurred", http_res, http_res_text)
492
+ if utils.match_response(http_res, "5XX", "*"):
493
+ http_res_text = utils.stream_to_text(http_res)
494
+ raise models.APIError("API error occurred", http_res, http_res_text)
495
+
496
+ raise models.APIError("Unexpected response received", http_res)
497
+
498
+ @deprecated(
499
+ "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
500
+ )
501
+ async def get_async(
502
+ self,
503
+ *,
504
+ project_id: str,
505
+ ssh_key_id: str,
506
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
507
+ server_url: Optional[str] = None,
508
+ timeout_ms: Optional[int] = None,
509
+ http_headers: Optional[Mapping[str, str]] = None,
510
+ ) -> models.GetProjectSSHKeyResponseBody:
511
+ r"""Retrieve a Project SSH Key
512
+
513
+ List all SSH Keys in the project. These keys can be used to access servers after deploy and reinstall actions.
514
+
515
+
516
+ :param project_id: Project ID or Slug
517
+ :param ssh_key_id:
518
+ :param retries: Override the default retry configuration for this method
519
+ :param server_url: Override the default server URL for this method
520
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
521
+ :param http_headers: Additional headers to set or replace on requests.
522
+ """
523
+ base_url = None
524
+ url_variables = None
525
+ if timeout_ms is None:
526
+ timeout_ms = self.sdk_configuration.timeout_ms
527
+
528
+ if server_url is not None:
529
+ base_url = server_url
530
+ else:
531
+ base_url = self._get_url(base_url, url_variables)
532
+
533
+ request = models.GetProjectSSHKeyRequest(
534
+ project_id=project_id,
535
+ ssh_key_id=ssh_key_id,
536
+ )
537
+
538
+ req = self._build_request_async(
539
+ method="GET",
540
+ path="/projects/{project_id}/ssh_keys/{ssh_key_id}",
541
+ base_url=base_url,
542
+ url_variables=url_variables,
543
+ request=request,
544
+ request_body_required=False,
545
+ request_has_path_params=True,
546
+ request_has_query_params=True,
547
+ user_agent_header="user-agent",
548
+ accept_header_value="application/vnd.api+json",
549
+ http_headers=http_headers,
550
+ security=self.sdk_configuration.security,
551
+ timeout_ms=timeout_ms,
552
+ )
553
+
554
+ if retries == UNSET:
555
+ if self.sdk_configuration.retry_config is not UNSET:
556
+ retries = self.sdk_configuration.retry_config
557
+
558
+ retry_config = None
559
+ if isinstance(retries, utils.RetryConfig):
560
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
561
+
562
+ http_res = await self.do_request_async(
563
+ hook_ctx=HookContext(
564
+ config=self.sdk_configuration,
565
+ base_url=base_url or "",
566
+ operation_id="get-project-ssh-key",
567
+ oauth2_scopes=[],
568
+ security_source=get_security_from_env(
569
+ self.sdk_configuration.security, models.Security
570
+ ),
571
+ ),
572
+ request=req,
573
+ error_status_codes=["4XX", "5XX"],
574
+ retry_config=retry_config,
575
+ )
576
+
577
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
578
+ return unmarshal_json_response(
579
+ models.GetProjectSSHKeyResponseBody, http_res
580
+ )
581
+ if utils.match_response(http_res, "4XX", "*"):
582
+ http_res_text = await utils.stream_to_text_async(http_res)
583
+ raise models.APIError("API error occurred", http_res, http_res_text)
584
+ if utils.match_response(http_res, "5XX", "*"):
585
+ http_res_text = await utils.stream_to_text_async(http_res)
586
+ raise models.APIError("API error occurred", http_res, http_res_text)
587
+
588
+ raise models.APIError("Unexpected response received", http_res)
589
+
590
+ @deprecated(
591
+ "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
592
+ )
593
+ def update(
594
+ self,
595
+ *,
596
+ project_id: str,
597
+ ssh_key_id: str,
598
+ data: Union[
599
+ models.PutProjectSSHKeySSHKeysData,
600
+ models.PutProjectSSHKeySSHKeysDataTypedDict,
601
+ ],
602
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
603
+ server_url: Optional[str] = None,
604
+ timeout_ms: Optional[int] = None,
605
+ http_headers: Optional[Mapping[str, str]] = None,
606
+ ) -> models.PutProjectSSHKeyResponseBody:
607
+ r"""Update a Project SSH Key
608
+
609
+ Allow you update SSH Key in a project. These keys can be used to access servers after deploy and reinstall actions.
610
+
611
+
612
+ :param project_id: Project ID or Slug
613
+ :param ssh_key_id:
614
+ :param data:
615
+ :param retries: Override the default retry configuration for this method
616
+ :param server_url: Override the default server URL for this method
617
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
618
+ :param http_headers: Additional headers to set or replace on requests.
619
+ """
620
+ base_url = None
621
+ url_variables = None
622
+ if timeout_ms is None:
623
+ timeout_ms = self.sdk_configuration.timeout_ms
624
+
625
+ if server_url is not None:
626
+ base_url = server_url
627
+ else:
628
+ base_url = self._get_url(base_url, url_variables)
629
+
630
+ request = models.PutProjectSSHKeyRequest(
631
+ project_id=project_id,
632
+ ssh_key_id=ssh_key_id,
633
+ request_body=models.PutProjectSSHKeySSHKeysRequestBody(
634
+ data=utils.get_pydantic_model(data, models.PutProjectSSHKeySSHKeysData),
635
+ ),
636
+ )
637
+
638
+ req = self._build_request(
639
+ method="PATCH",
640
+ path="/projects/{project_id}/ssh_keys/{ssh_key_id}",
641
+ base_url=base_url,
642
+ url_variables=url_variables,
643
+ request=request,
644
+ request_body_required=True,
645
+ request_has_path_params=True,
646
+ request_has_query_params=True,
647
+ user_agent_header="user-agent",
648
+ accept_header_value="application/vnd.api+json",
649
+ http_headers=http_headers,
650
+ security=self.sdk_configuration.security,
651
+ get_serialized_body=lambda: utils.serialize_request_body(
652
+ request.request_body,
653
+ False,
654
+ False,
655
+ "json",
656
+ models.PutProjectSSHKeySSHKeysRequestBody,
657
+ ),
658
+ timeout_ms=timeout_ms,
659
+ )
660
+
661
+ if retries == UNSET:
662
+ if self.sdk_configuration.retry_config is not UNSET:
663
+ retries = self.sdk_configuration.retry_config
664
+
665
+ retry_config = None
666
+ if isinstance(retries, utils.RetryConfig):
667
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
668
+
669
+ http_res = self.do_request(
670
+ hook_ctx=HookContext(
671
+ config=self.sdk_configuration,
672
+ base_url=base_url or "",
673
+ operation_id="put-project-ssh-key",
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=["400", "422", "4XX", "5XX"],
681
+ retry_config=retry_config,
682
+ )
683
+
684
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
685
+ return unmarshal_json_response(
686
+ models.PutProjectSSHKeyResponseBody, http_res
687
+ )
688
+ if utils.match_response(http_res, ["400", "422", "4XX"], "*"):
689
+ http_res_text = utils.stream_to_text(http_res)
690
+ raise models.APIError("API error occurred", http_res, http_res_text)
691
+ if utils.match_response(http_res, "5XX", "*"):
692
+ http_res_text = utils.stream_to_text(http_res)
693
+ raise models.APIError("API error occurred", http_res, http_res_text)
694
+
695
+ raise models.APIError("Unexpected response received", http_res)
696
+
697
+ @deprecated(
698
+ "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
699
+ )
700
+ async def update_async(
701
+ self,
702
+ *,
703
+ project_id: str,
704
+ ssh_key_id: str,
705
+ data: Union[
706
+ models.PutProjectSSHKeySSHKeysData,
707
+ models.PutProjectSSHKeySSHKeysDataTypedDict,
708
+ ],
709
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
710
+ server_url: Optional[str] = None,
711
+ timeout_ms: Optional[int] = None,
712
+ http_headers: Optional[Mapping[str, str]] = None,
713
+ ) -> models.PutProjectSSHKeyResponseBody:
714
+ r"""Update a Project SSH Key
715
+
716
+ Allow you update SSH Key in a project. These keys can be used to access servers after deploy and reinstall actions.
717
+
718
+
719
+ :param project_id: Project ID or Slug
720
+ :param ssh_key_id:
721
+ :param data:
722
+ :param retries: Override the default retry configuration for this method
723
+ :param server_url: Override the default server URL for this method
724
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
725
+ :param http_headers: Additional headers to set or replace on requests.
726
+ """
727
+ base_url = None
728
+ url_variables = None
729
+ if timeout_ms is None:
730
+ timeout_ms = self.sdk_configuration.timeout_ms
731
+
732
+ if server_url is not None:
733
+ base_url = server_url
734
+ else:
735
+ base_url = self._get_url(base_url, url_variables)
736
+
737
+ request = models.PutProjectSSHKeyRequest(
738
+ project_id=project_id,
739
+ ssh_key_id=ssh_key_id,
740
+ request_body=models.PutProjectSSHKeySSHKeysRequestBody(
741
+ data=utils.get_pydantic_model(data, models.PutProjectSSHKeySSHKeysData),
742
+ ),
743
+ )
744
+
745
+ req = self._build_request_async(
746
+ method="PATCH",
747
+ path="/projects/{project_id}/ssh_keys/{ssh_key_id}",
748
+ base_url=base_url,
749
+ url_variables=url_variables,
750
+ request=request,
751
+ request_body_required=True,
752
+ request_has_path_params=True,
753
+ request_has_query_params=True,
754
+ user_agent_header="user-agent",
755
+ accept_header_value="application/vnd.api+json",
756
+ http_headers=http_headers,
757
+ security=self.sdk_configuration.security,
758
+ get_serialized_body=lambda: utils.serialize_request_body(
759
+ request.request_body,
760
+ False,
761
+ False,
762
+ "json",
763
+ models.PutProjectSSHKeySSHKeysRequestBody,
764
+ ),
765
+ timeout_ms=timeout_ms,
766
+ )
767
+
768
+ if retries == UNSET:
769
+ if self.sdk_configuration.retry_config is not UNSET:
770
+ retries = self.sdk_configuration.retry_config
771
+
772
+ retry_config = None
773
+ if isinstance(retries, utils.RetryConfig):
774
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
775
+
776
+ http_res = await self.do_request_async(
777
+ hook_ctx=HookContext(
778
+ config=self.sdk_configuration,
779
+ base_url=base_url or "",
780
+ operation_id="put-project-ssh-key",
781
+ oauth2_scopes=[],
782
+ security_source=get_security_from_env(
783
+ self.sdk_configuration.security, models.Security
784
+ ),
785
+ ),
786
+ request=req,
787
+ error_status_codes=["400", "422", "4XX", "5XX"],
788
+ retry_config=retry_config,
789
+ )
790
+
791
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
792
+ return unmarshal_json_response(
793
+ models.PutProjectSSHKeyResponseBody, http_res
794
+ )
795
+ if utils.match_response(http_res, ["400", "422", "4XX"], "*"):
796
+ http_res_text = await utils.stream_to_text_async(http_res)
797
+ raise models.APIError("API error occurred", http_res, http_res_text)
798
+ if utils.match_response(http_res, "5XX", "*"):
799
+ http_res_text = await utils.stream_to_text_async(http_res)
800
+ raise models.APIError("API error occurred", http_res, http_res_text)
801
+
802
+ raise models.APIError("Unexpected response received", http_res)
803
+
804
+ @deprecated(
805
+ "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
806
+ )
807
+ def delete(
808
+ self,
809
+ *,
810
+ project_id: str,
811
+ ssh_key_id: str,
812
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
813
+ server_url: Optional[str] = None,
814
+ timeout_ms: Optional[int] = None,
815
+ http_headers: Optional[Mapping[str, str]] = None,
816
+ ):
817
+ r"""Delete a Project SSH Key
818
+
819
+ Allow you remove SSH Keys in a project. Remove a SSH Key from the project won't revoke the SSH Keys access for previously deploy and reinstall actions.
820
+
821
+
822
+ :param project_id: Project ID or Slug
823
+ :param ssh_key_id:
824
+ :param retries: Override the default retry configuration for this method
825
+ :param server_url: Override the default server URL for this method
826
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
827
+ :param http_headers: Additional headers to set or replace on requests.
828
+ """
829
+ base_url = None
830
+ url_variables = None
831
+ if timeout_ms is None:
832
+ timeout_ms = self.sdk_configuration.timeout_ms
833
+
834
+ if server_url is not None:
835
+ base_url = server_url
836
+ else:
837
+ base_url = self._get_url(base_url, url_variables)
838
+
839
+ request = models.DeleteProjectSSHKeyRequest(
840
+ project_id=project_id,
841
+ ssh_key_id=ssh_key_id,
842
+ )
843
+
844
+ req = self._build_request(
845
+ method="DELETE",
846
+ path="/projects/{project_id}/ssh_keys/{ssh_key_id}",
847
+ base_url=base_url,
848
+ url_variables=url_variables,
849
+ request=request,
850
+ request_body_required=False,
851
+ request_has_path_params=True,
852
+ request_has_query_params=True,
853
+ user_agent_header="user-agent",
854
+ accept_header_value="*/*",
855
+ http_headers=http_headers,
856
+ security=self.sdk_configuration.security,
857
+ timeout_ms=timeout_ms,
858
+ )
859
+
860
+ if retries == UNSET:
861
+ if self.sdk_configuration.retry_config is not UNSET:
862
+ retries = self.sdk_configuration.retry_config
863
+
864
+ retry_config = None
865
+ if isinstance(retries, utils.RetryConfig):
866
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
867
+
868
+ http_res = self.do_request(
869
+ hook_ctx=HookContext(
870
+ config=self.sdk_configuration,
871
+ base_url=base_url or "",
872
+ operation_id="delete-project-ssh-key",
873
+ oauth2_scopes=[],
874
+ security_source=get_security_from_env(
875
+ self.sdk_configuration.security, models.Security
876
+ ),
877
+ ),
878
+ request=req,
879
+ error_status_codes=["404", "4XX", "5XX"],
880
+ retry_config=retry_config,
881
+ )
882
+
883
+ if utils.match_response(http_res, "200", "*"):
884
+ return
885
+ if utils.match_response(http_res, ["404", "4XX"], "*"):
886
+ http_res_text = utils.stream_to_text(http_res)
887
+ raise models.APIError("API error occurred", http_res, http_res_text)
888
+ if utils.match_response(http_res, "5XX", "*"):
889
+ http_res_text = utils.stream_to_text(http_res)
890
+ raise models.APIError("API error occurred", http_res, http_res_text)
891
+
892
+ raise models.APIError("Unexpected response received", http_res)
893
+
894
+ @deprecated(
895
+ "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
896
+ )
897
+ async def delete_async(
898
+ self,
899
+ *,
900
+ project_id: str,
901
+ ssh_key_id: str,
902
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
903
+ server_url: Optional[str] = None,
904
+ timeout_ms: Optional[int] = None,
905
+ http_headers: Optional[Mapping[str, str]] = None,
906
+ ):
907
+ r"""Delete a Project SSH Key
908
+
909
+ Allow you remove SSH Keys in a project. Remove a SSH Key from the project won't revoke the SSH Keys access for previously deploy and reinstall actions.
910
+
911
+
912
+ :param project_id: Project ID or Slug
913
+ :param ssh_key_id:
914
+ :param retries: Override the default retry configuration for this method
915
+ :param server_url: Override the default server URL for this method
916
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
917
+ :param http_headers: Additional headers to set or replace on requests.
918
+ """
919
+ base_url = None
920
+ url_variables = None
921
+ if timeout_ms is None:
922
+ timeout_ms = self.sdk_configuration.timeout_ms
923
+
924
+ if server_url is not None:
925
+ base_url = server_url
926
+ else:
927
+ base_url = self._get_url(base_url, url_variables)
928
+
929
+ request = models.DeleteProjectSSHKeyRequest(
930
+ project_id=project_id,
931
+ ssh_key_id=ssh_key_id,
932
+ )
933
+
934
+ req = self._build_request_async(
935
+ method="DELETE",
936
+ path="/projects/{project_id}/ssh_keys/{ssh_key_id}",
937
+ base_url=base_url,
938
+ url_variables=url_variables,
939
+ request=request,
940
+ request_body_required=False,
941
+ request_has_path_params=True,
942
+ request_has_query_params=True,
943
+ user_agent_header="user-agent",
944
+ accept_header_value="*/*",
945
+ http_headers=http_headers,
946
+ security=self.sdk_configuration.security,
947
+ timeout_ms=timeout_ms,
948
+ )
949
+
950
+ if retries == UNSET:
951
+ if self.sdk_configuration.retry_config is not UNSET:
952
+ retries = self.sdk_configuration.retry_config
953
+
954
+ retry_config = None
955
+ if isinstance(retries, utils.RetryConfig):
956
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
957
+
958
+ http_res = await self.do_request_async(
959
+ hook_ctx=HookContext(
960
+ config=self.sdk_configuration,
961
+ base_url=base_url or "",
962
+ operation_id="delete-project-ssh-key",
963
+ oauth2_scopes=[],
964
+ security_source=get_security_from_env(
965
+ self.sdk_configuration.security, models.Security
966
+ ),
967
+ ),
968
+ request=req,
969
+ error_status_codes=["404", "4XX", "5XX"],
970
+ retry_config=retry_config,
971
+ )
972
+
973
+ if utils.match_response(http_res, "200", "*"):
974
+ return
975
+ if utils.match_response(http_res, ["404", "4XX"], "*"):
976
+ http_res_text = await utils.stream_to_text_async(http_res)
977
+ raise models.APIError("API error occurred", http_res, http_res_text)
978
+ if utils.match_response(http_res, "5XX", "*"):
979
+ http_res_text = await utils.stream_to_text_async(http_res)
980
+ raise models.APIError("API error occurred", http_res, http_res_text)
981
+
982
+ raise models.APIError("Unexpected response received", http_res)
983
+
984
+ def get_ssh_keys(
985
+ self,
986
+ *,
987
+ filter_tags: Optional[str] = None,
988
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
989
+ server_url: Optional[str] = None,
990
+ timeout_ms: Optional[int] = None,
991
+ http_headers: Optional[Mapping[str, str]] = None,
992
+ ) -> models.SSHKeys:
993
+ r"""List all SSH Keys
994
+
995
+ List all SSH Keys in the project. These keys can be used to access servers after deploy and reinstall actions.
996
+
997
+
998
+ :param filter_tags: The tags ids to filter by, separated by comma, e.g. `filter[tags]=tag_1,tag_2`will return ssh keys with `tag_1` AND `tag_2`
999
+ :param retries: Override the default retry configuration for this method
1000
+ :param server_url: Override the default server URL for this method
1001
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1002
+ :param http_headers: Additional headers to set or replace on requests.
1003
+ """
1004
+ base_url = None
1005
+ url_variables = None
1006
+ if timeout_ms is None:
1007
+ timeout_ms = self.sdk_configuration.timeout_ms
1008
+
1009
+ if server_url is not None:
1010
+ base_url = server_url
1011
+ else:
1012
+ base_url = self._get_url(base_url, url_variables)
1013
+
1014
+ request = models.GetSSHKeysRequest(
1015
+ filter_tags=filter_tags,
1016
+ )
1017
+
1018
+ req = self._build_request(
1019
+ method="GET",
1020
+ path="/ssh_keys",
1021
+ base_url=base_url,
1022
+ url_variables=url_variables,
1023
+ request=request,
1024
+ request_body_required=False,
1025
+ request_has_path_params=False,
1026
+ request_has_query_params=True,
1027
+ user_agent_header="user-agent",
1028
+ accept_header_value="application/vnd.api+json",
1029
+ http_headers=http_headers,
1030
+ security=self.sdk_configuration.security,
1031
+ timeout_ms=timeout_ms,
1032
+ )
1033
+
1034
+ if retries == UNSET:
1035
+ if self.sdk_configuration.retry_config is not UNSET:
1036
+ retries = self.sdk_configuration.retry_config
1037
+
1038
+ retry_config = None
1039
+ if isinstance(retries, utils.RetryConfig):
1040
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1041
+
1042
+ http_res = self.do_request(
1043
+ hook_ctx=HookContext(
1044
+ config=self.sdk_configuration,
1045
+ base_url=base_url or "",
1046
+ operation_id="get-ssh-keys",
1047
+ oauth2_scopes=[],
1048
+ security_source=get_security_from_env(
1049
+ self.sdk_configuration.security, models.Security
1050
+ ),
1051
+ ),
1052
+ request=req,
1053
+ error_status_codes=["4XX", "5XX"],
1054
+ retry_config=retry_config,
1055
+ )
1056
+
1057
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
1058
+ return unmarshal_json_response(models.SSHKeys, http_res)
1059
+ if utils.match_response(http_res, "4XX", "*"):
1060
+ http_res_text = utils.stream_to_text(http_res)
1061
+ raise models.APIError("API error occurred", http_res, http_res_text)
1062
+ if utils.match_response(http_res, "5XX", "*"):
1063
+ http_res_text = utils.stream_to_text(http_res)
1064
+ raise models.APIError("API error occurred", http_res, http_res_text)
1065
+
1066
+ raise models.APIError("Unexpected response received", http_res)
1067
+
1068
+ async def get_ssh_keys_async(
1069
+ self,
1070
+ *,
1071
+ filter_tags: Optional[str] = None,
1072
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1073
+ server_url: Optional[str] = None,
1074
+ timeout_ms: Optional[int] = None,
1075
+ http_headers: Optional[Mapping[str, str]] = None,
1076
+ ) -> models.SSHKeys:
1077
+ r"""List all SSH Keys
1078
+
1079
+ List all SSH Keys in the project. These keys can be used to access servers after deploy and reinstall actions.
1080
+
1081
+
1082
+ :param filter_tags: The tags ids to filter by, separated by comma, e.g. `filter[tags]=tag_1,tag_2`will return ssh keys with `tag_1` AND `tag_2`
1083
+ :param retries: Override the default retry configuration for this method
1084
+ :param server_url: Override the default server URL for this method
1085
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1086
+ :param http_headers: Additional headers to set or replace on requests.
1087
+ """
1088
+ base_url = None
1089
+ url_variables = None
1090
+ if timeout_ms is None:
1091
+ timeout_ms = self.sdk_configuration.timeout_ms
1092
+
1093
+ if server_url is not None:
1094
+ base_url = server_url
1095
+ else:
1096
+ base_url = self._get_url(base_url, url_variables)
1097
+
1098
+ request = models.GetSSHKeysRequest(
1099
+ filter_tags=filter_tags,
1100
+ )
1101
+
1102
+ req = self._build_request_async(
1103
+ method="GET",
1104
+ path="/ssh_keys",
1105
+ base_url=base_url,
1106
+ url_variables=url_variables,
1107
+ request=request,
1108
+ request_body_required=False,
1109
+ request_has_path_params=False,
1110
+ request_has_query_params=True,
1111
+ user_agent_header="user-agent",
1112
+ accept_header_value="application/vnd.api+json",
1113
+ http_headers=http_headers,
1114
+ security=self.sdk_configuration.security,
1115
+ timeout_ms=timeout_ms,
1116
+ )
1117
+
1118
+ if retries == UNSET:
1119
+ if self.sdk_configuration.retry_config is not UNSET:
1120
+ retries = self.sdk_configuration.retry_config
1121
+
1122
+ retry_config = None
1123
+ if isinstance(retries, utils.RetryConfig):
1124
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1125
+
1126
+ http_res = await self.do_request_async(
1127
+ hook_ctx=HookContext(
1128
+ config=self.sdk_configuration,
1129
+ base_url=base_url or "",
1130
+ operation_id="get-ssh-keys",
1131
+ oauth2_scopes=[],
1132
+ security_source=get_security_from_env(
1133
+ self.sdk_configuration.security, models.Security
1134
+ ),
1135
+ ),
1136
+ request=req,
1137
+ error_status_codes=["4XX", "5XX"],
1138
+ retry_config=retry_config,
1139
+ )
1140
+
1141
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
1142
+ return unmarshal_json_response(models.SSHKeys, http_res)
1143
+ if utils.match_response(http_res, "4XX", "*"):
1144
+ http_res_text = await utils.stream_to_text_async(http_res)
1145
+ raise models.APIError("API error occurred", http_res, http_res_text)
1146
+ if utils.match_response(http_res, "5XX", "*"):
1147
+ http_res_text = await utils.stream_to_text_async(http_res)
1148
+ raise models.APIError("API error occurred", http_res, http_res_text)
1149
+
1150
+ raise models.APIError("Unexpected response received", http_res)
1151
+
1152
+ def post_ssh_key(
1153
+ self,
1154
+ *,
1155
+ data: Union[
1156
+ models.PostSSHKeySSHKeysData, models.PostSSHKeySSHKeysDataTypedDict
1157
+ ],
1158
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1159
+ server_url: Optional[str] = None,
1160
+ timeout_ms: Optional[int] = None,
1161
+ http_headers: Optional[Mapping[str, str]] = None,
1162
+ ) -> models.PostSSHKeyResponseBody:
1163
+ r"""Create a SSH Key
1164
+
1165
+ Allow you create SSH Keys. These keys can be used to access servers after deploy and reinstall actions.
1166
+
1167
+
1168
+ :param data:
1169
+ :param retries: Override the default retry configuration for this method
1170
+ :param server_url: Override the default server URL for this method
1171
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1172
+ :param http_headers: Additional headers to set or replace on requests.
1173
+ """
1174
+ base_url = None
1175
+ url_variables = None
1176
+ if timeout_ms is None:
1177
+ timeout_ms = self.sdk_configuration.timeout_ms
1178
+
1179
+ if server_url is not None:
1180
+ base_url = server_url
1181
+ else:
1182
+ base_url = self._get_url(base_url, url_variables)
1183
+
1184
+ request = models.PostSSHKeySSHKeysRequestBody(
1185
+ data=utils.get_pydantic_model(data, models.PostSSHKeySSHKeysData),
1186
+ )
1187
+
1188
+ req = self._build_request(
1189
+ method="POST",
1190
+ path="/ssh_keys",
1191
+ base_url=base_url,
1192
+ url_variables=url_variables,
1193
+ request=request,
1194
+ request_body_required=True,
1195
+ request_has_path_params=False,
1196
+ request_has_query_params=True,
1197
+ user_agent_header="user-agent",
1198
+ accept_header_value="application/vnd.api+json",
1199
+ http_headers=http_headers,
1200
+ security=self.sdk_configuration.security,
1201
+ get_serialized_body=lambda: utils.serialize_request_body(
1202
+ request, False, False, "json", models.PostSSHKeySSHKeysRequestBody
1203
+ ),
1204
+ timeout_ms=timeout_ms,
1205
+ )
1206
+
1207
+ if retries == UNSET:
1208
+ if self.sdk_configuration.retry_config is not UNSET:
1209
+ retries = self.sdk_configuration.retry_config
1210
+
1211
+ retry_config = None
1212
+ if isinstance(retries, utils.RetryConfig):
1213
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1214
+
1215
+ http_res = self.do_request(
1216
+ hook_ctx=HookContext(
1217
+ config=self.sdk_configuration,
1218
+ base_url=base_url or "",
1219
+ operation_id="post-ssh-key",
1220
+ oauth2_scopes=[],
1221
+ security_source=get_security_from_env(
1222
+ self.sdk_configuration.security, models.Security
1223
+ ),
1224
+ ),
1225
+ request=req,
1226
+ error_status_codes=["400", "422", "4XX", "5XX"],
1227
+ retry_config=retry_config,
1228
+ )
1229
+
1230
+ if utils.match_response(http_res, "201", "application/vnd.api+json"):
1231
+ return unmarshal_json_response(models.PostSSHKeyResponseBody, http_res)
1232
+ if utils.match_response(http_res, ["400", "422", "4XX"], "*"):
1233
+ http_res_text = utils.stream_to_text(http_res)
1234
+ raise models.APIError("API error occurred", http_res, http_res_text)
1235
+ if utils.match_response(http_res, "5XX", "*"):
1236
+ http_res_text = utils.stream_to_text(http_res)
1237
+ raise models.APIError("API error occurred", http_res, http_res_text)
1238
+
1239
+ raise models.APIError("Unexpected response received", http_res)
1240
+
1241
+ async def post_ssh_key_async(
1242
+ self,
1243
+ *,
1244
+ data: Union[
1245
+ models.PostSSHKeySSHKeysData, models.PostSSHKeySSHKeysDataTypedDict
1246
+ ],
1247
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1248
+ server_url: Optional[str] = None,
1249
+ timeout_ms: Optional[int] = None,
1250
+ http_headers: Optional[Mapping[str, str]] = None,
1251
+ ) -> models.PostSSHKeyResponseBody:
1252
+ r"""Create a SSH Key
1253
+
1254
+ Allow you create SSH Keys. These keys can be used to access servers after deploy and reinstall actions.
1255
+
1256
+
1257
+ :param data:
1258
+ :param retries: Override the default retry configuration for this method
1259
+ :param server_url: Override the default server URL for this method
1260
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1261
+ :param http_headers: Additional headers to set or replace on requests.
1262
+ """
1263
+ base_url = None
1264
+ url_variables = None
1265
+ if timeout_ms is None:
1266
+ timeout_ms = self.sdk_configuration.timeout_ms
1267
+
1268
+ if server_url is not None:
1269
+ base_url = server_url
1270
+ else:
1271
+ base_url = self._get_url(base_url, url_variables)
1272
+
1273
+ request = models.PostSSHKeySSHKeysRequestBody(
1274
+ data=utils.get_pydantic_model(data, models.PostSSHKeySSHKeysData),
1275
+ )
1276
+
1277
+ req = self._build_request_async(
1278
+ method="POST",
1279
+ path="/ssh_keys",
1280
+ base_url=base_url,
1281
+ url_variables=url_variables,
1282
+ request=request,
1283
+ request_body_required=True,
1284
+ request_has_path_params=False,
1285
+ request_has_query_params=True,
1286
+ user_agent_header="user-agent",
1287
+ accept_header_value="application/vnd.api+json",
1288
+ http_headers=http_headers,
1289
+ security=self.sdk_configuration.security,
1290
+ get_serialized_body=lambda: utils.serialize_request_body(
1291
+ request, False, False, "json", models.PostSSHKeySSHKeysRequestBody
1292
+ ),
1293
+ timeout_ms=timeout_ms,
1294
+ )
1295
+
1296
+ if retries == UNSET:
1297
+ if self.sdk_configuration.retry_config is not UNSET:
1298
+ retries = self.sdk_configuration.retry_config
1299
+
1300
+ retry_config = None
1301
+ if isinstance(retries, utils.RetryConfig):
1302
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1303
+
1304
+ http_res = await self.do_request_async(
1305
+ hook_ctx=HookContext(
1306
+ config=self.sdk_configuration,
1307
+ base_url=base_url or "",
1308
+ operation_id="post-ssh-key",
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=["400", "422", "4XX", "5XX"],
1316
+ retry_config=retry_config,
1317
+ )
1318
+
1319
+ if utils.match_response(http_res, "201", "application/vnd.api+json"):
1320
+ return unmarshal_json_response(models.PostSSHKeyResponseBody, http_res)
1321
+ if utils.match_response(http_res, ["400", "422", "4XX"], "*"):
1322
+ http_res_text = await utils.stream_to_text_async(http_res)
1323
+ raise models.APIError("API error occurred", http_res, http_res_text)
1324
+ if utils.match_response(http_res, "5XX", "*"):
1325
+ http_res_text = await utils.stream_to_text_async(http_res)
1326
+ raise models.APIError("API error occurred", http_res, http_res_text)
1327
+
1328
+ raise models.APIError("Unexpected response received", http_res)
1329
+
1330
+ def get_ssh_key(
1331
+ self,
1332
+ *,
1333
+ ssh_key_id: str,
1334
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1335
+ server_url: Optional[str] = None,
1336
+ timeout_ms: Optional[int] = None,
1337
+ http_headers: Optional[Mapping[str, str]] = None,
1338
+ ) -> models.GetSSHKeyResponseBody:
1339
+ r"""Retrieve a SSH Key
1340
+
1341
+ List all SSH Keys in the project. These keys can be used to access servers after deploy and reinstall actions.
1342
+
1343
+
1344
+ :param ssh_key_id:
1345
+ :param retries: Override the default retry configuration for this method
1346
+ :param server_url: Override the default server URL for this method
1347
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1348
+ :param http_headers: Additional headers to set or replace on requests.
1349
+ """
1350
+ base_url = None
1351
+ url_variables = None
1352
+ if timeout_ms is None:
1353
+ timeout_ms = self.sdk_configuration.timeout_ms
1354
+
1355
+ if server_url is not None:
1356
+ base_url = server_url
1357
+ else:
1358
+ base_url = self._get_url(base_url, url_variables)
1359
+
1360
+ request = models.GetSSHKeyRequest(
1361
+ ssh_key_id=ssh_key_id,
1362
+ )
1363
+
1364
+ req = self._build_request(
1365
+ method="GET",
1366
+ path="/ssh_keys/{ssh_key_id}",
1367
+ base_url=base_url,
1368
+ url_variables=url_variables,
1369
+ request=request,
1370
+ request_body_required=False,
1371
+ request_has_path_params=True,
1372
+ request_has_query_params=True,
1373
+ user_agent_header="user-agent",
1374
+ accept_header_value="application/vnd.api+json",
1375
+ http_headers=http_headers,
1376
+ security=self.sdk_configuration.security,
1377
+ timeout_ms=timeout_ms,
1378
+ )
1379
+
1380
+ if retries == UNSET:
1381
+ if self.sdk_configuration.retry_config is not UNSET:
1382
+ retries = self.sdk_configuration.retry_config
1383
+
1384
+ retry_config = None
1385
+ if isinstance(retries, utils.RetryConfig):
1386
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1387
+
1388
+ http_res = self.do_request(
1389
+ hook_ctx=HookContext(
1390
+ config=self.sdk_configuration,
1391
+ base_url=base_url or "",
1392
+ operation_id="get-ssh-key",
1393
+ oauth2_scopes=[],
1394
+ security_source=get_security_from_env(
1395
+ self.sdk_configuration.security, models.Security
1396
+ ),
1397
+ ),
1398
+ request=req,
1399
+ error_status_codes=["4XX", "5XX"],
1400
+ retry_config=retry_config,
1401
+ )
1402
+
1403
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
1404
+ return unmarshal_json_response(models.GetSSHKeyResponseBody, http_res)
1405
+ if utils.match_response(http_res, "4XX", "*"):
1406
+ http_res_text = utils.stream_to_text(http_res)
1407
+ raise models.APIError("API error occurred", http_res, http_res_text)
1408
+ if utils.match_response(http_res, "5XX", "*"):
1409
+ http_res_text = utils.stream_to_text(http_res)
1410
+ raise models.APIError("API error occurred", http_res, http_res_text)
1411
+
1412
+ raise models.APIError("Unexpected response received", http_res)
1413
+
1414
+ async def get_ssh_key_async(
1415
+ self,
1416
+ *,
1417
+ ssh_key_id: str,
1418
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1419
+ server_url: Optional[str] = None,
1420
+ timeout_ms: Optional[int] = None,
1421
+ http_headers: Optional[Mapping[str, str]] = None,
1422
+ ) -> models.GetSSHKeyResponseBody:
1423
+ r"""Retrieve a SSH Key
1424
+
1425
+ List all SSH Keys in the project. These keys can be used to access servers after deploy and reinstall actions.
1426
+
1427
+
1428
+ :param ssh_key_id:
1429
+ :param retries: Override the default retry configuration for this method
1430
+ :param server_url: Override the default server URL for this method
1431
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1432
+ :param http_headers: Additional headers to set or replace on requests.
1433
+ """
1434
+ base_url = None
1435
+ url_variables = None
1436
+ if timeout_ms is None:
1437
+ timeout_ms = self.sdk_configuration.timeout_ms
1438
+
1439
+ if server_url is not None:
1440
+ base_url = server_url
1441
+ else:
1442
+ base_url = self._get_url(base_url, url_variables)
1443
+
1444
+ request = models.GetSSHKeyRequest(
1445
+ ssh_key_id=ssh_key_id,
1446
+ )
1447
+
1448
+ req = self._build_request_async(
1449
+ method="GET",
1450
+ path="/ssh_keys/{ssh_key_id}",
1451
+ base_url=base_url,
1452
+ url_variables=url_variables,
1453
+ request=request,
1454
+ request_body_required=False,
1455
+ request_has_path_params=True,
1456
+ request_has_query_params=True,
1457
+ user_agent_header="user-agent",
1458
+ accept_header_value="application/vnd.api+json",
1459
+ http_headers=http_headers,
1460
+ security=self.sdk_configuration.security,
1461
+ timeout_ms=timeout_ms,
1462
+ )
1463
+
1464
+ if retries == UNSET:
1465
+ if self.sdk_configuration.retry_config is not UNSET:
1466
+ retries = self.sdk_configuration.retry_config
1467
+
1468
+ retry_config = None
1469
+ if isinstance(retries, utils.RetryConfig):
1470
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1471
+
1472
+ http_res = await self.do_request_async(
1473
+ hook_ctx=HookContext(
1474
+ config=self.sdk_configuration,
1475
+ base_url=base_url or "",
1476
+ operation_id="get-ssh-key",
1477
+ oauth2_scopes=[],
1478
+ security_source=get_security_from_env(
1479
+ self.sdk_configuration.security, models.Security
1480
+ ),
1481
+ ),
1482
+ request=req,
1483
+ error_status_codes=["4XX", "5XX"],
1484
+ retry_config=retry_config,
1485
+ )
1486
+
1487
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
1488
+ return unmarshal_json_response(models.GetSSHKeyResponseBody, http_res)
1489
+ if utils.match_response(http_res, "4XX", "*"):
1490
+ http_res_text = await utils.stream_to_text_async(http_res)
1491
+ raise models.APIError("API error occurred", http_res, http_res_text)
1492
+ if utils.match_response(http_res, "5XX", "*"):
1493
+ http_res_text = await utils.stream_to_text_async(http_res)
1494
+ raise models.APIError("API error occurred", http_res, http_res_text)
1495
+
1496
+ raise models.APIError("Unexpected response received", http_res)
1497
+
1498
+ def put_ssh_key(
1499
+ self,
1500
+ *,
1501
+ ssh_key_id: str,
1502
+ data: Union[models.PutSSHKeySSHKeysData, models.PutSSHKeySSHKeysDataTypedDict],
1503
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1504
+ server_url: Optional[str] = None,
1505
+ timeout_ms: Optional[int] = None,
1506
+ http_headers: Optional[Mapping[str, str]] = None,
1507
+ ) -> models.PutSSHKeyResponseBody:
1508
+ r"""Update a SSH Key
1509
+
1510
+ Allow you update SSH Key in a project. These keys can be used to access servers after deploy and reinstall actions.
1511
+
1512
+
1513
+ :param ssh_key_id:
1514
+ :param data:
1515
+ :param retries: Override the default retry configuration for this method
1516
+ :param server_url: Override the default server URL for this method
1517
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1518
+ :param http_headers: Additional headers to set or replace on requests.
1519
+ """
1520
+ base_url = None
1521
+ url_variables = None
1522
+ if timeout_ms is None:
1523
+ timeout_ms = self.sdk_configuration.timeout_ms
1524
+
1525
+ if server_url is not None:
1526
+ base_url = server_url
1527
+ else:
1528
+ base_url = self._get_url(base_url, url_variables)
1529
+
1530
+ request = models.PutSSHKeyRequest(
1531
+ ssh_key_id=ssh_key_id,
1532
+ request_body=models.PutSSHKeySSHKeysRequestBody(
1533
+ data=utils.get_pydantic_model(data, models.PutSSHKeySSHKeysData),
1534
+ ),
1535
+ )
1536
+
1537
+ req = self._build_request(
1538
+ method="PATCH",
1539
+ path="/ssh_keys/{ssh_key_id}",
1540
+ base_url=base_url,
1541
+ url_variables=url_variables,
1542
+ request=request,
1543
+ request_body_required=True,
1544
+ request_has_path_params=True,
1545
+ request_has_query_params=True,
1546
+ user_agent_header="user-agent",
1547
+ accept_header_value="application/vnd.api+json",
1548
+ http_headers=http_headers,
1549
+ security=self.sdk_configuration.security,
1550
+ get_serialized_body=lambda: utils.serialize_request_body(
1551
+ request.request_body,
1552
+ False,
1553
+ False,
1554
+ "json",
1555
+ models.PutSSHKeySSHKeysRequestBody,
1556
+ ),
1557
+ timeout_ms=timeout_ms,
1558
+ )
1559
+
1560
+ if retries == UNSET:
1561
+ if self.sdk_configuration.retry_config is not UNSET:
1562
+ retries = self.sdk_configuration.retry_config
1563
+
1564
+ retry_config = None
1565
+ if isinstance(retries, utils.RetryConfig):
1566
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1567
+
1568
+ http_res = self.do_request(
1569
+ hook_ctx=HookContext(
1570
+ config=self.sdk_configuration,
1571
+ base_url=base_url or "",
1572
+ operation_id="put-ssh-key",
1573
+ oauth2_scopes=[],
1574
+ security_source=get_security_from_env(
1575
+ self.sdk_configuration.security, models.Security
1576
+ ),
1577
+ ),
1578
+ request=req,
1579
+ error_status_codes=["400", "422", "4XX", "5XX"],
1580
+ retry_config=retry_config,
1581
+ )
1582
+
1583
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
1584
+ return unmarshal_json_response(models.PutSSHKeyResponseBody, http_res)
1585
+ if utils.match_response(http_res, ["400", "422", "4XX"], "*"):
1586
+ http_res_text = utils.stream_to_text(http_res)
1587
+ raise models.APIError("API error occurred", http_res, http_res_text)
1588
+ if utils.match_response(http_res, "5XX", "*"):
1589
+ http_res_text = utils.stream_to_text(http_res)
1590
+ raise models.APIError("API error occurred", http_res, http_res_text)
1591
+
1592
+ raise models.APIError("Unexpected response received", http_res)
1593
+
1594
+ async def put_ssh_key_async(
1595
+ self,
1596
+ *,
1597
+ ssh_key_id: str,
1598
+ data: Union[models.PutSSHKeySSHKeysData, models.PutSSHKeySSHKeysDataTypedDict],
1599
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1600
+ server_url: Optional[str] = None,
1601
+ timeout_ms: Optional[int] = None,
1602
+ http_headers: Optional[Mapping[str, str]] = None,
1603
+ ) -> models.PutSSHKeyResponseBody:
1604
+ r"""Update a SSH Key
1605
+
1606
+ Allow you update SSH Key in a project. These keys can be used to access servers after deploy and reinstall actions.
1607
+
1608
+
1609
+ :param ssh_key_id:
1610
+ :param data:
1611
+ :param retries: Override the default retry configuration for this method
1612
+ :param server_url: Override the default server URL for this method
1613
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1614
+ :param http_headers: Additional headers to set or replace on requests.
1615
+ """
1616
+ base_url = None
1617
+ url_variables = None
1618
+ if timeout_ms is None:
1619
+ timeout_ms = self.sdk_configuration.timeout_ms
1620
+
1621
+ if server_url is not None:
1622
+ base_url = server_url
1623
+ else:
1624
+ base_url = self._get_url(base_url, url_variables)
1625
+
1626
+ request = models.PutSSHKeyRequest(
1627
+ ssh_key_id=ssh_key_id,
1628
+ request_body=models.PutSSHKeySSHKeysRequestBody(
1629
+ data=utils.get_pydantic_model(data, models.PutSSHKeySSHKeysData),
1630
+ ),
1631
+ )
1632
+
1633
+ req = self._build_request_async(
1634
+ method="PATCH",
1635
+ path="/ssh_keys/{ssh_key_id}",
1636
+ base_url=base_url,
1637
+ url_variables=url_variables,
1638
+ request=request,
1639
+ request_body_required=True,
1640
+ request_has_path_params=True,
1641
+ request_has_query_params=True,
1642
+ user_agent_header="user-agent",
1643
+ accept_header_value="application/vnd.api+json",
1644
+ http_headers=http_headers,
1645
+ security=self.sdk_configuration.security,
1646
+ get_serialized_body=lambda: utils.serialize_request_body(
1647
+ request.request_body,
1648
+ False,
1649
+ False,
1650
+ "json",
1651
+ models.PutSSHKeySSHKeysRequestBody,
1652
+ ),
1653
+ timeout_ms=timeout_ms,
1654
+ )
1655
+
1656
+ if retries == UNSET:
1657
+ if self.sdk_configuration.retry_config is not UNSET:
1658
+ retries = self.sdk_configuration.retry_config
1659
+
1660
+ retry_config = None
1661
+ if isinstance(retries, utils.RetryConfig):
1662
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1663
+
1664
+ http_res = await self.do_request_async(
1665
+ hook_ctx=HookContext(
1666
+ config=self.sdk_configuration,
1667
+ base_url=base_url or "",
1668
+ operation_id="put-ssh-key",
1669
+ oauth2_scopes=[],
1670
+ security_source=get_security_from_env(
1671
+ self.sdk_configuration.security, models.Security
1672
+ ),
1673
+ ),
1674
+ request=req,
1675
+ error_status_codes=["400", "422", "4XX", "5XX"],
1676
+ retry_config=retry_config,
1677
+ )
1678
+
1679
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
1680
+ return unmarshal_json_response(models.PutSSHKeyResponseBody, http_res)
1681
+ if utils.match_response(http_res, ["400", "422", "4XX"], "*"):
1682
+ http_res_text = await utils.stream_to_text_async(http_res)
1683
+ raise models.APIError("API error occurred", http_res, http_res_text)
1684
+ if utils.match_response(http_res, "5XX", "*"):
1685
+ http_res_text = await utils.stream_to_text_async(http_res)
1686
+ raise models.APIError("API error occurred", http_res, http_res_text)
1687
+
1688
+ raise models.APIError("Unexpected response received", http_res)
1689
+
1690
+ def delete_ssh_key(
1691
+ self,
1692
+ *,
1693
+ ssh_key_id: str,
1694
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1695
+ server_url: Optional[str] = None,
1696
+ timeout_ms: Optional[int] = None,
1697
+ http_headers: Optional[Mapping[str, str]] = None,
1698
+ ):
1699
+ r"""Delete a SSH Key
1700
+
1701
+ Allow you remove SSH Keys in a project. Remove a SSH Key from the project won't revoke the SSH Keys access for previously deploy and reinstall actions.
1702
+
1703
+
1704
+ :param ssh_key_id:
1705
+ :param retries: Override the default retry configuration for this method
1706
+ :param server_url: Override the default server URL for this method
1707
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1708
+ :param http_headers: Additional headers to set or replace on requests.
1709
+ """
1710
+ base_url = None
1711
+ url_variables = None
1712
+ if timeout_ms is None:
1713
+ timeout_ms = self.sdk_configuration.timeout_ms
1714
+
1715
+ if server_url is not None:
1716
+ base_url = server_url
1717
+ else:
1718
+ base_url = self._get_url(base_url, url_variables)
1719
+
1720
+ request = models.DeleteSSHKeyRequest(
1721
+ ssh_key_id=ssh_key_id,
1722
+ )
1723
+
1724
+ req = self._build_request(
1725
+ method="DELETE",
1726
+ path="/ssh_keys/{ssh_key_id}",
1727
+ base_url=base_url,
1728
+ url_variables=url_variables,
1729
+ request=request,
1730
+ request_body_required=False,
1731
+ request_has_path_params=True,
1732
+ request_has_query_params=True,
1733
+ user_agent_header="user-agent",
1734
+ accept_header_value="*/*",
1735
+ http_headers=http_headers,
1736
+ security=self.sdk_configuration.security,
1737
+ timeout_ms=timeout_ms,
1738
+ )
1739
+
1740
+ if retries == UNSET:
1741
+ if self.sdk_configuration.retry_config is not UNSET:
1742
+ retries = self.sdk_configuration.retry_config
1743
+
1744
+ retry_config = None
1745
+ if isinstance(retries, utils.RetryConfig):
1746
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1747
+
1748
+ http_res = self.do_request(
1749
+ hook_ctx=HookContext(
1750
+ config=self.sdk_configuration,
1751
+ base_url=base_url or "",
1752
+ operation_id="delete-ssh-key",
1753
+ oauth2_scopes=[],
1754
+ security_source=get_security_from_env(
1755
+ self.sdk_configuration.security, models.Security
1756
+ ),
1757
+ ),
1758
+ request=req,
1759
+ error_status_codes=["404", "4XX", "5XX"],
1760
+ retry_config=retry_config,
1761
+ )
1762
+
1763
+ if utils.match_response(http_res, "200", "*"):
1764
+ return
1765
+ if utils.match_response(http_res, ["404", "4XX"], "*"):
1766
+ http_res_text = utils.stream_to_text(http_res)
1767
+ raise models.APIError("API error occurred", http_res, http_res_text)
1768
+ if utils.match_response(http_res, "5XX", "*"):
1769
+ http_res_text = utils.stream_to_text(http_res)
1770
+ raise models.APIError("API error occurred", http_res, http_res_text)
1771
+
1772
+ raise models.APIError("Unexpected response received", http_res)
1773
+
1774
+ async def delete_ssh_key_async(
1775
+ self,
1776
+ *,
1777
+ ssh_key_id: str,
1778
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1779
+ server_url: Optional[str] = None,
1780
+ timeout_ms: Optional[int] = None,
1781
+ http_headers: Optional[Mapping[str, str]] = None,
1782
+ ):
1783
+ r"""Delete a SSH Key
1784
+
1785
+ Allow you remove SSH Keys in a project. Remove a SSH Key from the project won't revoke the SSH Keys access for previously deploy and reinstall actions.
1786
+
1787
+
1788
+ :param ssh_key_id:
1789
+ :param retries: Override the default retry configuration for this method
1790
+ :param server_url: Override the default server URL for this method
1791
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1792
+ :param http_headers: Additional headers to set or replace on requests.
1793
+ """
1794
+ base_url = None
1795
+ url_variables = None
1796
+ if timeout_ms is None:
1797
+ timeout_ms = self.sdk_configuration.timeout_ms
1798
+
1799
+ if server_url is not None:
1800
+ base_url = server_url
1801
+ else:
1802
+ base_url = self._get_url(base_url, url_variables)
1803
+
1804
+ request = models.DeleteSSHKeyRequest(
1805
+ ssh_key_id=ssh_key_id,
1806
+ )
1807
+
1808
+ req = self._build_request_async(
1809
+ method="DELETE",
1810
+ path="/ssh_keys/{ssh_key_id}",
1811
+ base_url=base_url,
1812
+ url_variables=url_variables,
1813
+ request=request,
1814
+ request_body_required=False,
1815
+ request_has_path_params=True,
1816
+ request_has_query_params=True,
1817
+ user_agent_header="user-agent",
1818
+ accept_header_value="*/*",
1819
+ http_headers=http_headers,
1820
+ security=self.sdk_configuration.security,
1821
+ timeout_ms=timeout_ms,
1822
+ )
1823
+
1824
+ if retries == UNSET:
1825
+ if self.sdk_configuration.retry_config is not UNSET:
1826
+ retries = self.sdk_configuration.retry_config
1827
+
1828
+ retry_config = None
1829
+ if isinstance(retries, utils.RetryConfig):
1830
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1831
+
1832
+ http_res = await self.do_request_async(
1833
+ hook_ctx=HookContext(
1834
+ config=self.sdk_configuration,
1835
+ base_url=base_url or "",
1836
+ operation_id="delete-ssh-key",
1837
+ oauth2_scopes=[],
1838
+ security_source=get_security_from_env(
1839
+ self.sdk_configuration.security, models.Security
1840
+ ),
1841
+ ),
1842
+ request=req,
1843
+ error_status_codes=["404", "4XX", "5XX"],
1844
+ retry_config=retry_config,
1845
+ )
1846
+
1847
+ if utils.match_response(http_res, "200", "*"):
1848
+ return
1849
+ if utils.match_response(http_res, ["404", "4XX"], "*"):
1850
+ http_res_text = await utils.stream_to_text_async(http_res)
1851
+ raise models.APIError("API error occurred", http_res, http_res_text)
1852
+ if utils.match_response(http_res, "5XX", "*"):
1853
+ http_res_text = await utils.stream_to_text_async(http_res)
1854
+ raise models.APIError("API error occurred", http_res, http_res_text)
1855
+
1856
+ raise models.APIError("Unexpected response received", http_res)