latitudesh-python-sdk 2.3.0__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.
Files changed (242) hide show
  1. latitudesh_python_sdk/__init__.py +18 -0
  2. latitudesh_python_sdk/_hooks/__init__.py +5 -0
  3. latitudesh_python_sdk/_hooks/registration.py +13 -0
  4. latitudesh_python_sdk/_hooks/sdkhooks.py +76 -0
  5. latitudesh_python_sdk/_hooks/types.py +113 -0
  6. latitudesh_python_sdk/_version.py +17 -0
  7. latitudesh_python_sdk/apikeys.py +703 -0
  8. latitudesh_python_sdk/basesdk.py +374 -0
  9. latitudesh_python_sdk/billing.py +197 -0
  10. latitudesh_python_sdk/events_sdk.py +298 -0
  11. latitudesh_python_sdk/firewalls_sdk.py +1786 -0
  12. latitudesh_python_sdk/httpclient.py +125 -0
  13. latitudesh_python_sdk/ipaddresses_sdk.py +470 -0
  14. latitudesh_python_sdk/models/__init__.py +3581 -0
  15. latitudesh_python_sdk/models/api_key.py +81 -0
  16. latitudesh_python_sdk/models/apierror.py +40 -0
  17. latitudesh_python_sdk/models/assign_server_virtual_networkop.py +43 -0
  18. latitudesh_python_sdk/models/bandwidth_packages.py +67 -0
  19. latitudesh_python_sdk/models/bandwidth_plan_data.py +72 -0
  20. latitudesh_python_sdk/models/bandwidth_plans.py +26 -0
  21. latitudesh_python_sdk/models/billing_usage.py +249 -0
  22. latitudesh_python_sdk/models/container_plan_data.py +163 -0
  23. latitudesh_python_sdk/models/create_api_key.py +40 -0
  24. latitudesh_python_sdk/models/create_firewall_assignmentop.py +61 -0
  25. latitudesh_python_sdk/models/create_firewallop.py +73 -0
  26. latitudesh_python_sdk/models/create_ipmi_sessionop.py +16 -0
  27. latitudesh_python_sdk/models/create_projectop.py +79 -0
  28. latitudesh_python_sdk/models/create_server_actionop.py +69 -0
  29. latitudesh_python_sdk/models/create_server_out_of_bandop.py +61 -0
  30. latitudesh_python_sdk/models/create_server_reinstallop.py +140 -0
  31. latitudesh_python_sdk/models/create_serverop.py +173 -0
  32. latitudesh_python_sdk/models/create_tagop.py +50 -0
  33. latitudesh_python_sdk/models/create_virtual_machine_actionop.py +63 -0
  34. latitudesh_python_sdk/models/create_virtual_networkop.py +72 -0
  35. latitudesh_python_sdk/models/custom_tag.py +26 -0
  36. latitudesh_python_sdk/models/custom_tag_data.py +54 -0
  37. latitudesh_python_sdk/models/custom_tags.py +26 -0
  38. latitudesh_python_sdk/models/delete_api_keyop.py +16 -0
  39. latitudesh_python_sdk/models/delete_firewall_assignmentop.py +25 -0
  40. latitudesh_python_sdk/models/delete_firewallop.py +18 -0
  41. latitudesh_python_sdk/models/delete_project_ssh_keyop.py +23 -0
  42. latitudesh_python_sdk/models/delete_project_user_dataop.py +23 -0
  43. latitudesh_python_sdk/models/delete_projectop.py +18 -0
  44. latitudesh_python_sdk/models/delete_ssh_keyop.py +16 -0
  45. latitudesh_python_sdk/models/delete_storage_filesystemsop.py +16 -0
  46. latitudesh_python_sdk/models/delete_storage_volumesop.py +16 -0
  47. latitudesh_python_sdk/models/delete_user_dataop.py +16 -0
  48. latitudesh_python_sdk/models/delete_virtual_networks_assignmentsop.py +16 -0
  49. latitudesh_python_sdk/models/delete_vpn_sessionop.py +16 -0
  50. latitudesh_python_sdk/models/deploy_config.py +62 -0
  51. latitudesh_python_sdk/models/destroy_serverop.py +31 -0
  52. latitudesh_python_sdk/models/destroy_tagop.py +16 -0
  53. latitudesh_python_sdk/models/destroy_team_memberop.py +18 -0
  54. latitudesh_python_sdk/models/destroy_virtual_machineop.py +16 -0
  55. latitudesh_python_sdk/models/destroy_virtual_networkop.py +18 -0
  56. latitudesh_python_sdk/models/event_data.py +98 -0
  57. latitudesh_python_sdk/models/events.py +26 -0
  58. latitudesh_python_sdk/models/filesystem_data.py +57 -0
  59. latitudesh_python_sdk/models/firewall.py +26 -0
  60. latitudesh_python_sdk/models/firewall_assignment_data.py +50 -0
  61. latitudesh_python_sdk/models/firewall_assignments.py +29 -0
  62. latitudesh_python_sdk/models/firewall_data.py +75 -0
  63. latitudesh_python_sdk/models/firewall_server.py +36 -0
  64. latitudesh_python_sdk/models/firewalls.py +26 -0
  65. latitudesh_python_sdk/models/get_all_firewall_assignmentsop.py +51 -0
  66. latitudesh_python_sdk/models/get_bandwidth_plansop.py +62 -0
  67. latitudesh_python_sdk/models/get_billing_usageop.py +46 -0
  68. latitudesh_python_sdk/models/get_containers_planop.py +18 -0
  69. latitudesh_python_sdk/models/get_eventsop.py +126 -0
  70. latitudesh_python_sdk/models/get_firewall_assignmentsop.py +53 -0
  71. latitudesh_python_sdk/models/get_firewallop.py +18 -0
  72. latitudesh_python_sdk/models/get_ipop.py +33 -0
  73. latitudesh_python_sdk/models/get_ipsop.py +120 -0
  74. latitudesh_python_sdk/models/get_planop.py +16 -0
  75. latitudesh_python_sdk/models/get_plans_operating_systemop.py +54 -0
  76. latitudesh_python_sdk/models/get_plansop.py +125 -0
  77. latitudesh_python_sdk/models/get_project_ssh_keyop.py +37 -0
  78. latitudesh_python_sdk/models/get_project_ssh_keysop.py +33 -0
  79. latitudesh_python_sdk/models/get_project_user_dataop.py +38 -0
  80. latitudesh_python_sdk/models/get_project_users_dataop.py +46 -0
  81. latitudesh_python_sdk/models/get_projectsop.py +105 -0
  82. latitudesh_python_sdk/models/get_regionop.py +18 -0
  83. latitudesh_python_sdk/models/get_regionsop.py +42 -0
  84. latitudesh_python_sdk/models/get_role_idop.py +16 -0
  85. latitudesh_python_sdk/models/get_rolesop.py +54 -0
  86. latitudesh_python_sdk/models/get_server_deploy_configop.py +18 -0
  87. latitudesh_python_sdk/models/get_server_out_of_bandop.py +18 -0
  88. latitudesh_python_sdk/models/get_serverop.py +33 -0
  89. latitudesh_python_sdk/models/get_serversop.py +185 -0
  90. latitudesh_python_sdk/models/get_ssh_keyop.py +30 -0
  91. latitudesh_python_sdk/models/get_ssh_keysop.py +31 -0
  92. latitudesh_python_sdk/models/get_storage_filesystemsop.py +22 -0
  93. latitudesh_python_sdk/models/get_storage_volumeop.py +32 -0
  94. latitudesh_python_sdk/models/get_storage_volumesop.py +35 -0
  95. latitudesh_python_sdk/models/get_team_membersop.py +42 -0
  96. latitudesh_python_sdk/models/get_traffic_consumptionop.py +49 -0
  97. latitudesh_python_sdk/models/get_traffic_quotaop.py +20 -0
  98. latitudesh_python_sdk/models/get_user_dataop.py +31 -0
  99. latitudesh_python_sdk/models/get_user_profileop.py +19 -0
  100. latitudesh_python_sdk/models/get_users_dataop.py +44 -0
  101. latitudesh_python_sdk/models/get_virtual_networkop.py +32 -0
  102. latitudesh_python_sdk/models/get_virtual_networks_assignmentsop.py +72 -0
  103. latitudesh_python_sdk/models/get_virtual_networksop.py +69 -0
  104. latitudesh_python_sdk/models/get_vpn_sessionsop.py +70 -0
  105. latitudesh_python_sdk/models/index_virtual_machineop.py +31 -0
  106. latitudesh_python_sdk/models/ip_address.py +122 -0
  107. latitudesh_python_sdk/models/ip_addresses.py +15 -0
  108. latitudesh_python_sdk/models/ipmi_session.py +53 -0
  109. latitudesh_python_sdk/models/latitudesherror.py +30 -0
  110. latitudesh_python_sdk/models/list_firewallsop.py +49 -0
  111. latitudesh_python_sdk/models/membership.py +63 -0
  112. latitudesh_python_sdk/models/no_response_error.py +17 -0
  113. latitudesh_python_sdk/models/operating_system_data.py +65 -0
  114. latitudesh_python_sdk/models/operating_systems.py +26 -0
  115. latitudesh_python_sdk/models/out_of_band_connection.py +88 -0
  116. latitudesh_python_sdk/models/patch_current_teamop.py +91 -0
  117. latitudesh_python_sdk/models/patch_storage_filesystemsop.py +79 -0
  118. latitudesh_python_sdk/models/patch_user_dataop.py +69 -0
  119. latitudesh_python_sdk/models/patch_user_profileop.py +88 -0
  120. latitudesh_python_sdk/models/plan.py +15 -0
  121. latitudesh_python_sdk/models/plan_data.py +210 -0
  122. latitudesh_python_sdk/models/post_api_keyop.py +19 -0
  123. latitudesh_python_sdk/models/post_project_ssh_keyop.py +81 -0
  124. latitudesh_python_sdk/models/post_project_user_dataop.py +68 -0
  125. latitudesh_python_sdk/models/post_ssh_keyop.py +63 -0
  126. latitudesh_python_sdk/models/post_storage_filesystemsop.py +63 -0
  127. latitudesh_python_sdk/models/post_storage_volumes_mountop.py +62 -0
  128. latitudesh_python_sdk/models/post_storage_volumesop.py +63 -0
  129. latitudesh_python_sdk/models/post_team_membersop.py +54 -0
  130. latitudesh_python_sdk/models/post_teamop.py +67 -0
  131. latitudesh_python_sdk/models/post_user_dataop.py +50 -0
  132. latitudesh_python_sdk/models/post_vpn_sessionop.py +63 -0
  133. latitudesh_python_sdk/models/project.py +131 -0
  134. latitudesh_python_sdk/models/project_include.py +75 -0
  135. latitudesh_python_sdk/models/projects.py +15 -0
  136. latitudesh_python_sdk/models/put_project_ssh_keyop.py +87 -0
  137. latitudesh_python_sdk/models/put_project_user_dataop.py +76 -0
  138. latitudesh_python_sdk/models/put_ssh_keyop.py +80 -0
  139. latitudesh_python_sdk/models/put_vpn_sessionop.py +16 -0
  140. latitudesh_python_sdk/models/region.py +50 -0
  141. latitudesh_python_sdk/models/region_resource_data.py +37 -0
  142. latitudesh_python_sdk/models/regions.py +50 -0
  143. latitudesh_python_sdk/models/responsevalidationerror.py +27 -0
  144. latitudesh_python_sdk/models/role.py +26 -0
  145. latitudesh_python_sdk/models/role_data.py +35 -0
  146. latitudesh_python_sdk/models/security.py +25 -0
  147. latitudesh_python_sdk/models/server.py +26 -0
  148. latitudesh_python_sdk/models/server_action.py +52 -0
  149. latitudesh_python_sdk/models/server_data.py +280 -0
  150. latitudesh_python_sdk/models/server_exit_rescue_modeop.py +16 -0
  151. latitudesh_python_sdk/models/server_lockop.py +16 -0
  152. latitudesh_python_sdk/models/server_region_resource_data.py +40 -0
  153. latitudesh_python_sdk/models/server_rescue.py +22 -0
  154. latitudesh_python_sdk/models/server_schedule_deletion.py +44 -0
  155. latitudesh_python_sdk/models/server_schedule_deletionop.py +16 -0
  156. latitudesh_python_sdk/models/server_start_rescue_modeop.py +16 -0
  157. latitudesh_python_sdk/models/server_unlockop.py +16 -0
  158. latitudesh_python_sdk/models/server_unschedule_deletionop.py +16 -0
  159. latitudesh_python_sdk/models/servers.py +26 -0
  160. latitudesh_python_sdk/models/show_virtual_machineop.py +16 -0
  161. latitudesh_python_sdk/models/ssh_key_data.py +55 -0
  162. latitudesh_python_sdk/models/ssh_keys.py +26 -0
  163. latitudesh_python_sdk/models/storage_plan_data.py +47 -0
  164. latitudesh_python_sdk/models/storage_plans.py +26 -0
  165. latitudesh_python_sdk/models/team.py +74 -0
  166. latitudesh_python_sdk/models/team_include.py +43 -0
  167. latitudesh_python_sdk/models/team_members.py +51 -0
  168. latitudesh_python_sdk/models/teams.py +26 -0
  169. latitudesh_python_sdk/models/traffic.py +133 -0
  170. latitudesh_python_sdk/models/traffic_quota.py +106 -0
  171. latitudesh_python_sdk/models/update_api_key.py +48 -0
  172. latitudesh_python_sdk/models/update_api_keyop.py +41 -0
  173. latitudesh_python_sdk/models/update_firewallop.py +89 -0
  174. latitudesh_python_sdk/models/update_plans_bandwidthop.py +50 -0
  175. latitudesh_python_sdk/models/update_projectop.py +95 -0
  176. latitudesh_python_sdk/models/update_server_deploy_configop.py +122 -0
  177. latitudesh_python_sdk/models/update_serverop.py +85 -0
  178. latitudesh_python_sdk/models/update_tagop.py +74 -0
  179. latitudesh_python_sdk/models/update_virtual_networkop.py +67 -0
  180. latitudesh_python_sdk/models/user.py +59 -0
  181. latitudesh_python_sdk/models/user_data.py +26 -0
  182. latitudesh_python_sdk/models/user_data_properties.py +46 -0
  183. latitudesh_python_sdk/models/user_include.py +52 -0
  184. latitudesh_python_sdk/models/user_team.py +61 -0
  185. latitudesh_python_sdk/models/user_teams.py +26 -0
  186. latitudesh_python_sdk/models/user_update.py +37 -0
  187. latitudesh_python_sdk/models/virtual_machine.py +29 -0
  188. latitudesh_python_sdk/models/virtual_machine_attributes.py +115 -0
  189. latitudesh_python_sdk/models/virtual_machine_payload.py +47 -0
  190. latitudesh_python_sdk/models/virtual_machine_plans.py +181 -0
  191. latitudesh_python_sdk/models/virtual_network.py +26 -0
  192. latitudesh_python_sdk/models/virtual_network_assignment.py +29 -0
  193. latitudesh_python_sdk/models/virtual_network_assignment_data.py +65 -0
  194. latitudesh_python_sdk/models/virtual_network_assignments.py +29 -0
  195. latitudesh_python_sdk/models/virtual_network_data.py +114 -0
  196. latitudesh_python_sdk/models/virtual_networks.py +26 -0
  197. latitudesh_python_sdk/models/volume_data.py +111 -0
  198. latitudesh_python_sdk/models/vpn_session_data_with_password.py +77 -0
  199. latitudesh_python_sdk/models/vpn_session_with_password.py +18 -0
  200. latitudesh_python_sdk/operatingsystems_sdk.py +238 -0
  201. latitudesh_python_sdk/plans.py +1304 -0
  202. latitudesh_python_sdk/privatenetworks.py +1612 -0
  203. latitudesh_python_sdk/projects_sdk.py +830 -0
  204. latitudesh_python_sdk/py.typed +1 -0
  205. latitudesh_python_sdk/regions_sdk.py +398 -0
  206. latitudesh_python_sdk/roles.py +398 -0
  207. latitudesh_python_sdk/sdk.py +264 -0
  208. latitudesh_python_sdk/sdkconfiguration.py +50 -0
  209. latitudesh_python_sdk/servers_sdk.py +3414 -0
  210. latitudesh_python_sdk/sshkeys_sdk.py +1882 -0
  211. latitudesh_python_sdk/storage.py +1651 -0
  212. latitudesh_python_sdk/tags.py +715 -0
  213. latitudesh_python_sdk/teams_sdk.py +527 -0
  214. latitudesh_python_sdk/teamsmembers.py +576 -0
  215. latitudesh_python_sdk/traffic_sdk.py +357 -0
  216. latitudesh_python_sdk/types/__init__.py +21 -0
  217. latitudesh_python_sdk/types/basemodel.py +39 -0
  218. latitudesh_python_sdk/userdata_sdk.py +1888 -0
  219. latitudesh_python_sdk/userprofile.py +531 -0
  220. latitudesh_python_sdk/utils/__init__.py +200 -0
  221. latitudesh_python_sdk/utils/annotations.py +79 -0
  222. latitudesh_python_sdk/utils/datetimes.py +23 -0
  223. latitudesh_python_sdk/utils/enums.py +74 -0
  224. latitudesh_python_sdk/utils/eventstreaming.py +248 -0
  225. latitudesh_python_sdk/utils/forms.py +234 -0
  226. latitudesh_python_sdk/utils/headers.py +136 -0
  227. latitudesh_python_sdk/utils/logger.py +27 -0
  228. latitudesh_python_sdk/utils/metadata.py +118 -0
  229. latitudesh_python_sdk/utils/queryparams.py +217 -0
  230. latitudesh_python_sdk/utils/requestbodies.py +66 -0
  231. latitudesh_python_sdk/utils/retries.py +281 -0
  232. latitudesh_python_sdk/utils/security.py +192 -0
  233. latitudesh_python_sdk/utils/serializers.py +249 -0
  234. latitudesh_python_sdk/utils/unmarshal_json_response.py +38 -0
  235. latitudesh_python_sdk/utils/url.py +155 -0
  236. latitudesh_python_sdk/utils/values.py +137 -0
  237. latitudesh_python_sdk/virtualmachines.py +941 -0
  238. latitudesh_python_sdk/vpnsessions.py +715 -0
  239. latitudesh_python_sdk-2.3.0.dist-info/METADATA +787 -0
  240. latitudesh_python_sdk-2.3.0.dist-info/RECORD +242 -0
  241. latitudesh_python_sdk-2.3.0.dist-info/WHEEL +4 -0
  242. latitudesh_python_sdk-2.3.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,1304 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from .basesdk import BaseSDK
