latitudesh-python-sdk 0.0.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of latitudesh-python-sdk might be problematic. Click here for more details.

Files changed (206) 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 +106 -0
  6. latitudesh_python_sdk/_version.py +15 -0
  7. latitudesh_python_sdk/apikeys.py +802 -0
  8. latitudesh_python_sdk/basesdk.py +366 -0
  9. latitudesh_python_sdk/billing.py +210 -0
  10. latitudesh_python_sdk/events_sdk.py +240 -0
  11. latitudesh_python_sdk/firewalls_sdk.py +1640 -0
  12. latitudesh_python_sdk/httpclient.py +136 -0
  13. latitudesh_python_sdk/ipaddresses_sdk.py +448 -0
  14. latitudesh_python_sdk/models/__init__.py +1927 -0
  15. latitudesh_python_sdk/models/api_key.py +81 -0
  16. latitudesh_python_sdk/models/apierror.py +22 -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.py +72 -0
  20. latitudesh_python_sdk/models/bandwidth_plans.py +15 -0
  21. latitudesh_python_sdk/models/billing_usage.py +158 -0
  22. latitudesh_python_sdk/models/create_api_key.py +40 -0
  23. latitudesh_python_sdk/models/create_firewall_assignmentop.py +61 -0
  24. latitudesh_python_sdk/models/create_firewallop.py +69 -0
  25. latitudesh_python_sdk/models/create_ipmi_sessionop.py +16 -0
  26. latitudesh_python_sdk/models/create_projectop.py +79 -0
  27. latitudesh_python_sdk/models/create_server_actionop.py +69 -0
  28. latitudesh_python_sdk/models/create_server_out_of_bandop.py +61 -0
  29. latitudesh_python_sdk/models/create_server_reinstallop.py +140 -0
  30. latitudesh_python_sdk/models/create_serverop.py +173 -0
  31. latitudesh_python_sdk/models/create_tagop.py +50 -0
  32. latitudesh_python_sdk/models/create_virtual_networkop.py +72 -0
  33. latitudesh_python_sdk/models/custom_tag.py +54 -0
  34. latitudesh_python_sdk/models/delete_api_keyop.py +16 -0
  35. latitudesh_python_sdk/models/delete_firewall_assignmentop.py +25 -0
  36. latitudesh_python_sdk/models/delete_firewallop.py +18 -0
  37. latitudesh_python_sdk/models/delete_project_ssh_keyop.py +23 -0
  38. latitudesh_python_sdk/models/delete_project_user_dataop.py +23 -0
  39. latitudesh_python_sdk/models/delete_projectop.py +18 -0
  40. latitudesh_python_sdk/models/delete_storage_filesystemsop.py +16 -0
  41. latitudesh_python_sdk/models/delete_virtual_networks_assignmentsop.py +16 -0
  42. latitudesh_python_sdk/models/delete_vpn_sessionop.py +16 -0
  43. latitudesh_python_sdk/models/deploy_config.py +74 -0
  44. latitudesh_python_sdk/models/destroy_serverop.py +31 -0
  45. latitudesh_python_sdk/models/destroy_tagop.py +16 -0
  46. latitudesh_python_sdk/models/destroy_team_memberop.py +18 -0
  47. latitudesh_python_sdk/models/destroy_virtual_machineop.py +16 -0
  48. latitudesh_python_sdk/models/destroy_virtual_networkop.py +18 -0
  49. latitudesh_python_sdk/models/error_object.py +49 -0
  50. latitudesh_python_sdk/models/events.py +90 -0
  51. latitudesh_python_sdk/models/filesystem_data.py +53 -0
  52. latitudesh_python_sdk/models/firewall.py +71 -0
  53. latitudesh_python_sdk/models/firewall_server.py +50 -0
  54. latitudesh_python_sdk/models/firewalls.py +26 -0
  55. latitudesh_python_sdk/models/get_bandwidth_plansop.py +33 -0
  56. latitudesh_python_sdk/models/get_billing_usageop.py +46 -0
  57. latitudesh_python_sdk/models/get_eventsop.py +98 -0
  58. latitudesh_python_sdk/models/get_firewall_assignmentsop.py +18 -0
  59. latitudesh_python_sdk/models/get_firewallop.py +18 -0
  60. latitudesh_python_sdk/models/get_ipop.py +33 -0
  61. latitudesh_python_sdk/models/get_ipsop.py +91 -0
  62. latitudesh_python_sdk/models/get_planop.py +16 -0
  63. latitudesh_python_sdk/models/get_plans_operating_systemop.py +19 -0
  64. latitudesh_python_sdk/models/get_plansop.py +125 -0
  65. latitudesh_python_sdk/models/get_project_ssh_keyop.py +37 -0
  66. latitudesh_python_sdk/models/get_project_ssh_keysop.py +33 -0
  67. latitudesh_python_sdk/models/get_project_user_dataop.py +38 -0
  68. latitudesh_python_sdk/models/get_project_users_dataop.py +46 -0
  69. latitudesh_python_sdk/models/get_projectsop.py +76 -0
  70. latitudesh_python_sdk/models/get_regionop.py +18 -0
  71. latitudesh_python_sdk/models/get_role_idop.py +16 -0
  72. latitudesh_python_sdk/models/get_rolesop.py +19 -0
  73. latitudesh_python_sdk/models/get_server_deploy_configop.py +18 -0
  74. latitudesh_python_sdk/models/get_server_out_of_bandop.py +18 -0
  75. latitudesh_python_sdk/models/get_serverop.py +33 -0
  76. latitudesh_python_sdk/models/get_serversop.py +156 -0
  77. latitudesh_python_sdk/models/get_storage_filesystemsop.py +22 -0
  78. latitudesh_python_sdk/models/get_traffic_consumptionop.py +45 -0
  79. latitudesh_python_sdk/models/get_traffic_quotaop.py +20 -0
  80. latitudesh_python_sdk/models/get_user_profileop.py +19 -0
  81. latitudesh_python_sdk/models/get_virtual_networkop.py +32 -0
  82. latitudesh_python_sdk/models/get_virtual_networks_assignmentsop.py +40 -0
  83. latitudesh_python_sdk/models/get_virtual_networksop.py +40 -0
  84. latitudesh_python_sdk/models/get_vpn_sessionsop.py +70 -0
  85. latitudesh_python_sdk/models/index_virtual_machineop.py +22 -0
  86. latitudesh_python_sdk/models/ip_address.py +122 -0
  87. latitudesh_python_sdk/models/ip_addresses.py +15 -0
  88. latitudesh_python_sdk/models/ipmi_session.py +53 -0
  89. latitudesh_python_sdk/models/list_firewallsop.py +20 -0
  90. latitudesh_python_sdk/models/membership.py +63 -0
  91. latitudesh_python_sdk/models/operating_systems.py +57 -0
  92. latitudesh_python_sdk/models/out_of_band_connection.py +88 -0
  93. latitudesh_python_sdk/models/patch_current_teamop.py +91 -0
  94. latitudesh_python_sdk/models/patch_storage_filesystemsop.py +79 -0
  95. latitudesh_python_sdk/models/patch_user_profileop.py +88 -0
  96. latitudesh_python_sdk/models/plan.py +15 -0
  97. latitudesh_python_sdk/models/plan_data.py +206 -0
  98. latitudesh_python_sdk/models/post_api_keyop.py +19 -0
  99. latitudesh_python_sdk/models/post_project_ssh_keyop.py +81 -0
  100. latitudesh_python_sdk/models/post_project_user_dataop.py +68 -0
  101. latitudesh_python_sdk/models/post_storage_filesystemsop.py +63 -0
  102. latitudesh_python_sdk/models/post_team_membersop.py +54 -0
  103. latitudesh_python_sdk/models/post_teamop.py +67 -0
  104. latitudesh_python_sdk/models/post_vpn_sessionop.py +63 -0
  105. latitudesh_python_sdk/models/project.py +130 -0
  106. latitudesh_python_sdk/models/project_include.py +72 -0
  107. latitudesh_python_sdk/models/projects.py +15 -0
  108. latitudesh_python_sdk/models/put_project_ssh_keyop.py +87 -0
  109. latitudesh_python_sdk/models/put_project_user_dataop.py +76 -0
  110. latitudesh_python_sdk/models/put_vpn_sessionop.py +16 -0
  111. latitudesh_python_sdk/models/region.py +50 -0
  112. latitudesh_python_sdk/models/region_resource_data.py +37 -0
  113. latitudesh_python_sdk/models/regions.py +50 -0
  114. latitudesh_python_sdk/models/role.py +15 -0
  115. latitudesh_python_sdk/models/role_data.py +35 -0
  116. latitudesh_python_sdk/models/security.py +25 -0
  117. latitudesh_python_sdk/models/server.py +54 -0
  118. latitudesh_python_sdk/models/server_action.py +52 -0
  119. latitudesh_python_sdk/models/server_data.py +219 -0
  120. latitudesh_python_sdk/models/server_exit_rescue_modeop.py +16 -0
  121. latitudesh_python_sdk/models/server_lockop.py +16 -0
  122. latitudesh_python_sdk/models/server_rescue.py +22 -0
  123. latitudesh_python_sdk/models/server_schedule_deletion.py +44 -0
  124. latitudesh_python_sdk/models/server_schedule_deletionop.py +16 -0
  125. latitudesh_python_sdk/models/server_start_rescue_modeop.py +16 -0
  126. latitudesh_python_sdk/models/server_unlockop.py +16 -0
  127. latitudesh_python_sdk/models/server_unschedule_deletionop.py +16 -0
  128. latitudesh_python_sdk/models/servers.py +26 -0
  129. latitudesh_python_sdk/models/show_virtual_machineop.py +16 -0
  130. latitudesh_python_sdk/models/ssh_key.py +15 -0
  131. latitudesh_python_sdk/models/ssh_key_data.py +55 -0
  132. latitudesh_python_sdk/models/storage_plan.py +36 -0
  133. latitudesh_python_sdk/models/storage_plans.py +15 -0
  134. latitudesh_python_sdk/models/team.py +74 -0
  135. latitudesh_python_sdk/models/team_include.py +43 -0
  136. latitudesh_python_sdk/models/team_members.py +51 -0
  137. latitudesh_python_sdk/models/teams.py +26 -0
  138. latitudesh_python_sdk/models/traffic.py +133 -0
  139. latitudesh_python_sdk/models/traffic_quota.py +106 -0
  140. latitudesh_python_sdk/models/update_api_key.py +48 -0
  141. latitudesh_python_sdk/models/update_api_keyop.py +41 -0
  142. latitudesh_python_sdk/models/update_firewallop.py +89 -0
  143. latitudesh_python_sdk/models/update_plans_bandwidthop.py +50 -0
  144. latitudesh_python_sdk/models/update_projectop.py +95 -0
  145. latitudesh_python_sdk/models/update_server_deploy_configop.py +122 -0
  146. latitudesh_python_sdk/models/update_serverop.py +69 -0
  147. latitudesh_python_sdk/models/update_tagop.py +74 -0
  148. latitudesh_python_sdk/models/update_virtual_networkop.py +67 -0
  149. latitudesh_python_sdk/models/user.py +59 -0
  150. latitudesh_python_sdk/models/user_data.py +15 -0
  151. latitudesh_python_sdk/models/user_data_properties.py +46 -0
  152. latitudesh_python_sdk/models/user_include.py +52 -0
  153. latitudesh_python_sdk/models/user_team.py +61 -0
  154. latitudesh_python_sdk/models/user_teams.py +26 -0
  155. latitudesh_python_sdk/models/user_update.py +37 -0
  156. latitudesh_python_sdk/models/virtual_machine.py +25 -0
  157. latitudesh_python_sdk/models/virtual_machine_payload.py +41 -0
  158. latitudesh_python_sdk/models/virtual_machine_plans.py +180 -0
  159. latitudesh_python_sdk/models/virtual_network.py +103 -0
  160. latitudesh_python_sdk/models/virtual_network1.py +84 -0
  161. latitudesh_python_sdk/models/virtual_network_assignment.py +37 -0
  162. latitudesh_python_sdk/models/virtual_network_assignments.py +29 -0
  163. latitudesh_python_sdk/models/virtual_networks.py +26 -0
  164. latitudesh_python_sdk/models/vpn_session_data_with_password.py +77 -0
  165. latitudesh_python_sdk/models/vpn_session_with_password.py +18 -0
  166. latitudesh_python_sdk/operatingsystems_sdk.py +188 -0
  167. latitudesh_python_sdk/plans.py +1178 -0
  168. latitudesh_python_sdk/privatenetworks.py +1672 -0
  169. latitudesh_python_sdk/projects_sdk.py +864 -0
  170. latitudesh_python_sdk/py.typed +1 -0
  171. latitudesh_python_sdk/regions_sdk.py +376 -0
  172. latitudesh_python_sdk/roles.py +374 -0
  173. latitudesh_python_sdk/sdk.py +214 -0
  174. latitudesh_python_sdk/sdkconfiguration.py +57 -0
  175. latitudesh_python_sdk/servers_sdk.py +3810 -0
  176. latitudesh_python_sdk/sshkeys.py +1050 -0
  177. latitudesh_python_sdk/storage.py +820 -0
  178. latitudesh_python_sdk/tags.py +786 -0
  179. latitudesh_python_sdk/teams_sdk.py +596 -0
  180. latitudesh_python_sdk/teamsmembers.py +578 -0
  181. latitudesh_python_sdk/traffic_sdk.py +400 -0
  182. latitudesh_python_sdk/types/__init__.py +21 -0
  183. latitudesh_python_sdk/types/basemodel.py +39 -0
  184. latitudesh_python_sdk/userdata_sdk.py +1052 -0
  185. latitudesh_python_sdk/userprofile.py +596 -0
  186. latitudesh_python_sdk/utils/__init__.py +101 -0
  187. latitudesh_python_sdk/utils/annotations.py +55 -0
  188. latitudesh_python_sdk/utils/enums.py +34 -0
  189. latitudesh_python_sdk/utils/eventstreaming.py +238 -0
  190. latitudesh_python_sdk/utils/forms.py +202 -0
  191. latitudesh_python_sdk/utils/headers.py +136 -0
  192. latitudesh_python_sdk/utils/logger.py +27 -0
  193. latitudesh_python_sdk/utils/metadata.py +118 -0
  194. latitudesh_python_sdk/utils/queryparams.py +205 -0
  195. latitudesh_python_sdk/utils/requestbodies.py +66 -0
  196. latitudesh_python_sdk/utils/retries.py +217 -0
  197. latitudesh_python_sdk/utils/security.py +192 -0
  198. latitudesh_python_sdk/utils/serializers.py +219 -0
  199. latitudesh_python_sdk/utils/url.py +155 -0
  200. latitudesh_python_sdk/utils/values.py +137 -0
  201. latitudesh_python_sdk/virtualmachines.py +772 -0
  202. latitudesh_python_sdk/vpnsessions.py +818 -0
  203. latitudesh_python_sdk-0.0.6.dist-info/LICENSE +21 -0
  204. latitudesh_python_sdk-0.0.6.dist-info/METADATA +730 -0
  205. latitudesh_python_sdk-0.0.6.dist-info/RECORD +206 -0
  206. latitudesh_python_sdk-0.0.6.dist-info/WHEEL +4 -0
