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
@@ -1,1050 +0,0 @@
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 Mapping, Optional, Union
9
-
10
-
11
- class SSHKeys(BaseSDK):
12
- def list_for_project(
13
- self,
14
- *,
15
- project_id: str,
16
- filter_tags: Optional[str] = None,
17
- retries: OptionalNullable[utils.RetryConfig] = UNSET,
18
- server_url: Optional[str] = None,
19
- timeout_ms: Optional[int] = None,
20
- http_headers: Optional[Mapping[str, str]] = None,
21
- ) -> models.SSHKey:
22
- r"""List all Project SSH Keys
23
-
24
- List all SSH Keys in the project. These keys can be used to access servers after deploy and reinstall actions.
25
-
26
-
27
- :param project_id: Project ID or Slug
28
- :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`
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.GetProjectSSHKeysRequest(
45
- project_id=project_id,
46
- filter_tags=filter_tags,
47
- )
48
-
49
- req = self._build_request(
50
- method="GET",
51
- path="/projects/{project_id}/ssh_keys",
52
- base_url=base_url,
53
- url_variables=url_variables,
54
- request=request,
55
- request_body_required=False,
56
- request_has_path_params=True,
57
- request_has_query_params=True,
58
- user_agent_header="user-agent",
59
- accept_header_value="application/vnd.api+json",
60
- http_headers=http_headers,
61
- security=self.sdk_configuration.security,
62
- timeout_ms=timeout_ms,
63
- )
64
-
65
- if retries == UNSET:
66
- if self.sdk_configuration.retry_config is not UNSET:
67
- retries = self.sdk_configuration.retry_config
68
-
69
- retry_config = None
70
- if isinstance(retries, utils.RetryConfig):
71
- retry_config = (retries, ["429", "500", "502", "503", "504"])
72
-
73
- http_res = self.do_request(
74
- hook_ctx=HookContext(
75
- base_url=base_url or "",
76
- operation_id="get-project-ssh-keys",
77
- oauth2_scopes=[],
78
- security_source=get_security_from_env(
79
- self.sdk_configuration.security, models.Security
80
- ),
81
- ),
82
- request=req,
83
- error_status_codes=["4XX", "5XX"],
84
- retry_config=retry_config,
85
- )
86
-
87
- if utils.match_response(http_res, "200", "application/vnd.api+json"):
88
- return utils.unmarshal_json(http_res.text, models.SSHKey)
89
- if utils.match_response(http_res, "4XX", "*"):
90
- http_res_text = utils.stream_to_text(http_res)
91
- raise models.APIError(
92
- "API error occurred", http_res.status_code, http_res_text, http_res
93
- )
94
- if utils.match_response(http_res, "5XX", "*"):
95
- http_res_text = utils.stream_to_text(http_res)
96
- raise models.APIError(
97
- "API error occurred", http_res.status_code, http_res_text, http_res
98
- )
99
-
100
- content_type = http_res.headers.get("Content-Type")
101
- http_res_text = utils.stream_to_text(http_res)
102
- raise models.APIError(
103
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
104
- http_res.status_code,
105
- http_res_text,
106
- http_res,
107
- )
108
-
109
- async def list_for_project_async(
110
- self,
111
- *,
112
- project_id: str,
113
- filter_tags: Optional[str] = None,
114
- retries: OptionalNullable[utils.RetryConfig] = UNSET,
115
- server_url: Optional[str] = None,
116
- timeout_ms: Optional[int] = None,
117
- http_headers: Optional[Mapping[str, str]] = None,
118
- ) -> models.SSHKey:
119
- r"""List all Project SSH Keys
120
-
121
- List all SSH Keys in the project. These keys can be used to access servers after deploy and reinstall actions.
122
-
123
-
124
- :param project_id: Project ID or Slug
125
- :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`
126
- :param retries: Override the default retry configuration for this method
127
- :param server_url: Override the default server URL for this method
128
- :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
129
- :param http_headers: Additional headers to set or replace on requests.
130
- """
131
- base_url = None
132
- url_variables = None
133
- if timeout_ms is None:
134
- timeout_ms = self.sdk_configuration.timeout_ms
135
-
136
- if server_url is not None:
137
- base_url = server_url
138
- else:
139
- base_url = self._get_url(base_url, url_variables)
140
-
141
- request = models.GetProjectSSHKeysRequest(
142
- project_id=project_id,
143
- filter_tags=filter_tags,
144
- )
145
-
146
- req = self._build_request_async(
147
- method="GET",
148
- path="/projects/{project_id}/ssh_keys",
149
- base_url=base_url,
150
- url_variables=url_variables,
151
- request=request,
152
- request_body_required=False,
153
- request_has_path_params=True,
154
- request_has_query_params=True,
155
- user_agent_header="user-agent",
156
- accept_header_value="application/vnd.api+json",
157
- http_headers=http_headers,
158
- security=self.sdk_configuration.security,
159
- timeout_ms=timeout_ms,
160
- )
161
-
162
- if retries == UNSET:
163
- if self.sdk_configuration.retry_config is not UNSET:
164
- retries = self.sdk_configuration.retry_config
165
-
166
- retry_config = None
167
- if isinstance(retries, utils.RetryConfig):
168
- retry_config = (retries, ["429", "500", "502", "503", "504"])
169
-
170
- http_res = await self.do_request_async(
171
- hook_ctx=HookContext(
172
- base_url=base_url or "",
173
- operation_id="get-project-ssh-keys",
174
- oauth2_scopes=[],
175
- security_source=get_security_from_env(
176
- self.sdk_configuration.security, models.Security
177
- ),
178
- ),
179
- request=req,
180
- error_status_codes=["4XX", "5XX"],
181
- retry_config=retry_config,
182
- )
183
-
184
- if utils.match_response(http_res, "200", "application/vnd.api+json"):
185
- return utils.unmarshal_json(http_res.text, models.SSHKey)
186
- if utils.match_response(http_res, "4XX", "*"):
187
- http_res_text = await utils.stream_to_text_async(http_res)
188
- raise models.APIError(
189
- "API error occurred", http_res.status_code, http_res_text, http_res
190
- )
191
- if utils.match_response(http_res, "5XX", "*"):
192
- http_res_text = await utils.stream_to_text_async(http_res)
193
- raise models.APIError(
194
- "API error occurred", http_res.status_code, http_res_text, http_res
195
- )
196
-
197
- content_type = http_res.headers.get("Content-Type")
198
- http_res_text = await utils.stream_to_text_async(http_res)
199
- raise models.APIError(
200
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
201
- http_res.status_code,
202
- http_res_text,
203
- http_res,
204
- )
205
-
206
- def create(
207
- self,
208
- *,
209
- project_id: str,
210
- data: Union[
211
- models.PostProjectSSHKeySSHKeysData,
212
- models.PostProjectSSHKeySSHKeysDataTypedDict,
213
- ],
214
- retries: OptionalNullable[utils.RetryConfig] = UNSET,
215
- server_url: Optional[str] = None,
216
- timeout_ms: Optional[int] = None,
217
- http_headers: Optional[Mapping[str, str]] = None,
218
- ) -> models.PostProjectSSHKeyResponseBody:
219
- r"""Create a Project SSH Key
220
-
221
- Allow you create SSH Keys in a project. These keys can be used to access servers after deploy and reinstall actions.
222
-
223
-
224
- :param project_id: Project ID or Slug
225
- :param data:
226
- :param retries: Override the default retry configuration for this method
227
- :param server_url: Override the default server URL for this method
228
- :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
229
- :param http_headers: Additional headers to set or replace on requests.
230
- """
231
- base_url = None
232
- url_variables = None
233
- if timeout_ms is None:
234
- timeout_ms = self.sdk_configuration.timeout_ms
235
-
236
- if server_url is not None:
237
- base_url = server_url
238
- else:
239
- base_url = self._get_url(base_url, url_variables)
240
-
241
- request = models.PostProjectSSHKeyRequest(
242
- project_id=project_id,
243
- request_body=models.PostProjectSSHKeySSHKeysRequestBody(
244
- data=utils.get_pydantic_model(
245
- data, models.PostProjectSSHKeySSHKeysData
246
- ),
247
- ),
248
- )
249
-
250
- req = self._build_request(
251
- method="POST",
252
- path="/projects/{project_id}/ssh_keys",
253
- base_url=base_url,
254
- url_variables=url_variables,
255
- request=request,
256
- request_body_required=True,
257
- request_has_path_params=True,
258
- request_has_query_params=True,
259
- user_agent_header="user-agent",
260
- accept_header_value="application/vnd.api+json",
261
- http_headers=http_headers,
262
- security=self.sdk_configuration.security,
263
- get_serialized_body=lambda: utils.serialize_request_body(
264
- request.request_body,
265
- False,
266
- False,
267
- "json",
268
- models.PostProjectSSHKeySSHKeysRequestBody,
269
- ),
270
- timeout_ms=timeout_ms,
271
- )
272
-
273
- if retries == UNSET:
274
- if self.sdk_configuration.retry_config is not UNSET:
275
- retries = self.sdk_configuration.retry_config
276
-
277
- retry_config = None
278
- if isinstance(retries, utils.RetryConfig):
279
- retry_config = (retries, ["429", "500", "502", "503", "504"])
280
-
281
- http_res = self.do_request(
282
- hook_ctx=HookContext(
283
- base_url=base_url or "",
284
- operation_id="post-project-ssh-key",
285
- oauth2_scopes=[],
286
- security_source=get_security_from_env(
287
- self.sdk_configuration.security, models.Security
288
- ),
289
- ),
290
- request=req,
291
- error_status_codes=["400", "422", "4XX", "5XX"],
292
- retry_config=retry_config,
293
- )
294
-
295
- if utils.match_response(http_res, "201", "application/vnd.api+json"):
296
- return utils.unmarshal_json(
297
- http_res.text, models.PostProjectSSHKeyResponseBody
298
- )
299
- if utils.match_response(http_res, ["400", "422", "4XX"], "*"):
300
- http_res_text = utils.stream_to_text(http_res)
301
- raise models.APIError(
302
- "API error occurred", http_res.status_code, http_res_text, http_res
303
- )
304
- if utils.match_response(http_res, "5XX", "*"):
305
- http_res_text = utils.stream_to_text(http_res)
306
- raise models.APIError(
307
- "API error occurred", http_res.status_code, http_res_text, http_res
308
- )
309
-
310
- content_type = http_res.headers.get("Content-Type")
311
- http_res_text = utils.stream_to_text(http_res)
312
- raise models.APIError(
313
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
314
- http_res.status_code,
315
- http_res_text,
316
- http_res,
317
- )
318
-
319
- async def create_async(
320
- self,
321
- *,
322
- project_id: str,
323
- data: Union[
324
- models.PostProjectSSHKeySSHKeysData,
325
- models.PostProjectSSHKeySSHKeysDataTypedDict,
326
- ],
327
- retries: OptionalNullable[utils.RetryConfig] = UNSET,
328
- server_url: Optional[str] = None,
329
- timeout_ms: Optional[int] = None,
330
- http_headers: Optional[Mapping[str, str]] = None,
331
- ) -> models.PostProjectSSHKeyResponseBody:
332
- r"""Create a Project SSH Key
333
-
334
- Allow you create SSH Keys in a project. These keys can be used to access servers after deploy and reinstall actions.
335
-
336
-
337
- :param project_id: Project ID or Slug
338
- :param data:
339
- :param retries: Override the default retry configuration for this method
340
- :param server_url: Override the default server URL for this method
341
- :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
342
- :param http_headers: Additional headers to set or replace on requests.
343
- """
344
- base_url = None
345
- url_variables = None
346
- if timeout_ms is None:
347
- timeout_ms = self.sdk_configuration.timeout_ms
348
-
349
- if server_url is not None:
350
- base_url = server_url
351
- else:
352
- base_url = self._get_url(base_url, url_variables)
353
-
354
- request = models.PostProjectSSHKeyRequest(
355
- project_id=project_id,
356
- request_body=models.PostProjectSSHKeySSHKeysRequestBody(
357
- data=utils.get_pydantic_model(
358
- data, models.PostProjectSSHKeySSHKeysData
359
- ),
360
- ),
361
- )
362
-
363
- req = self._build_request_async(
364
- method="POST",
365
- path="/projects/{project_id}/ssh_keys",
366
- base_url=base_url,
367
- url_variables=url_variables,
368
- request=request,
369
- request_body_required=True,
370
- request_has_path_params=True,
371
- request_has_query_params=True,
372
- user_agent_header="user-agent",
373
- accept_header_value="application/vnd.api+json",
374
- http_headers=http_headers,
375
- security=self.sdk_configuration.security,
376
- get_serialized_body=lambda: utils.serialize_request_body(
377
- request.request_body,
378
- False,
379
- False,
380
- "json",
381
- models.PostProjectSSHKeySSHKeysRequestBody,
382
- ),
383
- timeout_ms=timeout_ms,
384
- )
385
-
386
- if retries == UNSET:
387
- if self.sdk_configuration.retry_config is not UNSET:
388
- retries = self.sdk_configuration.retry_config
389
-
390
- retry_config = None
391
- if isinstance(retries, utils.RetryConfig):
392
- retry_config = (retries, ["429", "500", "502", "503", "504"])
393
-
394
- http_res = await self.do_request_async(
395
- hook_ctx=HookContext(
396
- base_url=base_url or "",
397
- operation_id="post-project-ssh-key",
398
- oauth2_scopes=[],
399
- security_source=get_security_from_env(
400
- self.sdk_configuration.security, models.Security
401
- ),
402
- ),
403
- request=req,
404
- error_status_codes=["400", "422", "4XX", "5XX"],
405
- retry_config=retry_config,
406
- )
407
-
408
- if utils.match_response(http_res, "201", "application/vnd.api+json"):
409
- return utils.unmarshal_json(
410
- http_res.text, models.PostProjectSSHKeyResponseBody
411
- )
412
- if utils.match_response(http_res, ["400", "422", "4XX"], "*"):
413
- http_res_text = await utils.stream_to_text_async(http_res)
414
- raise models.APIError(
415
- "API error occurred", http_res.status_code, http_res_text, http_res
416
- )
417
- if utils.match_response(http_res, "5XX", "*"):
418
- http_res_text = await utils.stream_to_text_async(http_res)
419
- raise models.APIError(
420
- "API error occurred", http_res.status_code, http_res_text, http_res
421
- )
422
-
423
- content_type = http_res.headers.get("Content-Type")
424
- http_res_text = await utils.stream_to_text_async(http_res)
425
- raise models.APIError(
426
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
427
- http_res.status_code,
428
- http_res_text,
429
- http_res,
430
- )
431
-
432
- def get(
433
- self,
434
- *,
435
- project_id: str,
436
- ssh_key_id: str,
437
- retries: OptionalNullable[utils.RetryConfig] = UNSET,
438
- server_url: Optional[str] = None,
439
- timeout_ms: Optional[int] = None,
440
- http_headers: Optional[Mapping[str, str]] = None,
441
- ) -> models.GetProjectSSHKeyResponseBody:
442
- r"""Retrieve a Project SSH Key
443
-
444
- List all SSH Keys in the project. These keys can be used to access servers after deploy and reinstall actions.
445
-
446
-
447
- :param project_id: Project ID or Slug
448
- :param ssh_key_id:
449
- :param retries: Override the default retry configuration for this method
450
- :param server_url: Override the default server URL for this method
451
- :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
452
- :param http_headers: Additional headers to set or replace on requests.
453
- """
454
- base_url = None
455
- url_variables = None
456
- if timeout_ms is None:
457
- timeout_ms = self.sdk_configuration.timeout_ms
458
-
459
- if server_url is not None:
460
- base_url = server_url
461
- else:
462
- base_url = self._get_url(base_url, url_variables)
463
-
464
- request = models.GetProjectSSHKeyRequest(
465
- project_id=project_id,
466
- ssh_key_id=ssh_key_id,
467
- )
468
-
469
- req = self._build_request(
470
- method="GET",
471
- path="/projects/{project_id}/ssh_keys/{ssh_key_id}",
472
- base_url=base_url,
473
- url_variables=url_variables,
474
- request=request,
475
- request_body_required=False,
476
- request_has_path_params=True,
477
- request_has_query_params=True,
478
- user_agent_header="user-agent",
479
- accept_header_value="application/vnd.api+json",
480
- http_headers=http_headers,
481
- security=self.sdk_configuration.security,
482
- timeout_ms=timeout_ms,
483
- )
484
-
485
- if retries == UNSET:
486
- if self.sdk_configuration.retry_config is not UNSET:
487
- retries = self.sdk_configuration.retry_config
488
-
489
- retry_config = None
490
- if isinstance(retries, utils.RetryConfig):
491
- retry_config = (retries, ["429", "500", "502", "503", "504"])
492
-
493
- http_res = self.do_request(
494
- hook_ctx=HookContext(
495
- base_url=base_url or "",
496
- operation_id="get-project-ssh-key",
497
- oauth2_scopes=[],
498
- security_source=get_security_from_env(
499
- self.sdk_configuration.security, models.Security
500
- ),
501
- ),
502
- request=req,
503
- error_status_codes=["4XX", "5XX"],
504
- retry_config=retry_config,
505
- )
506
-
507
- if utils.match_response(http_res, "200", "application/vnd.api+json"):
508
- return utils.unmarshal_json(
509
- http_res.text, models.GetProjectSSHKeyResponseBody
510
- )
511
- if utils.match_response(http_res, "4XX", "*"):
512
- http_res_text = utils.stream_to_text(http_res)
513
- raise models.APIError(
514
- "API error occurred", http_res.status_code, http_res_text, http_res
515
- )
516
- if utils.match_response(http_res, "5XX", "*"):
517
- http_res_text = utils.stream_to_text(http_res)
518
- raise models.APIError(
519
- "API error occurred", http_res.status_code, http_res_text, http_res
520
- )
521
-
522
- content_type = http_res.headers.get("Content-Type")
523
- http_res_text = utils.stream_to_text(http_res)
524
- raise models.APIError(
525
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
526
- http_res.status_code,
527
- http_res_text,
528
- http_res,
529
- )
530
-
531
- async def get_async(
532
- self,
533
- *,
534
- project_id: str,
535
- ssh_key_id: str,
536
- retries: OptionalNullable[utils.RetryConfig] = UNSET,
537
- server_url: Optional[str] = None,
538
- timeout_ms: Optional[int] = None,
539
- http_headers: Optional[Mapping[str, str]] = None,
540
- ) -> models.GetProjectSSHKeyResponseBody:
541
- r"""Retrieve a Project SSH Key
542
-
543
- List all SSH Keys in the project. These keys can be used to access servers after deploy and reinstall actions.
544
-
545
-
546
- :param project_id: Project ID or Slug
547
- :param ssh_key_id:
548
- :param retries: Override the default retry configuration for this method
549
- :param server_url: Override the default server URL for this method
550
- :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
551
- :param http_headers: Additional headers to set or replace on requests.
552
- """
553
- base_url = None
554
- url_variables = None
555
- if timeout_ms is None:
556
- timeout_ms = self.sdk_configuration.timeout_ms
557
-
558
- if server_url is not None:
559
- base_url = server_url
560
- else:
561
- base_url = self._get_url(base_url, url_variables)
562
-
563
- request = models.GetProjectSSHKeyRequest(
564
- project_id=project_id,
565
- ssh_key_id=ssh_key_id,
566
- )
567
-
568
- req = self._build_request_async(
569
- method="GET",
570
- path="/projects/{project_id}/ssh_keys/{ssh_key_id}",
571
- base_url=base_url,
572
- url_variables=url_variables,
573
- request=request,
574
- request_body_required=False,
575
- request_has_path_params=True,
576
- request_has_query_params=True,
577
- user_agent_header="user-agent",
578
- accept_header_value="application/vnd.api+json",
579
- http_headers=http_headers,
580
- security=self.sdk_configuration.security,
581
- timeout_ms=timeout_ms,
582
- )
583
-
584
- if retries == UNSET:
585
- if self.sdk_configuration.retry_config is not UNSET:
586
- retries = self.sdk_configuration.retry_config
587
-
588
- retry_config = None
589
- if isinstance(retries, utils.RetryConfig):
590
- retry_config = (retries, ["429", "500", "502", "503", "504"])
591
-
592
- http_res = await self.do_request_async(
593
- hook_ctx=HookContext(
594
- base_url=base_url or "",
595
- operation_id="get-project-ssh-key",
596
- oauth2_scopes=[],
597
- security_source=get_security_from_env(
598
- self.sdk_configuration.security, models.Security
599
- ),
600
- ),
601
- request=req,
602
- error_status_codes=["4XX", "5XX"],
603
- retry_config=retry_config,
604
- )
605
-
606
- if utils.match_response(http_res, "200", "application/vnd.api+json"):
607
- return utils.unmarshal_json(
608
- http_res.text, models.GetProjectSSHKeyResponseBody
609
- )
610
- if utils.match_response(http_res, "4XX", "*"):
611
- http_res_text = await utils.stream_to_text_async(http_res)
612
- raise models.APIError(
613
- "API error occurred", http_res.status_code, http_res_text, http_res
614
- )
615
- if utils.match_response(http_res, "5XX", "*"):
616
- http_res_text = await utils.stream_to_text_async(http_res)
617
- raise models.APIError(
618
- "API error occurred", http_res.status_code, http_res_text, http_res
619
- )
620
-
621
- content_type = http_res.headers.get("Content-Type")
622
- http_res_text = await utils.stream_to_text_async(http_res)
623
- raise models.APIError(
624
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
625
- http_res.status_code,
626
- http_res_text,
627
- http_res,
628
- )
629
-
630
- def update(
631
- self,
632
- *,
633
- project_id: str,
634
- ssh_key_id: str,
635
- data: Union[
636
- models.PutProjectSSHKeySSHKeysData,
637
- models.PutProjectSSHKeySSHKeysDataTypedDict,
638
- ],
639
- retries: OptionalNullable[utils.RetryConfig] = UNSET,
640
- server_url: Optional[str] = None,
641
- timeout_ms: Optional[int] = None,
642
- http_headers: Optional[Mapping[str, str]] = None,
643
- ) -> models.PutProjectSSHKeyResponseBody:
644
- r"""Update a Project SSH Key
645
-
646
- Allow you update SSH Key in a project. These keys can be used to access servers after deploy and reinstall actions.
647
-
648
-
649
- :param project_id: Project ID or Slug
650
- :param ssh_key_id:
651
- :param data:
652
- :param retries: Override the default retry configuration for this method
653
- :param server_url: Override the default server URL for this method
654
- :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
655
- :param http_headers: Additional headers to set or replace on requests.
656
- """
657
- base_url = None
658
- url_variables = None
659
- if timeout_ms is None:
660
- timeout_ms = self.sdk_configuration.timeout_ms
661
-
662
- if server_url is not None:
663
- base_url = server_url
664
- else:
665
- base_url = self._get_url(base_url, url_variables)
666
-
667
- request = models.PutProjectSSHKeyRequest(
668
- project_id=project_id,
669
- ssh_key_id=ssh_key_id,
670
- request_body=models.PutProjectSSHKeySSHKeysRequestBody(
671
- data=utils.get_pydantic_model(data, models.PutProjectSSHKeySSHKeysData),
672
- ),
673
- )
674
-
675
- req = self._build_request(
676
- method="PATCH",
677
- path="/projects/{project_id}/ssh_keys/{ssh_key_id}",
678
- base_url=base_url,
679
- url_variables=url_variables,
680
- request=request,
681
- request_body_required=True,
682
- request_has_path_params=True,
683
- request_has_query_params=True,
684
- user_agent_header="user-agent",
685
- accept_header_value="application/vnd.api+json",
686
- http_headers=http_headers,
687
- security=self.sdk_configuration.security,
688
- get_serialized_body=lambda: utils.serialize_request_body(
689
- request.request_body,
690
- False,
691
- False,
692
- "json",
693
- models.PutProjectSSHKeySSHKeysRequestBody,
694
- ),
695
- timeout_ms=timeout_ms,
696
- )
697
-
698
- if retries == UNSET:
699
- if self.sdk_configuration.retry_config is not UNSET:
700
- retries = self.sdk_configuration.retry_config
701
-
702
- retry_config = None
703
- if isinstance(retries, utils.RetryConfig):
704
- retry_config = (retries, ["429", "500", "502", "503", "504"])
705
-
706
- http_res = self.do_request(
707
- hook_ctx=HookContext(
708
- base_url=base_url or "",
709
- operation_id="put-project-ssh-key",
710
- oauth2_scopes=[],
711
- security_source=get_security_from_env(
712
- self.sdk_configuration.security, models.Security
713
- ),
714
- ),
715
- request=req,
716
- error_status_codes=["400", "422", "4XX", "5XX"],
717
- retry_config=retry_config,
718
- )
719
-
720
- if utils.match_response(http_res, "200", "application/vnd.api+json"):
721
- return utils.unmarshal_json(
722
- http_res.text, models.PutProjectSSHKeyResponseBody
723
- )
724
- if utils.match_response(http_res, ["400", "422", "4XX"], "*"):
725
- http_res_text = utils.stream_to_text(http_res)
726
- raise models.APIError(
727
- "API error occurred", http_res.status_code, http_res_text, http_res
728
- )
729
- if utils.match_response(http_res, "5XX", "*"):
730
- http_res_text = utils.stream_to_text(http_res)
731
- raise models.APIError(
732
- "API error occurred", http_res.status_code, http_res_text, http_res
733
- )
734
-
735
- content_type = http_res.headers.get("Content-Type")
736
- http_res_text = utils.stream_to_text(http_res)
737
- raise models.APIError(
738
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
739
- http_res.status_code,
740
- http_res_text,
741
- http_res,
742
- )
743
-
744
- async def update_async(
745
- self,
746
- *,
747
- project_id: str,
748
- ssh_key_id: str,
749
- data: Union[
750
- models.PutProjectSSHKeySSHKeysData,
751
- models.PutProjectSSHKeySSHKeysDataTypedDict,
752
- ],
753
- retries: OptionalNullable[utils.RetryConfig] = UNSET,
754
- server_url: Optional[str] = None,
755
- timeout_ms: Optional[int] = None,
756
- http_headers: Optional[Mapping[str, str]] = None,
757
- ) -> models.PutProjectSSHKeyResponseBody:
758
- r"""Update a Project SSH Key
759
-
760
- Allow you update SSH Key in a project. These keys can be used to access servers after deploy and reinstall actions.
761
-
762
-
763
- :param project_id: Project ID or Slug
764
- :param ssh_key_id:
765
- :param data:
766
- :param retries: Override the default retry configuration for this method
767
- :param server_url: Override the default server URL for this method
768
- :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
769
- :param http_headers: Additional headers to set or replace on requests.
770
- """
771
- base_url = None
772
- url_variables = None
773
- if timeout_ms is None:
774
- timeout_ms = self.sdk_configuration.timeout_ms
775
-
776
- if server_url is not None:
777
- base_url = server_url
778
- else:
779
- base_url = self._get_url(base_url, url_variables)
780
-
781
- request = models.PutProjectSSHKeyRequest(
782
- project_id=project_id,
783
- ssh_key_id=ssh_key_id,
784
- request_body=models.PutProjectSSHKeySSHKeysRequestBody(
785
- data=utils.get_pydantic_model(data, models.PutProjectSSHKeySSHKeysData),
786
- ),
787
- )
788
-
789
- req = self._build_request_async(
790
- method="PATCH",
791
- path="/projects/{project_id}/ssh_keys/{ssh_key_id}",
792
- base_url=base_url,
793
- url_variables=url_variables,
794
- request=request,
795
- request_body_required=True,
796
- request_has_path_params=True,
797
- request_has_query_params=True,
798
- user_agent_header="user-agent",
799
- accept_header_value="application/vnd.api+json",
800
- http_headers=http_headers,
801
- security=self.sdk_configuration.security,
802
- get_serialized_body=lambda: utils.serialize_request_body(
803
- request.request_body,
804
- False,
805
- False,
806
- "json",
807
- models.PutProjectSSHKeySSHKeysRequestBody,
808
- ),
809
- timeout_ms=timeout_ms,
810
- )
811
-
812
- if retries == UNSET:
813
- if self.sdk_configuration.retry_config is not UNSET:
814
- retries = self.sdk_configuration.retry_config
815
-
816
- retry_config = None
817
- if isinstance(retries, utils.RetryConfig):
818
- retry_config = (retries, ["429", "500", "502", "503", "504"])
819
-
820
- http_res = await self.do_request_async(
821
- hook_ctx=HookContext(
822
- base_url=base_url or "",
823
- operation_id="put-project-ssh-key",
824
- oauth2_scopes=[],
825
- security_source=get_security_from_env(
826
- self.sdk_configuration.security, models.Security
827
- ),
828
- ),
829
- request=req,
830
- error_status_codes=["400", "422", "4XX", "5XX"],
831
- retry_config=retry_config,
832
- )
833
-
834
- if utils.match_response(http_res, "200", "application/vnd.api+json"):
835
- return utils.unmarshal_json(
836
- http_res.text, models.PutProjectSSHKeyResponseBody
837
- )
838
- if utils.match_response(http_res, ["400", "422", "4XX"], "*"):
839
- http_res_text = await utils.stream_to_text_async(http_res)
840
- raise models.APIError(
841
- "API error occurred", http_res.status_code, http_res_text, http_res
842
- )
843
- if utils.match_response(http_res, "5XX", "*"):
844
- http_res_text = await utils.stream_to_text_async(http_res)
845
- raise models.APIError(
846
- "API error occurred", http_res.status_code, http_res_text, http_res
847
- )
848
-
849
- content_type = http_res.headers.get("Content-Type")
850
- http_res_text = await utils.stream_to_text_async(http_res)
851
- raise models.APIError(
852
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
853
- http_res.status_code,
854
- http_res_text,
855
- http_res,
856
- )
857
-
858
- def delete(
859
- self,
860
- *,
861
- project_id: str,
862
- ssh_key_id: str,
863
- retries: OptionalNullable[utils.RetryConfig] = UNSET,
864
- server_url: Optional[str] = None,
865
- timeout_ms: Optional[int] = None,
866
- http_headers: Optional[Mapping[str, str]] = None,
867
- ):
868
- r"""Delete a Project SSH Key
869
-
870
- 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.
871
-
872
-
873
- :param project_id: Project ID or Slug
874
- :param ssh_key_id:
875
- :param retries: Override the default retry configuration for this method
876
- :param server_url: Override the default server URL for this method
877
- :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
878
- :param http_headers: Additional headers to set or replace on requests.
879
- """
880
- base_url = None
881
- url_variables = None
882
- if timeout_ms is None:
883
- timeout_ms = self.sdk_configuration.timeout_ms
884
-
885
- if server_url is not None:
886
- base_url = server_url
887
- else:
888
- base_url = self._get_url(base_url, url_variables)
889
-
890
- request = models.DeleteProjectSSHKeyRequest(
891
- project_id=project_id,
892
- ssh_key_id=ssh_key_id,
893
- )
894
-
895
- req = self._build_request(
896
- method="DELETE",
897
- path="/projects/{project_id}/ssh_keys/{ssh_key_id}",
898
- base_url=base_url,
899
- url_variables=url_variables,
900
- request=request,
901
- request_body_required=False,
902
- request_has_path_params=True,
903
- request_has_query_params=True,
904
- user_agent_header="user-agent",
905
- accept_header_value="*/*",
906
- http_headers=http_headers,
907
- security=self.sdk_configuration.security,
908
- timeout_ms=timeout_ms,
909
- )
910
-
911
- if retries == UNSET:
912
- if self.sdk_configuration.retry_config is not UNSET:
913
- retries = self.sdk_configuration.retry_config
914
-
915
- retry_config = None
916
- if isinstance(retries, utils.RetryConfig):
917
- retry_config = (retries, ["429", "500", "502", "503", "504"])
918
-
919
- http_res = self.do_request(
920
- hook_ctx=HookContext(
921
- base_url=base_url or "",
922
- operation_id="delete-project-ssh-key",
923
- oauth2_scopes=[],
924
- security_source=get_security_from_env(
925
- self.sdk_configuration.security, models.Security
926
- ),
927
- ),
928
- request=req,
929
- error_status_codes=["404", "4XX", "5XX"],
930
- retry_config=retry_config,
931
- )
932
-
933
- if utils.match_response(http_res, "200", "*"):
934
- return
935
- if utils.match_response(http_res, ["404", "4XX"], "*"):
936
- http_res_text = utils.stream_to_text(http_res)
937
- raise models.APIError(
938
- "API error occurred", http_res.status_code, http_res_text, http_res
939
- )
940
- if utils.match_response(http_res, "5XX", "*"):
941
- http_res_text = utils.stream_to_text(http_res)
942
- raise models.APIError(
943
- "API error occurred", http_res.status_code, http_res_text, http_res
944
- )
945
-
946
- content_type = http_res.headers.get("Content-Type")
947
- http_res_text = utils.stream_to_text(http_res)
948
- raise models.APIError(
949
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
950
- http_res.status_code,
951
- http_res_text,
952
- http_res,
953
- )
954
-
955
- async def delete_async(
956
- self,
957
- *,
958
- project_id: str,
959
- ssh_key_id: str,
960
- retries: OptionalNullable[utils.RetryConfig] = UNSET,
961
- server_url: Optional[str] = None,
962
- timeout_ms: Optional[int] = None,
963
- http_headers: Optional[Mapping[str, str]] = None,
964
- ):
965
- r"""Delete a Project SSH Key
966
-
967
- 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.
968
-
969
-
970
- :param project_id: Project ID or Slug
971
- :param ssh_key_id:
972
- :param retries: Override the default retry configuration for this method
973
- :param server_url: Override the default server URL for this method
974
- :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
975
- :param http_headers: Additional headers to set or replace on requests.
976
- """
977
- base_url = None
978
- url_variables = None
979
- if timeout_ms is None:
980
- timeout_ms = self.sdk_configuration.timeout_ms
981
-
982
- if server_url is not None:
983
- base_url = server_url
984
- else:
985
- base_url = self._get_url(base_url, url_variables)
986
-
987
- request = models.DeleteProjectSSHKeyRequest(
988
- project_id=project_id,
989
- ssh_key_id=ssh_key_id,
990
- )
991
-
992
- req = self._build_request_async(
993
- method="DELETE",
994
- path="/projects/{project_id}/ssh_keys/{ssh_key_id}",
995
- base_url=base_url,
996
- url_variables=url_variables,
997
- request=request,
998
- request_body_required=False,
999
- request_has_path_params=True,
1000
- request_has_query_params=True,
1001
- user_agent_header="user-agent",
1002
- accept_header_value="*/*",
1003
- http_headers=http_headers,
1004
- security=self.sdk_configuration.security,
1005
- timeout_ms=timeout_ms,
1006
- )
1007
-
1008
- if retries == UNSET:
1009
- if self.sdk_configuration.retry_config is not UNSET:
1010
- retries = self.sdk_configuration.retry_config
1011
-
1012
- retry_config = None
1013
- if isinstance(retries, utils.RetryConfig):
1014
- retry_config = (retries, ["429", "500", "502", "503", "504"])
1015
-
1016
- http_res = await self.do_request_async(
1017
- hook_ctx=HookContext(
1018
- base_url=base_url or "",
1019
- operation_id="delete-project-ssh-key",
1020
- oauth2_scopes=[],
1021
- security_source=get_security_from_env(
1022
- self.sdk_configuration.security, models.Security
1023
- ),
1024
- ),
1025
- request=req,
1026
- error_status_codes=["404", "4XX", "5XX"],
1027
- retry_config=retry_config,
1028
- )
1029
-
1030
- if utils.match_response(http_res, "200", "*"):
1031
- return
1032
- if utils.match_response(http_res, ["404", "4XX"], "*"):
1033
- http_res_text = await utils.stream_to_text_async(http_res)
1034
- raise models.APIError(
1035
- "API error occurred", http_res.status_code, http_res_text, http_res
1036
- )
1037
- if utils.match_response(http_res, "5XX", "*"):
1038
- http_res_text = await utils.stream_to_text_async(http_res)
1039
- raise models.APIError(
1040
- "API error occurred", http_res.status_code, http_res_text, http_res
1041
- )
1042
-
1043
- content_type = http_res.headers.get("Content-Type")
1044
- http_res_text = await utils.stream_to_text_async(http_res)
1045
- raise models.APIError(
1046
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1047
- http_res.status_code,
1048
- http_res_text,
1049
- http_res,
1050
- )