latitudesh-python-sdk 1.0.0__py3-none-any.whl → 2.0.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.
Potentially problematic release.
This version of latitudesh-python-sdk might be problematic. Click here for more details.
- latitudesh_python_sdk/_hooks/types.py +7 -0
- latitudesh_python_sdk/_version.py +6 -4
- latitudesh_python_sdk/apikeys.py +22 -18
- latitudesh_python_sdk/basesdk.py +12 -20
- latitudesh_python_sdk/billing.py +2 -0
- latitudesh_python_sdk/events_sdk.py +86 -5
- latitudesh_python_sdk/firewalls_sdk.py +146 -9
- latitudesh_python_sdk/httpclient.py +6 -16
- latitudesh_python_sdk/ipaddresses_sdk.py +82 -5
- latitudesh_python_sdk/models/__init__.py +2597 -1071
- latitudesh_python_sdk/models/assign_server_virtual_networkop.py +2 -2
- latitudesh_python_sdk/models/{bandwidth_plan.py → bandwidth_plan_data.py} +9 -9
- latitudesh_python_sdk/models/bandwidth_plans.py +14 -3
- latitudesh_python_sdk/models/billing_usage.py +3 -0
- latitudesh_python_sdk/models/custom_tag.py +15 -0
- latitudesh_python_sdk/models/custom_tag_data.py +54 -0
- latitudesh_python_sdk/models/custom_tags.py +26 -0
- latitudesh_python_sdk/models/delete_ssh_keyop.py +16 -0
- latitudesh_python_sdk/models/delete_user_dataop.py +16 -0
- latitudesh_python_sdk/models/event_data.py +98 -0
- latitudesh_python_sdk/models/events.py +16 -1
- latitudesh_python_sdk/models/filesystem_data.py +4 -0
- latitudesh_python_sdk/models/firewall.py +15 -0
- latitudesh_python_sdk/models/firewall_assignment_data.py +50 -0
- latitudesh_python_sdk/models/firewall_assignments.py +29 -0
- latitudesh_python_sdk/models/firewall_data.py +71 -0
- latitudesh_python_sdk/models/firewall_server.py +4 -1
- latitudesh_python_sdk/models/firewalls.py +7 -7
- latitudesh_python_sdk/models/get_bandwidth_plansop.py +30 -1
- latitudesh_python_sdk/models/get_eventsop.py +29 -1
- latitudesh_python_sdk/models/get_firewall_assignmentsop.py +37 -2
- latitudesh_python_sdk/models/get_ipsop.py +30 -1
- latitudesh_python_sdk/models/get_plans_operating_systemop.py +37 -2
- latitudesh_python_sdk/models/get_projectsop.py +30 -1
- latitudesh_python_sdk/models/get_regionsop.py +42 -0
- latitudesh_python_sdk/models/get_rolesop.py +37 -2
- latitudesh_python_sdk/models/get_serversop.py +30 -1
- latitudesh_python_sdk/models/get_ssh_keyop.py +30 -0
- latitudesh_python_sdk/models/get_ssh_keysop.py +22 -0
- latitudesh_python_sdk/models/get_team_membersop.py +42 -0
- latitudesh_python_sdk/models/get_traffic_consumptionop.py +8 -4
- latitudesh_python_sdk/models/get_user_dataop.py +31 -0
- latitudesh_python_sdk/models/get_users_dataop.py +35 -0
- latitudesh_python_sdk/models/get_virtual_networks_assignmentsop.py +33 -1
- latitudesh_python_sdk/models/get_virtual_networksop.py +30 -1
- latitudesh_python_sdk/models/list_firewallsop.py +30 -1
- latitudesh_python_sdk/models/operating_system_data.py +65 -0
- latitudesh_python_sdk/models/operating_systems.py +15 -0
- latitudesh_python_sdk/models/out_of_band_connection.py +4 -4
- latitudesh_python_sdk/models/patch_user_dataop.py +69 -0
- latitudesh_python_sdk/models/post_ssh_keyop.py +58 -0
- latitudesh_python_sdk/models/post_user_dataop.py +45 -0
- latitudesh_python_sdk/models/project_include.py +3 -0
- latitudesh_python_sdk/models/put_ssh_keyop.py +80 -0
- latitudesh_python_sdk/models/role.py +11 -0
- latitudesh_python_sdk/models/server_data.py +8 -0
- latitudesh_python_sdk/models/{ssh_key.py → ssh_keys.py} +13 -2
- latitudesh_python_sdk/models/storage_plan_data.py +47 -0
- latitudesh_python_sdk/models/storage_plans.py +14 -3
- latitudesh_python_sdk/models/update_serverop.py +60 -10
- latitudesh_python_sdk/models/user_data.py +11 -0
- latitudesh_python_sdk/models/virtual_network.py +19 -1
- latitudesh_python_sdk/models/virtual_network1.py +15 -0
- latitudesh_python_sdk/models/virtual_network_assignment.py +41 -0
- latitudesh_python_sdk/models/virtual_network_assignment_data.py +68 -0
- latitudesh_python_sdk/models/virtual_network_assignments.py +5 -5
- latitudesh_python_sdk/models/virtual_network_data.py +88 -0
- latitudesh_python_sdk/models/virtual_networks.py +3 -3
- latitudesh_python_sdk/operatingsystems_sdk.py +78 -9
- latitudesh_python_sdk/plans.py +109 -30
- latitudesh_python_sdk/privatenetworks.py +185 -36
- latitudesh_python_sdk/projects_sdk.py +113 -32
- latitudesh_python_sdk/regions_sdk.py +78 -7
- latitudesh_python_sdk/roles.py +78 -7
- latitudesh_python_sdk/sdk.py +110 -73
- latitudesh_python_sdk/sdkconfiguration.py +0 -7
- latitudesh_python_sdk/servers_sdk.py +195 -50
- latitudesh_python_sdk/{sshkeys.py → sshkeys_sdk.py} +1030 -5
- latitudesh_python_sdk/storage.py +8 -0
- latitudesh_python_sdk/tags.py +30 -22
- latitudesh_python_sdk/teams_sdk.py +6 -0
- latitudesh_python_sdk/teamsmembers.py +80 -7
- latitudesh_python_sdk/traffic_sdk.py +12 -8
- latitudesh_python_sdk/userdata_sdk.py +1029 -0
- latitudesh_python_sdk/userprofile.py +6 -0
- latitudesh_python_sdk/utils/__init__.py +131 -45
- latitudesh_python_sdk/utils/datetimes.py +23 -0
- latitudesh_python_sdk/utils/forms.py +49 -28
- latitudesh_python_sdk/utils/serializers.py +32 -3
- latitudesh_python_sdk/virtualmachines.py +36 -18
- latitudesh_python_sdk/vpnsessions.py +38 -26
- {latitudesh_python_sdk-1.0.0.dist-info → latitudesh_python_sdk-2.0.0.dist-info}/METADATA +58 -22
- {latitudesh_python_sdk-1.0.0.dist-info → latitudesh_python_sdk-2.0.0.dist-info}/RECORD +95 -73
- {latitudesh_python_sdk-1.0.0.dist-info → latitudesh_python_sdk-2.0.0.dist-info}/WHEEL +1 -1
- latitudesh_python_sdk/models/storage_plan.py +0 -36
- {latitudesh_python_sdk-1.0.0.dist-info → latitudesh_python_sdk-2.0.0.dist-info}/LICENSE +0 -0
|
@@ -6,9 +6,13 @@ from latitudesh_python_sdk._hooks import HookContext
|
|
|
6
6
|
from latitudesh_python_sdk.types import OptionalNullable, UNSET
|
|
7
7
|
from latitudesh_python_sdk.utils import get_security_from_env
|
|
8
8
|
from typing import Mapping, Optional, Union
|
|
9
|
+
from typing_extensions import deprecated
|
|
9
10
|
|
|
10
11
|
|
|
11
|
-
class
|
|
12
|
+
class SSHKeysSDK(BaseSDK):
|
|
13
|
+
@deprecated(
|
|
14
|
+
"warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
|
|
15
|
+
)
|
|
12
16
|
def list_for_project(
|
|
13
17
|
self,
|
|
14
18
|
*,
|
|
@@ -18,7 +22,7 @@ class SSHKeys(BaseSDK):
|
|
|
18
22
|
server_url: Optional[str] = None,
|
|
19
23
|
timeout_ms: Optional[int] = None,
|
|
20
24
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
21
|
-
) -> models.
|
|
25
|
+
) -> models.SSHKeys:
|
|
22
26
|
r"""List all Project SSH Keys
|
|
23
27
|
|
|
24
28
|
List all SSH Keys in the project. These keys can be used to access servers after deploy and reinstall actions.
|
|
@@ -72,6 +76,7 @@ class SSHKeys(BaseSDK):
|
|
|
72
76
|
|
|
73
77
|
http_res = self.do_request(
|
|
74
78
|
hook_ctx=HookContext(
|
|
79
|
+
config=self.sdk_configuration,
|
|
75
80
|
base_url=base_url or "",
|
|
76
81
|
operation_id="get-project-ssh-keys",
|
|
77
82
|
oauth2_scopes=[],
|
|
@@ -85,7 +90,7 @@ class SSHKeys(BaseSDK):
|
|
|
85
90
|
)
|
|
86
91
|
|
|
87
92
|
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
88
|
-
return utils.unmarshal_json(http_res.text, models.
|
|
93
|
+
return utils.unmarshal_json(http_res.text, models.SSHKeys)
|
|
89
94
|
if utils.match_response(http_res, "4XX", "*"):
|
|
90
95
|
http_res_text = utils.stream_to_text(http_res)
|
|
91
96
|
raise models.APIError(
|
|
@@ -106,6 +111,9 @@ class SSHKeys(BaseSDK):
|
|
|
106
111
|
http_res,
|
|
107
112
|
)
|
|
108
113
|
|
|
114
|
+
@deprecated(
|
|
115
|
+
"warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
|
|
116
|
+
)
|
|
109
117
|
async def list_for_project_async(
|
|
110
118
|
self,
|
|
111
119
|
*,
|
|
@@ -115,7 +123,7 @@ class SSHKeys(BaseSDK):
|
|
|
115
123
|
server_url: Optional[str] = None,
|
|
116
124
|
timeout_ms: Optional[int] = None,
|
|
117
125
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
118
|
-
) -> models.
|
|
126
|
+
) -> models.SSHKeys:
|
|
119
127
|
r"""List all Project SSH Keys
|
|
120
128
|
|
|
121
129
|
List all SSH Keys in the project. These keys can be used to access servers after deploy and reinstall actions.
|
|
@@ -169,6 +177,7 @@ class SSHKeys(BaseSDK):
|
|
|
169
177
|
|
|
170
178
|
http_res = await self.do_request_async(
|
|
171
179
|
hook_ctx=HookContext(
|
|
180
|
+
config=self.sdk_configuration,
|
|
172
181
|
base_url=base_url or "",
|
|
173
182
|
operation_id="get-project-ssh-keys",
|
|
174
183
|
oauth2_scopes=[],
|
|
@@ -182,7 +191,7 @@ class SSHKeys(BaseSDK):
|
|
|
182
191
|
)
|
|
183
192
|
|
|
184
193
|
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
185
|
-
return utils.unmarshal_json(http_res.text, models.
|
|
194
|
+
return utils.unmarshal_json(http_res.text, models.SSHKeys)
|
|
186
195
|
if utils.match_response(http_res, "4XX", "*"):
|
|
187
196
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
188
197
|
raise models.APIError(
|
|
@@ -203,6 +212,9 @@ class SSHKeys(BaseSDK):
|
|
|
203
212
|
http_res,
|
|
204
213
|
)
|
|
205
214
|
|
|
215
|
+
@deprecated(
|
|
216
|
+
"warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
|
|
217
|
+
)
|
|
206
218
|
def create(
|
|
207
219
|
self,
|
|
208
220
|
*,
|
|
@@ -280,6 +292,7 @@ class SSHKeys(BaseSDK):
|
|
|
280
292
|
|
|
281
293
|
http_res = self.do_request(
|
|
282
294
|
hook_ctx=HookContext(
|
|
295
|
+
config=self.sdk_configuration,
|
|
283
296
|
base_url=base_url or "",
|
|
284
297
|
operation_id="post-project-ssh-key",
|
|
285
298
|
oauth2_scopes=[],
|
|
@@ -316,6 +329,9 @@ class SSHKeys(BaseSDK):
|
|
|
316
329
|
http_res,
|
|
317
330
|
)
|
|
318
331
|
|
|
332
|
+
@deprecated(
|
|
333
|
+
"warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
|
|
334
|
+
)
|
|
319
335
|
async def create_async(
|
|
320
336
|
self,
|
|
321
337
|
*,
|
|
@@ -393,6 +409,7 @@ class SSHKeys(BaseSDK):
|
|
|
393
409
|
|
|
394
410
|
http_res = await self.do_request_async(
|
|
395
411
|
hook_ctx=HookContext(
|
|
412
|
+
config=self.sdk_configuration,
|
|
396
413
|
base_url=base_url or "",
|
|
397
414
|
operation_id="post-project-ssh-key",
|
|
398
415
|
oauth2_scopes=[],
|
|
@@ -429,6 +446,9 @@ class SSHKeys(BaseSDK):
|
|
|
429
446
|
http_res,
|
|
430
447
|
)
|
|
431
448
|
|
|
449
|
+
@deprecated(
|
|
450
|
+
"warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
|
|
451
|
+
)
|
|
432
452
|
def get(
|
|
433
453
|
self,
|
|
434
454
|
*,
|
|
@@ -492,6 +512,7 @@ class SSHKeys(BaseSDK):
|
|
|
492
512
|
|
|
493
513
|
http_res = self.do_request(
|
|
494
514
|
hook_ctx=HookContext(
|
|
515
|
+
config=self.sdk_configuration,
|
|
495
516
|
base_url=base_url or "",
|
|
496
517
|
operation_id="get-project-ssh-key",
|
|
497
518
|
oauth2_scopes=[],
|
|
@@ -528,6 +549,9 @@ class SSHKeys(BaseSDK):
|
|
|
528
549
|
http_res,
|
|
529
550
|
)
|
|
530
551
|
|
|
552
|
+
@deprecated(
|
|
553
|
+
"warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
|
|
554
|
+
)
|
|
531
555
|
async def get_async(
|
|
532
556
|
self,
|
|
533
557
|
*,
|
|
@@ -591,6 +615,7 @@ class SSHKeys(BaseSDK):
|
|
|
591
615
|
|
|
592
616
|
http_res = await self.do_request_async(
|
|
593
617
|
hook_ctx=HookContext(
|
|
618
|
+
config=self.sdk_configuration,
|
|
594
619
|
base_url=base_url or "",
|
|
595
620
|
operation_id="get-project-ssh-key",
|
|
596
621
|
oauth2_scopes=[],
|
|
@@ -627,6 +652,9 @@ class SSHKeys(BaseSDK):
|
|
|
627
652
|
http_res,
|
|
628
653
|
)
|
|
629
654
|
|
|
655
|
+
@deprecated(
|
|
656
|
+
"warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
|
|
657
|
+
)
|
|
630
658
|
def update(
|
|
631
659
|
self,
|
|
632
660
|
*,
|
|
@@ -705,6 +733,7 @@ class SSHKeys(BaseSDK):
|
|
|
705
733
|
|
|
706
734
|
http_res = self.do_request(
|
|
707
735
|
hook_ctx=HookContext(
|
|
736
|
+
config=self.sdk_configuration,
|
|
708
737
|
base_url=base_url or "",
|
|
709
738
|
operation_id="put-project-ssh-key",
|
|
710
739
|
oauth2_scopes=[],
|
|
@@ -741,6 +770,9 @@ class SSHKeys(BaseSDK):
|
|
|
741
770
|
http_res,
|
|
742
771
|
)
|
|
743
772
|
|
|
773
|
+
@deprecated(
|
|
774
|
+
"warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
|
|
775
|
+
)
|
|
744
776
|
async def update_async(
|
|
745
777
|
self,
|
|
746
778
|
*,
|
|
@@ -819,6 +851,7 @@ class SSHKeys(BaseSDK):
|
|
|
819
851
|
|
|
820
852
|
http_res = await self.do_request_async(
|
|
821
853
|
hook_ctx=HookContext(
|
|
854
|
+
config=self.sdk_configuration,
|
|
822
855
|
base_url=base_url or "",
|
|
823
856
|
operation_id="put-project-ssh-key",
|
|
824
857
|
oauth2_scopes=[],
|
|
@@ -855,6 +888,9 @@ class SSHKeys(BaseSDK):
|
|
|
855
888
|
http_res,
|
|
856
889
|
)
|
|
857
890
|
|
|
891
|
+
@deprecated(
|
|
892
|
+
"warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
|
|
893
|
+
)
|
|
858
894
|
def delete(
|
|
859
895
|
self,
|
|
860
896
|
*,
|
|
@@ -918,6 +954,7 @@ class SSHKeys(BaseSDK):
|
|
|
918
954
|
|
|
919
955
|
http_res = self.do_request(
|
|
920
956
|
hook_ctx=HookContext(
|
|
957
|
+
config=self.sdk_configuration,
|
|
921
958
|
base_url=base_url or "",
|
|
922
959
|
operation_id="delete-project-ssh-key",
|
|
923
960
|
oauth2_scopes=[],
|
|
@@ -952,6 +989,9 @@ class SSHKeys(BaseSDK):
|
|
|
952
989
|
http_res,
|
|
953
990
|
)
|
|
954
991
|
|
|
992
|
+
@deprecated(
|
|
993
|
+
"warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
|
|
994
|
+
)
|
|
955
995
|
async def delete_async(
|
|
956
996
|
self,
|
|
957
997
|
*,
|
|
@@ -1015,6 +1055,7 @@ class SSHKeys(BaseSDK):
|
|
|
1015
1055
|
|
|
1016
1056
|
http_res = await self.do_request_async(
|
|
1017
1057
|
hook_ctx=HookContext(
|
|
1058
|
+
config=self.sdk_configuration,
|
|
1018
1059
|
base_url=base_url or "",
|
|
1019
1060
|
operation_id="delete-project-ssh-key",
|
|
1020
1061
|
oauth2_scopes=[],
|
|
@@ -1048,3 +1089,987 @@ class SSHKeys(BaseSDK):
|
|
|
1048
1089
|
http_res_text,
|
|
1049
1090
|
http_res,
|
|
1050
1091
|
)
|
|
1092
|
+
|
|
1093
|
+
def get_ssh_keys(
|
|
1094
|
+
self,
|
|
1095
|
+
*,
|
|
1096
|
+
filter_tags: Optional[str] = None,
|
|
1097
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1098
|
+
server_url: Optional[str] = None,
|
|
1099
|
+
timeout_ms: Optional[int] = None,
|
|
1100
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1101
|
+
) -> models.SSHKeys:
|
|
1102
|
+
r"""List all SSH Keys
|
|
1103
|
+
|
|
1104
|
+
List all SSH Keys in the project. These keys can be used to access servers after deploy and reinstall actions.
|
|
1105
|
+
|
|
1106
|
+
|
|
1107
|
+
: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`
|
|
1108
|
+
:param retries: Override the default retry configuration for this method
|
|
1109
|
+
:param server_url: Override the default server URL for this method
|
|
1110
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1111
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1112
|
+
"""
|
|
1113
|
+
base_url = None
|
|
1114
|
+
url_variables = None
|
|
1115
|
+
if timeout_ms is None:
|
|
1116
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1117
|
+
|
|
1118
|
+
if server_url is not None:
|
|
1119
|
+
base_url = server_url
|
|
1120
|
+
else:
|
|
1121
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1122
|
+
|
|
1123
|
+
request = models.GetSSHKeysRequest(
|
|
1124
|
+
filter_tags=filter_tags,
|
|
1125
|
+
)
|
|
1126
|
+
|
|
1127
|
+
req = self._build_request(
|
|
1128
|
+
method="GET",
|
|
1129
|
+
path="/ssh_keys",
|
|
1130
|
+
base_url=base_url,
|
|
1131
|
+
url_variables=url_variables,
|
|
1132
|
+
request=request,
|
|
1133
|
+
request_body_required=False,
|
|
1134
|
+
request_has_path_params=False,
|
|
1135
|
+
request_has_query_params=True,
|
|
1136
|
+
user_agent_header="user-agent",
|
|
1137
|
+
accept_header_value="application/vnd.api+json",
|
|
1138
|
+
http_headers=http_headers,
|
|
1139
|
+
security=self.sdk_configuration.security,
|
|
1140
|
+
timeout_ms=timeout_ms,
|
|
1141
|
+
)
|
|
1142
|
+
|
|
1143
|
+
if retries == UNSET:
|
|
1144
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1145
|
+
retries = self.sdk_configuration.retry_config
|
|
1146
|
+
|
|
1147
|
+
retry_config = None
|
|
1148
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1149
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1150
|
+
|
|
1151
|
+
http_res = self.do_request(
|
|
1152
|
+
hook_ctx=HookContext(
|
|
1153
|
+
config=self.sdk_configuration,
|
|
1154
|
+
base_url=base_url or "",
|
|
1155
|
+
operation_id="get-ssh-keys",
|
|
1156
|
+
oauth2_scopes=[],
|
|
1157
|
+
security_source=get_security_from_env(
|
|
1158
|
+
self.sdk_configuration.security, models.Security
|
|
1159
|
+
),
|
|
1160
|
+
),
|
|
1161
|
+
request=req,
|
|
1162
|
+
error_status_codes=["4XX", "5XX"],
|
|
1163
|
+
retry_config=retry_config,
|
|
1164
|
+
)
|
|
1165
|
+
|
|
1166
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
1167
|
+
return utils.unmarshal_json(http_res.text, models.SSHKeys)
|
|
1168
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1169
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1170
|
+
raise models.APIError(
|
|
1171
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1172
|
+
)
|
|
1173
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1174
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1175
|
+
raise models.APIError(
|
|
1176
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1177
|
+
)
|
|
1178
|
+
|
|
1179
|
+
content_type = http_res.headers.get("Content-Type")
|
|
1180
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1181
|
+
raise models.APIError(
|
|
1182
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1183
|
+
http_res.status_code,
|
|
1184
|
+
http_res_text,
|
|
1185
|
+
http_res,
|
|
1186
|
+
)
|
|
1187
|
+
|
|
1188
|
+
async def get_ssh_keys_async(
|
|
1189
|
+
self,
|
|
1190
|
+
*,
|
|
1191
|
+
filter_tags: Optional[str] = None,
|
|
1192
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1193
|
+
server_url: Optional[str] = None,
|
|
1194
|
+
timeout_ms: Optional[int] = None,
|
|
1195
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1196
|
+
) -> models.SSHKeys:
|
|
1197
|
+
r"""List all SSH Keys
|
|
1198
|
+
|
|
1199
|
+
List all SSH Keys in the project. These keys can be used to access servers after deploy and reinstall actions.
|
|
1200
|
+
|
|
1201
|
+
|
|
1202
|
+
: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`
|
|
1203
|
+
:param retries: Override the default retry configuration for this method
|
|
1204
|
+
:param server_url: Override the default server URL for this method
|
|
1205
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1206
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1207
|
+
"""
|
|
1208
|
+
base_url = None
|
|
1209
|
+
url_variables = None
|
|
1210
|
+
if timeout_ms is None:
|
|
1211
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1212
|
+
|
|
1213
|
+
if server_url is not None:
|
|
1214
|
+
base_url = server_url
|
|
1215
|
+
else:
|
|
1216
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1217
|
+
|
|
1218
|
+
request = models.GetSSHKeysRequest(
|
|
1219
|
+
filter_tags=filter_tags,
|
|
1220
|
+
)
|
|
1221
|
+
|
|
1222
|
+
req = self._build_request_async(
|
|
1223
|
+
method="GET",
|
|
1224
|
+
path="/ssh_keys",
|
|
1225
|
+
base_url=base_url,
|
|
1226
|
+
url_variables=url_variables,
|
|
1227
|
+
request=request,
|
|
1228
|
+
request_body_required=False,
|
|
1229
|
+
request_has_path_params=False,
|
|
1230
|
+
request_has_query_params=True,
|
|
1231
|
+
user_agent_header="user-agent",
|
|
1232
|
+
accept_header_value="application/vnd.api+json",
|
|
1233
|
+
http_headers=http_headers,
|
|
1234
|
+
security=self.sdk_configuration.security,
|
|
1235
|
+
timeout_ms=timeout_ms,
|
|
1236
|
+
)
|
|
1237
|
+
|
|
1238
|
+
if retries == UNSET:
|
|
1239
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1240
|
+
retries = self.sdk_configuration.retry_config
|
|
1241
|
+
|
|
1242
|
+
retry_config = None
|
|
1243
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1244
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1245
|
+
|
|
1246
|
+
http_res = await self.do_request_async(
|
|
1247
|
+
hook_ctx=HookContext(
|
|
1248
|
+
config=self.sdk_configuration,
|
|
1249
|
+
base_url=base_url or "",
|
|
1250
|
+
operation_id="get-ssh-keys",
|
|
1251
|
+
oauth2_scopes=[],
|
|
1252
|
+
security_source=get_security_from_env(
|
|
1253
|
+
self.sdk_configuration.security, models.Security
|
|
1254
|
+
),
|
|
1255
|
+
),
|
|
1256
|
+
request=req,
|
|
1257
|
+
error_status_codes=["4XX", "5XX"],
|
|
1258
|
+
retry_config=retry_config,
|
|
1259
|
+
)
|
|
1260
|
+
|
|
1261
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
1262
|
+
return utils.unmarshal_json(http_res.text, models.SSHKeys)
|
|
1263
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1264
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1265
|
+
raise models.APIError(
|
|
1266
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1267
|
+
)
|
|
1268
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1269
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1270
|
+
raise models.APIError(
|
|
1271
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1272
|
+
)
|
|
1273
|
+
|
|
1274
|
+
content_type = http_res.headers.get("Content-Type")
|
|
1275
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1276
|
+
raise models.APIError(
|
|
1277
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1278
|
+
http_res.status_code,
|
|
1279
|
+
http_res_text,
|
|
1280
|
+
http_res,
|
|
1281
|
+
)
|
|
1282
|
+
|
|
1283
|
+
def post_ssh_key(
|
|
1284
|
+
self,
|
|
1285
|
+
*,
|
|
1286
|
+
data: Union[
|
|
1287
|
+
models.PostSSHKeySSHKeysData, models.PostSSHKeySSHKeysDataTypedDict
|
|
1288
|
+
],
|
|
1289
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1290
|
+
server_url: Optional[str] = None,
|
|
1291
|
+
timeout_ms: Optional[int] = None,
|
|
1292
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1293
|
+
) -> models.PostSSHKeyResponseBody:
|
|
1294
|
+
r"""Create a SSH Key
|
|
1295
|
+
|
|
1296
|
+
Allow you create SSH Keys in a project. These keys can be used to access servers after deploy and reinstall actions.
|
|
1297
|
+
|
|
1298
|
+
|
|
1299
|
+
:param data:
|
|
1300
|
+
:param retries: Override the default retry configuration for this method
|
|
1301
|
+
:param server_url: Override the default server URL for this method
|
|
1302
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1303
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1304
|
+
"""
|
|
1305
|
+
base_url = None
|
|
1306
|
+
url_variables = None
|
|
1307
|
+
if timeout_ms is None:
|
|
1308
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1309
|
+
|
|
1310
|
+
if server_url is not None:
|
|
1311
|
+
base_url = server_url
|
|
1312
|
+
else:
|
|
1313
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1314
|
+
|
|
1315
|
+
request = models.PostSSHKeySSHKeysRequestBody(
|
|
1316
|
+
data=utils.get_pydantic_model(data, models.PostSSHKeySSHKeysData),
|
|
1317
|
+
)
|
|
1318
|
+
|
|
1319
|
+
req = self._build_request(
|
|
1320
|
+
method="POST",
|
|
1321
|
+
path="/ssh_keys",
|
|
1322
|
+
base_url=base_url,
|
|
1323
|
+
url_variables=url_variables,
|
|
1324
|
+
request=request,
|
|
1325
|
+
request_body_required=True,
|
|
1326
|
+
request_has_path_params=False,
|
|
1327
|
+
request_has_query_params=True,
|
|
1328
|
+
user_agent_header="user-agent",
|
|
1329
|
+
accept_header_value="application/vnd.api+json",
|
|
1330
|
+
http_headers=http_headers,
|
|
1331
|
+
security=self.sdk_configuration.security,
|
|
1332
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
1333
|
+
request, False, False, "json", models.PostSSHKeySSHKeysRequestBody
|
|
1334
|
+
),
|
|
1335
|
+
timeout_ms=timeout_ms,
|
|
1336
|
+
)
|
|
1337
|
+
|
|
1338
|
+
if retries == UNSET:
|
|
1339
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1340
|
+
retries = self.sdk_configuration.retry_config
|
|
1341
|
+
|
|
1342
|
+
retry_config = None
|
|
1343
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1344
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1345
|
+
|
|
1346
|
+
http_res = self.do_request(
|
|
1347
|
+
hook_ctx=HookContext(
|
|
1348
|
+
config=self.sdk_configuration,
|
|
1349
|
+
base_url=base_url or "",
|
|
1350
|
+
operation_id="post-ssh-key",
|
|
1351
|
+
oauth2_scopes=[],
|
|
1352
|
+
security_source=get_security_from_env(
|
|
1353
|
+
self.sdk_configuration.security, models.Security
|
|
1354
|
+
),
|
|
1355
|
+
),
|
|
1356
|
+
request=req,
|
|
1357
|
+
error_status_codes=["400", "422", "4XX", "5XX"],
|
|
1358
|
+
retry_config=retry_config,
|
|
1359
|
+
)
|
|
1360
|
+
|
|
1361
|
+
if utils.match_response(http_res, "201", "application/vnd.api+json"):
|
|
1362
|
+
return utils.unmarshal_json(http_res.text, models.PostSSHKeyResponseBody)
|
|
1363
|
+
if utils.match_response(http_res, ["400", "422", "4XX"], "*"):
|
|
1364
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1365
|
+
raise models.APIError(
|
|
1366
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1367
|
+
)
|
|
1368
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1369
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1370
|
+
raise models.APIError(
|
|
1371
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1372
|
+
)
|
|
1373
|
+
|
|
1374
|
+
content_type = http_res.headers.get("Content-Type")
|
|
1375
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1376
|
+
raise models.APIError(
|
|
1377
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1378
|
+
http_res.status_code,
|
|
1379
|
+
http_res_text,
|
|
1380
|
+
http_res,
|
|
1381
|
+
)
|
|
1382
|
+
|
|
1383
|
+
async def post_ssh_key_async(
|
|
1384
|
+
self,
|
|
1385
|
+
*,
|
|
1386
|
+
data: Union[
|
|
1387
|
+
models.PostSSHKeySSHKeysData, models.PostSSHKeySSHKeysDataTypedDict
|
|
1388
|
+
],
|
|
1389
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1390
|
+
server_url: Optional[str] = None,
|
|
1391
|
+
timeout_ms: Optional[int] = None,
|
|
1392
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1393
|
+
) -> models.PostSSHKeyResponseBody:
|
|
1394
|
+
r"""Create a SSH Key
|
|
1395
|
+
|
|
1396
|
+
Allow you create SSH Keys in a project. These keys can be used to access servers after deploy and reinstall actions.
|
|
1397
|
+
|
|
1398
|
+
|
|
1399
|
+
:param data:
|
|
1400
|
+
:param retries: Override the default retry configuration for this method
|
|
1401
|
+
:param server_url: Override the default server URL for this method
|
|
1402
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1403
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1404
|
+
"""
|
|
1405
|
+
base_url = None
|
|
1406
|
+
url_variables = None
|
|
1407
|
+
if timeout_ms is None:
|
|
1408
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1409
|
+
|
|
1410
|
+
if server_url is not None:
|
|
1411
|
+
base_url = server_url
|
|
1412
|
+
else:
|
|
1413
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1414
|
+
|
|
1415
|
+
request = models.PostSSHKeySSHKeysRequestBody(
|
|
1416
|
+
data=utils.get_pydantic_model(data, models.PostSSHKeySSHKeysData),
|
|
1417
|
+
)
|
|
1418
|
+
|
|
1419
|
+
req = self._build_request_async(
|
|
1420
|
+
method="POST",
|
|
1421
|
+
path="/ssh_keys",
|
|
1422
|
+
base_url=base_url,
|
|
1423
|
+
url_variables=url_variables,
|
|
1424
|
+
request=request,
|
|
1425
|
+
request_body_required=True,
|
|
1426
|
+
request_has_path_params=False,
|
|
1427
|
+
request_has_query_params=True,
|
|
1428
|
+
user_agent_header="user-agent",
|
|
1429
|
+
accept_header_value="application/vnd.api+json",
|
|
1430
|
+
http_headers=http_headers,
|
|
1431
|
+
security=self.sdk_configuration.security,
|
|
1432
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
1433
|
+
request, False, False, "json", models.PostSSHKeySSHKeysRequestBody
|
|
1434
|
+
),
|
|
1435
|
+
timeout_ms=timeout_ms,
|
|
1436
|
+
)
|
|
1437
|
+
|
|
1438
|
+
if retries == UNSET:
|
|
1439
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1440
|
+
retries = self.sdk_configuration.retry_config
|
|
1441
|
+
|
|
1442
|
+
retry_config = None
|
|
1443
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1444
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1445
|
+
|
|
1446
|
+
http_res = await self.do_request_async(
|
|
1447
|
+
hook_ctx=HookContext(
|
|
1448
|
+
config=self.sdk_configuration,
|
|
1449
|
+
base_url=base_url or "",
|
|
1450
|
+
operation_id="post-ssh-key",
|
|
1451
|
+
oauth2_scopes=[],
|
|
1452
|
+
security_source=get_security_from_env(
|
|
1453
|
+
self.sdk_configuration.security, models.Security
|
|
1454
|
+
),
|
|
1455
|
+
),
|
|
1456
|
+
request=req,
|
|
1457
|
+
error_status_codes=["400", "422", "4XX", "5XX"],
|
|
1458
|
+
retry_config=retry_config,
|
|
1459
|
+
)
|
|
1460
|
+
|
|
1461
|
+
if utils.match_response(http_res, "201", "application/vnd.api+json"):
|
|
1462
|
+
return utils.unmarshal_json(http_res.text, models.PostSSHKeyResponseBody)
|
|
1463
|
+
if utils.match_response(http_res, ["400", "422", "4XX"], "*"):
|
|
1464
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1465
|
+
raise models.APIError(
|
|
1466
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1467
|
+
)
|
|
1468
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1469
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1470
|
+
raise models.APIError(
|
|
1471
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1472
|
+
)
|
|
1473
|
+
|
|
1474
|
+
content_type = http_res.headers.get("Content-Type")
|
|
1475
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1476
|
+
raise models.APIError(
|
|
1477
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1478
|
+
http_res.status_code,
|
|
1479
|
+
http_res_text,
|
|
1480
|
+
http_res,
|
|
1481
|
+
)
|
|
1482
|
+
|
|
1483
|
+
def get_ssh_key(
|
|
1484
|
+
self,
|
|
1485
|
+
*,
|
|
1486
|
+
ssh_key_id: str,
|
|
1487
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1488
|
+
server_url: Optional[str] = None,
|
|
1489
|
+
timeout_ms: Optional[int] = None,
|
|
1490
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1491
|
+
) -> models.GetSSHKeyResponseBody:
|
|
1492
|
+
r"""Retrieve a SSH Key
|
|
1493
|
+
|
|
1494
|
+
List all SSH Keys in the project. These keys can be used to access servers after deploy and reinstall actions.
|
|
1495
|
+
|
|
1496
|
+
|
|
1497
|
+
:param ssh_key_id:
|
|
1498
|
+
:param retries: Override the default retry configuration for this method
|
|
1499
|
+
:param server_url: Override the default server URL for this method
|
|
1500
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1501
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1502
|
+
"""
|
|
1503
|
+
base_url = None
|
|
1504
|
+
url_variables = None
|
|
1505
|
+
if timeout_ms is None:
|
|
1506
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1507
|
+
|
|
1508
|
+
if server_url is not None:
|
|
1509
|
+
base_url = server_url
|
|
1510
|
+
else:
|
|
1511
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1512
|
+
|
|
1513
|
+
request = models.GetSSHKeyRequest(
|
|
1514
|
+
ssh_key_id=ssh_key_id,
|
|
1515
|
+
)
|
|
1516
|
+
|
|
1517
|
+
req = self._build_request(
|
|
1518
|
+
method="GET",
|
|
1519
|
+
path="/ssh_keys/{ssh_key_id}",
|
|
1520
|
+
base_url=base_url,
|
|
1521
|
+
url_variables=url_variables,
|
|
1522
|
+
request=request,
|
|
1523
|
+
request_body_required=False,
|
|
1524
|
+
request_has_path_params=True,
|
|
1525
|
+
request_has_query_params=True,
|
|
1526
|
+
user_agent_header="user-agent",
|
|
1527
|
+
accept_header_value="application/vnd.api+json",
|
|
1528
|
+
http_headers=http_headers,
|
|
1529
|
+
security=self.sdk_configuration.security,
|
|
1530
|
+
timeout_ms=timeout_ms,
|
|
1531
|
+
)
|
|
1532
|
+
|
|
1533
|
+
if retries == UNSET:
|
|
1534
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1535
|
+
retries = self.sdk_configuration.retry_config
|
|
1536
|
+
|
|
1537
|
+
retry_config = None
|
|
1538
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1539
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1540
|
+
|
|
1541
|
+
http_res = self.do_request(
|
|
1542
|
+
hook_ctx=HookContext(
|
|
1543
|
+
config=self.sdk_configuration,
|
|
1544
|
+
base_url=base_url or "",
|
|
1545
|
+
operation_id="get-ssh-key",
|
|
1546
|
+
oauth2_scopes=[],
|
|
1547
|
+
security_source=get_security_from_env(
|
|
1548
|
+
self.sdk_configuration.security, models.Security
|
|
1549
|
+
),
|
|
1550
|
+
),
|
|
1551
|
+
request=req,
|
|
1552
|
+
error_status_codes=["4XX", "5XX"],
|
|
1553
|
+
retry_config=retry_config,
|
|
1554
|
+
)
|
|
1555
|
+
|
|
1556
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
1557
|
+
return utils.unmarshal_json(http_res.text, models.GetSSHKeyResponseBody)
|
|
1558
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1559
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1560
|
+
raise models.APIError(
|
|
1561
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1562
|
+
)
|
|
1563
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1564
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1565
|
+
raise models.APIError(
|
|
1566
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1567
|
+
)
|
|
1568
|
+
|
|
1569
|
+
content_type = http_res.headers.get("Content-Type")
|
|
1570
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1571
|
+
raise models.APIError(
|
|
1572
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1573
|
+
http_res.status_code,
|
|
1574
|
+
http_res_text,
|
|
1575
|
+
http_res,
|
|
1576
|
+
)
|
|
1577
|
+
|
|
1578
|
+
async def get_ssh_key_async(
|
|
1579
|
+
self,
|
|
1580
|
+
*,
|
|
1581
|
+
ssh_key_id: str,
|
|
1582
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1583
|
+
server_url: Optional[str] = None,
|
|
1584
|
+
timeout_ms: Optional[int] = None,
|
|
1585
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1586
|
+
) -> models.GetSSHKeyResponseBody:
|
|
1587
|
+
r"""Retrieve a SSH Key
|
|
1588
|
+
|
|
1589
|
+
List all SSH Keys in the project. These keys can be used to access servers after deploy and reinstall actions.
|
|
1590
|
+
|
|
1591
|
+
|
|
1592
|
+
:param ssh_key_id:
|
|
1593
|
+
:param retries: Override the default retry configuration for this method
|
|
1594
|
+
:param server_url: Override the default server URL for this method
|
|
1595
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1596
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1597
|
+
"""
|
|
1598
|
+
base_url = None
|
|
1599
|
+
url_variables = None
|
|
1600
|
+
if timeout_ms is None:
|
|
1601
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1602
|
+
|
|
1603
|
+
if server_url is not None:
|
|
1604
|
+
base_url = server_url
|
|
1605
|
+
else:
|
|
1606
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1607
|
+
|
|
1608
|
+
request = models.GetSSHKeyRequest(
|
|
1609
|
+
ssh_key_id=ssh_key_id,
|
|
1610
|
+
)
|
|
1611
|
+
|
|
1612
|
+
req = self._build_request_async(
|
|
1613
|
+
method="GET",
|
|
1614
|
+
path="/ssh_keys/{ssh_key_id}",
|
|
1615
|
+
base_url=base_url,
|
|
1616
|
+
url_variables=url_variables,
|
|
1617
|
+
request=request,
|
|
1618
|
+
request_body_required=False,
|
|
1619
|
+
request_has_path_params=True,
|
|
1620
|
+
request_has_query_params=True,
|
|
1621
|
+
user_agent_header="user-agent",
|
|
1622
|
+
accept_header_value="application/vnd.api+json",
|
|
1623
|
+
http_headers=http_headers,
|
|
1624
|
+
security=self.sdk_configuration.security,
|
|
1625
|
+
timeout_ms=timeout_ms,
|
|
1626
|
+
)
|
|
1627
|
+
|
|
1628
|
+
if retries == UNSET:
|
|
1629
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1630
|
+
retries = self.sdk_configuration.retry_config
|
|
1631
|
+
|
|
1632
|
+
retry_config = None
|
|
1633
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1634
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1635
|
+
|
|
1636
|
+
http_res = await self.do_request_async(
|
|
1637
|
+
hook_ctx=HookContext(
|
|
1638
|
+
config=self.sdk_configuration,
|
|
1639
|
+
base_url=base_url or "",
|
|
1640
|
+
operation_id="get-ssh-key",
|
|
1641
|
+
oauth2_scopes=[],
|
|
1642
|
+
security_source=get_security_from_env(
|
|
1643
|
+
self.sdk_configuration.security, models.Security
|
|
1644
|
+
),
|
|
1645
|
+
),
|
|
1646
|
+
request=req,
|
|
1647
|
+
error_status_codes=["4XX", "5XX"],
|
|
1648
|
+
retry_config=retry_config,
|
|
1649
|
+
)
|
|
1650
|
+
|
|
1651
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
1652
|
+
return utils.unmarshal_json(http_res.text, models.GetSSHKeyResponseBody)
|
|
1653
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1654
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1655
|
+
raise models.APIError(
|
|
1656
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1657
|
+
)
|
|
1658
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1659
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1660
|
+
raise models.APIError(
|
|
1661
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1662
|
+
)
|
|
1663
|
+
|
|
1664
|
+
content_type = http_res.headers.get("Content-Type")
|
|
1665
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1666
|
+
raise models.APIError(
|
|
1667
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1668
|
+
http_res.status_code,
|
|
1669
|
+
http_res_text,
|
|
1670
|
+
http_res,
|
|
1671
|
+
)
|
|
1672
|
+
|
|
1673
|
+
def put_ssh_key(
|
|
1674
|
+
self,
|
|
1675
|
+
*,
|
|
1676
|
+
ssh_key_id: str,
|
|
1677
|
+
data: Union[models.PutSSHKeySSHKeysData, models.PutSSHKeySSHKeysDataTypedDict],
|
|
1678
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1679
|
+
server_url: Optional[str] = None,
|
|
1680
|
+
timeout_ms: Optional[int] = None,
|
|
1681
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1682
|
+
) -> models.PutSSHKeyResponseBody:
|
|
1683
|
+
r"""Update a SSH Key
|
|
1684
|
+
|
|
1685
|
+
Allow you update SSH Key in a project. These keys can be used to access servers after deploy and reinstall actions.
|
|
1686
|
+
|
|
1687
|
+
|
|
1688
|
+
:param ssh_key_id:
|
|
1689
|
+
:param data:
|
|
1690
|
+
:param retries: Override the default retry configuration for this method
|
|
1691
|
+
:param server_url: Override the default server URL for this method
|
|
1692
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1693
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1694
|
+
"""
|
|
1695
|
+
base_url = None
|
|
1696
|
+
url_variables = None
|
|
1697
|
+
if timeout_ms is None:
|
|
1698
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1699
|
+
|
|
1700
|
+
if server_url is not None:
|
|
1701
|
+
base_url = server_url
|
|
1702
|
+
else:
|
|
1703
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1704
|
+
|
|
1705
|
+
request = models.PutSSHKeyRequest(
|
|
1706
|
+
ssh_key_id=ssh_key_id,
|
|
1707
|
+
request_body=models.PutSSHKeySSHKeysRequestBody(
|
|
1708
|
+
data=utils.get_pydantic_model(data, models.PutSSHKeySSHKeysData),
|
|
1709
|
+
),
|
|
1710
|
+
)
|
|
1711
|
+
|
|
1712
|
+
req = self._build_request(
|
|
1713
|
+
method="PATCH",
|
|
1714
|
+
path="/ssh_keys/{ssh_key_id}",
|
|
1715
|
+
base_url=base_url,
|
|
1716
|
+
url_variables=url_variables,
|
|
1717
|
+
request=request,
|
|
1718
|
+
request_body_required=True,
|
|
1719
|
+
request_has_path_params=True,
|
|
1720
|
+
request_has_query_params=True,
|
|
1721
|
+
user_agent_header="user-agent",
|
|
1722
|
+
accept_header_value="application/vnd.api+json",
|
|
1723
|
+
http_headers=http_headers,
|
|
1724
|
+
security=self.sdk_configuration.security,
|
|
1725
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
1726
|
+
request.request_body,
|
|
1727
|
+
False,
|
|
1728
|
+
False,
|
|
1729
|
+
"json",
|
|
1730
|
+
models.PutSSHKeySSHKeysRequestBody,
|
|
1731
|
+
),
|
|
1732
|
+
timeout_ms=timeout_ms,
|
|
1733
|
+
)
|
|
1734
|
+
|
|
1735
|
+
if retries == UNSET:
|
|
1736
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1737
|
+
retries = self.sdk_configuration.retry_config
|
|
1738
|
+
|
|
1739
|
+
retry_config = None
|
|
1740
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1741
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1742
|
+
|
|
1743
|
+
http_res = self.do_request(
|
|
1744
|
+
hook_ctx=HookContext(
|
|
1745
|
+
config=self.sdk_configuration,
|
|
1746
|
+
base_url=base_url or "",
|
|
1747
|
+
operation_id="put-ssh-key",
|
|
1748
|
+
oauth2_scopes=[],
|
|
1749
|
+
security_source=get_security_from_env(
|
|
1750
|
+
self.sdk_configuration.security, models.Security
|
|
1751
|
+
),
|
|
1752
|
+
),
|
|
1753
|
+
request=req,
|
|
1754
|
+
error_status_codes=["400", "422", "4XX", "5XX"],
|
|
1755
|
+
retry_config=retry_config,
|
|
1756
|
+
)
|
|
1757
|
+
|
|
1758
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
1759
|
+
return utils.unmarshal_json(http_res.text, models.PutSSHKeyResponseBody)
|
|
1760
|
+
if utils.match_response(http_res, ["400", "422", "4XX"], "*"):
|
|
1761
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1762
|
+
raise models.APIError(
|
|
1763
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1764
|
+
)
|
|
1765
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1766
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1767
|
+
raise models.APIError(
|
|
1768
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1769
|
+
)
|
|
1770
|
+
|
|
1771
|
+
content_type = http_res.headers.get("Content-Type")
|
|
1772
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1773
|
+
raise models.APIError(
|
|
1774
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1775
|
+
http_res.status_code,
|
|
1776
|
+
http_res_text,
|
|
1777
|
+
http_res,
|
|
1778
|
+
)
|
|
1779
|
+
|
|
1780
|
+
async def put_ssh_key_async(
|
|
1781
|
+
self,
|
|
1782
|
+
*,
|
|
1783
|
+
ssh_key_id: str,
|
|
1784
|
+
data: Union[models.PutSSHKeySSHKeysData, models.PutSSHKeySSHKeysDataTypedDict],
|
|
1785
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1786
|
+
server_url: Optional[str] = None,
|
|
1787
|
+
timeout_ms: Optional[int] = None,
|
|
1788
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1789
|
+
) -> models.PutSSHKeyResponseBody:
|
|
1790
|
+
r"""Update a SSH Key
|
|
1791
|
+
|
|
1792
|
+
Allow you update SSH Key in a project. These keys can be used to access servers after deploy and reinstall actions.
|
|
1793
|
+
|
|
1794
|
+
|
|
1795
|
+
:param ssh_key_id:
|
|
1796
|
+
:param data:
|
|
1797
|
+
:param retries: Override the default retry configuration for this method
|
|
1798
|
+
:param server_url: Override the default server URL for this method
|
|
1799
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1800
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1801
|
+
"""
|
|
1802
|
+
base_url = None
|
|
1803
|
+
url_variables = None
|
|
1804
|
+
if timeout_ms is None:
|
|
1805
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1806
|
+
|
|
1807
|
+
if server_url is not None:
|
|
1808
|
+
base_url = server_url
|
|
1809
|
+
else:
|
|
1810
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1811
|
+
|
|
1812
|
+
request = models.PutSSHKeyRequest(
|
|
1813
|
+
ssh_key_id=ssh_key_id,
|
|
1814
|
+
request_body=models.PutSSHKeySSHKeysRequestBody(
|
|
1815
|
+
data=utils.get_pydantic_model(data, models.PutSSHKeySSHKeysData),
|
|
1816
|
+
),
|
|
1817
|
+
)
|
|
1818
|
+
|
|
1819
|
+
req = self._build_request_async(
|
|
1820
|
+
method="PATCH",
|
|
1821
|
+
path="/ssh_keys/{ssh_key_id}",
|
|
1822
|
+
base_url=base_url,
|
|
1823
|
+
url_variables=url_variables,
|
|
1824
|
+
request=request,
|
|
1825
|
+
request_body_required=True,
|
|
1826
|
+
request_has_path_params=True,
|
|
1827
|
+
request_has_query_params=True,
|
|
1828
|
+
user_agent_header="user-agent",
|
|
1829
|
+
accept_header_value="application/vnd.api+json",
|
|
1830
|
+
http_headers=http_headers,
|
|
1831
|
+
security=self.sdk_configuration.security,
|
|
1832
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
1833
|
+
request.request_body,
|
|
1834
|
+
False,
|
|
1835
|
+
False,
|
|
1836
|
+
"json",
|
|
1837
|
+
models.PutSSHKeySSHKeysRequestBody,
|
|
1838
|
+
),
|
|
1839
|
+
timeout_ms=timeout_ms,
|
|
1840
|
+
)
|
|
1841
|
+
|
|
1842
|
+
if retries == UNSET:
|
|
1843
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1844
|
+
retries = self.sdk_configuration.retry_config
|
|
1845
|
+
|
|
1846
|
+
retry_config = None
|
|
1847
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1848
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1849
|
+
|
|
1850
|
+
http_res = await self.do_request_async(
|
|
1851
|
+
hook_ctx=HookContext(
|
|
1852
|
+
config=self.sdk_configuration,
|
|
1853
|
+
base_url=base_url or "",
|
|
1854
|
+
operation_id="put-ssh-key",
|
|
1855
|
+
oauth2_scopes=[],
|
|
1856
|
+
security_source=get_security_from_env(
|
|
1857
|
+
self.sdk_configuration.security, models.Security
|
|
1858
|
+
),
|
|
1859
|
+
),
|
|
1860
|
+
request=req,
|
|
1861
|
+
error_status_codes=["400", "422", "4XX", "5XX"],
|
|
1862
|
+
retry_config=retry_config,
|
|
1863
|
+
)
|
|
1864
|
+
|
|
1865
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
1866
|
+
return utils.unmarshal_json(http_res.text, models.PutSSHKeyResponseBody)
|
|
1867
|
+
if utils.match_response(http_res, ["400", "422", "4XX"], "*"):
|
|
1868
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1869
|
+
raise models.APIError(
|
|
1870
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1871
|
+
)
|
|
1872
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1873
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1874
|
+
raise models.APIError(
|
|
1875
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1876
|
+
)
|
|
1877
|
+
|
|
1878
|
+
content_type = http_res.headers.get("Content-Type")
|
|
1879
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1880
|
+
raise models.APIError(
|
|
1881
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1882
|
+
http_res.status_code,
|
|
1883
|
+
http_res_text,
|
|
1884
|
+
http_res,
|
|
1885
|
+
)
|
|
1886
|
+
|
|
1887
|
+
def delete_ssh_key(
|
|
1888
|
+
self,
|
|
1889
|
+
*,
|
|
1890
|
+
ssh_key_id: str,
|
|
1891
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1892
|
+
server_url: Optional[str] = None,
|
|
1893
|
+
timeout_ms: Optional[int] = None,
|
|
1894
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1895
|
+
):
|
|
1896
|
+
r"""Delete a SSH Key
|
|
1897
|
+
|
|
1898
|
+
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.
|
|
1899
|
+
|
|
1900
|
+
|
|
1901
|
+
:param ssh_key_id:
|
|
1902
|
+
:param retries: Override the default retry configuration for this method
|
|
1903
|
+
:param server_url: Override the default server URL for this method
|
|
1904
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1905
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1906
|
+
"""
|
|
1907
|
+
base_url = None
|
|
1908
|
+
url_variables = None
|
|
1909
|
+
if timeout_ms is None:
|
|
1910
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1911
|
+
|
|
1912
|
+
if server_url is not None:
|
|
1913
|
+
base_url = server_url
|
|
1914
|
+
else:
|
|
1915
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1916
|
+
|
|
1917
|
+
request = models.DeleteSSHKeyRequest(
|
|
1918
|
+
ssh_key_id=ssh_key_id,
|
|
1919
|
+
)
|
|
1920
|
+
|
|
1921
|
+
req = self._build_request(
|
|
1922
|
+
method="DELETE",
|
|
1923
|
+
path="/ssh_keys/{ssh_key_id}",
|
|
1924
|
+
base_url=base_url,
|
|
1925
|
+
url_variables=url_variables,
|
|
1926
|
+
request=request,
|
|
1927
|
+
request_body_required=False,
|
|
1928
|
+
request_has_path_params=True,
|
|
1929
|
+
request_has_query_params=True,
|
|
1930
|
+
user_agent_header="user-agent",
|
|
1931
|
+
accept_header_value="*/*",
|
|
1932
|
+
http_headers=http_headers,
|
|
1933
|
+
security=self.sdk_configuration.security,
|
|
1934
|
+
timeout_ms=timeout_ms,
|
|
1935
|
+
)
|
|
1936
|
+
|
|
1937
|
+
if retries == UNSET:
|
|
1938
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1939
|
+
retries = self.sdk_configuration.retry_config
|
|
1940
|
+
|
|
1941
|
+
retry_config = None
|
|
1942
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1943
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1944
|
+
|
|
1945
|
+
http_res = self.do_request(
|
|
1946
|
+
hook_ctx=HookContext(
|
|
1947
|
+
config=self.sdk_configuration,
|
|
1948
|
+
base_url=base_url or "",
|
|
1949
|
+
operation_id="delete-ssh-key",
|
|
1950
|
+
oauth2_scopes=[],
|
|
1951
|
+
security_source=get_security_from_env(
|
|
1952
|
+
self.sdk_configuration.security, models.Security
|
|
1953
|
+
),
|
|
1954
|
+
),
|
|
1955
|
+
request=req,
|
|
1956
|
+
error_status_codes=["404", "4XX", "5XX"],
|
|
1957
|
+
retry_config=retry_config,
|
|
1958
|
+
)
|
|
1959
|
+
|
|
1960
|
+
if utils.match_response(http_res, "200", "*"):
|
|
1961
|
+
return
|
|
1962
|
+
if utils.match_response(http_res, ["404", "4XX"], "*"):
|
|
1963
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1964
|
+
raise models.APIError(
|
|
1965
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1966
|
+
)
|
|
1967
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1968
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1969
|
+
raise models.APIError(
|
|
1970
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1971
|
+
)
|
|
1972
|
+
|
|
1973
|
+
content_type = http_res.headers.get("Content-Type")
|
|
1974
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1975
|
+
raise models.APIError(
|
|
1976
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1977
|
+
http_res.status_code,
|
|
1978
|
+
http_res_text,
|
|
1979
|
+
http_res,
|
|
1980
|
+
)
|
|
1981
|
+
|
|
1982
|
+
async def delete_ssh_key_async(
|
|
1983
|
+
self,
|
|
1984
|
+
*,
|
|
1985
|
+
ssh_key_id: str,
|
|
1986
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1987
|
+
server_url: Optional[str] = None,
|
|
1988
|
+
timeout_ms: Optional[int] = None,
|
|
1989
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1990
|
+
):
|
|
1991
|
+
r"""Delete a SSH Key
|
|
1992
|
+
|
|
1993
|
+
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.
|
|
1994
|
+
|
|
1995
|
+
|
|
1996
|
+
:param ssh_key_id:
|
|
1997
|
+
:param retries: Override the default retry configuration for this method
|
|
1998
|
+
:param server_url: Override the default server URL for this method
|
|
1999
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
2000
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
2001
|
+
"""
|
|
2002
|
+
base_url = None
|
|
2003
|
+
url_variables = None
|
|
2004
|
+
if timeout_ms is None:
|
|
2005
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
2006
|
+
|
|
2007
|
+
if server_url is not None:
|
|
2008
|
+
base_url = server_url
|
|
2009
|
+
else:
|
|
2010
|
+
base_url = self._get_url(base_url, url_variables)
|
|
2011
|
+
|
|
2012
|
+
request = models.DeleteSSHKeyRequest(
|
|
2013
|
+
ssh_key_id=ssh_key_id,
|
|
2014
|
+
)
|
|
2015
|
+
|
|
2016
|
+
req = self._build_request_async(
|
|
2017
|
+
method="DELETE",
|
|
2018
|
+
path="/ssh_keys/{ssh_key_id}",
|
|
2019
|
+
base_url=base_url,
|
|
2020
|
+
url_variables=url_variables,
|
|
2021
|
+
request=request,
|
|
2022
|
+
request_body_required=False,
|
|
2023
|
+
request_has_path_params=True,
|
|
2024
|
+
request_has_query_params=True,
|
|
2025
|
+
user_agent_header="user-agent",
|
|
2026
|
+
accept_header_value="*/*",
|
|
2027
|
+
http_headers=http_headers,
|
|
2028
|
+
security=self.sdk_configuration.security,
|
|
2029
|
+
timeout_ms=timeout_ms,
|
|
2030
|
+
)
|
|
2031
|
+
|
|
2032
|
+
if retries == UNSET:
|
|
2033
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
2034
|
+
retries = self.sdk_configuration.retry_config
|
|
2035
|
+
|
|
2036
|
+
retry_config = None
|
|
2037
|
+
if isinstance(retries, utils.RetryConfig):
|
|
2038
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
2039
|
+
|
|
2040
|
+
http_res = await self.do_request_async(
|
|
2041
|
+
hook_ctx=HookContext(
|
|
2042
|
+
config=self.sdk_configuration,
|
|
2043
|
+
base_url=base_url or "",
|
|
2044
|
+
operation_id="delete-ssh-key",
|
|
2045
|
+
oauth2_scopes=[],
|
|
2046
|
+
security_source=get_security_from_env(
|
|
2047
|
+
self.sdk_configuration.security, models.Security
|
|
2048
|
+
),
|
|
2049
|
+
),
|
|
2050
|
+
request=req,
|
|
2051
|
+
error_status_codes=["404", "4XX", "5XX"],
|
|
2052
|
+
retry_config=retry_config,
|
|
2053
|
+
)
|
|
2054
|
+
|
|
2055
|
+
if utils.match_response(http_res, "200", "*"):
|
|
2056
|
+
return
|
|
2057
|
+
if utils.match_response(http_res, ["404", "4XX"], "*"):
|
|
2058
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
2059
|
+
raise models.APIError(
|
|
2060
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
2061
|
+
)
|
|
2062
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
2063
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
2064
|
+
raise models.APIError(
|
|
2065
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
2066
|
+
)
|
|
2067
|
+
|
|
2068
|
+
content_type = http_res.headers.get("Content-Type")
|
|
2069
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
2070
|
+
raise models.APIError(
|
|
2071
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
2072
|
+
http_res.status_code,
|
|
2073
|
+
http_res_text,
|
|
2074
|
+
http_res,
|
|
2075
|
+
)
|