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