4
+ from jsonpath import JSONPath
5
+ from latitudesh_python_sdk import models, utils
6
+ from latitudesh_python_sdk._hooks import HookContext
7
+ from latitudesh_python_sdk.types import OptionalNullable, UNSET
8
+ from latitudesh_python_sdk.utils import get_security_from_env
9
+ from latitudesh_python_sdk.utils.unmarshal_json_response import unmarshal_json_response
10
+ from typing import Any, Dict, List, Mapping, Optional, Union
11
+
12
+
13
+ class Plans(BaseSDK):
14
+ def list(
15
+ self,
16
+ *,
17
+ filter_name: Optional[str] = None,
18
+ filter_slug: Optional[str] = None,
19
+ filter_location: Optional[str] = None,
20
+ filter_stock_level: Optional[models.FilterStockLevel] = None,
21
+ filter_in_stock: Optional[bool] = None,
22
+ filter_gpu: Optional[bool] = None,
23
+ filter_ram: Optional[int] = None,
24
+ filter_disk: Optional[int] = None,
25
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
26
+ server_url: Optional[str] = None,
27
+ timeout_ms: Optional[int] = None,
28
+ http_headers: Optional[Mapping[str, str]] = None,
29
+ ) -> models.GetPlansResponseBody:
30
+ r"""List all Plans
31
+
32
+ Lists all plans. Availability by region is included in `attributes.regions.locations.available[*]` node for a given plan.
33
+
34
+
35
+ :param filter_name: The plan name to filter by
36
+ :param filter_slug: The plan slug to filter by
37
+ :param filter_location: The location of the site to filter by
38
+ :param filter_stock_level: The stock level at the site to filter by
39
+ :param filter_in_stock: The stock available at the site to filter by
40
+ :param filter_gpu: Filter by the existence of an associated GPU
41
+ :param filter_ram: The ram size in Gigabytes to filter by, should be used with the following options:
42
+ [eql] to filter for values equal to the provided value.
43
+ [gte] to filter for values greater or equal to the provided value.
44
+ [lte] to filter by values lower or equal to the provided value.
45
+ :param filter_disk: The disk size in Gigabytes to filter by, should be used with the following options:
46
+ [eql] to filter for values equal to the provided value.
47
+ [gte] to filter for values greater or equal to the provided value.
48
+ [lte] to filter by values lower or equal to the provided value.
49
+ :param retries: Override the default retry configuration for this method
50
+ :param server_url: Override the default server URL for this method
51
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
52
+ :param http_headers: Additional headers to set or replace on requests.
53
+ """
54
+ base_url = None
55
+ url_variables = None
56
+ if timeout_ms is None:
57
+ timeout_ms = self.sdk_configuration.timeout_ms
58
+
59
+ if server_url is not None:
60
+ base_url = server_url
61
+ else:
62
+ base_url = self._get_url(base_url, url_variables)
63
+
64
+ request = models.GetPlansRequest(
65
+ filter_name=filter_name,
66
+ filter_slug=filter_slug,
67
+ filter_location=filter_location,
68
+ filter_stock_level=filter_stock_level,
69
+ filter_in_stock=filter_in_stock,
70
+ filter_gpu=filter_gpu,
71
+ filter_ram=filter_ram,
72
+ filter_disk=filter_disk,
73
+ )
74
+
75
+ req = self._build_request(
76
+ method="GET",
77
+ path="/plans",
78
+ base_url=base_url,
79
+ url_variables=url_variables,
80
+ request=request,
81
+ request_body_required=False,
82
+ request_has_path_params=False,
83
+ request_has_query_params=True,
84
+ user_agent_header="user-agent",
85
+ accept_header_value="application/vnd.api+json",
86
+ http_headers=http_headers,
87
+ security=self.sdk_configuration.security,
88
+ allow_empty_value=None,
89
+ timeout_ms=timeout_ms,
90
+ )
91
+
92
+ if retries == UNSET:
93
+ if self.sdk_configuration.retry_config is not UNSET:
94
+ retries = self.sdk_configuration.retry_config
95
+
96
+ retry_config = None
97
+ if isinstance(retries, utils.RetryConfig):
98
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
99
+
100
+ http_res = self.do_request(
101
+ hook_ctx=HookContext(
102
+ config=self.sdk_configuration,
103
+ base_url=base_url or "",
104
+ operation_id="get-plans",
105
+ oauth2_scopes=None,
106
+ security_source=get_security_from_env(
107
+ self.sdk_configuration.security, models.Security
108
+ ),
109
+ ),
110
+ request=req,
111
+ error_status_codes=["4XX", "5XX"],
112
+ retry_config=retry_config,
113
+ )
114
+
115
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
116
+ return unmarshal_json_response(models.GetPlansResponseBody, http_res)
117
+ if utils.match_response(http_res, "4XX", "*"):
118
+ http_res_text = utils.stream_to_text(http_res)
119
+ raise models.APIError("API error occurred", http_res, http_res_text)
120
+ if utils.match_response(http_res, "5XX", "*"):
121
+ http_res_text = utils.stream_to_text(http_res)
122
+ raise models.APIError("API error occurred", http_res, http_res_text)
123
+
124
+ raise models.APIError("Unexpected response received", http_res)
125
+
126
+ async def list_async(
127
+ self,
128
+ *,
129
+ filter_name: Optional[str] = None,
130
+ filter_slug: Optional[str] = None,
131
+ filter_location: Optional[str] = None,
132
+ filter_stock_level: Optional[models.FilterStockLevel] = None,
133
+ filter_in_stock: Optional[bool] = None,
134
+ filter_gpu: Optional[bool] = None,
135
+ filter_ram: Optional[int] = None,
136
+ filter_disk: Optional[int] = None,
137
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
138
+ server_url: Optional[str] = None,
139
+ timeout_ms: Optional[int] = None,
140
+ http_headers: Optional[Mapping[str, str]] = None,
141
+ ) -> models.GetPlansResponseBody:
142
+ r"""List all Plans
143
+
144
+ Lists all plans. Availability by region is included in `attributes.regions.locations.available[*]` node for a given plan.
145
+
146
+
147
+ :param filter_name: The plan name to filter by
148
+ :param filter_slug: The plan slug to filter by
149
+ :param filter_location: The location of the site to filter by
150
+ :param filter_stock_level: The stock level at the site to filter by
151
+ :param filter_in_stock: The stock available at the site to filter by
152
+ :param filter_gpu: Filter by the existence of an associated GPU
153
+ :param filter_ram: The ram size in Gigabytes to filter by, should be used with the following options:
154
+ [eql] to filter for values equal to the provided value.
155
+ [gte] to filter for values greater or equal to the provided value.
156
+ [lte] to filter by values lower or equal to the provided value.
157
+ :param filter_disk: The disk size in Gigabytes to filter by, should be used with the following options:
158
+ [eql] to filter for values equal to the provided value.
159
+ [gte] to filter for values greater or equal to the provided value.
160
+ [lte] to filter by values lower or equal to the provided value.
161
+ :param retries: Override the default retry configuration for this method
162
+ :param server_url: Override the default server URL for this method
163
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
164
+ :param http_headers: Additional headers to set or replace on requests.
165
+ """
166
+ base_url = None
167
+ url_variables = None
168
+ if timeout_ms is None:
169
+ timeout_ms = self.sdk_configuration.timeout_ms
170
+
171
+ if server_url is not None:
172
+ base_url = server_url
173
+ else:
174
+ base_url = self._get_url(base_url, url_variables)
175
+
176
+ request = models.GetPlansRequest(
177
+ filter_name=filter_name,
178
+ filter_slug=filter_slug,
179
+ filter_location=filter_location,
180
+ filter_stock_level=filter_stock_level,
181
+ filter_in_stock=filter_in_stock,
182
+ filter_gpu=filter_gpu,
183
+ filter_ram=filter_ram,
184
+ filter_disk=filter_disk,
185
+ )
186
+
187
+ req = self._build_request_async(
188
+ method="GET",
189
+ path="/plans",
190
+ base_url=base_url,
191
+ url_variables=url_variables,
192
+ request=request,
193
+ request_body_required=False,
194
+ request_has_path_params=False,
195
+ request_has_query_params=True,
196
+ user_agent_header="user-agent",
197
+ accept_header_value="application/vnd.api+json",
198
+ http_headers=http_headers,
199
+ security=self.sdk_configuration.security,
200
+ allow_empty_value=None,
201
+ timeout_ms=timeout_ms,
202
+ )
203
+
204
+ if retries == UNSET:
205
+ if self.sdk_configuration.retry_config is not UNSET:
206
+ retries = self.sdk_configuration.retry_config
207
+
208
+ retry_config = None
209
+ if isinstance(retries, utils.RetryConfig):
210
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
211
+
212
+ http_res = await self.do_request_async(
213
+ hook_ctx=HookContext(
214
+ config=self.sdk_configuration,
215
+ base_url=base_url or "",
216
+ operation_id="get-plans",
217
+ oauth2_scopes=None,
218
+ security_source=get_security_from_env(
219
+ self.sdk_configuration.security, models.Security
220
+ ),
221
+ ),
222
+ request=req,
223
+ error_status_codes=["4XX", "5XX"],
224
+ retry_config=retry_config,
225
+ )
226
+
227
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
228
+ return unmarshal_json_response(models.GetPlansResponseBody, http_res)
229
+ if utils.match_response(http_res, "4XX", "*"):
230
+ http_res_text = await utils.stream_to_text_async(http_res)
231
+ raise models.APIError("API error occurred", http_res, http_res_text)
232
+ if utils.match_response(http_res, "5XX", "*"):
233
+ http_res_text = await utils.stream_to_text_async(http_res)
234
+ raise models.APIError("API error occurred", http_res, http_res_text)
235
+
236
+ raise models.APIError("Unexpected response received", http_res)
237
+
238
+ def get(
239
+ self,
240
+ *,
241
+ plan_id: str,
242
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
243
+ server_url: Optional[str] = None,
244
+ timeout_ms: Optional[int] = None,
245
+ http_headers: Optional[Mapping[str, str]] = None,
246
+ ) -> models.Plan:
247
+ r"""Retrieve a Plan
248
+
249
+ :param plan_id:
250
+ :param retries: Override the default retry configuration for this method
251
+ :param server_url: Override the default server URL for this method
252
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
253
+ :param http_headers: Additional headers to set or replace on requests.
254
+ """
255
+ base_url = None
256
+ url_variables = None
257
+ if timeout_ms is None:
258
+ timeout_ms = self.sdk_configuration.timeout_ms
259
+
260
+ if server_url is not None:
261
+ base_url = server_url
262
+ else:
263
+ base_url = self._get_url(base_url, url_variables)
264
+
265
+ request = models.GetPlanRequest(
266
+ plan_id=plan_id,
267
+ )
268
+
269
+ req = self._build_request(
270
+ method="GET",
271
+ path="/plans/{plan_id}",
272
+ base_url=base_url,
273
+ url_variables=url_variables,
274
+ request=request,
275
+ request_body_required=False,
276
+ request_has_path_params=True,
277
+ request_has_query_params=True,
278
+ user_agent_header="user-agent",
279
+ accept_header_value="application/vnd.api+json",
280
+ http_headers=http_headers,
281
+ security=self.sdk_configuration.security,
282
+ allow_empty_value=None,
283
+ timeout_ms=timeout_ms,
284
+ )
285
+
286
+ if retries == UNSET:
287
+ if self.sdk_configuration.retry_config is not UNSET:
288
+ retries = self.sdk_configuration.retry_config
289
+
290
+ retry_config = None
291
+ if isinstance(retries, utils.RetryConfig):
292
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
293
+
294
+ http_res = self.do_request(
295
+ hook_ctx=HookContext(
296
+ config=self.sdk_configuration,
297
+ base_url=base_url or "",
298
+ operation_id="get-plan",
299
+ oauth2_scopes=None,
300
+ security_source=get_security_from_env(
301
+ self.sdk_configuration.security, models.Security
302
+ ),
303
+ ),
304
+ request=req,
305
+ error_status_codes=["4XX", "5XX"],
306
+ retry_config=retry_config,
307
+ )
308
+
309
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
310
+ return unmarshal_json_response(models.Plan, http_res)
311
+ if utils.match_response(http_res, "4XX", "*"):
312
+ http_res_text = utils.stream_to_text(http_res)
313
+ raise models.APIError("API error occurred", http_res, http_res_text)
314
+ if utils.match_response(http_res, "5XX", "*"):
315
+ http_res_text = utils.stream_to_text(http_res)
316
+ raise models.APIError("API error occurred", http_res, http_res_text)
317
+
318
+ raise models.APIError("Unexpected response received", http_res)
319
+
320
+ async def get_async(
321
+ self,
322
+ *,
323
+ plan_id: str,
324
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
325
+ server_url: Optional[str] = None,
326
+ timeout_ms: Optional[int] = None,
327
+ http_headers: Optional[Mapping[str, str]] = None,
328
+ ) -> models.Plan:
329
+ r"""Retrieve a Plan
330
+
331
+ :param plan_id:
332
+ :param retries: Override the default retry configuration for this method
333
+ :param server_url: Override the default server URL for this method
334
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
335
+ :param http_headers: Additional headers to set or replace on requests.
336
+ """
337
+ base_url = None
338
+ url_variables = None
339
+ if timeout_ms is None:
340
+ timeout_ms = self.sdk_configuration.timeout_ms
341
+
342
+ if server_url is not None:
343
+ base_url = server_url
344
+ else:
345
+ base_url = self._get_url(base_url, url_variables)
346
+
347
+ request = models.GetPlanRequest(
348
+ plan_id=plan_id,
349
+ )
350
+
351
+ req = self._build_request_async(
352
+ method="GET",
353
+ path="/plans/{plan_id}",
354
+ base_url=base_url,
355
+ url_variables=url_variables,
356
+ request=request,
357
+ request_body_required=False,
358
+ request_has_path_params=True,
359
+ request_has_query_params=True,
360
+ user_agent_header="user-agent",
361
+ accept_header_value="application/vnd.api+json",
362
+ http_headers=http_headers,
363
+ security=self.sdk_configuration.security,
364
+ allow_empty_value=None,
365
+ timeout_ms=timeout_ms,
366
+ )
367
+
368
+ if retries == UNSET:
369
+ if self.sdk_configuration.retry_config is not UNSET:
370
+ retries = self.sdk_configuration.retry_config
371
+
372
+ retry_config = None
373
+ if isinstance(retries, utils.RetryConfig):
374
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
375
+
376
+ http_res = await self.do_request_async(
377
+ hook_ctx=HookContext(
378
+ config=self.sdk_configuration,
379
+ base_url=base_url or "",
380
+ operation_id="get-plan",
381
+ oauth2_scopes=None,
382
+ security_source=get_security_from_env(
383
+ self.sdk_configuration.security, models.Security
384
+ ),
385
+ ),
386
+ request=req,
387
+ error_status_codes=["4XX", "5XX"],
388
+ retry_config=retry_config,
389
+ )
390
+
391
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
392
+ return unmarshal_json_response(models.Plan, http_res)
393
+ if utils.match_response(http_res, "4XX", "*"):
394
+ http_res_text = await utils.stream_to_text_async(http_res)
395
+ raise models.APIError("API error occurred", http_res, http_res_text)
396
+ if utils.match_response(http_res, "5XX", "*"):
397
+ http_res_text = await utils.stream_to_text_async(http_res)
398
+ raise models.APIError("API error occurred", http_res, http_res_text)
399
+
400
+ raise models.APIError("Unexpected response received", http_res)
401
+
402
+ def list_bandwidth(
403
+ self,
404
+ *,
405
+ api_version: Optional[str] = "2023-06-01",
406
+ filter_id: Optional[str] = None,
407
+ page_size: Optional[int] = 20,
408
+ page_number: Optional[int] = 1,
409
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
410
+ server_url: Optional[str] = None,
411
+ timeout_ms: Optional[int] = None,
412
+ http_headers: Optional[Mapping[str, str]] = None,
413
+ ) -> Optional[models.GetBandwidthPlansResponse]:
414
+ r"""List all bandwidth plans
415
+
416
+ Lists all bandwidth plans.
417
+
418
+ :param api_version:
419
+ :param filter_id: The plan ID to filter by
420
+ :param page_size: Number of items to return per page
421
+ :param page_number: Page number to return (starts at 1)
422
+ :param retries: Override the default retry configuration for this method
423
+ :param server_url: Override the default server URL for this method
424
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
425
+ :param http_headers: Additional headers to set or replace on requests.
426
+ """
427
+ base_url = None
428
+ url_variables = None
429
+ if timeout_ms is None:
430
+ timeout_ms = self.sdk_configuration.timeout_ms
431
+
432
+ if server_url is not None:
433
+ base_url = server_url
434
+ else:
435
+ base_url = self._get_url(base_url, url_variables)
436
+
437
+ request = models.GetBandwidthPlansRequest(
438
+ api_version=api_version,
439
+ filter_id=filter_id,
440
+ page_size=page_size,
441
+ page_number=page_number,
442
+ )
443
+
444
+ req = self._build_request(
445
+ method="GET",
446
+ path="/plans/bandwidth",
447
+ base_url=base_url,
448
+ url_variables=url_variables,
449
+ request=request,
450
+ request_body_required=False,
451
+ request_has_path_params=False,
452
+ request_has_query_params=True,
453
+ user_agent_header="user-agent",
454
+ accept_header_value="application/vnd.api+json",
455
+ http_headers=http_headers,
456
+ security=self.sdk_configuration.security,
457
+ allow_empty_value=None,
458
+ timeout_ms=timeout_ms,
459
+ )
460
+
461
+ if retries == UNSET:
462
+ if self.sdk_configuration.retry_config is not UNSET:
463
+ retries = self.sdk_configuration.retry_config
464
+
465
+ retry_config = None
466
+ if isinstance(retries, utils.RetryConfig):
467
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
468
+
469
+ http_res = self.do_request(
470
+ hook_ctx=HookContext(
471
+ config=self.sdk_configuration,
472
+ base_url=base_url or "",
473
+ operation_id="get-bandwidth-plans",
474
+ oauth2_scopes=None,
475
+ security_source=get_security_from_env(
476
+ self.sdk_configuration.security, models.Security
477
+ ),
478
+ ),
479
+ request=req,
480
+ error_status_codes=["4XX", "5XX"],
481
+ retry_config=retry_config,
482
+ )
483
+
484
+ def next_func() -> Optional[models.GetBandwidthPlansResponse]:
485
+ body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]])
486
+ page = request.page_number if not request.page_number is None else 1
487
+ next_page = page + 1
488
+
489
+ if not http_res.text:
490
+ return None
491
+ results = JSONPath("$.data").parse(body)
492
+ if len(results) == 0 or len(results[0]) == 0:
493
+ return None
494
+ limit = request.page_size if not request.page_size is None else 20
495
+ if len(results[0]) < limit:
496
+ return None
497
+
498
+ return self.list_bandwidth(
499
+ api_version=api_version,
500
+ filter_id=filter_id,
501
+ page_size=page_size,
502
+ page_number=next_page,
503
+ retries=retries,
504
+ )
505
+
506
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
507
+ return models.GetBandwidthPlansResponse(
508
+ result=unmarshal_json_response(models.BandwidthPlans, http_res),
509
+ next=next_func,
510
+ )
511
+ if utils.match_response(http_res, "4XX", "*"):
512
+ http_res_text = utils.stream_to_text(http_res)
513
+ raise models.APIError("API error occurred", http_res, http_res_text)
514
+ if utils.match_response(http_res, "5XX", "*"):
515
+ http_res_text = utils.stream_to_text(http_res)
516
+ raise models.APIError("API error occurred", http_res, http_res_text)
517
+
518
+ raise models.APIError("Unexpected response received", http_res)
519
+
520
+ async def list_bandwidth_async(
521
+ self,
522
+ *,
523
+ api_version: Optional[str] = "2023-06-01",
524
+ filter_id: Optional[str] = None,
525
+ page_size: Optional[int] = 20,
526
+ page_number: Optional[int] = 1,
527
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
528
+ server_url: Optional[str] = None,
529
+ timeout_ms: Optional[int] = None,
530
+ http_headers: Optional[Mapping[str, str]] = None,
531
+ ) -> Optional[models.GetBandwidthPlansResponse]:
532
+ r"""List all bandwidth plans
533
+
534
+ Lists all bandwidth plans.
535
+
536
+ :param api_version:
537
+ :param filter_id: The plan ID to filter by
538
+ :param page_size: Number of items to return per page
539
+ :param page_number: Page number to return (starts at 1)
540
+ :param retries: Override the default retry configuration for this method
541
+ :param server_url: Override the default server URL for this method
542
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
543
+ :param http_headers: Additional headers to set or replace on requests.
544
+ """
545
+ base_url = None
546
+ url_variables = None
547
+ if timeout_ms is None:
548
+ timeout_ms = self.sdk_configuration.timeout_ms
549
+
550
+ if server_url is not None:
551
+ base_url = server_url
552
+ else:
553
+ base_url = self._get_url(base_url, url_variables)
554
+
555
+ request = models.GetBandwidthPlansRequest(
556
+ api_version=api_version,
557
+ filter_id=filter_id,
558
+ page_size=page_size,
559
+ page_number=page_number,
560
+ )
561
+
562
+ req = self._build_request_async(
563
+ method="GET",
564
+ path="/plans/bandwidth",
565
+ base_url=base_url,
566
+ url_variables=url_variables,
567
+ request=request,
568
+ request_body_required=False,
569
+ request_has_path_params=False,
570
+ request_has_query_params=True,
571
+ user_agent_header="user-agent",
572
+ accept_header_value="application/vnd.api+json",
573
+ http_headers=http_headers,
574
+ security=self.sdk_configuration.security,
575
+ allow_empty_value=None,
576
+ timeout_ms=timeout_ms,
577
+ )
578
+
579
+ if retries == UNSET:
580
+ if self.sdk_configuration.retry_config is not UNSET:
581
+ retries = self.sdk_configuration.retry_config
582
+
583
+ retry_config = None
584
+ if isinstance(retries, utils.RetryConfig):
585
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
586
+
587
+ http_res = await self.do_request_async(
588
+ hook_ctx=HookContext(
589
+ config=self.sdk_configuration,
590
+ base_url=base_url or "",
591
+ operation_id="get-bandwidth-plans",
592
+ oauth2_scopes=None,
593
+ security_source=get_security_from_env(
594
+ self.sdk_configuration.security, models.Security
595
+ ),
596
+ ),
597
+ request=req,
598
+ error_status_codes=["4XX", "5XX"],
599
+ retry_config=retry_config,
600
+ )
601
+
602
+ def next_func() -> Optional[models.GetBandwidthPlansResponse]:
603
+ body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]])
604
+ page = request.page_number if not request.page_number is None else 1
605
+ next_page = page + 1
606
+
607
+ if not http_res.text:
608
+ return None
609
+ results = JSONPath("$.data").parse(body)
610
+ if len(results) == 0 or len(results[0]) == 0:
611
+ return None
612
+ limit = request.page_size if not request.page_size is None else 20
613
+ if len(results[0]) < limit:
614
+ return None
615
+
616
+ return self.list_bandwidth(
617
+ api_version=api_version,
618
+ filter_id=filter_id,
619
+ page_size=page_size,
620
+ page_number=next_page,
621
+ retries=retries,
622
+ )
623
+
624
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
625
+ return models.GetBandwidthPlansResponse(
626
+ result=unmarshal_json_response(models.BandwidthPlans, http_res),
627
+ next=next_func,
628
+ )
629
+ if utils.match_response(http_res, "4XX", "*"):
630
+ http_res_text = await utils.stream_to_text_async(http_res)
631
+ raise models.APIError("API error occurred", http_res, http_res_text)
632
+ if utils.match_response(http_res, "5XX", "*"):
633
+ http_res_text = await utils.stream_to_text_async(http_res)
634
+ raise models.APIError("API error occurred", http_res, http_res_text)
635
+
636
+ raise models.APIError("Unexpected response received", http_res)
637
+
638
+ def update_bandwidth(
639
+ self,
640
+ *,
641
+ data: Optional[
642
+ Union[
643
+ models.UpdatePlansBandwidthPlansData,
644
+ models.UpdatePlansBandwidthPlansDataTypedDict,
645
+ ]
646
+ ] = None,
647
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
648
+ server_url: Optional[str] = None,
649
+ timeout_ms: Optional[int] = None,
650
+ http_headers: Optional[Mapping[str, str]] = None,
651
+ ) -> models.BandwidthPackages:
652
+ r"""Buy or remove bandwidth packages
653
+
654
+ Allows to increase or decrease bandwidth packages. Only admins and owners can request.
655
+
656
+
657
+ :param data:
658
+ :param retries: Override the default retry configuration for this method
659
+ :param server_url: Override the default server URL for this method
660
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
661
+ :param http_headers: Additional headers to set or replace on requests.
662
+ """
663
+ base_url = None
664
+ url_variables = None
665
+ if timeout_ms is None:
666
+ timeout_ms = self.sdk_configuration.timeout_ms
667
+
668
+ if server_url is not None:
669
+ base_url = server_url
670
+ else:
671
+ base_url = self._get_url(base_url, url_variables)
672
+
673
+ request = models.UpdatePlansBandwidthPlansRequestBody(
674
+ data=utils.get_pydantic_model(
675
+ data, Optional[models.UpdatePlansBandwidthPlansData]
676
+ ),
677
+ )
678
+
679
+ req = self._build_request(
680
+ method="POST",
681
+ path="/plans/bandwidth",
682
+ base_url=base_url,
683
+ url_variables=url_variables,
684
+ request=request,
685
+ request_body_required=True,
686
+ request_has_path_params=False,
687
+ request_has_query_params=True,
688
+ user_agent_header="user-agent",
689
+ accept_header_value="application/vnd.api+json",
690
+ http_headers=http_headers,
691
+ security=self.sdk_configuration.security,
692
+ get_serialized_body=lambda: utils.serialize_request_body(
693
+ request,
694
+ False,
695
+ False,
696
+ "json",
697
+ models.UpdatePlansBandwidthPlansRequestBody,
698
+ ),
699
+ allow_empty_value=None,
700
+ timeout_ms=timeout_ms,
701
+ )
702
+
703
+ if retries == UNSET:
704
+ if self.sdk_configuration.retry_config is not UNSET:
705
+ retries = self.sdk_configuration.retry_config
706
+
707
+ retry_config = None
708
+ if isinstance(retries, utils.RetryConfig):
709
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
710
+
711
+ http_res = self.do_request(
712
+ hook_ctx=HookContext(
713
+ config=self.sdk_configuration,
714
+ base_url=base_url or "",
715
+ operation_id="update-plans-bandwidth",
716
+ oauth2_scopes=None,
717
+ security_source=get_security_from_env(
718
+ self.sdk_configuration.security, models.Security
719
+ ),
720
+ ),
721
+ request=req,
722
+ error_status_codes=["4XX", "5XX"],
723
+ retry_config=retry_config,
724
+ )
725
+
726
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
727
+ return unmarshal_json_response(models.BandwidthPackages, http_res)
728
+ if utils.match_response(http_res, "4XX", "*"):
729
+ http_res_text = utils.stream_to_text(http_res)
730
+ raise models.APIError("API error occurred", http_res, http_res_text)
731
+ if utils.match_response(http_res, "5XX", "*"):
732
+ http_res_text = utils.stream_to_text(http_res)
733
+ raise models.APIError("API error occurred", http_res, http_res_text)
734
+
735
+ raise models.APIError("Unexpected response received", http_res)
736
+
737
+ async def update_bandwidth_async(
738
+ self,
739
+ *,
740
+ data: Optional[
741
+ Union[
742
+ models.UpdatePlansBandwidthPlansData,
743
+ models.UpdatePlansBandwidthPlansDataTypedDict,
744
+ ]
745
+ ] = None,
746
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
747
+ server_url: Optional[str] = None,
748
+ timeout_ms: Optional[int] = None,
749
+ http_headers: Optional[Mapping[str, str]] = None,
750
+ ) -> models.BandwidthPackages:
751
+ r"""Buy or remove bandwidth packages
752
+
753
+ Allows to increase or decrease bandwidth packages. Only admins and owners can request.
754
+
755
+
756
+ :param data:
757
+ :param retries: Override the default retry configuration for this method
758
+ :param server_url: Override the default server URL for this method
759
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
760
+ :param http_headers: Additional headers to set or replace on requests.
761
+ """
762
+ base_url = None
763
+ url_variables = None
764
+ if timeout_ms is None:
765
+ timeout_ms = self.sdk_configuration.timeout_ms
766
+
767
+ if server_url is not None:
768
+ base_url = server_url
769
+ else:
770
+ base_url = self._get_url(base_url, url_variables)
771
+
772
+ request = models.UpdatePlansBandwidthPlansRequestBody(
773
+ data=utils.get_pydantic_model(
774
+ data, Optional[models.UpdatePlansBandwidthPlansData]
775
+ ),
776
+ )
777
+
778
+ req = self._build_request_async(
779
+ method="POST",
780
+ path="/plans/bandwidth",
781
+ base_url=base_url,
782
+ url_variables=url_variables,
783
+ request=request,
784
+ request_body_required=True,
785
+ request_has_path_params=False,
786
+ request_has_query_params=True,
787
+ user_agent_header="user-agent",
788
+ accept_header_value="application/vnd.api+json",
789
+ http_headers=http_headers,
790
+ security=self.sdk_configuration.security,
791
+ get_serialized_body=lambda: utils.serialize_request_body(
792
+ request,
793
+ False,
794
+ False,
795
+ "json",
796
+ models.UpdatePlansBandwidthPlansRequestBody,
797
+ ),
798
+ allow_empty_value=None,
799
+ timeout_ms=timeout_ms,
800
+ )
801
+
802
+ if retries == UNSET:
803
+ if self.sdk_configuration.retry_config is not UNSET:
804
+ retries = self.sdk_configuration.retry_config
805
+
806
+ retry_config = None
807
+ if isinstance(retries, utils.RetryConfig):
808
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
809
+
810
+ http_res = await self.do_request_async(
811
+ hook_ctx=HookContext(
812
+ config=self.sdk_configuration,
813
+ base_url=base_url or "",
814
+ operation_id="update-plans-bandwidth",
815
+ oauth2_scopes=None,
816
+ security_source=get_security_from_env(
817
+ self.sdk_configuration.security, models.Security
818
+ ),
819
+ ),
820
+ request=req,
821
+ error_status_codes=["4XX", "5XX"],
822
+ retry_config=retry_config,
823
+ )
824
+
825
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
826
+ return unmarshal_json_response(models.BandwidthPackages, http_res)
827
+ if utils.match_response(http_res, "4XX", "*"):
828
+ http_res_text = await utils.stream_to_text_async(http_res)
829
+ raise models.APIError("API error occurred", http_res, http_res_text)
830
+ if utils.match_response(http_res, "5XX", "*"):
831
+ http_res_text = await utils.stream_to_text_async(http_res)
832
+ raise models.APIError("API error occurred", http_res, http_res_text)
833
+
834
+ raise models.APIError("Unexpected response received", http_res)
835
+
836
+ def get_containers_plan(
837
+ self,
838
+ *,
839
+ plan_id: str,
840
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
841
+ server_url: Optional[str] = None,
842
+ timeout_ms: Optional[int] = None,
843
+ http_headers: Optional[Mapping[str, str]] = None,
844
+ ) -> models.ContainerPlanData:
845
+ r"""Retrieve container plan
846
+
847
+ Retrieve a container plan.
848
+
849
+
850
+ :param plan_id: The Plan ID
851
+ :param retries: Override the default retry configuration for this method
852
+ :param server_url: Override the default server URL for this method
853
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
854
+ :param http_headers: Additional headers to set or replace on requests.
855
+ """
856
+ base_url = None
857
+ url_variables = None
858
+ if timeout_ms is None:
859
+ timeout_ms = self.sdk_configuration.timeout_ms
860
+
861
+ if server_url is not None:
862
+ base_url = server_url
863
+ else:
864
+ base_url = self._get_url(base_url, url_variables)
865
+
866
+ request = models.GetContainersPlanRequest(
867
+ plan_id=plan_id,
868
+ )
869
+
870
+ req = self._build_request(
871
+ method="GET",
872
+ path="/plans/containers/{plan_id}",
873
+ base_url=base_url,
874
+ url_variables=url_variables,
875
+ request=request,
876
+ request_body_required=False,
877
+ request_has_path_params=True,
878
+ request_has_query_params=True,
879
+ user_agent_header="user-agent",
880
+ accept_header_value="application/vnd.api+json",
881
+ http_headers=http_headers,
882
+ security=self.sdk_configuration.security,
883
+ allow_empty_value=None,
884
+ timeout_ms=timeout_ms,
885
+ )
886
+
887
+ if retries == UNSET:
888
+ if self.sdk_configuration.retry_config is not UNSET:
889
+ retries = self.sdk_configuration.retry_config
890
+
891
+ retry_config = None
892
+ if isinstance(retries, utils.RetryConfig):
893
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
894
+
895
+ http_res = self.do_request(
896
+ hook_ctx=HookContext(
897
+ config=self.sdk_configuration,
898
+ base_url=base_url or "",
899
+ operation_id="get-containers-plan",
900
+ oauth2_scopes=None,
901
+ security_source=get_security_from_env(
902
+ self.sdk_configuration.security, models.Security
903
+ ),
904
+ ),
905
+ request=req,
906
+ error_status_codes=["4XX", "5XX"],
907
+ retry_config=retry_config,
908
+ )
909
+
910
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
911
+ return unmarshal_json_response(models.ContainerPlanData, http_res)
912
+ if utils.match_response(http_res, "4XX", "*"):
913
+ http_res_text = utils.stream_to_text(http_res)
914
+ raise models.APIError("API error occurred", http_res, http_res_text)
915
+ if utils.match_response(http_res, "5XX", "*"):
916
+ http_res_text = utils.stream_to_text(http_res)
917
+ raise models.APIError("API error occurred", http_res, http_res_text)
918
+
919
+ raise models.APIError("Unexpected response received", http_res)
920
+
921
+ async def get_containers_plan_async(
922
+ self,
923
+ *,
924
+ plan_id: str,
925
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
926
+ server_url: Optional[str] = None,
927
+ timeout_ms: Optional[int] = None,
928
+ http_headers: Optional[Mapping[str, str]] = None,
929
+ ) -> models.ContainerPlanData:
930
+ r"""Retrieve container plan
931
+
932
+ Retrieve a container plan.
933
+
934
+
935
+ :param plan_id: The Plan ID
936
+ :param retries: Override the default retry configuration for this method
937
+ :param server_url: Override the default server URL for this method
938
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
939
+ :param http_headers: Additional headers to set or replace on requests.
940
+ """
941
+ base_url = None
942
+ url_variables = None
943
+ if timeout_ms is None:
944
+ timeout_ms = self.sdk_configuration.timeout_ms
945
+
946
+ if server_url is not None:
947
+ base_url = server_url
948
+ else:
949
+ base_url = self._get_url(base_url, url_variables)
950
+
951
+ request = models.GetContainersPlanRequest(
952
+ plan_id=plan_id,
953
+ )
954
+
955
+ req = self._build_request_async(
956
+ method="GET",
957
+ path="/plans/containers/{plan_id}",
958
+ base_url=base_url,
959
+ url_variables=url_variables,
960
+ request=request,
961
+ request_body_required=False,
962
+ request_has_path_params=True,
963
+ request_has_query_params=True,
964
+ user_agent_header="user-agent",
965
+ accept_header_value="application/vnd.api+json",
966
+ http_headers=http_headers,
967
+ security=self.sdk_configuration.security,
968
+ allow_empty_value=None,
969
+ timeout_ms=timeout_ms,
970
+ )
971
+
972
+ if retries == UNSET:
973
+ if self.sdk_configuration.retry_config is not UNSET:
974
+ retries = self.sdk_configuration.retry_config
975
+
976
+ retry_config = None
977
+ if isinstance(retries, utils.RetryConfig):
978
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
979
+
980
+ http_res = await self.do_request_async(
981
+ hook_ctx=HookContext(
982
+ config=self.sdk_configuration,
983
+ base_url=base_url or "",
984
+ operation_id="get-containers-plan",
985
+ oauth2_scopes=None,
986
+ security_source=get_security_from_env(
987
+ self.sdk_configuration.security, models.Security
988
+ ),
989
+ ),
990
+ request=req,
991
+ error_status_codes=["4XX", "5XX"],
992
+ retry_config=retry_config,
993
+ )
994
+
995
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
996
+ return unmarshal_json_response(models.ContainerPlanData, http_res)
997
+ if utils.match_response(http_res, "4XX", "*"):
998
+ http_res_text = await utils.stream_to_text_async(http_res)
999
+ raise models.APIError("API error occurred", http_res, http_res_text)
1000
+ if utils.match_response(http_res, "5XX", "*"):
1001
+ http_res_text = await utils.stream_to_text_async(http_res)
1002
+ raise models.APIError("API error occurred", http_res, http_res_text)
1003
+
1004
+ raise models.APIError("Unexpected response received", http_res)
1005
+
1006
+ def list_storage(
1007
+ self,
1008
+ *,
1009
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1010
+ server_url: Optional[str] = None,
1011
+ timeout_ms: Optional[int] = None,
1012
+ http_headers: Optional[Mapping[str, str]] = None,
1013
+ ) -> models.StoragePlans:
1014
+ r"""List all Storage Plans
1015
+
1016
+ :param retries: Override the default retry configuration for this method
1017
+ :param server_url: Override the default server URL for this method
1018
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1019
+ :param http_headers: Additional headers to set or replace on requests.
1020
+ """
1021
+ base_url = None
1022
+ url_variables = None
1023
+ if timeout_ms is None:
1024
+ timeout_ms = self.sdk_configuration.timeout_ms
1025
+
1026
+ if server_url is not None:
1027
+ base_url = server_url
1028
+ else:
1029
+ base_url = self._get_url(base_url, url_variables)
1030
+ req = self._build_request(
1031
+ method="GET",
1032
+ path="/plans/storage",
1033
+ base_url=base_url,
1034
+ url_variables=url_variables,
1035
+ request=None,
1036
+ request_body_required=False,
1037
+ request_has_path_params=False,
1038
+ request_has_query_params=True,
1039
+ user_agent_header="user-agent",
1040
+ accept_header_value="application/vnd.api+json",
1041
+ http_headers=http_headers,
1042
+ security=self.sdk_configuration.security,
1043
+ allow_empty_value=None,
1044
+ timeout_ms=timeout_ms,
1045
+ )
1046
+
1047
+ if retries == UNSET:
1048
+ if self.sdk_configuration.retry_config is not UNSET:
1049
+ retries = self.sdk_configuration.retry_config
1050
+
1051
+ retry_config = None
1052
+ if isinstance(retries, utils.RetryConfig):
1053
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1054
+
1055
+ http_res = self.do_request(
1056
+ hook_ctx=HookContext(
1057
+ config=self.sdk_configuration,
1058
+ base_url=base_url or "",
1059
+ operation_id="get-storage-plans",
1060
+ oauth2_scopes=None,
1061
+ security_source=get_security_from_env(
1062
+ self.sdk_configuration.security, models.Security
1063
+ ),
1064
+ ),
1065
+ request=req,
1066
+ error_status_codes=["4XX", "5XX"],
1067
+ retry_config=retry_config,
1068
+ )
1069
+
1070
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
1071
+ return unmarshal_json_response(models.StoragePlans, http_res)
1072
+ if utils.match_response(http_res, "4XX", "*"):
1073
+ http_res_text = utils.stream_to_text(http_res)
1074
+ raise models.APIError("API error occurred", http_res, http_res_text)
1075
+ if utils.match_response(http_res, "5XX", "*"):
1076
+ http_res_text = utils.stream_to_text(http_res)
1077
+ raise models.APIError("API error occurred", http_res, http_res_text)
1078
+
1079
+ raise models.APIError("Unexpected response received", http_res)
1080
+
1081
+ async def list_storage_async(
1082
+ self,
1083
+ *,
1084
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1085
+ server_url: Optional[str] = None,
1086
+ timeout_ms: Optional[int] = None,
1087
+ http_headers: Optional[Mapping[str, str]] = None,
1088
+ ) -> models.StoragePlans:
1089
+ r"""List all Storage Plans
1090
+
1091
+ :param retries: Override the default retry configuration for this method
1092
+ :param server_url: Override the default server URL for this method
1093
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1094
+ :param http_headers: Additional headers to set or replace on requests.
1095
+ """
1096
+ base_url = None
1097
+ url_variables = None
1098
+ if timeout_ms is None:
1099
+ timeout_ms = self.sdk_configuration.timeout_ms
1100
+
1101
+ if server_url is not None:
1102
+ base_url = server_url
1103
+ else:
1104
+ base_url = self._get_url(base_url, url_variables)
1105
+ req = self._build_request_async(
1106
+ method="GET",
1107
+ path="/plans/storage",
1108
+ base_url=base_url,
1109
+ url_variables=url_variables,
1110
+ request=None,
1111
+ request_body_required=False,
1112
+ request_has_path_params=False,
1113
+ request_has_query_params=True,
1114
+ user_agent_header="user-agent",
1115
+ accept_header_value="application/vnd.api+json",
1116
+ http_headers=http_headers,
1117
+ security=self.sdk_configuration.security,
1118
+ allow_empty_value=None,
1119
+ timeout_ms=timeout_ms,
1120
+ )
1121
+
1122
+ if retries == UNSET:
1123
+ if self.sdk_configuration.retry_config is not UNSET:
1124
+ retries = self.sdk_configuration.retry_config
1125
+
1126
+ retry_config = None
1127
+ if isinstance(retries, utils.RetryConfig):
1128
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1129
+
1130
+ http_res = await self.do_request_async(
1131
+ hook_ctx=HookContext(
1132
+ config=self.sdk_configuration,
1133
+ base_url=base_url or "",
1134
+ operation_id="get-storage-plans",
1135
+ oauth2_scopes=None,
1136
+ security_source=get_security_from_env(
1137
+ self.sdk_configuration.security, models.Security
1138
+ ),
1139
+ ),
1140
+ request=req,
1141
+ error_status_codes=["4XX", "5XX"],
1142
+ retry_config=retry_config,
1143
+ )
1144
+
1145
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
1146
+ return unmarshal_json_response(models.StoragePlans, http_res)
1147
+ if utils.match_response(http_res, "4XX", "*"):
1148
+ http_res_text = await utils.stream_to_text_async(http_res)
1149
+ raise models.APIError("API error occurred", http_res, http_res_text)
1150
+ if utils.match_response(http_res, "5XX", "*"):
1151
+ http_res_text = await utils.stream_to_text_async(http_res)
1152
+ raise models.APIError("API error occurred", http_res, http_res_text)
1153
+
1154
+ raise models.APIError("Unexpected response received", http_res)
1155
+
1156
+ def list_vm_plans(
1157
+ self,
1158
+ *,
1159
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1160
+ server_url: Optional[str] = None,
1161
+ timeout_ms: Optional[int] = None,
1162
+ http_headers: Optional[Mapping[str, str]] = None,
1163
+ ) -> models.VirtualMachinePlans:
1164
+ r"""List all Virtual Machines Plans
1165
+
1166
+ :param retries: Override the default retry configuration for this method
1167
+ :param server_url: Override the default server URL for this method
1168
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1169
+ :param http_headers: Additional headers to set or replace on requests.
1170
+ """
1171
+ base_url = None
1172
+ url_variables = None
1173
+ if timeout_ms is None:
1174
+ timeout_ms = self.sdk_configuration.timeout_ms
1175
+
1176
+ if server_url is not None:
1177
+ base_url = server_url
1178
+ else:
1179
+ base_url = self._get_url(base_url, url_variables)
1180
+ req = self._build_request(
1181
+ method="GET",
1182
+ path="/plans/virtual_machines",
1183
+ base_url=base_url,
1184
+ url_variables=url_variables,
1185
+ request=None,
1186
+ request_body_required=False,
1187
+ request_has_path_params=False,
1188
+ request_has_query_params=True,
1189
+ user_agent_header="user-agent",
1190
+ accept_header_value="application/vnd.api+json",
1191
+ http_headers=http_headers,
1192
+ security=self.sdk_configuration.security,
1193
+ allow_empty_value=None,
1194
+ timeout_ms=timeout_ms,
1195
+ )
1196
+
1197
+ if retries == UNSET:
1198
+ if self.sdk_configuration.retry_config is not UNSET:
1199
+ retries = self.sdk_configuration.retry_config
1200
+
1201
+ retry_config = None
1202
+ if isinstance(retries, utils.RetryConfig):
1203
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1204
+
1205
+ http_res = self.do_request(
1206
+ hook_ctx=HookContext(
1207
+ config=self.sdk_configuration,
1208
+ base_url=base_url or "",
1209
+ operation_id="get-vm-plans",
1210
+ oauth2_scopes=None,
1211
+ security_source=get_security_from_env(
1212
+ self.sdk_configuration.security, models.Security
1213
+ ),
1214
+ ),
1215
+ request=req,
1216
+ error_status_codes=["4XX", "5XX"],
1217
+ retry_config=retry_config,
1218
+ )
1219
+
1220
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
1221
+ return unmarshal_json_response(models.VirtualMachinePlans, http_res)
1222
+ if utils.match_response(http_res, "4XX", "*"):
1223
+ http_res_text = utils.stream_to_text(http_res)
1224
+ raise models.APIError("API error occurred", http_res, http_res_text)
1225
+ if utils.match_response(http_res, "5XX", "*"):
1226
+ http_res_text = utils.stream_to_text(http_res)
1227
+ raise models.APIError("API error occurred", http_res, http_res_text)
1228
+
1229
+ raise models.APIError("Unexpected response received", http_res)
1230
+
1231
+ async def list_vm_plans_async(
1232
+ self,
1233
+ *,
1234
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1235
+ server_url: Optional[str] = None,
1236
+ timeout_ms: Optional[int] = None,
1237
+ http_headers: Optional[Mapping[str, str]] = None,
1238
+ ) -> models.VirtualMachinePlans:
1239
+ r"""List all Virtual Machines Plans
1240
+
1241
+ :param retries: Override the default retry configuration for this method
1242
+ :param server_url: Override the default server URL for this method
1243
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1244
+ :param http_headers: Additional headers to set or replace on requests.
1245
+ """
1246
+ base_url = None
1247
+ url_variables = None
1248
+ if timeout_ms is None:
1249
+ timeout_ms = self.sdk_configuration.timeout_ms
1250
+
1251
+ if server_url is not None:
1252
+ base_url = server_url
1253
+ else:
1254
+ base_url = self._get_url(base_url, url_variables)
1255
+ req = self._build_request_async(
1256
+ method="GET",
1257
+ path="/plans/virtual_machines",
1258
+ base_url=base_url,
1259
+ url_variables=url_variables,
1260
+ request=None,
1261
+ request_body_required=False,
1262
+ request_has_path_params=False,
1263
+ request_has_query_params=True,
1264
+ user_agent_header="user-agent",
1265
+ accept_header_value="application/vnd.api+json",
1266
+ http_headers=http_headers,
1267
+ security=self.sdk_configuration.security,
1268
+ allow_empty_value=None,
1269
+ timeout_ms=timeout_ms,
1270
+ )
1271
+
1272
+ if retries == UNSET:
1273
+ if self.sdk_configuration.retry_config is not UNSET:
1274
+ retries = self.sdk_configuration.retry_config
1275
+
1276
+ retry_config = None
1277
+ if isinstance(retries, utils.RetryConfig):
1278
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1279
+
1280
+ http_res = await self.do_request_async(
1281
+ hook_ctx=HookContext(
1282
+ config=self.sdk_configuration,
1283
+ base_url=base_url or "",
1284
+ operation_id="get-vm-plans",
1285
+ oauth2_scopes=None,
1286
+ security_source=get_security_from_env(
1287
+ self.sdk_configuration.security, models.Security
1288
+ ),
1289
+ ),
1290
+ request=req,
1291
+ error_status_codes=["4XX", "5XX"],
1292
+ retry_config=retry_config,
1293
+ )
1294
+
1295
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
1296
+ return unmarshal_json_response(models.VirtualMachinePlans, http_res)
1297
+ if utils.match_response(http_res, "4XX", "*"):
1298
+ http_res_text = await utils.stream_to_text_async(http_res)
1299
+ raise models.APIError("API error occurred", http_res, http_res_text)
1300
+ if utils.match_response(http_res, "5XX", "*"):
1301
+ http_res_text = await utils.stream_to_text_async(http_res)
1302
+ raise models.APIError("API error occurred", http_res, http_res_text)
1303
+
1304
+ raise models.APIError("Unexpected response received", http_res)