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
@@ -2,7 +2,6 @@
2
2
 
3
3
  # pyright: reportReturnType = false
4
4
  import asyncio
5
- from concurrent.futures import ThreadPoolExecutor
6
5
  from typing_extensions import Protocol, runtime_checkable
7
6
  import httpx
8
7
  from typing import Any, Optional, Union
@@ -116,21 +115,12 @@ def close_clients(
116
115
  pass
117
116
 
118
117
  if async_client is not None and not async_client_supplied:
119
- is_async = False
120
118
  try:
121
- asyncio.get_running_loop()
122
- is_async = True
119
+ loop = asyncio.get_running_loop()
120
+ asyncio.run_coroutine_threadsafe(async_client.aclose(), loop)
123
121
  except RuntimeError:
124
- pass
125
-
126
- try:
127
- # If this function is called in an async loop then start another
128
- # loop in a separate thread to close the async http client.
129
- if is_async:
130
- with ThreadPoolExecutor(max_workers=1) as executor:
131
- future = executor.submit(asyncio.run, async_client.aclose())
132
- future.result()
133
- else:
122
+ try:
134
123
  asyncio.run(async_client.aclose())
135
- except Exception:
136
- pass
124
+ except RuntimeError:
125
+ # best effort
126
+ pass
@@ -6,6 +6,7 @@ from latitudesh_python_sdk import models, utils
6
6
  from latitudesh_python_sdk._hooks import HookContext
7
7
  from latitudesh_python_sdk.types import OptionalNullable, UNSET
8
8
  from latitudesh_python_sdk.utils import get_security_from_env
9
+ from latitudesh_python_sdk.utils.unmarshal_json_response import unmarshal_json_response
9
10
  from typing import Any, Dict, List, Mapping, Optional, Union
10
11
 
11
12
 
@@ -97,6 +98,7 @@ class IPAddressesSDK(BaseSDK):
97
98
 
98
99
  http_res = self.do_request(
99
100
  hook_ctx=HookContext(
101
+ config=self.sdk_configuration,
100
102
  base_url=base_url or "",
101
103
  operation_id="get-ips",
102
104
  oauth2_scopes=[],
@@ -139,31 +141,20 @@ class IPAddressesSDK(BaseSDK):
139
141
  response_data: Any = None
140
142
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
141
143
  return models.GetIpsResponse(
142
- result=utils.unmarshal_json(http_res.text, models.IPAddresses),
144
+ result=unmarshal_json_response(models.IPAddresses, http_res),
143
145
  next=next_func,
144
146
  )
145
147
  if utils.match_response(http_res, "422", "application/vnd.api+json"):
146
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
147
- raise models.ErrorObject(data=response_data)
148
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
149
+ raise models.ErrorObject(response_data, http_res)
148
150
  if utils.match_response(http_res, "4XX", "*"):
149
151
  http_res_text = utils.stream_to_text(http_res)
150
- raise models.APIError(
151
- "API error occurred", http_res.status_code, http_res_text, http_res
152
- )
152
+ raise models.APIError("API error occurred", http_res, http_res_text)
153
153
  if utils.match_response(http_res, "5XX", "*"):
154
154
  http_res_text = utils.stream_to_text(http_res)
155
- raise models.APIError(
156
- "API error occurred", http_res.status_code, http_res_text, http_res
157
- )
155
+ raise models.APIError("API error occurred", http_res, http_res_text)
158
156
 
159
- content_type = http_res.headers.get("Content-Type")
160
- http_res_text = utils.stream_to_text(http_res)
161
- raise models.APIError(
162
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
163
- http_res.status_code,
164
- http_res_text,
165
- http_res,
166
- )
157
+ raise models.APIError("Unexpected response received", http_res)
167
158
 
168
159
  async def list_async(
169
160
  self,
@@ -252,6 +243,7 @@ class IPAddressesSDK(BaseSDK):
252
243
 
253
244
  http_res = await self.do_request_async(
254
245
  hook_ctx=HookContext(
246
+ config=self.sdk_configuration,
255
247
  base_url=base_url or "",
256
248
  operation_id="get-ips",
257
249
  oauth2_scopes=[],
@@ -294,31 +286,20 @@ class IPAddressesSDK(BaseSDK):
294
286
  response_data: Any = None
295
287
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
296
288
  return models.GetIpsResponse(
297
- result=utils.unmarshal_json(http_res.text, models.IPAddresses),
289
+ result=unmarshal_json_response(models.IPAddresses, http_res),
298
290
  next=next_func,
299
291
  )
300
292
  if utils.match_response(http_res, "422", "application/vnd.api+json"):
301
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
302
- raise models.ErrorObject(data=response_data)
293
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
294
+ raise models.ErrorObject(response_data, http_res)
303
295
  if utils.match_response(http_res, "4XX", "*"):
304
296
  http_res_text = await utils.stream_to_text_async(http_res)
305
- raise models.APIError(
306
- "API error occurred", http_res.status_code, http_res_text, http_res
307
- )
297
+ raise models.APIError("API error occurred", http_res, http_res_text)
308
298
  if utils.match_response(http_res, "5XX", "*"):
309
299
  http_res_text = await utils.stream_to_text_async(http_res)
310
- raise models.APIError(
311
- "API error occurred", http_res.status_code, http_res_text, http_res
312
- )
300
+ raise models.APIError("API error occurred", http_res, http_res_text)
313
301
 
314
- content_type = http_res.headers.get("Content-Type")
315
- http_res_text = await utils.stream_to_text_async(http_res)
316
- raise models.APIError(
317
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
318
- http_res.status_code,
319
- http_res_text,
320
- http_res,
321
- )
302
+ raise models.APIError("Unexpected response received", http_res)
322
303
 
323
304
  def get(
324
305
  self,
@@ -382,6 +363,7 @@ class IPAddressesSDK(BaseSDK):
382
363
 
383
364
  http_res = self.do_request(
384
365
  hook_ctx=HookContext(
366
+ config=self.sdk_configuration,
385
367
  base_url=base_url or "",
386
368
  operation_id="get-ip",
387
369
  oauth2_scopes=[],
@@ -396,29 +378,18 @@ class IPAddressesSDK(BaseSDK):
396
378
 
397
379
  response_data: Any = None
398
380
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
399
- return utils.unmarshal_json(http_res.text, models.IPAddress)
381
+ return unmarshal_json_response(models.IPAddress, http_res)
400
382
  if utils.match_response(http_res, "404", "application/vnd.api+json"):
401
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
402
- raise models.ErrorObject(data=response_data)
383
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
384
+ raise models.ErrorObject(response_data, http_res)
403
385
  if utils.match_response(http_res, "4XX", "*"):
404
386
  http_res_text = utils.stream_to_text(http_res)
405
- raise models.APIError(
406
- "API error occurred", http_res.status_code, http_res_text, http_res
407
- )
387
+ raise models.APIError("API error occurred", http_res, http_res_text)
408
388
  if utils.match_response(http_res, "5XX", "*"):
409
389
  http_res_text = utils.stream_to_text(http_res)
410
- raise models.APIError(
411
- "API error occurred", http_res.status_code, http_res_text, http_res
412
- )
390
+ raise models.APIError("API error occurred", http_res, http_res_text)
413
391
 
414
- content_type = http_res.headers.get("Content-Type")
415
- http_res_text = utils.stream_to_text(http_res)
416
- raise models.APIError(
417
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
418
- http_res.status_code,
419
- http_res_text,
420
- http_res,
421
- )
392
+ raise models.APIError("Unexpected response received", http_res)
422
393
 
423
394
  async def get_async(
424
395
  self,
@@ -482,6 +453,7 @@ class IPAddressesSDK(BaseSDK):
482
453
 
483
454
  http_res = await self.do_request_async(
484
455
  hook_ctx=HookContext(
456
+ config=self.sdk_configuration,
485
457
  base_url=base_url or "",
486
458
  operation_id="get-ip",
487
459
  oauth2_scopes=[],
@@ -496,26 +468,15 @@ class IPAddressesSDK(BaseSDK):
496
468
 
497
469
  response_data: Any = None
498
470
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
499
- return utils.unmarshal_json(http_res.text, models.IPAddress)
471
+ return unmarshal_json_response(models.IPAddress, http_res)
500
472
  if utils.match_response(http_res, "404", "application/vnd.api+json"):
501
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
502
- raise models.ErrorObject(data=response_data)
473
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
474
+ raise models.ErrorObject(response_data, http_res)
503
475
  if utils.match_response(http_res, "4XX", "*"):
504
476
  http_res_text = await utils.stream_to_text_async(http_res)
505
- raise models.APIError(
506
- "API error occurred", http_res.status_code, http_res_text, http_res
507
- )
477
+ raise models.APIError("API error occurred", http_res, http_res_text)
508
478
  if utils.match_response(http_res, "5XX", "*"):
509
479
  http_res_text = await utils.stream_to_text_async(http_res)
510
- raise models.APIError(
511
- "API error occurred", http_res.status_code, http_res_text, http_res
512
- )
480
+ raise models.APIError("API error occurred", http_res, http_res_text)
513
481
 
514
- content_type = http_res.headers.get("Content-Type")
515
- http_res_text = await utils.stream_to_text_async(http_res)
516
- raise models.APIError(
517
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
518
- http_res.status_code,
519
- http_res_text,
520
- http_res,
521
- )
482
+ raise models.APIError("Unexpected response received", http_res)