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,703 @@
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 APIKeys(BaseSDK):
13
+ def list(
14
+ self,
15
+ *,
16
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
17
+ server_url: Optional[str] = None,
18
+ timeout_ms: Optional[int] = None,
19
+ http_headers: Optional[Mapping[str, str]] = None,
20
+ ) -> models.APIKey:
21
+ r"""List API Keys
22
+
23
+ Returns a list of all API keys from the team members
24
+
25
+
26
+ :param retries: Override the default retry configuration for this method
27
+ :param server_url: Override the default server URL for this method
28
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
29
+ :param http_headers: Additional headers to set or replace on requests.
30
+ """
31
+ base_url = None
32
+ url_variables = None
33
+ if timeout_ms is None:
34
+ timeout_ms = self.sdk_configuration.timeout_ms
35
+
36
+ if server_url is not None:
37
+ base_url = server_url
38
+ else:
39
+ base_url = self._get_url(base_url, url_variables)
40
+ req = self._build_request(
41
+ method="GET",
42
+ path="/auth/api_keys",
43
+ base_url=base_url,
44
+ url_variables=url_variables,
45
+ request=None,
46
+ request_body_required=False,
47
+ request_has_path_params=False,
48
+ request_has_query_params=True,
49
+ user_agent_header="user-agent",
50
+ accept_header_value="application/vnd.api+json",
51
+ http_headers=http_headers,
52
+ security=self.sdk_configuration.security,
53
+ allow_empty_value=None,
54
+ timeout_ms=timeout_ms,
55
+ )
56
+
57
+ if retries == UNSET:
58
+ if self.sdk_configuration.retry_config is not UNSET:
59
+ retries = self.sdk_configuration.retry_config
60
+
61
+ retry_config = None
62
+ if isinstance(retries, utils.RetryConfig):
63
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
64
+
65
+ http_res = self.do_request(
66
+ hook_ctx=HookContext(
67
+ config=self.sdk_configuration,
68
+ base_url=base_url or "",
69
+ operation_id="get-api-keys",
70
+ oauth2_scopes=None,
71
+ security_source=get_security_from_env(
72
+ self.sdk_configuration.security, models.Security
73
+ ),
74
+ ),
75
+ request=req,
76
+ error_status_codes=["4XX", "5XX"],
77
+ retry_config=retry_config,
78
+ )
79
+
80
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
81
+ return unmarshal_json_response(models.APIKey, http_res)
82
+ if utils.match_response(http_res, "4XX", "*"):
83
+ http_res_text = utils.stream_to_text(http_res)
84
+ raise models.APIError("API error occurred", http_res, http_res_text)
85
+ if utils.match_response(http_res, "5XX", "*"):
86
+ http_res_text = utils.stream_to_text(http_res)
87
+ raise models.APIError("API error occurred", http_res, http_res_text)
88
+
89
+ raise models.APIError("Unexpected response received", http_res)
90
+
91
+ async def list_async(
92
+ self,
93
+ *,
94
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
95
+ server_url: Optional[str] = None,
96
+ timeout_ms: Optional[int] = None,
97
+ http_headers: Optional[Mapping[str, str]] = None,
98
+ ) -> models.APIKey:
99
+ r"""List API Keys
100
+
101
+ Returns a list of all API keys from the team members
102
+
103
+
104
+ :param retries: Override the default retry configuration for this method
105
+ :param server_url: Override the default server URL for this method
106
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
107
+ :param http_headers: Additional headers to set or replace on requests.
108
+ """
109
+ base_url = None
110
+ url_variables = None
111
+ if timeout_ms is None:
112
+ timeout_ms = self.sdk_configuration.timeout_ms
113
+
114
+ if server_url is not None:
115
+ base_url = server_url
116
+ else:
117
+ base_url = self._get_url(base_url, url_variables)
118
+ req = self._build_request_async(
119
+ method="GET",
120
+ path="/auth/api_keys",
121
+ base_url=base_url,
122
+ url_variables=url_variables,
123
+ request=None,
124
+ request_body_required=False,
125
+ request_has_path_params=False,
126
+ request_has_query_params=True,
127
+ user_agent_header="user-agent",
128
+ accept_header_value="application/vnd.api+json",
129
+ http_headers=http_headers,
130
+ security=self.sdk_configuration.security,
131
+ allow_empty_value=None,
132
+ timeout_ms=timeout_ms,
133
+ )
134
+
135
+ if retries == UNSET:
136
+ if self.sdk_configuration.retry_config is not UNSET:
137
+ retries = self.sdk_configuration.retry_config
138
+
139
+ retry_config = None
140
+ if isinstance(retries, utils.RetryConfig):
141
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
142
+
143
+ http_res = await self.do_request_async(
144
+ hook_ctx=HookContext(
145
+ config=self.sdk_configuration,
146
+ base_url=base_url or "",
147
+ operation_id="get-api-keys",
148
+ oauth2_scopes=None,
149
+ security_source=get_security_from_env(
150
+ self.sdk_configuration.security, models.Security
151
+ ),
152
+ ),
153
+ request=req,
154
+ error_status_codes=["4XX", "5XX"],
155
+ retry_config=retry_config,
156
+ )
157
+
158
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
159
+ return unmarshal_json_response(models.APIKey, http_res)
160
+ if utils.match_response(http_res, "4XX", "*"):
161
+ http_res_text = await utils.stream_to_text_async(http_res)
162
+ raise models.APIError("API error occurred", http_res, http_res_text)
163
+ if utils.match_response(http_res, "5XX", "*"):
164
+ http_res_text = await utils.stream_to_text_async(http_res)
165
+ raise models.APIError("API error occurred", http_res, http_res_text)
166
+
167
+ raise models.APIError("Unexpected response received", http_res)
168
+
169
+ def create(
170
+ self,
171
+ *,
172
+ data: Optional[Union[models.Data, models.DataTypedDict]] = None,
173
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
174
+ server_url: Optional[str] = None,
175
+ timeout_ms: Optional[int] = None,
176
+ http_headers: Optional[Mapping[str, str]] = None,
177
+ ) -> models.PostAPIKeyResponseBody:
178
+ r"""Create API Key
179
+
180
+ 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.
181
+
182
+
183
+ :param data:
184
+ :param retries: Override the default retry configuration for this method
185
+ :param server_url: Override the default server URL for this method
186
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
187
+ :param http_headers: Additional headers to set or replace on requests.
188
+ """
189
+ base_url = None
190
+ url_variables = None
191
+ if timeout_ms is None:
192
+ timeout_ms = self.sdk_configuration.timeout_ms
193
+
194
+ if server_url is not None:
195
+ base_url = server_url
196
+ else:
197
+ base_url = self._get_url(base_url, url_variables)
198
+
199
+ request = models.CreateAPIKey(
200
+ data=utils.get_pydantic_model(data, Optional[models.Data]),
201
+ )
202
+
203
+ req = self._build_request(
204
+ method="POST",
205
+ path="/auth/api_keys",
206
+ base_url=base_url,
207
+ url_variables=url_variables,
208
+ request=request,
209
+ request_body_required=True,
210
+ request_has_path_params=False,
211
+ request_has_query_params=True,
212
+ user_agent_header="user-agent",
213
+ accept_header_value="application/vnd.api+json",
214
+ http_headers=http_headers,
215
+ security=self.sdk_configuration.security,
216
+ get_serialized_body=lambda: utils.serialize_request_body(
217
+ request, False, False, "json", models.CreateAPIKey
218
+ ),
219
+ allow_empty_value=None,
220
+ timeout_ms=timeout_ms,
221
+ )
222
+
223
+ if retries == UNSET:
224
+ if self.sdk_configuration.retry_config is not UNSET:
225
+ retries = self.sdk_configuration.retry_config
226
+
227
+ retry_config = None
228
+ if isinstance(retries, utils.RetryConfig):
229
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
230
+
231
+ http_res = self.do_request(
232
+ hook_ctx=HookContext(
233
+ config=self.sdk_configuration,
234
+ base_url=base_url or "",
235
+ operation_id="post-api-key",
236
+ oauth2_scopes=None,
237
+ security_source=get_security_from_env(
238
+ self.sdk_configuration.security, models.Security
239
+ ),
240
+ ),
241
+ request=req,
242
+ error_status_codes=["4XX", "5XX"],
243
+ retry_config=retry_config,
244
+ )
245
+
246
+ if utils.match_response(http_res, "201", "application/vnd.api+json"):
247
+ return unmarshal_json_response(models.PostAPIKeyResponseBody, http_res)
248
+ if utils.match_response(http_res, "4XX", "*"):
249
+ http_res_text = utils.stream_to_text(http_res)
250
+ raise models.APIError("API error occurred", http_res, http_res_text)
251
+ if utils.match_response(http_res, "5XX", "*"):
252
+ http_res_text = utils.stream_to_text(http_res)
253
+ raise models.APIError("API error occurred", http_res, http_res_text)
254
+
255
+ raise models.APIError("Unexpected response received", http_res)
256
+
257
+ async def create_async(
258
+ self,
259
+ *,
260
+ data: Optional[Union[models.Data, models.DataTypedDict]] = None,
261
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
262
+ server_url: Optional[str] = None,
263
+ timeout_ms: Optional[int] = None,
264
+ http_headers: Optional[Mapping[str, str]] = None,
265
+ ) -> models.PostAPIKeyResponseBody:
266
+ r"""Create API Key
267
+
268
+ 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.
269
+
270
+
271
+ :param data:
272
+ :param retries: Override the default retry configuration for this method
273
+ :param server_url: Override the default server URL for this method
274
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
275
+ :param http_headers: Additional headers to set or replace on requests.
276
+ """
277
+ base_url = None
278
+ url_variables = None
279
+ if timeout_ms is None:
280
+ timeout_ms = self.sdk_configuration.timeout_ms
281
+
282
+ if server_url is not None:
283
+ base_url = server_url
284
+ else:
285
+ base_url = self._get_url(base_url, url_variables)
286
+
287
+ request = models.CreateAPIKey(
288
+ data=utils.get_pydantic_model(data, Optional[models.Data]),
289
+ )
290
+
291
+ req = self._build_request_async(
292
+ method="POST",
293
+ path="/auth/api_keys",
294
+ base_url=base_url,
295
+ url_variables=url_variables,
296
+ request=request,
297
+ request_body_required=True,
298
+ request_has_path_params=False,
299
+ request_has_query_params=True,
300
+ user_agent_header="user-agent",
301
+ accept_header_value="application/vnd.api+json",
302
+ http_headers=http_headers,
303
+ security=self.sdk_configuration.security,
304
+ get_serialized_body=lambda: utils.serialize_request_body(
305
+ request, False, False, "json", models.CreateAPIKey
306
+ ),
307
+ allow_empty_value=None,
308
+ timeout_ms=timeout_ms,
309
+ )
310
+
311
+ if retries == UNSET:
312
+ if self.sdk_configuration.retry_config is not UNSET:
313
+ retries = self.sdk_configuration.retry_config
314
+
315
+ retry_config = None
316
+ if isinstance(retries, utils.RetryConfig):
317
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
318
+
319
+ http_res = await self.do_request_async(
320
+ hook_ctx=HookContext(
321
+ config=self.sdk_configuration,
322
+ base_url=base_url or "",
323
+ operation_id="post-api-key",
324
+ oauth2_scopes=None,
325
+ security_source=get_security_from_env(
326
+ self.sdk_configuration.security, models.Security
327
+ ),
328
+ ),
329
+ request=req,
330
+ error_status_codes=["4XX", "5XX"],
331
+ retry_config=retry_config,
332
+ )
333
+
334
+ if utils.match_response(http_res, "201", "application/vnd.api+json"):
335
+ return unmarshal_json_response(models.PostAPIKeyResponseBody, http_res)
336
+ if utils.match_response(http_res, "4XX", "*"):
337
+ http_res_text = await utils.stream_to_text_async(http_res)
338
+ raise models.APIError("API error occurred", http_res, http_res_text)
339
+ if utils.match_response(http_res, "5XX", "*"):
340
+ http_res_text = await utils.stream_to_text_async(http_res)
341
+ raise models.APIError("API error occurred", http_res, http_res_text)
342
+
343
+ raise models.APIError("Unexpected response received", http_res)
344
+
345
+ def regenerate(
346
+ self,
347
+ *,
348
+ api_key_id: str,
349
+ data: Optional[
350
+ Union[models.UpdateAPIKeyData, models.UpdateAPIKeyDataTypedDict]
351
+ ] = None,
352
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
353
+ server_url: Optional[str] = None,
354
+ timeout_ms: Optional[int] = None,
355
+ http_headers: Optional[Mapping[str, str]] = None,
356
+ ) -> models.UpdateAPIKeyResponseBody:
357
+ r"""Regenerate API Key
358
+
359
+ Regenerate an existing API Key that is tied to the current user. This overrides the previous key.
360
+
361
+
362
+ :param api_key_id:
363
+ :param data:
364
+ :param retries: Override the default retry configuration for this method
365
+ :param server_url: Override the default server URL for this method
366
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
367
+ :param http_headers: Additional headers to set or replace on requests.
368
+ """
369
+ base_url = None
370
+ url_variables = None
371
+ if timeout_ms is None:
372
+ timeout_ms = self.sdk_configuration.timeout_ms
373
+
374
+ if server_url is not None:
375
+ base_url = server_url
376
+ else:
377
+ base_url = self._get_url(base_url, url_variables)
378
+
379
+ request = models.UpdateAPIKeyRequest(
380
+ api_key_id=api_key_id,
381
+ update_api_key=models.UpdateAPIKey(
382
+ data=utils.get_pydantic_model(data, Optional[models.UpdateAPIKeyData]),
383
+ ),
384
+ )
385
+
386
+ req = self._build_request(
387
+ method="PUT",
388
+ path="/auth/api_keys/{api_key_id}",
389
+ base_url=base_url,
390
+ url_variables=url_variables,
391
+ request=request,
392
+ request_body_required=True,
393
+ request_has_path_params=True,
394
+ request_has_query_params=True,
395
+ user_agent_header="user-agent",
396
+ accept_header_value="application/vnd.api+json",
397
+ http_headers=http_headers,
398
+ security=self.sdk_configuration.security,
399
+ get_serialized_body=lambda: utils.serialize_request_body(
400
+ request.update_api_key, False, False, "json", models.UpdateAPIKey
401
+ ),
402
+ allow_empty_value=None,
403
+ timeout_ms=timeout_ms,
404
+ )
405
+
406
+ if retries == UNSET:
407
+ if self.sdk_configuration.retry_config is not UNSET:
408
+ retries = self.sdk_configuration.retry_config
409
+
410
+ retry_config = None
411
+ if isinstance(retries, utils.RetryConfig):
412
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
413
+
414
+ http_res = self.do_request(
415
+ hook_ctx=HookContext(
416
+ config=self.sdk_configuration,
417
+ base_url=base_url or "",
418
+ operation_id="update-api-key",
419
+ oauth2_scopes=None,
420
+ security_source=get_security_from_env(
421
+ self.sdk_configuration.security, models.Security
422
+ ),
423
+ ),
424
+ request=req,
425
+ error_status_codes=["4XX", "5XX"],
426
+ retry_config=retry_config,
427
+ )
428
+
429
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
430
+ return unmarshal_json_response(models.UpdateAPIKeyResponseBody, http_res)
431
+ if utils.match_response(http_res, "4XX", "*"):
432
+ http_res_text = utils.stream_to_text(http_res)
433
+ raise models.APIError("API error occurred", http_res, http_res_text)
434
+ if utils.match_response(http_res, "5XX", "*"):
435
+ http_res_text = utils.stream_to_text(http_res)
436
+ raise models.APIError("API error occurred", http_res, http_res_text)
437
+
438
+ raise models.APIError("Unexpected response received", http_res)
439
+
440
+ async def regenerate_async(
441
+ self,
442
+ *,
443
+ api_key_id: str,
444
+ data: Optional[
445
+ Union[models.UpdateAPIKeyData, models.UpdateAPIKeyDataTypedDict]
446
+ ] = None,
447
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
448
+ server_url: Optional[str] = None,
449
+ timeout_ms: Optional[int] = None,
450
+ http_headers: Optional[Mapping[str, str]] = None,
451
+ ) -> models.UpdateAPIKeyResponseBody:
452
+ r"""Regenerate API Key
453
+
454
+ Regenerate an existing API Key that is tied to the current user. This overrides the previous key.
455
+
456
+
457
+ :param api_key_id:
458
+ :param data:
459
+ :param retries: Override the default retry configuration for this method
460
+ :param server_url: Override the default server URL for this method
461
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
462
+ :param http_headers: Additional headers to set or replace on requests.
463
+ """
464
+ base_url = None
465
+ url_variables = None
466
+ if timeout_ms is None:
467
+ timeout_ms = self.sdk_configuration.timeout_ms
468
+
469
+ if server_url is not None:
470
+ base_url = server_url
471
+ else:
472
+ base_url = self._get_url(base_url, url_variables)
473
+
474
+ request = models.UpdateAPIKeyRequest(
475
+ api_key_id=api_key_id,
476
+ update_api_key=models.UpdateAPIKey(
477
+ data=utils.get_pydantic_model(data, Optional[models.UpdateAPIKeyData]),
478
+ ),
479
+ )
480
+
481
+ req = self._build_request_async(
482
+ method="PUT",
483
+ path="/auth/api_keys/{api_key_id}",
484
+ base_url=base_url,
485
+ url_variables=url_variables,
486
+ request=request,
487
+ request_body_required=True,
488
+ request_has_path_params=True,
489
+ request_has_query_params=True,
490
+ user_agent_header="user-agent",
491
+ accept_header_value="application/vnd.api+json",
492
+ http_headers=http_headers,
493
+ security=self.sdk_configuration.security,
494
+ get_serialized_body=lambda: utils.serialize_request_body(
495
+ request.update_api_key, False, False, "json", models.UpdateAPIKey
496
+ ),
497
+ allow_empty_value=None,
498
+ timeout_ms=timeout_ms,
499
+ )
500
+
501
+ if retries == UNSET:
502
+ if self.sdk_configuration.retry_config is not UNSET:
503
+ retries = self.sdk_configuration.retry_config
504
+
505
+ retry_config = None
506
+ if isinstance(retries, utils.RetryConfig):
507
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
508
+
509
+ http_res = await self.do_request_async(
510
+ hook_ctx=HookContext(
511
+ config=self.sdk_configuration,
512
+ base_url=base_url or "",
513
+ operation_id="update-api-key",
514
+ oauth2_scopes=None,
515
+ security_source=get_security_from_env(
516
+ self.sdk_configuration.security, models.Security
517
+ ),
518
+ ),
519
+ request=req,
520
+ error_status_codes=["4XX", "5XX"],
521
+ retry_config=retry_config,
522
+ )
523
+
524
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
525
+ return unmarshal_json_response(models.UpdateAPIKeyResponseBody, http_res)
526
+ if utils.match_response(http_res, "4XX", "*"):
527
+ http_res_text = await utils.stream_to_text_async(http_res)
528
+ raise models.APIError("API error occurred", http_res, http_res_text)
529
+ if utils.match_response(http_res, "5XX", "*"):
530
+ http_res_text = await utils.stream_to_text_async(http_res)
531
+ raise models.APIError("API error occurred", http_res, http_res_text)
532
+
533
+ raise models.APIError("Unexpected response received", http_res)
534
+
535
+ def delete(
536
+ self,
537
+ *,
538
+ api_key_id: str,
539
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
540
+ server_url: Optional[str] = None,
541
+ timeout_ms: Optional[int] = None,
542
+ http_headers: Optional[Mapping[str, str]] = None,
543
+ ):
544
+ r"""Delete API Key
545
+
546
+ Delete an existing API Key. Once deleted, the API Key can no longer be used to access the API.
547
+
548
+
549
+ :param api_key_id:
550
+ :param retries: Override the default retry configuration for this method
551
+ :param server_url: Override the default server URL for this method
552
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
553
+ :param http_headers: Additional headers to set or replace on requests.
554
+ """
555
+ base_url = None
556
+ url_variables = None
557
+ if timeout_ms is None:
558
+ timeout_ms = self.sdk_configuration.timeout_ms
559
+
560
+ if server_url is not None:
561
+ base_url = server_url
562
+ else:
563
+ base_url = self._get_url(base_url, url_variables)
564
+
565
+ request = models.DeleteAPIKeyRequest(
566
+ api_key_id=api_key_id,
567
+ )
568
+
569
+ req = self._build_request(
570
+ method="DELETE",
571
+ path="/auth/api_keys/{api_key_id}",
572
+ base_url=base_url,
573
+ url_variables=url_variables,
574
+ request=request,
575
+ request_body_required=False,
576
+ request_has_path_params=True,
577
+ request_has_query_params=True,
578
+ user_agent_header="user-agent",
579
+ accept_header_value="*/*",
580
+ http_headers=http_headers,
581
+ security=self.sdk_configuration.security,
582
+ allow_empty_value=None,
583
+ timeout_ms=timeout_ms,
584
+ )
585
+
586
+ if retries == UNSET:
587
+ if self.sdk_configuration.retry_config is not UNSET:
588
+ retries = self.sdk_configuration.retry_config
589
+
590
+ retry_config = None
591
+ if isinstance(retries, utils.RetryConfig):
592
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
593
+
594
+ http_res = self.do_request(
595
+ hook_ctx=HookContext(
596
+ config=self.sdk_configuration,
597
+ base_url=base_url or "",
598
+ operation_id="delete-api-key",
599
+ oauth2_scopes=None,
600
+ security_source=get_security_from_env(
601
+ self.sdk_configuration.security, models.Security
602
+ ),
603
+ ),
604
+ request=req,
605
+ error_status_codes=["4XX", "5XX"],
606
+ retry_config=retry_config,
607
+ )
608
+
609
+ if utils.match_response(http_res, "200", "*"):
610
+ return
611
+ if utils.match_response(http_res, "4XX", "*"):
612
+ http_res_text = utils.stream_to_text(http_res)
613
+ raise models.APIError("API error occurred", http_res, http_res_text)
614
+ if utils.match_response(http_res, "5XX", "*"):
615
+ http_res_text = utils.stream_to_text(http_res)
616
+ raise models.APIError("API error occurred", http_res, http_res_text)
617
+
618
+ raise models.APIError("Unexpected response received", http_res)
619
+
620
+ async def delete_async(
621
+ self,
622
+ *,
623
+ api_key_id: str,
624
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
625
+ server_url: Optional[str] = None,
626
+ timeout_ms: Optional[int] = None,
627
+ http_headers: Optional[Mapping[str, str]] = None,
628
+ ):
629
+ r"""Delete API Key
630
+
631
+ Delete an existing API Key. Once deleted, the API Key can no longer be used to access the API.
632
+
633
+
634
+ :param api_key_id:
635
+ :param retries: Override the default retry configuration for this method
636
+ :param server_url: Override the default server URL for this method
637
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
638
+ :param http_headers: Additional headers to set or replace on requests.
639
+ """
640
+ base_url = None
641
+ url_variables = None
642
+ if timeout_ms is None:
643
+ timeout_ms = self.sdk_configuration.timeout_ms
644
+
645
+ if server_url is not None:
646
+ base_url = server_url
647
+ else:
648
+ base_url = self._get_url(base_url, url_variables)
649
+
650
+ request = models.DeleteAPIKeyRequest(
651
+ api_key_id=api_key_id,
652
+ )
653
+
654
+ req = self._build_request_async(
655
+ method="DELETE",
656
+ path="/auth/api_keys/{api_key_id}",
657
+ base_url=base_url,
658
+ url_variables=url_variables,
659
+ request=request,
660
+ request_body_required=False,
661
+ request_has_path_params=True,
662
+ request_has_query_params=True,
663
+ user_agent_header="user-agent",
664
+ accept_header_value="*/*",
665
+ http_headers=http_headers,
666
+ security=self.sdk_configuration.security,
667
+ allow_empty_value=None,
668
+ timeout_ms=timeout_ms,
669
+ )
670
+
671
+ if retries == UNSET:
672
+ if self.sdk_configuration.retry_config is not UNSET:
673
+ retries = self.sdk_configuration.retry_config
674
+
675
+ retry_config = None
676
+ if isinstance(retries, utils.RetryConfig):
677
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
678
+
679
+ http_res = await self.do_request_async(
680
+ hook_ctx=HookContext(
681
+ config=self.sdk_configuration,
682
+ base_url=base_url or "",
683
+ operation_id="delete-api-key",
684
+ oauth2_scopes=None,
685
+ security_source=get_security_from_env(
686
+ self.sdk_configuration.security, models.Security
687
+ ),
688
+ ),
689
+ request=req,
690
+ error_status_codes=["4XX", "5XX"],
691
+ retry_config=retry_config,
692
+ )
693
+
694
+ if utils.match_response(http_res, "200", "*"):
695
+ return
696
+ if utils.match_response(http_res, "4XX", "*"):
697
+ http_res_text = await utils.stream_to_text_async(http_res)
698
+ raise models.APIError("API error occurred", http_res, http_res_text)
699
+ if utils.match_response(http_res, "5XX", "*"):
700
+ http_res_text = await utils.stream_to_text_async(http_res)
701
+ raise models.APIError("API error occurred", http_res, http_res_text)
702
+
703
+ raise models.APIError("Unexpected response received", http_res)