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