@@ -0,0 +1,802 @@
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 BaseModel, OptionalNullable, UNSET
7
+ from latitudesh_python_sdk.utils import get_security_from_env
8
+ from typing import Any, Mapping, Optional, Union, cast
9
+
10
+
11
+ class APIKeys(BaseSDK):
12
+ def list(
13
+ self,
14
+ *,
15
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
16
+ server_url: Optional[str] = None,
17
+ timeout_ms: Optional[int] = None,
18
+ http_headers: Optional[Mapping[str, str]] = None,
19
+ ) -> models.APIKey:
20
+ r"""List API Keys
21
+
22
+ Returns a list of all API keys from the team members
23
+
24
+
25
+ :param retries: Override the default retry configuration for this method
26
+ :param server_url: Override the default server URL for this method
27
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
28
+ :param http_headers: Additional headers to set or replace on requests.
29
+ """
30
+ base_url = None
31
+ url_variables = None
32
+ if timeout_ms is None:
33
+ timeout_ms = self.sdk_configuration.timeout_ms
34
+
35
+ if server_url is not None:
36
+ base_url = server_url
37
+ else:
38
+ base_url = self._get_url(base_url, url_variables)
39
+ req = self._build_request(
40
+ method="GET",
41
+ path="/auth/api_keys",
42
+ base_url=base_url,
43
+ url_variables=url_variables,
44
+ request=None,
45
+ request_body_required=False,
46
+ request_has_path_params=False,
47
+ request_has_query_params=True,
48
+ user_agent_header="user-agent",
49
+ accept_header_value="application/vnd.api+json",
50
+ http_headers=http_headers,
51
+ security=self.sdk_configuration.security,
52
+ timeout_ms=timeout_ms,
53
+ )
54
+
55
+ if retries == UNSET:
56
+ if self.sdk_configuration.retry_config is not UNSET:
57
+ retries = self.sdk_configuration.retry_config
58
+
59
+ retry_config = None
60
+ if isinstance(retries, utils.RetryConfig):
61
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
62
+
63
+ http_res = self.do_request(
64
+ hook_ctx=HookContext(
65
+ base_url=base_url or "",
66
+ operation_id="get-api-keys",
67
+ oauth2_scopes=[],
68
+ security_source=get_security_from_env(
69
+ self.sdk_configuration.security, models.Security
70
+ ),
71
+ ),
72
+ request=req,
73
+ error_status_codes=["4XX", "5XX"],
74
+ retry_config=retry_config,
75
+ )
76
+
77
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
78
+ return utils.unmarshal_json(http_res.text, models.APIKey)
79
+ if utils.match_response(http_res, "4XX", "*"):
80
+ http_res_text = utils.stream_to_text(http_res)
81
+ raise models.APIError(
82
+ "API error occurred", http_res.status_code, http_res_text, http_res
83
+ )
84
+ if utils.match_response(http_res, "5XX", "*"):
85
+ http_res_text = utils.stream_to_text(http_res)
86
+ raise models.APIError(
87
+ "API error occurred", http_res.status_code, http_res_text, http_res
88
+ )
89
+
90
+ content_type = http_res.headers.get("Content-Type")
91
+ http_res_text = utils.stream_to_text(http_res)
92
+ raise models.APIError(
93
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
94
+ http_res.status_code,
95
+ http_res_text,
96
+ http_res,
97
+ )
98
+
99
+ async def list_async(
100
+ self,
101
+ *,
102
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
103
+ server_url: Optional[str] = None,
104
+ timeout_ms: Optional[int] = None,
105
+ http_headers: Optional[Mapping[str, str]] = None,
106
+ ) -> models.APIKey:
107
+ r"""List API Keys
108
+
109
+ Returns a list of all API keys from the team members
110
+
111
+
112
+ :param retries: Override the default retry configuration for this method
113
+ :param server_url: Override the default server URL for this method
114
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
115
+ :param http_headers: Additional headers to set or replace on requests.
116
+ """
117
+ base_url = None
118
+ url_variables = None
119
+ if timeout_ms is None:
120
+ timeout_ms = self.sdk_configuration.timeout_ms
121
+
122
+ if server_url is not None:
123
+ base_url = server_url
124
+ else:
125
+ base_url = self._get_url(base_url, url_variables)
126
+ req = self._build_request_async(
127
+ method="GET",
128
+ path="/auth/api_keys",
129
+ base_url=base_url,
130
+ url_variables=url_variables,
131
+ request=None,
132
+ request_body_required=False,
133
+ request_has_path_params=False,
134
+ request_has_query_params=True,
135
+ user_agent_header="user-agent",
136
+ accept_header_value="application/vnd.api+json",
137
+ http_headers=http_headers,
138
+ security=self.sdk_configuration.security,
139
+ timeout_ms=timeout_ms,
140
+ )
141
+
142
+ if retries == UNSET:
143
+ if self.sdk_configuration.retry_config is not UNSET:
144
+ retries = self.sdk_configuration.retry_config
145
+
146
+ retry_config = None
147
+ if isinstance(retries, utils.RetryConfig):
148
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
149
+
150
+ http_res = await self.do_request_async(
151
+ hook_ctx=HookContext(
152
+ base_url=base_url or "",
153
+ operation_id="get-api-keys",
154
+ oauth2_scopes=[],
155
+ security_source=get_security_from_env(
156
+ self.sdk_configuration.security, models.Security
157
+ ),
158
+ ),
159
+ request=req,
160
+ error_status_codes=["4XX", "5XX"],
161
+ retry_config=retry_config,
162
+ )
163
+
164
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
165
+ return utils.unmarshal_json(http_res.text, models.APIKey)
166
+ if utils.match_response(http_res, "4XX", "*"):
167
+ http_res_text = await utils.stream_to_text_async(http_res)
168
+ raise models.APIError(
169
+ "API error occurred", http_res.status_code, http_res_text, http_res
170
+ )
171
+ if utils.match_response(http_res, "5XX", "*"):
172
+ http_res_text = await utils.stream_to_text_async(http_res)
173
+ raise models.APIError(
174
+ "API error occurred", http_res.status_code, http_res_text, http_res
175
+ )
176
+
177
+ content_type = http_res.headers.get("Content-Type")
178
+ http_res_text = await utils.stream_to_text_async(http_res)
179
+ raise models.APIError(
180
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
181
+ http_res.status_code,
182
+ http_res_text,
183
+ http_res,
184
+ )
185
+
186
+ def create(
187
+ self,
188
+ *,
189
+ request: Union[
190
+ models.CreateAPIKey, models.CreateAPIKeyTypedDict
191
+ ] = models.CreateAPIKey(),
192
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
193
+ server_url: Optional[str] = None,
194
+ timeout_ms: Optional[int] = None,
195
+ http_headers: Optional[Mapping[str, str]] = None,
196
+ ) -> models.PostAPIKeyResponseBody:
197
+ r"""Create API Key
198
+
199
+ Create a new API Key that is tied to the current user account. The created API key is only listed ONCE upon creation. It can however be regenerated or deleted.
200
+
201
+
202
+ :param request: The request object to send.
203
+ :param retries: Override the default retry configuration for this method
204
+ :param server_url: Override the default server URL for this method
205
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
206
+ :param http_headers: Additional headers to set or replace on requests.
207
+ """
208
+ base_url = None
209
+ url_variables = None
210
+ if timeout_ms is None:
211
+ timeout_ms = self.sdk_configuration.timeout_ms
212
+
213
+ if server_url is not None:
214
+ base_url = server_url
215
+ else:
216
+ base_url = self._get_url(base_url, url_variables)
217
+
218
+ if not isinstance(request, BaseModel):
219
+ request = utils.unmarshal(request, models.CreateAPIKey)
220
+ request = cast(models.CreateAPIKey, request)
221
+
222
+ req = self._build_request(
223
+ method="POST",
224
+ path="/auth/api_keys",
225
+ base_url=base_url,
226
+ url_variables=url_variables,
227
+ request=request,
228
+ request_body_required=True,
229
+ request_has_path_params=False,
230
+ request_has_query_params=True,
231
+ user_agent_header="user-agent",
232
+ accept_header_value="application/vnd.api+json",
233
+ http_headers=http_headers,
234
+ security=self.sdk_configuration.security,
235
+ get_serialized_body=lambda: utils.serialize_request_body(
236
+ request, False, True, "json", Optional[models.CreateAPIKey]
237
+ ),
238
+ timeout_ms=timeout_ms,
239
+ )
240
+
241
+ if retries == UNSET:
242
+ if self.sdk_configuration.retry_config is not UNSET:
243
+ retries = self.sdk_configuration.retry_config
244
+
245
+ retry_config = None
246
+ if isinstance(retries, utils.RetryConfig):
247
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
248
+
249
+ http_res = self.do_request(
250
+ hook_ctx=HookContext(
251
+ base_url=base_url or "",
252
+ operation_id="post-api-key",
253
+ oauth2_scopes=[],
254
+ security_source=get_security_from_env(
255
+ self.sdk_configuration.security, models.Security
256
+ ),
257
+ ),
258
+ request=req,
259
+ error_status_codes=["400", "422", "4XX", "5XX"],
260
+ retry_config=retry_config,
261
+ )
262
+
263
+ response_data: Any = None
264
+ if utils.match_response(http_res, "201", "application/vnd.api+json"):
265
+ return utils.unmarshal_json(http_res.text, models.PostAPIKeyResponseBody)
266
+ if utils.match_response(http_res, ["400", "422"], "application/vnd.api+json"):
267
+ response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
268
+ raise models.ErrorObject(data=response_data)
269
+ if utils.match_response(http_res, "4XX", "*"):
270
+ http_res_text = utils.stream_to_text(http_res)
271
+ raise models.APIError(
272
+ "API error occurred", http_res.status_code, http_res_text, http_res
273
+ )
274
+ if utils.match_response(http_res, "5XX", "*"):
275
+ http_res_text = utils.stream_to_text(http_res)
276
+ raise models.APIError(
277
+ "API error occurred", http_res.status_code, http_res_text, http_res
278
+ )
279
+
280
+ content_type = http_res.headers.get("Content-Type")
281
+ http_res_text = utils.stream_to_text(http_res)
282
+ raise models.APIError(
283
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
284
+ http_res.status_code,
285
+ http_res_text,
286
+ http_res,
287
+ )
288
+
289
+ async def create_async(
290
+ self,
291
+ *,
292
+ request: Union[
293
+ models.CreateAPIKey, models.CreateAPIKeyTypedDict
294
+ ] = models.CreateAPIKey(),
295
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
296
+ server_url: Optional[str] = None,
297
+ timeout_ms: Optional[int] = None,
298
+ http_headers: Optional[Mapping[str, str]] = None,
299
+ ) -> models.PostAPIKeyResponseBody:
300
+ r"""Create API Key
301
+
302
+ Create a new API Key that is tied to the current user account. The created API key is only listed ONCE upon creation. It can however be regenerated or deleted.
303
+
304
+
305
+ :param request: The request object to send.
306
+ :param retries: Override the default retry configuration for this method
307
+ :param server_url: Override the default server URL for this method
308
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
309
+ :param http_headers: Additional headers to set or replace on requests.
310
+ """
311
+ base_url = None
312
+ url_variables = None
313
+ if timeout_ms is None:
314
+ timeout_ms = self.sdk_configuration.timeout_ms
315
+
316
+ if server_url is not None:
317
+ base_url = server_url
318
+ else:
319
+ base_url = self._get_url(base_url, url_variables)
320
+
321
+ if not isinstance(request, BaseModel):
322
+ request = utils.unmarshal(request, models.CreateAPIKey)
323
+ request = cast(models.CreateAPIKey, request)
324
+
325
+ req = self._build_request_async(
326
+ method="POST",
327
+ path="/auth/api_keys",
328
+ base_url=base_url,
329
+ url_variables=url_variables,
330
+ request=request,
331
+ request_body_required=True,
332
+ request_has_path_params=False,
333
+ request_has_query_params=True,
334
+ user_agent_header="user-agent",
335
+ accept_header_value="application/vnd.api+json",
336
+ http_headers=http_headers,
337
+ security=self.sdk_configuration.security,
338
+ get_serialized_body=lambda: utils.serialize_request_body(
339
+ request, False, True, "json", Optional[models.CreateAPIKey]
340
+ ),
341
+ timeout_ms=timeout_ms,
342
+ )
343
+
344
+ if retries == UNSET:
345
+ if self.sdk_configuration.retry_config is not UNSET:
346
+ retries = self.sdk_configuration.retry_config
347
+
348
+ retry_config = None
349
+ if isinstance(retries, utils.RetryConfig):
350
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
351
+
352
+ http_res = await self.do_request_async(
353
+ hook_ctx=HookContext(
354
+ base_url=base_url or "",
355
+ operation_id="post-api-key",
356
+ oauth2_scopes=[],
357
+ security_source=get_security_from_env(
358
+ self.sdk_configuration.security, models.Security
359
+ ),
360
+ ),
361
+ request=req,
362
+ error_status_codes=["400", "422", "4XX", "5XX"],
363
+ retry_config=retry_config,
364
+ )
365
+
366
+ response_data: Any = None
367
+ if utils.match_response(http_res, "201", "application/vnd.api+json"):
368
+ return utils.unmarshal_json(http_res.text, models.PostAPIKeyResponseBody)
369
+ if utils.match_response(http_res, ["400", "422"], "application/vnd.api+json"):
370
+ response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
371
+ raise models.ErrorObject(data=response_data)
372
+ if utils.match_response(http_res, "4XX", "*"):
373
+ http_res_text = await utils.stream_to_text_async(http_res)
374
+ raise models.APIError(
375
+ "API error occurred", http_res.status_code, http_res_text, http_res
376
+ )
377
+ if utils.match_response(http_res, "5XX", "*"):
378
+ http_res_text = await utils.stream_to_text_async(http_res)
379
+ raise models.APIError(
380
+ "API error occurred", http_res.status_code, http_res_text, http_res
381
+ )
382
+
383
+ content_type = http_res.headers.get("Content-Type")
384
+ http_res_text = await utils.stream_to_text_async(http_res)
385
+ raise models.APIError(
386
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
387
+ http_res.status_code,
388
+ http_res_text,
389
+ http_res,
390
+ )
391
+
392
+ def regenerate(
393
+ self,
394
+ *,
395
+ api_key_id: str,
396
+ data: Optional[
397
+ Union[models.UpdateAPIKeyData, models.UpdateAPIKeyDataTypedDict]
398
+ ] = None,
399
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
400
+ server_url: Optional[str] = None,
401
+ timeout_ms: Optional[int] = None,
402
+ http_headers: Optional[Mapping[str, str]] = None,
403
+ ) -> models.UpdateAPIKeyResponseBody:
404
+ r"""Regenerate API Key
405
+
406
+ Regenerate an existing API Key that is tied to the current user. This overrides the previous key.
407
+
408
+
409
+ :param api_key_id:
410
+ :param data:
411
+ :param retries: Override the default retry configuration for this method
412
+ :param server_url: Override the default server URL for this method
413
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
414
+ :param http_headers: Additional headers to set or replace on requests.
415
+ """
416
+ base_url = None
417
+ url_variables = None
418
+ if timeout_ms is None:
419
+ timeout_ms = self.sdk_configuration.timeout_ms
420
+
421
+ if server_url is not None:
422
+ base_url = server_url
423
+ else:
424
+ base_url = self._get_url(base_url, url_variables)
425
+
426
+ request = models.UpdateAPIKeyRequest(
427
+ api_key_id=api_key_id,
428
+ update_api_key=models.UpdateAPIKey(
429
+ data=utils.get_pydantic_model(data, Optional[models.UpdateAPIKeyData]),
430
+ ),
431
+ )
432
+
433
+ req = self._build_request(
434
+ method="PUT",
435
+ path="/auth/api_keys/{api_key_id}",
436
+ base_url=base_url,
437
+ url_variables=url_variables,
438
+ request=request,
439
+ request_body_required=True,
440
+ request_has_path_params=True,
441
+ request_has_query_params=True,
442
+ user_agent_header="user-agent",
443
+ accept_header_value="application/vnd.api+json",
444
+ http_headers=http_headers,
445
+ security=self.sdk_configuration.security,
446
+ get_serialized_body=lambda: utils.serialize_request_body(
447
+ request.update_api_key, False, False, "json", models.UpdateAPIKey
448
+ ),
449
+ timeout_ms=timeout_ms,
450
+ )
451
+
452
+ if retries == UNSET:
453
+ if self.sdk_configuration.retry_config is not UNSET:
454
+ retries = self.sdk_configuration.retry_config
455
+
456
+ retry_config = None
457
+ if isinstance(retries, utils.RetryConfig):
458
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
459
+
460
+ http_res = self.do_request(
461
+ hook_ctx=HookContext(
462
+ base_url=base_url or "",
463
+ operation_id="update-api-key",
464
+ oauth2_scopes=[],
465
+ security_source=get_security_from_env(
466
+ self.sdk_configuration.security, models.Security
467
+ ),
468
+ ),
469
+ request=req,
470
+ error_status_codes=["400", "404", "4XX", "5XX"],
471
+ retry_config=retry_config,
472
+ )
473
+
474
+ response_data: Any = None
475
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
476
+ return utils.unmarshal_json(http_res.text, models.UpdateAPIKeyResponseBody)
477
+ if utils.match_response(http_res, ["400", "404"], "application/vnd.api+json"):
478
+ response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
479
+ raise models.ErrorObject(data=response_data)
480
+ if utils.match_response(http_res, "4XX", "*"):
481
+ http_res_text = utils.stream_to_text(http_res)
482
+ raise models.APIError(
483
+ "API error occurred", http_res.status_code, http_res_text, http_res
484
+ )
485
+ if utils.match_response(http_res, "5XX", "*"):
486
+ http_res_text = utils.stream_to_text(http_res)
487
+ raise models.APIError(
488
+ "API error occurred", http_res.status_code, http_res_text, http_res
489
+ )
490
+
491
+ content_type = http_res.headers.get("Content-Type")
492
+ http_res_text = utils.stream_to_text(http_res)
493
+ raise models.APIError(
494
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
495
+ http_res.status_code,
496
+ http_res_text,
497
+ http_res,
498
+ )
499
+
500
+ async def regenerate_async(
501
+ self,
502
+ *,
503
+ api_key_id: str,
504
+ data: Optional[
505
+ Union[models.UpdateAPIKeyData, models.UpdateAPIKeyDataTypedDict]
506
+ ] = None,
507
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
508
+ server_url: Optional[str] = None,
509
+ timeout_ms: Optional[int] = None,
510
+ http_headers: Optional[Mapping[str, str]] = None,
511
+ ) -> models.UpdateAPIKeyResponseBody:
512
+ r"""Regenerate API Key
513
+
514
+ Regenerate an existing API Key that is tied to the current user. This overrides the previous key.
515
+
516
+
517
+ :param api_key_id:
518
+ :param data:
519
+ :param retries: Override the default retry configuration for this method
520
+ :param server_url: Override the default server URL for this method
521
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
522
+ :param http_headers: Additional headers to set or replace on requests.
523
+ """
524
+ base_url = None
525
+ url_variables = None
526
+ if timeout_ms is None:
527
+ timeout_ms = self.sdk_configuration.timeout_ms
528
+
529
+ if server_url is not None:
530
+ base_url = server_url
531
+ else:
532
+ base_url = self._get_url(base_url, url_variables)
533
+
534
+ request = models.UpdateAPIKeyRequest(
535
+ api_key_id=api_key_id,
536
+ update_api_key=models.UpdateAPIKey(
537
+ data=utils.get_pydantic_model(data, Optional[models.UpdateAPIKeyData]),
538
+ ),
539
+ )
540
+
541
+ req = self._build_request_async(
542
+ method="PUT",
543
+ path="/auth/api_keys/{api_key_id}",
544
+ base_url=base_url,
545
+ url_variables=url_variables,
546
+ request=request,
547
+ request_body_required=True,
548
+ request_has_path_params=True,
549
+ request_has_query_params=True,
550
+ user_agent_header="user-agent",
551
+ accept_header_value="application/vnd.api+json",
552
+ http_headers=http_headers,
553
+ security=self.sdk_configuration.security,
554
+ get_serialized_body=lambda: utils.serialize_request_body(
555
+ request.update_api_key, False, False, "json", models.UpdateAPIKey
556
+ ),
557
+ timeout_ms=timeout_ms,
558
+ )
559
+
560
+ if retries == UNSET:
561
+ if self.sdk_configuration.retry_config is not UNSET:
562
+ retries = self.sdk_configuration.retry_config
563
+
564
+ retry_config = None
565
+ if isinstance(retries, utils.RetryConfig):
566
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
567
+
568
+ http_res = await self.do_request_async(
569
+ hook_ctx=HookContext(
570
+ base_url=base_url or "",
571
+ operation_id="update-api-key",
572
+ oauth2_scopes=[],
573
+ security_source=get_security_from_env(
574
+ self.sdk_configuration.security, models.Security
575
+ ),
576
+ ),
577
+ request=req,
578
+ error_status_codes=["400", "404", "4XX", "5XX"],
579
+ retry_config=retry_config,
580
+ )
581
+
582
+ response_data: Any = None
583
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
584
+ return utils.unmarshal_json(http_res.text, models.UpdateAPIKeyResponseBody)
585
+ if utils.match_response(http_res, ["400", "404"], "application/vnd.api+json"):
586
+ response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
587
+ raise models.ErrorObject(data=response_data)
588
+ if utils.match_response(http_res, "4XX", "*"):
589
+ http_res_text = await utils.stream_to_text_async(http_res)
590
+ raise models.APIError(
591
+ "API error occurred", http_res.status_code, http_res_text, http_res
592
+ )
593
+ if utils.match_response(http_res, "5XX", "*"):
594
+ http_res_text = await utils.stream_to_text_async(http_res)
595
+ raise models.APIError(
596
+ "API error occurred", http_res.status_code, http_res_text, http_res
597
+ )
598
+
599
+ content_type = http_res.headers.get("Content-Type")
600
+ http_res_text = await utils.stream_to_text_async(http_res)
601
+ raise models.APIError(
602
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
603
+ http_res.status_code,
604
+ http_res_text,
605
+ http_res,
606
+ )
607
+
608
+ def delete(
609
+ self,
610
+ *,
611
+ api_key_id: str,
612
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
613
+ server_url: Optional[str] = None,
614
+ timeout_ms: Optional[int] = None,
615
+ http_headers: Optional[Mapping[str, str]] = None,
616
+ ):
617
+ r"""Delete API Key
618
+
619
+ Delete an existing API Key. Once deleted, the API Key can no longer be used to access the API.
620
+
621
+
622
+ :param api_key_id:
623
+ :param retries: Override the default retry configuration for this method
624
+ :param server_url: Override the default server URL for this method
625
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
626
+ :param http_headers: Additional headers to set or replace on requests.
627
+ """
628
+ base_url = None
629
+ url_variables = None
630
+ if timeout_ms is None:
631
+ timeout_ms = self.sdk_configuration.timeout_ms
632
+
633
+ if server_url is not None:
634
+ base_url = server_url
635
+ else:
636
+ base_url = self._get_url(base_url, url_variables)
637
+
638
+ request = models.DeleteAPIKeyRequest(
639
+ api_key_id=api_key_id,
640
+ )
641
+
642
+ req = self._build_request(
643
+ method="DELETE",
644
+ path="/auth/api_keys/{api_key_id}",
645
+ base_url=base_url,
646
+ url_variables=url_variables,
647
+ request=request,
648
+ request_body_required=False,
649
+ request_has_path_params=True,
650
+ request_has_query_params=True,
651
+ user_agent_header="user-agent",
652
+ accept_header_value="application/vnd.api+json",
653
+ http_headers=http_headers,
654
+ security=self.sdk_configuration.security,
655
+ timeout_ms=timeout_ms,
656
+ )
657
+
658
+ if retries == UNSET:
659
+ if self.sdk_configuration.retry_config is not UNSET:
660
+ retries = self.sdk_configuration.retry_config
661
+
662
+ retry_config = None
663
+ if isinstance(retries, utils.RetryConfig):
664
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
665
+
666
+ http_res = self.do_request(
667
+ hook_ctx=HookContext(
668
+ base_url=base_url or "",
669
+ operation_id="delete-api-key",
670
+ oauth2_scopes=[],
671
+ security_source=get_security_from_env(
672
+ self.sdk_configuration.security, models.Security
673
+ ),
674
+ ),
675
+ request=req,
676
+ error_status_codes=["404", "4XX", "5XX"],
677
+ retry_config=retry_config,
678
+ )
679
+
680
+ response_data: Any = None
681
+ if utils.match_response(http_res, "200", "*"):
682
+ return
683
+ if utils.match_response(http_res, "404", "application/vnd.api+json"):
684
+ response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
685
+ raise models.ErrorObject(data=response_data)
686
+ if utils.match_response(http_res, "4XX", "*"):
687
+ http_res_text = utils.stream_to_text(http_res)
688
+ raise models.APIError(
689
+ "API error occurred", http_res.status_code, http_res_text, http_res
690
+ )
691
+ if utils.match_response(http_res, "5XX", "*"):
692
+ http_res_text = utils.stream_to_text(http_res)
693
+ raise models.APIError(
694
+ "API error occurred", http_res.status_code, http_res_text, http_res
695
+ )
696
+
697
+ content_type = http_res.headers.get("Content-Type")
698
+ http_res_text = utils.stream_to_text(http_res)
699
+ raise models.APIError(
700
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
701
+ http_res.status_code,
702
+ http_res_text,
703
+ http_res,
704
+ )
705
+
706
+ async def delete_async(
707
+ self,
708
+ *,
709
+ api_key_id: str,
710
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
711
+ server_url: Optional[str] = None,
712
+ timeout_ms: Optional[int] = None,
713
+ http_headers: Optional[Mapping[str, str]] = None,
714
+ ):
715
+ r"""Delete API Key
716
+
717
+ Delete an existing API Key. Once deleted, the API Key can no longer be used to access the API.
718
+
719
+
720
+ :param api_key_id:
721
+ :param retries: Override the default retry configuration for this method
722
+ :param server_url: Override the default server URL for this method
723
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
724
+ :param http_headers: Additional headers to set or replace on requests.
725
+ """
726
+ base_url = None
727
+ url_variables = None
728
+ if timeout_ms is None:
729
+ timeout_ms = self.sdk_configuration.timeout_ms
730
+
731
+ if server_url is not None:
732
+ base_url = server_url
733
+ else:
734
+ base_url = self._get_url(base_url, url_variables)
735
+
736
+ request = models.DeleteAPIKeyRequest(
737
+ api_key_id=api_key_id,
738
+ )
739
+
740
+ req = self._build_request_async(
741
+ method="DELETE",
742
+ path="/auth/api_keys/{api_key_id}",
743
+ base_url=base_url,
744
+ url_variables=url_variables,
745
+ request=request,
746
+ request_body_required=False,
747
+ request_has_path_params=True,
748
+ request_has_query_params=True,
749
+ user_agent_header="user-agent",
750
+ accept_header_value="application/vnd.api+json",
751
+ http_headers=http_headers,
752
+ security=self.sdk_configuration.security,
753
+ timeout_ms=timeout_ms,
754
+ )
755
+
756
+ if retries == UNSET:
757
+ if self.sdk_configuration.retry_config is not UNSET:
758
+ retries = self.sdk_configuration.retry_config
759
+
760
+ retry_config = None
761
+ if isinstance(retries, utils.RetryConfig):
762
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
763
+
764
+ http_res = await self.do_request_async(
765
+ hook_ctx=HookContext(
766
+ base_url=base_url or "",
767
+ operation_id="delete-api-key",
768
+ oauth2_scopes=[],
769
+ security_source=get_security_from_env(
770
+ self.sdk_configuration.security, models.Security
771
+ ),
772
+ ),
773
+ request=req,
774
+ error_status_codes=["404", "4XX", "5XX"],
775
+ retry_config=retry_config,
776
+ )
777
+
778
+ response_data: Any = None
779
+ if utils.match_response(http_res, "200", "*"):
780
+ return
781
+ if utils.match_response(http_res, "404", "application/vnd.api+json"):
782
+ response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
783
+ raise models.ErrorObject(data=response_data)
784
+ if utils.match_response(http_res, "4XX", "*"):
785
+ http_res_text = await utils.stream_to_text_async(http_res)
786
+ raise models.APIError(
787
+ "API error occurred", http_res.status_code, http_res_text, http_res
788
+ )
789
+ if utils.match_response(http_res, "5XX", "*"):
790
+ http_res_text = await utils.stream_to_text_async(http_res)
791
+ raise models.APIError(
792
+ "API error occurred", http_res.status_code, http_res_text, http_res
793
+ )
794
+
795
+ content_type = http_res.headers.get("Content-Type")
796
+ http_res_text = await utils.stream_to_text_async(http_res)
797
+ raise models.APIError(
798
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
799
+ http_res.status_code,
800
+ http_res_text,
801
+ http_res,
802
+ )