lambdadb 0.1.3__py3-none-any.whl → 0.2.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 lambdadb might be problematic. Click here for more details.
- lambdadb/_hooks/__init__.py +0 -1
- lambdadb/_hooks/sdkhooks.py +4 -6
- lambdadb/_hooks/types.py +8 -2
- lambdadb/_version.py +4 -4
- lambdadb/basesdk.py +12 -20
- lambdadb/collections.py +12 -0
- lambdadb/docs.py +10 -0
- lambdadb/models/__init__.py +0 -87
- lambdadb/projects.py +0 -1211
- lambdadb/sdk.py +2 -7
- lambdadb/sdkconfiguration.py +0 -7
- lambdadb/utils/forms.py +49 -28
- {lambdadb-0.1.3.dist-info → lambdadb-0.2.0.dist-info}/METADATA +74 -89
- {lambdadb-0.1.3.dist-info → lambdadb-0.2.0.dist-info}/RECORD +16 -22
- lambdadb/models/createprojectop.py +0 -39
- lambdadb/models/deleteprojectop.py +0 -52
- lambdadb/models/getprojectop.py +0 -39
- lambdadb/models/listprojectsop.py +0 -38
- lambdadb/models/projectresponse.py +0 -38
- lambdadb/models/updateprojectop.py +0 -58
- {lambdadb-0.1.3.dist-info → lambdadb-0.2.0.dist-info}/LICENSE +0 -0
- {lambdadb-0.1.3.dist-info → lambdadb-0.2.0.dist-info}/WHEEL +0 -0
lambdadb/projects.py
CHANGED
|
@@ -2,12 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from .basesdk import BaseSDK
|
|
4
4
|
from .sdkconfiguration import SDKConfiguration
|
|
5
|
-
from lambdadb import errors, models, utils
|
|
6
|
-
from lambdadb._hooks import HookContext
|
|
7
5
|
from lambdadb.collections import Collections
|
|
8
|
-
from lambdadb.types import BaseModel, OptionalNullable, UNSET
|
|
9
|
-
from lambdadb.utils import get_security_from_env
|
|
10
|
-
from typing import Any, Mapping, Optional, Union, cast
|
|
11
6
|
|
|
12
7
|
|
|
13
8
|
class Projects(BaseSDK):
|
|
@@ -20,1209 +15,3 @@ class Projects(BaseSDK):
|
|
|
20
15
|
|
|
21
16
|
def _init_sdks(self):
|
|
22
17
|
self.collections = Collections(self.sdk_configuration)
|
|
23
|
-
|
|
24
|
-
def list(
|
|
25
|
-
self,
|
|
26
|
-
*,
|
|
27
|
-
security: Union[
|
|
28
|
-
models.ListProjectsSecurity, models.ListProjectsSecurityTypedDict
|
|
29
|
-
],
|
|
30
|
-
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
31
|
-
server_url: Optional[str] = None,
|
|
32
|
-
timeout_ms: Optional[int] = None,
|
|
33
|
-
http_headers: Optional[Mapping[str, str]] = None,
|
|
34
|
-
) -> models.ListProjectsResponse:
|
|
35
|
-
r"""List all projects in an account.
|
|
36
|
-
|
|
37
|
-
:param security:
|
|
38
|
-
:param retries: Override the default retry configuration for this method
|
|
39
|
-
:param server_url: Override the default server URL for this method
|
|
40
|
-
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
41
|
-
:param http_headers: Additional headers to set or replace on requests.
|
|
42
|
-
"""
|
|
43
|
-
base_url = None
|
|
44
|
-
url_variables = None
|
|
45
|
-
if timeout_ms is None:
|
|
46
|
-
timeout_ms = self.sdk_configuration.timeout_ms
|
|
47
|
-
|
|
48
|
-
if server_url is not None:
|
|
49
|
-
base_url = server_url
|
|
50
|
-
else:
|
|
51
|
-
base_url = self._get_url(base_url, url_variables)
|
|
52
|
-
req = self._build_request(
|
|
53
|
-
method="GET",
|
|
54
|
-
path="/projects",
|
|
55
|
-
base_url=base_url,
|
|
56
|
-
url_variables=url_variables,
|
|
57
|
-
request=None,
|
|
58
|
-
request_body_required=False,
|
|
59
|
-
request_has_path_params=False,
|
|
60
|
-
request_has_query_params=True,
|
|
61
|
-
user_agent_header="user-agent",
|
|
62
|
-
accept_header_value="application/json",
|
|
63
|
-
http_headers=http_headers,
|
|
64
|
-
security=utils.get_pydantic_model(security, models.ListProjectsSecurity),
|
|
65
|
-
timeout_ms=timeout_ms,
|
|
66
|
-
)
|
|
67
|
-
|
|
68
|
-
if retries == UNSET:
|
|
69
|
-
if self.sdk_configuration.retry_config is not UNSET:
|
|
70
|
-
retries = self.sdk_configuration.retry_config
|
|
71
|
-
else:
|
|
72
|
-
retries = utils.RetryConfig(
|
|
73
|
-
"backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True
|
|
74
|
-
)
|
|
75
|
-
|
|
76
|
-
retry_config = None
|
|
77
|
-
if isinstance(retries, utils.RetryConfig):
|
|
78
|
-
retry_config = (retries, ["429", "5XX"])
|
|
79
|
-
|
|
80
|
-
http_res = self.do_request(
|
|
81
|
-
hook_ctx=HookContext(
|
|
82
|
-
base_url=base_url or "",
|
|
83
|
-
operation_id="listProjects",
|
|
84
|
-
oauth2_scopes=None,
|
|
85
|
-
security_source=get_security_from_env(security, models.Security),
|
|
86
|
-
),
|
|
87
|
-
request=req,
|
|
88
|
-
error_status_codes=["401", "429", "4XX", "500", "5XX"],
|
|
89
|
-
retry_config=retry_config,
|
|
90
|
-
)
|
|
91
|
-
|
|
92
|
-
response_data: Any = None
|
|
93
|
-
if utils.match_response(http_res, "200", "application/json"):
|
|
94
|
-
return utils.unmarshal_json(http_res.text, models.ListProjectsResponse)
|
|
95
|
-
if utils.match_response(http_res, "401", "application/json"):
|
|
96
|
-
response_data = utils.unmarshal_json(
|
|
97
|
-
http_res.text, errors.UnauthenticatedErrorData
|
|
98
|
-
)
|
|
99
|
-
raise errors.UnauthenticatedError(data=response_data)
|
|
100
|
-
if utils.match_response(http_res, "429", "application/json"):
|
|
101
|
-
response_data = utils.unmarshal_json(
|
|
102
|
-
http_res.text, errors.TooManyRequestsErrorData
|
|
103
|
-
)
|
|
104
|
-
raise errors.TooManyRequestsError(data=response_data)
|
|
105
|
-
if utils.match_response(http_res, "500", "application/json"):
|
|
106
|
-
response_data = utils.unmarshal_json(
|
|
107
|
-
http_res.text, errors.InternalServerErrorData
|
|
108
|
-
)
|
|
109
|
-
raise errors.InternalServerError(data=response_data)
|
|
110
|
-
if utils.match_response(http_res, "4XX", "*"):
|
|
111
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
112
|
-
raise errors.APIError(
|
|
113
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
114
|
-
)
|
|
115
|
-
if utils.match_response(http_res, "5XX", "*"):
|
|
116
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
117
|
-
raise errors.APIError(
|
|
118
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
119
|
-
)
|
|
120
|
-
|
|
121
|
-
content_type = http_res.headers.get("Content-Type")
|
|
122
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
123
|
-
raise errors.APIError(
|
|
124
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
125
|
-
http_res.status_code,
|
|
126
|
-
http_res_text,
|
|
127
|
-
http_res,
|
|
128
|
-
)
|
|
129
|
-
|
|
130
|
-
async def list_async(
|
|
131
|
-
self,
|
|
132
|
-
*,
|
|
133
|
-
security: Union[
|
|
134
|
-
models.ListProjectsSecurity, models.ListProjectsSecurityTypedDict
|
|
135
|
-
],
|
|
136
|
-
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
137
|
-
server_url: Optional[str] = None,
|
|
138
|
-
timeout_ms: Optional[int] = None,
|
|
139
|
-
http_headers: Optional[Mapping[str, str]] = None,
|
|
140
|
-
) -> models.ListProjectsResponse:
|
|
141
|
-
r"""List all projects in an account.
|
|
142
|
-
|
|
143
|
-
:param security:
|
|
144
|
-
:param retries: Override the default retry configuration for this method
|
|
145
|
-
:param server_url: Override the default server URL for this method
|
|
146
|
-
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
147
|
-
:param http_headers: Additional headers to set or replace on requests.
|
|
148
|
-
"""
|
|
149
|
-
base_url = None
|
|
150
|
-
url_variables = None
|
|
151
|
-
if timeout_ms is None:
|
|
152
|
-
timeout_ms = self.sdk_configuration.timeout_ms
|
|
153
|
-
|
|
154
|
-
if server_url is not None:
|
|
155
|
-
base_url = server_url
|
|
156
|
-
else:
|
|
157
|
-
base_url = self._get_url(base_url, url_variables)
|
|
158
|
-
req = self._build_request_async(
|
|
159
|
-
method="GET",
|
|
160
|
-
path="/projects",
|
|
161
|
-
base_url=base_url,
|
|
162
|
-
url_variables=url_variables,
|
|
163
|
-
request=None,
|
|
164
|
-
request_body_required=False,
|
|
165
|
-
request_has_path_params=False,
|
|
166
|
-
request_has_query_params=True,
|
|
167
|
-
user_agent_header="user-agent",
|
|
168
|
-
accept_header_value="application/json",
|
|
169
|
-
http_headers=http_headers,
|
|
170
|
-
security=utils.get_pydantic_model(security, models.ListProjectsSecurity),
|
|
171
|
-
timeout_ms=timeout_ms,
|
|
172
|
-
)
|
|
173
|
-
|
|
174
|
-
if retries == UNSET:
|
|
175
|
-
if self.sdk_configuration.retry_config is not UNSET:
|
|
176
|
-
retries = self.sdk_configuration.retry_config
|
|
177
|
-
else:
|
|
178
|
-
retries = utils.RetryConfig(
|
|
179
|
-
"backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True
|
|
180
|
-
)
|
|
181
|
-
|
|
182
|
-
retry_config = None
|
|
183
|
-
if isinstance(retries, utils.RetryConfig):
|
|
184
|
-
retry_config = (retries, ["429", "5XX"])
|
|
185
|
-
|
|
186
|
-
http_res = await self.do_request_async(
|
|
187
|
-
hook_ctx=HookContext(
|
|
188
|
-
base_url=base_url or "",
|
|
189
|
-
operation_id="listProjects",
|
|
190
|
-
oauth2_scopes=None,
|
|
191
|
-
security_source=get_security_from_env(security, models.Security),
|
|
192
|
-
),
|
|
193
|
-
request=req,
|
|
194
|
-
error_status_codes=["401", "429", "4XX", "500", "5XX"],
|
|
195
|
-
retry_config=retry_config,
|
|
196
|
-
)
|
|
197
|
-
|
|
198
|
-
response_data: Any = None
|
|
199
|
-
if utils.match_response(http_res, "200", "application/json"):
|
|
200
|
-
return utils.unmarshal_json(http_res.text, models.ListProjectsResponse)
|
|
201
|
-
if utils.match_response(http_res, "401", "application/json"):
|
|
202
|
-
response_data = utils.unmarshal_json(
|
|
203
|
-
http_res.text, errors.UnauthenticatedErrorData
|
|
204
|
-
)
|
|
205
|
-
raise errors.UnauthenticatedError(data=response_data)
|
|
206
|
-
if utils.match_response(http_res, "429", "application/json"):
|
|
207
|
-
response_data = utils.unmarshal_json(
|
|
208
|
-
http_res.text, errors.TooManyRequestsErrorData
|
|
209
|
-
)
|
|
210
|
-
raise errors.TooManyRequestsError(data=response_data)
|
|
211
|
-
if utils.match_response(http_res, "500", "application/json"):
|
|
212
|
-
response_data = utils.unmarshal_json(
|
|
213
|
-
http_res.text, errors.InternalServerErrorData
|
|
214
|
-
)
|
|
215
|
-
raise errors.InternalServerError(data=response_data)
|
|
216
|
-
if utils.match_response(http_res, "4XX", "*"):
|
|
217
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
218
|
-
raise errors.APIError(
|
|
219
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
220
|
-
)
|
|
221
|
-
if utils.match_response(http_res, "5XX", "*"):
|
|
222
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
223
|
-
raise errors.APIError(
|
|
224
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
225
|
-
)
|
|
226
|
-
|
|
227
|
-
content_type = http_res.headers.get("Content-Type")
|
|
228
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
229
|
-
raise errors.APIError(
|
|
230
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
231
|
-
http_res.status_code,
|
|
232
|
-
http_res_text,
|
|
233
|
-
http_res,
|
|
234
|
-
)
|
|
235
|
-
|
|
236
|
-
def create(
|
|
237
|
-
self,
|
|
238
|
-
*,
|
|
239
|
-
security: Union[
|
|
240
|
-
models.CreateProjectSecurity, models.CreateProjectSecurityTypedDict
|
|
241
|
-
],
|
|
242
|
-
request: Union[
|
|
243
|
-
models.CreateProjectRequest, models.CreateProjectRequestTypedDict
|
|
244
|
-
] = models.CreateProjectRequest(),
|
|
245
|
-
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
246
|
-
server_url: Optional[str] = None,
|
|
247
|
-
timeout_ms: Optional[int] = None,
|
|
248
|
-
http_headers: Optional[Mapping[str, str]] = None,
|
|
249
|
-
) -> models.ProjectResponse:
|
|
250
|
-
r"""Create a project.
|
|
251
|
-
|
|
252
|
-
:param security:
|
|
253
|
-
:param request: The request object to send.
|
|
254
|
-
:param retries: Override the default retry configuration for this method
|
|
255
|
-
:param server_url: Override the default server URL for this method
|
|
256
|
-
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
257
|
-
:param http_headers: Additional headers to set or replace on requests.
|
|
258
|
-
"""
|
|
259
|
-
base_url = None
|
|
260
|
-
url_variables = None
|
|
261
|
-
if timeout_ms is None:
|
|
262
|
-
timeout_ms = self.sdk_configuration.timeout_ms
|
|
263
|
-
|
|
264
|
-
if server_url is not None:
|
|
265
|
-
base_url = server_url
|
|
266
|
-
else:
|
|
267
|
-
base_url = self._get_url(base_url, url_variables)
|
|
268
|
-
|
|
269
|
-
if not isinstance(request, BaseModel):
|
|
270
|
-
request = utils.unmarshal(request, models.CreateProjectRequest)
|
|
271
|
-
request = cast(models.CreateProjectRequest, request)
|
|
272
|
-
|
|
273
|
-
req = self._build_request(
|
|
274
|
-
method="POST",
|
|
275
|
-
path="/projects",
|
|
276
|
-
base_url=base_url,
|
|
277
|
-
url_variables=url_variables,
|
|
278
|
-
request=request,
|
|
279
|
-
request_body_required=True,
|
|
280
|
-
request_has_path_params=False,
|
|
281
|
-
request_has_query_params=True,
|
|
282
|
-
user_agent_header="user-agent",
|
|
283
|
-
accept_header_value="application/json",
|
|
284
|
-
http_headers=http_headers,
|
|
285
|
-
security=utils.get_pydantic_model(security, models.CreateProjectSecurity),
|
|
286
|
-
get_serialized_body=lambda: utils.serialize_request_body(
|
|
287
|
-
request, False, True, "json", Optional[models.CreateProjectRequest]
|
|
288
|
-
),
|
|
289
|
-
timeout_ms=timeout_ms,
|
|
290
|
-
)
|
|
291
|
-
|
|
292
|
-
if retries == UNSET:
|
|
293
|
-
if self.sdk_configuration.retry_config is not UNSET:
|
|
294
|
-
retries = self.sdk_configuration.retry_config
|
|
295
|
-
else:
|
|
296
|
-
retries = utils.RetryConfig(
|
|
297
|
-
"backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True
|
|
298
|
-
)
|
|
299
|
-
|
|
300
|
-
retry_config = None
|
|
301
|
-
if isinstance(retries, utils.RetryConfig):
|
|
302
|
-
retry_config = (retries, ["429", "5XX"])
|
|
303
|
-
|
|
304
|
-
http_res = self.do_request(
|
|
305
|
-
hook_ctx=HookContext(
|
|
306
|
-
base_url=base_url or "",
|
|
307
|
-
operation_id="createProject",
|
|
308
|
-
oauth2_scopes=None,
|
|
309
|
-
security_source=get_security_from_env(security, models.Security),
|
|
310
|
-
),
|
|
311
|
-
request=req,
|
|
312
|
-
error_status_codes=["400", "401", "409", "429", "4XX", "500", "5XX"],
|
|
313
|
-
retry_config=retry_config,
|
|
314
|
-
)
|
|
315
|
-
|
|
316
|
-
response_data: Any = None
|
|
317
|
-
if utils.match_response(http_res, "202", "application/json"):
|
|
318
|
-
return utils.unmarshal_json(http_res.text, models.ProjectResponse)
|
|
319
|
-
if utils.match_response(http_res, "400", "application/json"):
|
|
320
|
-
response_data = utils.unmarshal_json(
|
|
321
|
-
http_res.text, errors.BadRequestErrorData
|
|
322
|
-
)
|
|
323
|
-
raise errors.BadRequestError(data=response_data)
|
|
324
|
-
if utils.match_response(http_res, "401", "application/json"):
|
|
325
|
-
response_data = utils.unmarshal_json(
|
|
326
|
-
http_res.text, errors.UnauthenticatedErrorData
|
|
327
|
-
)
|
|
328
|
-
raise errors.UnauthenticatedError(data=response_data)
|
|
329
|
-
if utils.match_response(http_res, "409", "application/json"):
|
|
330
|
-
response_data = utils.unmarshal_json(
|
|
331
|
-
http_res.text, errors.ResourceAlreadyExistsErrorData
|
|
332
|
-
)
|
|
333
|
-
raise errors.ResourceAlreadyExistsError(data=response_data)
|
|
334
|
-
if utils.match_response(http_res, "429", "application/json"):
|
|
335
|
-
response_data = utils.unmarshal_json(
|
|
336
|
-
http_res.text, errors.TooManyRequestsErrorData
|
|
337
|
-
)
|
|
338
|
-
raise errors.TooManyRequestsError(data=response_data)
|
|
339
|
-
if utils.match_response(http_res, "500", "application/json"):
|
|
340
|
-
response_data = utils.unmarshal_json(
|
|
341
|
-
http_res.text, errors.InternalServerErrorData
|
|
342
|
-
)
|
|
343
|
-
raise errors.InternalServerError(data=response_data)
|
|
344
|
-
if utils.match_response(http_res, "4XX", "*"):
|
|
345
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
346
|
-
raise errors.APIError(
|
|
347
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
348
|
-
)
|
|
349
|
-
if utils.match_response(http_res, "5XX", "*"):
|
|
350
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
351
|
-
raise errors.APIError(
|
|
352
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
353
|
-
)
|
|
354
|
-
|
|
355
|
-
content_type = http_res.headers.get("Content-Type")
|
|
356
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
357
|
-
raise errors.APIError(
|
|
358
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
359
|
-
http_res.status_code,
|
|
360
|
-
http_res_text,
|
|
361
|
-
http_res,
|
|
362
|
-
)
|
|
363
|
-
|
|
364
|
-
async def create_async(
|
|
365
|
-
self,
|
|
366
|
-
*,
|
|
367
|
-
security: Union[
|
|
368
|
-
models.CreateProjectSecurity, models.CreateProjectSecurityTypedDict
|
|
369
|
-
],
|
|
370
|
-
request: Union[
|
|
371
|
-
models.CreateProjectRequest, models.CreateProjectRequestTypedDict
|
|
372
|
-
] = models.CreateProjectRequest(),
|
|
373
|
-
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
374
|
-
server_url: Optional[str] = None,
|
|
375
|
-
timeout_ms: Optional[int] = None,
|
|
376
|
-
http_headers: Optional[Mapping[str, str]] = None,
|
|
377
|
-
) -> models.ProjectResponse:
|
|
378
|
-
r"""Create a project.
|
|
379
|
-
|
|
380
|
-
:param security:
|
|
381
|
-
:param request: The request object to send.
|
|
382
|
-
:param retries: Override the default retry configuration for this method
|
|
383
|
-
:param server_url: Override the default server URL for this method
|
|
384
|
-
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
385
|
-
:param http_headers: Additional headers to set or replace on requests.
|
|
386
|
-
"""
|
|
387
|
-
base_url = None
|
|
388
|
-
url_variables = None
|
|
389
|
-
if timeout_ms is None:
|
|
390
|
-
timeout_ms = self.sdk_configuration.timeout_ms
|
|
391
|
-
|
|
392
|
-
if server_url is not None:
|
|
393
|
-
base_url = server_url
|
|
394
|
-
else:
|
|
395
|
-
base_url = self._get_url(base_url, url_variables)
|
|
396
|
-
|
|
397
|
-
if not isinstance(request, BaseModel):
|
|
398
|
-
request = utils.unmarshal(request, models.CreateProjectRequest)
|
|
399
|
-
request = cast(models.CreateProjectRequest, request)
|
|
400
|
-
|
|
401
|
-
req = self._build_request_async(
|
|
402
|
-
method="POST",
|
|
403
|
-
path="/projects",
|
|
404
|
-
base_url=base_url,
|
|
405
|
-
url_variables=url_variables,
|
|
406
|
-
request=request,
|
|
407
|
-
request_body_required=True,
|
|
408
|
-
request_has_path_params=False,
|
|
409
|
-
request_has_query_params=True,
|
|
410
|
-
user_agent_header="user-agent",
|
|
411
|
-
accept_header_value="application/json",
|
|
412
|
-
http_headers=http_headers,
|
|
413
|
-
security=utils.get_pydantic_model(security, models.CreateProjectSecurity),
|
|
414
|
-
get_serialized_body=lambda: utils.serialize_request_body(
|
|
415
|
-
request, False, True, "json", Optional[models.CreateProjectRequest]
|
|
416
|
-
),
|
|
417
|
-
timeout_ms=timeout_ms,
|
|
418
|
-
)
|
|
419
|
-
|
|
420
|
-
if retries == UNSET:
|
|
421
|
-
if self.sdk_configuration.retry_config is not UNSET:
|
|
422
|
-
retries = self.sdk_configuration.retry_config
|
|
423
|
-
else:
|
|
424
|
-
retries = utils.RetryConfig(
|
|
425
|
-
"backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True
|
|
426
|
-
)
|
|
427
|
-
|
|
428
|
-
retry_config = None
|
|
429
|
-
if isinstance(retries, utils.RetryConfig):
|
|
430
|
-
retry_config = (retries, ["429", "5XX"])
|
|
431
|
-
|
|
432
|
-
http_res = await self.do_request_async(
|
|
433
|
-
hook_ctx=HookContext(
|
|
434
|
-
base_url=base_url or "",
|
|
435
|
-
operation_id="createProject",
|
|
436
|
-
oauth2_scopes=None,
|
|
437
|
-
security_source=get_security_from_env(security, models.Security),
|
|
438
|
-
),
|
|
439
|
-
request=req,
|
|
440
|
-
error_status_codes=["400", "401", "409", "429", "4XX", "500", "5XX"],
|
|
441
|
-
retry_config=retry_config,
|
|
442
|
-
)
|
|
443
|
-
|
|
444
|
-
response_data: Any = None
|
|
445
|
-
if utils.match_response(http_res, "202", "application/json"):
|
|
446
|
-
return utils.unmarshal_json(http_res.text, models.ProjectResponse)
|
|
447
|
-
if utils.match_response(http_res, "400", "application/json"):
|
|
448
|
-
response_data = utils.unmarshal_json(
|
|
449
|
-
http_res.text, errors.BadRequestErrorData
|
|
450
|
-
)
|
|
451
|
-
raise errors.BadRequestError(data=response_data)
|
|
452
|
-
if utils.match_response(http_res, "401", "application/json"):
|
|
453
|
-
response_data = utils.unmarshal_json(
|
|
454
|
-
http_res.text, errors.UnauthenticatedErrorData
|
|
455
|
-
)
|
|
456
|
-
raise errors.UnauthenticatedError(data=response_data)
|
|
457
|
-
if utils.match_response(http_res, "409", "application/json"):
|
|
458
|
-
response_data = utils.unmarshal_json(
|
|
459
|
-
http_res.text, errors.ResourceAlreadyExistsErrorData
|
|
460
|
-
)
|
|
461
|
-
raise errors.ResourceAlreadyExistsError(data=response_data)
|
|
462
|
-
if utils.match_response(http_res, "429", "application/json"):
|
|
463
|
-
response_data = utils.unmarshal_json(
|
|
464
|
-
http_res.text, errors.TooManyRequestsErrorData
|
|
465
|
-
)
|
|
466
|
-
raise errors.TooManyRequestsError(data=response_data)
|
|
467
|
-
if utils.match_response(http_res, "500", "application/json"):
|
|
468
|
-
response_data = utils.unmarshal_json(
|
|
469
|
-
http_res.text, errors.InternalServerErrorData
|
|
470
|
-
)
|
|
471
|
-
raise errors.InternalServerError(data=response_data)
|
|
472
|
-
if utils.match_response(http_res, "4XX", "*"):
|
|
473
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
474
|
-
raise errors.APIError(
|
|
475
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
476
|
-
)
|
|
477
|
-
if utils.match_response(http_res, "5XX", "*"):
|
|
478
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
479
|
-
raise errors.APIError(
|
|
480
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
481
|
-
)
|
|
482
|
-
|
|
483
|
-
content_type = http_res.headers.get("Content-Type")
|
|
484
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
485
|
-
raise errors.APIError(
|
|
486
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
487
|
-
http_res.status_code,
|
|
488
|
-
http_res_text,
|
|
489
|
-
http_res,
|
|
490
|
-
)
|
|
491
|
-
|
|
492
|
-
def get(
|
|
493
|
-
self,
|
|
494
|
-
*,
|
|
495
|
-
security: Union[models.GetProjectSecurity, models.GetProjectSecurityTypedDict],
|
|
496
|
-
project_name: str,
|
|
497
|
-
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
498
|
-
server_url: Optional[str] = None,
|
|
499
|
-
timeout_ms: Optional[int] = None,
|
|
500
|
-
http_headers: Optional[Mapping[str, str]] = None,
|
|
501
|
-
) -> models.ProjectResponse:
|
|
502
|
-
r"""Get metadata of an existing project.
|
|
503
|
-
|
|
504
|
-
:param security:
|
|
505
|
-
:param project_name: Project name.
|
|
506
|
-
:param retries: Override the default retry configuration for this method
|
|
507
|
-
:param server_url: Override the default server URL for this method
|
|
508
|
-
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
509
|
-
:param http_headers: Additional headers to set or replace on requests.
|
|
510
|
-
"""
|
|
511
|
-
base_url = None
|
|
512
|
-
url_variables = None
|
|
513
|
-
if timeout_ms is None:
|
|
514
|
-
timeout_ms = self.sdk_configuration.timeout_ms
|
|
515
|
-
|
|
516
|
-
if server_url is not None:
|
|
517
|
-
base_url = server_url
|
|
518
|
-
else:
|
|
519
|
-
base_url = self._get_url(base_url, url_variables)
|
|
520
|
-
|
|
521
|
-
request = models.GetProjectRequest(
|
|
522
|
-
project_name=project_name,
|
|
523
|
-
)
|
|
524
|
-
|
|
525
|
-
req = self._build_request(
|
|
526
|
-
method="GET",
|
|
527
|
-
path="/projects/{projectName}",
|
|
528
|
-
base_url=base_url,
|
|
529
|
-
url_variables=url_variables,
|
|
530
|
-
request=request,
|
|
531
|
-
request_body_required=False,
|
|
532
|
-
request_has_path_params=True,
|
|
533
|
-
request_has_query_params=True,
|
|
534
|
-
user_agent_header="user-agent",
|
|
535
|
-
accept_header_value="application/json",
|
|
536
|
-
http_headers=http_headers,
|
|
537
|
-
security=utils.get_pydantic_model(security, models.GetProjectSecurity),
|
|
538
|
-
timeout_ms=timeout_ms,
|
|
539
|
-
)
|
|
540
|
-
|
|
541
|
-
if retries == UNSET:
|
|
542
|
-
if self.sdk_configuration.retry_config is not UNSET:
|
|
543
|
-
retries = self.sdk_configuration.retry_config
|
|
544
|
-
else:
|
|
545
|
-
retries = utils.RetryConfig(
|
|
546
|
-
"backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True
|
|
547
|
-
)
|
|
548
|
-
|
|
549
|
-
retry_config = None
|
|
550
|
-
if isinstance(retries, utils.RetryConfig):
|
|
551
|
-
retry_config = (retries, ["429", "5XX"])
|
|
552
|
-
|
|
553
|
-
http_res = self.do_request(
|
|
554
|
-
hook_ctx=HookContext(
|
|
555
|
-
base_url=base_url or "",
|
|
556
|
-
operation_id="getProject",
|
|
557
|
-
oauth2_scopes=None,
|
|
558
|
-
security_source=get_security_from_env(security, models.Security),
|
|
559
|
-
),
|
|
560
|
-
request=req,
|
|
561
|
-
error_status_codes=["401", "404", "429", "4XX", "500", "5XX"],
|
|
562
|
-
retry_config=retry_config,
|
|
563
|
-
)
|
|
564
|
-
|
|
565
|
-
response_data: Any = None
|
|
566
|
-
if utils.match_response(http_res, "200", "application/json"):
|
|
567
|
-
return utils.unmarshal_json(http_res.text, models.ProjectResponse)
|
|
568
|
-
if utils.match_response(http_res, "401", "application/json"):
|
|
569
|
-
response_data = utils.unmarshal_json(
|
|
570
|
-
http_res.text, errors.UnauthenticatedErrorData
|
|
571
|
-
)
|
|
572
|
-
raise errors.UnauthenticatedError(data=response_data)
|
|
573
|
-
if utils.match_response(http_res, "404", "application/json"):
|
|
574
|
-
response_data = utils.unmarshal_json(
|
|
575
|
-
http_res.text, errors.ResourceNotFoundErrorData
|
|
576
|
-
)
|
|
577
|
-
raise errors.ResourceNotFoundError(data=response_data)
|
|
578
|
-
if utils.match_response(http_res, "429", "application/json"):
|
|
579
|
-
response_data = utils.unmarshal_json(
|
|
580
|
-
http_res.text, errors.TooManyRequestsErrorData
|
|
581
|
-
)
|
|
582
|
-
raise errors.TooManyRequestsError(data=response_data)
|
|
583
|
-
if utils.match_response(http_res, "500", "application/json"):
|
|
584
|
-
response_data = utils.unmarshal_json(
|
|
585
|
-
http_res.text, errors.InternalServerErrorData
|
|
586
|
-
)
|
|
587
|
-
raise errors.InternalServerError(data=response_data)
|
|
588
|
-
if utils.match_response(http_res, "4XX", "*"):
|
|
589
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
590
|
-
raise errors.APIError(
|
|
591
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
592
|
-
)
|
|
593
|
-
if utils.match_response(http_res, "5XX", "*"):
|
|
594
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
595
|
-
raise errors.APIError(
|
|
596
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
597
|
-
)
|
|
598
|
-
|
|
599
|
-
content_type = http_res.headers.get("Content-Type")
|
|
600
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
601
|
-
raise errors.APIError(
|
|
602
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
603
|
-
http_res.status_code,
|
|
604
|
-
http_res_text,
|
|
605
|
-
http_res,
|
|
606
|
-
)
|
|
607
|
-
|
|
608
|
-
async def get_async(
|
|
609
|
-
self,
|
|
610
|
-
*,
|
|
611
|
-
security: Union[models.GetProjectSecurity, models.GetProjectSecurityTypedDict],
|
|
612
|
-
project_name: str,
|
|
613
|
-
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
614
|
-
server_url: Optional[str] = None,
|
|
615
|
-
timeout_ms: Optional[int] = None,
|
|
616
|
-
http_headers: Optional[Mapping[str, str]] = None,
|
|
617
|
-
) -> models.ProjectResponse:
|
|
618
|
-
r"""Get metadata of an existing project.
|
|
619
|
-
|
|
620
|
-
:param security:
|
|
621
|
-
:param project_name: Project name.
|
|
622
|
-
:param retries: Override the default retry configuration for this method
|
|
623
|
-
:param server_url: Override the default server URL for this method
|
|
624
|
-
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
625
|
-
:param http_headers: Additional headers to set or replace on requests.
|
|
626
|
-
"""
|
|
627
|
-
base_url = None
|
|
628
|
-
url_variables = None
|
|
629
|
-
if timeout_ms is None:
|
|
630
|
-
timeout_ms = self.sdk_configuration.timeout_ms
|
|
631
|
-
|
|
632
|
-
if server_url is not None:
|
|
633
|
-
base_url = server_url
|
|
634
|
-
else:
|
|
635
|
-
base_url = self._get_url(base_url, url_variables)
|
|
636
|
-
|
|
637
|
-
request = models.GetProjectRequest(
|
|
638
|
-
project_name=project_name,
|
|
639
|
-
)
|
|
640
|
-
|
|
641
|
-
req = self._build_request_async(
|
|
642
|
-
method="GET",
|
|
643
|
-
path="/projects/{projectName}",
|
|
644
|
-
base_url=base_url,
|
|
645
|
-
url_variables=url_variables,
|
|
646
|
-
request=request,
|
|
647
|
-
request_body_required=False,
|
|
648
|
-
request_has_path_params=True,
|
|
649
|
-
request_has_query_params=True,
|
|
650
|
-
user_agent_header="user-agent",
|
|
651
|
-
accept_header_value="application/json",
|
|
652
|
-
http_headers=http_headers,
|
|
653
|
-
security=utils.get_pydantic_model(security, models.GetProjectSecurity),
|
|
654
|
-
timeout_ms=timeout_ms,
|
|
655
|
-
)
|
|
656
|
-
|
|
657
|
-
if retries == UNSET:
|
|
658
|
-
if self.sdk_configuration.retry_config is not UNSET:
|
|
659
|
-
retries = self.sdk_configuration.retry_config
|
|
660
|
-
else:
|
|
661
|
-
retries = utils.RetryConfig(
|
|
662
|
-
"backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True
|
|
663
|
-
)
|
|
664
|
-
|
|
665
|
-
retry_config = None
|
|
666
|
-
if isinstance(retries, utils.RetryConfig):
|
|
667
|
-
retry_config = (retries, ["429", "5XX"])
|
|
668
|
-
|
|
669
|
-
http_res = await self.do_request_async(
|
|
670
|
-
hook_ctx=HookContext(
|
|
671
|
-
base_url=base_url or "",
|
|
672
|
-
operation_id="getProject",
|
|
673
|
-
oauth2_scopes=None,
|
|
674
|
-
security_source=get_security_from_env(security, models.Security),
|
|
675
|
-
),
|
|
676
|
-
request=req,
|
|
677
|
-
error_status_codes=["401", "404", "429", "4XX", "500", "5XX"],
|
|
678
|
-
retry_config=retry_config,
|
|
679
|
-
)
|
|
680
|
-
|
|
681
|
-
response_data: Any = None
|
|
682
|
-
if utils.match_response(http_res, "200", "application/json"):
|
|
683
|
-
return utils.unmarshal_json(http_res.text, models.ProjectResponse)
|
|
684
|
-
if utils.match_response(http_res, "401", "application/json"):
|
|
685
|
-
response_data = utils.unmarshal_json(
|
|
686
|
-
http_res.text, errors.UnauthenticatedErrorData
|
|
687
|
-
)
|
|
688
|
-
raise errors.UnauthenticatedError(data=response_data)
|
|
689
|
-
if utils.match_response(http_res, "404", "application/json"):
|
|
690
|
-
response_data = utils.unmarshal_json(
|
|
691
|
-
http_res.text, errors.ResourceNotFoundErrorData
|
|
692
|
-
)
|
|
693
|
-
raise errors.ResourceNotFoundError(data=response_data)
|
|
694
|
-
if utils.match_response(http_res, "429", "application/json"):
|
|
695
|
-
response_data = utils.unmarshal_json(
|
|
696
|
-
http_res.text, errors.TooManyRequestsErrorData
|
|
697
|
-
)
|
|
698
|
-
raise errors.TooManyRequestsError(data=response_data)
|
|
699
|
-
if utils.match_response(http_res, "500", "application/json"):
|
|
700
|
-
response_data = utils.unmarshal_json(
|
|
701
|
-
http_res.text, errors.InternalServerErrorData
|
|
702
|
-
)
|
|
703
|
-
raise errors.InternalServerError(data=response_data)
|
|
704
|
-
if utils.match_response(http_res, "4XX", "*"):
|
|
705
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
706
|
-
raise errors.APIError(
|
|
707
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
708
|
-
)
|
|
709
|
-
if utils.match_response(http_res, "5XX", "*"):
|
|
710
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
711
|
-
raise errors.APIError(
|
|
712
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
713
|
-
)
|
|
714
|
-
|
|
715
|
-
content_type = http_res.headers.get("Content-Type")
|
|
716
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
717
|
-
raise errors.APIError(
|
|
718
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
719
|
-
http_res.status_code,
|
|
720
|
-
http_res_text,
|
|
721
|
-
http_res,
|
|
722
|
-
)
|
|
723
|
-
|
|
724
|
-
def delete(
|
|
725
|
-
self,
|
|
726
|
-
*,
|
|
727
|
-
security: Union[
|
|
728
|
-
models.DeleteProjectSecurity, models.DeleteProjectSecurityTypedDict
|
|
729
|
-
],
|
|
730
|
-
project_name: str,
|
|
731
|
-
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
732
|
-
server_url: Optional[str] = None,
|
|
733
|
-
timeout_ms: Optional[int] = None,
|
|
734
|
-
http_headers: Optional[Mapping[str, str]] = None,
|
|
735
|
-
) -> models.DeleteProjectResponse:
|
|
736
|
-
r"""Delete an existing project.
|
|
737
|
-
|
|
738
|
-
:param security:
|
|
739
|
-
:param project_name: Project name.
|
|
740
|
-
:param retries: Override the default retry configuration for this method
|
|
741
|
-
:param server_url: Override the default server URL for this method
|
|
742
|
-
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
743
|
-
:param http_headers: Additional headers to set or replace on requests.
|
|
744
|
-
"""
|
|
745
|
-
base_url = None
|
|
746
|
-
url_variables = None
|
|
747
|
-
if timeout_ms is None:
|
|
748
|
-
timeout_ms = self.sdk_configuration.timeout_ms
|
|
749
|
-
|
|
750
|
-
if server_url is not None:
|
|
751
|
-
base_url = server_url
|
|
752
|
-
else:
|
|
753
|
-
base_url = self._get_url(base_url, url_variables)
|
|
754
|
-
|
|
755
|
-
request = models.DeleteProjectRequest(
|
|
756
|
-
project_name=project_name,
|
|
757
|
-
)
|
|
758
|
-
|
|
759
|
-
req = self._build_request(
|
|
760
|
-
method="DELETE",
|
|
761
|
-
path="/projects/{projectName}",
|
|
762
|
-
base_url=base_url,
|
|
763
|
-
url_variables=url_variables,
|
|
764
|
-
request=request,
|
|
765
|
-
request_body_required=False,
|
|
766
|
-
request_has_path_params=True,
|
|
767
|
-
request_has_query_params=True,
|
|
768
|
-
user_agent_header="user-agent",
|
|
769
|
-
accept_header_value="application/json",
|
|
770
|
-
http_headers=http_headers,
|
|
771
|
-
security=utils.get_pydantic_model(security, models.DeleteProjectSecurity),
|
|
772
|
-
timeout_ms=timeout_ms,
|
|
773
|
-
)
|
|
774
|
-
|
|
775
|
-
if retries == UNSET:
|
|
776
|
-
if self.sdk_configuration.retry_config is not UNSET:
|
|
777
|
-
retries = self.sdk_configuration.retry_config
|
|
778
|
-
else:
|
|
779
|
-
retries = utils.RetryConfig(
|
|
780
|
-
"backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True
|
|
781
|
-
)
|
|
782
|
-
|
|
783
|
-
retry_config = None
|
|
784
|
-
if isinstance(retries, utils.RetryConfig):
|
|
785
|
-
retry_config = (retries, ["429", "5XX"])
|
|
786
|
-
|
|
787
|
-
http_res = self.do_request(
|
|
788
|
-
hook_ctx=HookContext(
|
|
789
|
-
base_url=base_url or "",
|
|
790
|
-
operation_id="deleteProject",
|
|
791
|
-
oauth2_scopes=None,
|
|
792
|
-
security_source=get_security_from_env(security, models.Security),
|
|
793
|
-
),
|
|
794
|
-
request=req,
|
|
795
|
-
error_status_codes=["401", "404", "429", "4XX", "500", "5XX"],
|
|
796
|
-
retry_config=retry_config,
|
|
797
|
-
)
|
|
798
|
-
|
|
799
|
-
response_data: Any = None
|
|
800
|
-
if utils.match_response(http_res, "202", "application/json"):
|
|
801
|
-
return utils.unmarshal_json(http_res.text, models.DeleteProjectResponse)
|
|
802
|
-
if utils.match_response(http_res, "401", "application/json"):
|
|
803
|
-
response_data = utils.unmarshal_json(
|
|
804
|
-
http_res.text, errors.UnauthenticatedErrorData
|
|
805
|
-
)
|
|
806
|
-
raise errors.UnauthenticatedError(data=response_data)
|
|
807
|
-
if utils.match_response(http_res, "404", "application/json"):
|
|
808
|
-
response_data = utils.unmarshal_json(
|
|
809
|
-
http_res.text, errors.ResourceNotFoundErrorData
|
|
810
|
-
)
|
|
811
|
-
raise errors.ResourceNotFoundError(data=response_data)
|
|
812
|
-
if utils.match_response(http_res, "429", "application/json"):
|
|
813
|
-
response_data = utils.unmarshal_json(
|
|
814
|
-
http_res.text, errors.TooManyRequestsErrorData
|
|
815
|
-
)
|
|
816
|
-
raise errors.TooManyRequestsError(data=response_data)
|
|
817
|
-
if utils.match_response(http_res, "500", "application/json"):
|
|
818
|
-
response_data = utils.unmarshal_json(
|
|
819
|
-
http_res.text, errors.InternalServerErrorData
|
|
820
|
-
)
|
|
821
|
-
raise errors.InternalServerError(data=response_data)
|
|
822
|
-
if utils.match_response(http_res, "4XX", "*"):
|
|
823
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
824
|
-
raise errors.APIError(
|
|
825
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
826
|
-
)
|
|
827
|
-
if utils.match_response(http_res, "5XX", "*"):
|
|
828
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
829
|
-
raise errors.APIError(
|
|
830
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
831
|
-
)
|
|
832
|
-
|
|
833
|
-
content_type = http_res.headers.get("Content-Type")
|
|
834
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
835
|
-
raise errors.APIError(
|
|
836
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
837
|
-
http_res.status_code,
|
|
838
|
-
http_res_text,
|
|
839
|
-
http_res,
|
|
840
|
-
)
|
|
841
|
-
|
|
842
|
-
async def delete_async(
|
|
843
|
-
self,
|
|
844
|
-
*,
|
|
845
|
-
security: Union[
|
|
846
|
-
models.DeleteProjectSecurity, models.DeleteProjectSecurityTypedDict
|
|
847
|
-
],
|
|
848
|
-
project_name: str,
|
|
849
|
-
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
850
|
-
server_url: Optional[str] = None,
|
|
851
|
-
timeout_ms: Optional[int] = None,
|
|
852
|
-
http_headers: Optional[Mapping[str, str]] = None,
|
|
853
|
-
) -> models.DeleteProjectResponse:
|
|
854
|
-
r"""Delete an existing project.
|
|
855
|
-
|
|
856
|
-
:param security:
|
|
857
|
-
:param project_name: Project name.
|
|
858
|
-
:param retries: Override the default retry configuration for this method
|
|
859
|
-
:param server_url: Override the default server URL for this method
|
|
860
|
-
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
861
|
-
:param http_headers: Additional headers to set or replace on requests.
|
|
862
|
-
"""
|
|
863
|
-
base_url = None
|
|
864
|
-
url_variables = None
|
|
865
|
-
if timeout_ms is None:
|
|
866
|
-
timeout_ms = self.sdk_configuration.timeout_ms
|
|
867
|
-
|
|
868
|
-
if server_url is not None:
|
|
869
|
-
base_url = server_url
|
|
870
|
-
else:
|
|
871
|
-
base_url = self._get_url(base_url, url_variables)
|
|
872
|
-
|
|
873
|
-
request = models.DeleteProjectRequest(
|
|
874
|
-
project_name=project_name,
|
|
875
|
-
)
|
|
876
|
-
|
|
877
|
-
req = self._build_request_async(
|
|
878
|
-
method="DELETE",
|
|
879
|
-
path="/projects/{projectName}",
|
|
880
|
-
base_url=base_url,
|
|
881
|
-
url_variables=url_variables,
|
|
882
|
-
request=request,
|
|
883
|
-
request_body_required=False,
|
|
884
|
-
request_has_path_params=True,
|
|
885
|
-
request_has_query_params=True,
|
|
886
|
-
user_agent_header="user-agent",
|
|
887
|
-
accept_header_value="application/json",
|
|
888
|
-
http_headers=http_headers,
|
|
889
|
-
security=utils.get_pydantic_model(security, models.DeleteProjectSecurity),
|
|
890
|
-
timeout_ms=timeout_ms,
|
|
891
|
-
)
|
|
892
|
-
|
|
893
|
-
if retries == UNSET:
|
|
894
|
-
if self.sdk_configuration.retry_config is not UNSET:
|
|
895
|
-
retries = self.sdk_configuration.retry_config
|
|
896
|
-
else:
|
|
897
|
-
retries = utils.RetryConfig(
|
|
898
|
-
"backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True
|
|
899
|
-
)
|
|
900
|
-
|
|
901
|
-
retry_config = None
|
|
902
|
-
if isinstance(retries, utils.RetryConfig):
|
|
903
|
-
retry_config = (retries, ["429", "5XX"])
|
|
904
|
-
|
|
905
|
-
http_res = await self.do_request_async(
|
|
906
|
-
hook_ctx=HookContext(
|
|
907
|
-
base_url=base_url or "",
|
|
908
|
-
operation_id="deleteProject",
|
|
909
|
-
oauth2_scopes=None,
|
|
910
|
-
security_source=get_security_from_env(security, models.Security),
|
|
911
|
-
),
|
|
912
|
-
request=req,
|
|
913
|
-
error_status_codes=["401", "404", "429", "4XX", "500", "5XX"],
|
|
914
|
-
retry_config=retry_config,
|
|
915
|
-
)
|
|
916
|
-
|
|
917
|
-
response_data: Any = None
|
|
918
|
-
if utils.match_response(http_res, "202", "application/json"):
|
|
919
|
-
return utils.unmarshal_json(http_res.text, models.DeleteProjectResponse)
|
|
920
|
-
if utils.match_response(http_res, "401", "application/json"):
|
|
921
|
-
response_data = utils.unmarshal_json(
|
|
922
|
-
http_res.text, errors.UnauthenticatedErrorData
|
|
923
|
-
)
|
|
924
|
-
raise errors.UnauthenticatedError(data=response_data)
|
|
925
|
-
if utils.match_response(http_res, "404", "application/json"):
|
|
926
|
-
response_data = utils.unmarshal_json(
|
|
927
|
-
http_res.text, errors.ResourceNotFoundErrorData
|
|
928
|
-
)
|
|
929
|
-
raise errors.ResourceNotFoundError(data=response_data)
|
|
930
|
-
if utils.match_response(http_res, "429", "application/json"):
|
|
931
|
-
response_data = utils.unmarshal_json(
|
|
932
|
-
http_res.text, errors.TooManyRequestsErrorData
|
|
933
|
-
)
|
|
934
|
-
raise errors.TooManyRequestsError(data=response_data)
|
|
935
|
-
if utils.match_response(http_res, "500", "application/json"):
|
|
936
|
-
response_data = utils.unmarshal_json(
|
|
937
|
-
http_res.text, errors.InternalServerErrorData
|
|
938
|
-
)
|
|
939
|
-
raise errors.InternalServerError(data=response_data)
|
|
940
|
-
if utils.match_response(http_res, "4XX", "*"):
|
|
941
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
942
|
-
raise errors.APIError(
|
|
943
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
944
|
-
)
|
|
945
|
-
if utils.match_response(http_res, "5XX", "*"):
|
|
946
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
947
|
-
raise errors.APIError(
|
|
948
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
949
|
-
)
|
|
950
|
-
|
|
951
|
-
content_type = http_res.headers.get("Content-Type")
|
|
952
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
953
|
-
raise errors.APIError(
|
|
954
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
955
|
-
http_res.status_code,
|
|
956
|
-
http_res_text,
|
|
957
|
-
http_res,
|
|
958
|
-
)
|
|
959
|
-
|
|
960
|
-
def update(
|
|
961
|
-
self,
|
|
962
|
-
*,
|
|
963
|
-
security: Union[
|
|
964
|
-
models.UpdateProjectSecurity, models.UpdateProjectSecurityTypedDict
|
|
965
|
-
],
|
|
966
|
-
project_name: str,
|
|
967
|
-
rate_limit: float,
|
|
968
|
-
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
969
|
-
server_url: Optional[str] = None,
|
|
970
|
-
timeout_ms: Optional[int] = None,
|
|
971
|
-
http_headers: Optional[Mapping[str, str]] = None,
|
|
972
|
-
) -> models.ProjectResponse:
|
|
973
|
-
r"""Configure an existing project
|
|
974
|
-
|
|
975
|
-
:param security:
|
|
976
|
-
:param project_name: Project name.
|
|
977
|
-
:param rate_limit:
|
|
978
|
-
:param retries: Override the default retry configuration for this method
|
|
979
|
-
:param server_url: Override the default server URL for this method
|
|
980
|
-
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
981
|
-
:param http_headers: Additional headers to set or replace on requests.
|
|
982
|
-
"""
|
|
983
|
-
base_url = None
|
|
984
|
-
url_variables = None
|
|
985
|
-
if timeout_ms is None:
|
|
986
|
-
timeout_ms = self.sdk_configuration.timeout_ms
|
|
987
|
-
|
|
988
|
-
if server_url is not None:
|
|
989
|
-
base_url = server_url
|
|
990
|
-
else:
|
|
991
|
-
base_url = self._get_url(base_url, url_variables)
|
|
992
|
-
|
|
993
|
-
request = models.UpdateProjectRequest(
|
|
994
|
-
project_name=project_name,
|
|
995
|
-
request_body=models.UpdateProjectRequestBody(
|
|
996
|
-
rate_limit=rate_limit,
|
|
997
|
-
),
|
|
998
|
-
)
|
|
999
|
-
|
|
1000
|
-
req = self._build_request(
|
|
1001
|
-
method="PATCH",
|
|
1002
|
-
path="/projects/{projectName}",
|
|
1003
|
-
base_url=base_url,
|
|
1004
|
-
url_variables=url_variables,
|
|
1005
|
-
request=request,
|
|
1006
|
-
request_body_required=True,
|
|
1007
|
-
request_has_path_params=True,
|
|
1008
|
-
request_has_query_params=True,
|
|
1009
|
-
user_agent_header="user-agent",
|
|
1010
|
-
accept_header_value="application/json",
|
|
1011
|
-
http_headers=http_headers,
|
|
1012
|
-
security=utils.get_pydantic_model(security, models.UpdateProjectSecurity),
|
|
1013
|
-
get_serialized_body=lambda: utils.serialize_request_body(
|
|
1014
|
-
request.request_body,
|
|
1015
|
-
False,
|
|
1016
|
-
False,
|
|
1017
|
-
"json",
|
|
1018
|
-
models.UpdateProjectRequestBody,
|
|
1019
|
-
),
|
|
1020
|
-
timeout_ms=timeout_ms,
|
|
1021
|
-
)
|
|
1022
|
-
|
|
1023
|
-
if retries == UNSET:
|
|
1024
|
-
if self.sdk_configuration.retry_config is not UNSET:
|
|
1025
|
-
retries = self.sdk_configuration.retry_config
|
|
1026
|
-
else:
|
|
1027
|
-
retries = utils.RetryConfig(
|
|
1028
|
-
"backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True
|
|
1029
|
-
)
|
|
1030
|
-
|
|
1031
|
-
retry_config = None
|
|
1032
|
-
if isinstance(retries, utils.RetryConfig):
|
|
1033
|
-
retry_config = (retries, ["429", "5XX"])
|
|
1034
|
-
|
|
1035
|
-
http_res = self.do_request(
|
|
1036
|
-
hook_ctx=HookContext(
|
|
1037
|
-
base_url=base_url or "",
|
|
1038
|
-
operation_id="updateProject",
|
|
1039
|
-
oauth2_scopes=None,
|
|
1040
|
-
security_source=get_security_from_env(security, models.Security),
|
|
1041
|
-
),
|
|
1042
|
-
request=req,
|
|
1043
|
-
error_status_codes=["400", "401", "404", "429", "4XX", "500", "5XX"],
|
|
1044
|
-
retry_config=retry_config,
|
|
1045
|
-
)
|
|
1046
|
-
|
|
1047
|
-
response_data: Any = None
|
|
1048
|
-
if utils.match_response(http_res, "200", "application/json"):
|
|
1049
|
-
return utils.unmarshal_json(http_res.text, models.ProjectResponse)
|
|
1050
|
-
if utils.match_response(http_res, "400", "application/json"):
|
|
1051
|
-
response_data = utils.unmarshal_json(
|
|
1052
|
-
http_res.text, errors.BadRequestErrorData
|
|
1053
|
-
)
|
|
1054
|
-
raise errors.BadRequestError(data=response_data)
|
|
1055
|
-
if utils.match_response(http_res, "401", "application/json"):
|
|
1056
|
-
response_data = utils.unmarshal_json(
|
|
1057
|
-
http_res.text, errors.UnauthenticatedErrorData
|
|
1058
|
-
)
|
|
1059
|
-
raise errors.UnauthenticatedError(data=response_data)
|
|
1060
|
-
if utils.match_response(http_res, "404", "application/json"):
|
|
1061
|
-
response_data = utils.unmarshal_json(
|
|
1062
|
-
http_res.text, errors.ResourceNotFoundErrorData
|
|
1063
|
-
)
|
|
1064
|
-
raise errors.ResourceNotFoundError(data=response_data)
|
|
1065
|
-
if utils.match_response(http_res, "429", "application/json"):
|
|
1066
|
-
response_data = utils.unmarshal_json(
|
|
1067
|
-
http_res.text, errors.TooManyRequestsErrorData
|
|
1068
|
-
)
|
|
1069
|
-
raise errors.TooManyRequestsError(data=response_data)
|
|
1070
|
-
if utils.match_response(http_res, "500", "application/json"):
|
|
1071
|
-
response_data = utils.unmarshal_json(
|
|
1072
|
-
http_res.text, errors.InternalServerErrorData
|
|
1073
|
-
)
|
|
1074
|
-
raise errors.InternalServerError(data=response_data)
|
|
1075
|
-
if utils.match_response(http_res, "4XX", "*"):
|
|
1076
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
1077
|
-
raise errors.APIError(
|
|
1078
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1079
|
-
)
|
|
1080
|
-
if utils.match_response(http_res, "5XX", "*"):
|
|
1081
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
1082
|
-
raise errors.APIError(
|
|
1083
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1084
|
-
)
|
|
1085
|
-
|
|
1086
|
-
content_type = http_res.headers.get("Content-Type")
|
|
1087
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
1088
|
-
raise errors.APIError(
|
|
1089
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1090
|
-
http_res.status_code,
|
|
1091
|
-
http_res_text,
|
|
1092
|
-
http_res,
|
|
1093
|
-
)
|
|
1094
|
-
|
|
1095
|
-
async def update_async(
|
|
1096
|
-
self,
|
|
1097
|
-
*,
|
|
1098
|
-
security: Union[
|
|
1099
|
-
models.UpdateProjectSecurity, models.UpdateProjectSecurityTypedDict
|
|
1100
|
-
],
|
|
1101
|
-
project_name: str,
|
|
1102
|
-
rate_limit: float,
|
|
1103
|
-
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1104
|
-
server_url: Optional[str] = None,
|
|
1105
|
-
timeout_ms: Optional[int] = None,
|
|
1106
|
-
http_headers: Optional[Mapping[str, str]] = None,
|
|
1107
|
-
) -> models.ProjectResponse:
|
|
1108
|
-
r"""Configure an existing project
|
|
1109
|
-
|
|
1110
|
-
:param security:
|
|
1111
|
-
:param project_name: Project name.
|
|
1112
|
-
:param rate_limit:
|
|
1113
|
-
:param retries: Override the default retry configuration for this method
|
|
1114
|
-
:param server_url: Override the default server URL for this method
|
|
1115
|
-
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1116
|
-
:param http_headers: Additional headers to set or replace on requests.
|
|
1117
|
-
"""
|
|
1118
|
-
base_url = None
|
|
1119
|
-
url_variables = None
|
|
1120
|
-
if timeout_ms is None:
|
|
1121
|
-
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1122
|
-
|
|
1123
|
-
if server_url is not None:
|
|
1124
|
-
base_url = server_url
|
|
1125
|
-
else:
|
|
1126
|
-
base_url = self._get_url(base_url, url_variables)
|
|
1127
|
-
|
|
1128
|
-
request = models.UpdateProjectRequest(
|
|
1129
|
-
project_name=project_name,
|
|
1130
|
-
request_body=models.UpdateProjectRequestBody(
|
|
1131
|
-
rate_limit=rate_limit,
|
|
1132
|
-
),
|
|
1133
|
-
)
|
|
1134
|
-
|
|
1135
|
-
req = self._build_request_async(
|
|
1136
|
-
method="PATCH",
|
|
1137
|
-
path="/projects/{projectName}",
|
|
1138
|
-
base_url=base_url,
|
|
1139
|
-
url_variables=url_variables,
|
|
1140
|
-
request=request,
|
|
1141
|
-
request_body_required=True,
|
|
1142
|
-
request_has_path_params=True,
|
|
1143
|
-
request_has_query_params=True,
|
|
1144
|
-
user_agent_header="user-agent",
|
|
1145
|
-
accept_header_value="application/json",
|
|
1146
|
-
http_headers=http_headers,
|
|
1147
|
-
security=utils.get_pydantic_model(security, models.UpdateProjectSecurity),
|
|
1148
|
-
get_serialized_body=lambda: utils.serialize_request_body(
|
|
1149
|
-
request.request_body,
|
|
1150
|
-
False,
|
|
1151
|
-
False,
|
|
1152
|
-
"json",
|
|
1153
|
-
models.UpdateProjectRequestBody,
|
|
1154
|
-
),
|
|
1155
|
-
timeout_ms=timeout_ms,
|
|
1156
|
-
)
|
|
1157
|
-
|
|
1158
|
-
if retries == UNSET:
|
|
1159
|
-
if self.sdk_configuration.retry_config is not UNSET:
|
|
1160
|
-
retries = self.sdk_configuration.retry_config
|
|
1161
|
-
else:
|
|
1162
|
-
retries = utils.RetryConfig(
|
|
1163
|
-
"backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True
|
|
1164
|
-
)
|
|
1165
|
-
|
|
1166
|
-
retry_config = None
|
|
1167
|
-
if isinstance(retries, utils.RetryConfig):
|
|
1168
|
-
retry_config = (retries, ["429", "5XX"])
|
|
1169
|
-
|
|
1170
|
-
http_res = await self.do_request_async(
|
|
1171
|
-
hook_ctx=HookContext(
|
|
1172
|
-
base_url=base_url or "",
|
|
1173
|
-
operation_id="updateProject",
|
|
1174
|
-
oauth2_scopes=None,
|
|
1175
|
-
security_source=get_security_from_env(security, models.Security),
|
|
1176
|
-
),
|
|
1177
|
-
request=req,
|
|
1178
|
-
error_status_codes=["400", "401", "404", "429", "4XX", "500", "5XX"],
|
|
1179
|
-
retry_config=retry_config,
|
|
1180
|
-
)
|
|
1181
|
-
|
|
1182
|
-
response_data: Any = None
|
|
1183
|
-
if utils.match_response(http_res, "200", "application/json"):
|
|
1184
|
-
return utils.unmarshal_json(http_res.text, models.ProjectResponse)
|
|
1185
|
-
if utils.match_response(http_res, "400", "application/json"):
|
|
1186
|
-
response_data = utils.unmarshal_json(
|
|
1187
|
-
http_res.text, errors.BadRequestErrorData
|
|
1188
|
-
)
|
|
1189
|
-
raise errors.BadRequestError(data=response_data)
|
|
1190
|
-
if utils.match_response(http_res, "401", "application/json"):
|
|
1191
|
-
response_data = utils.unmarshal_json(
|
|
1192
|
-
http_res.text, errors.UnauthenticatedErrorData
|
|
1193
|
-
)
|
|
1194
|
-
raise errors.UnauthenticatedError(data=response_data)
|
|
1195
|
-
if utils.match_response(http_res, "404", "application/json"):
|
|
1196
|
-
response_data = utils.unmarshal_json(
|
|
1197
|
-
http_res.text, errors.ResourceNotFoundErrorData
|
|
1198
|
-
)
|
|
1199
|
-
raise errors.ResourceNotFoundError(data=response_data)
|
|
1200
|
-
if utils.match_response(http_res, "429", "application/json"):
|
|
1201
|
-
response_data = utils.unmarshal_json(
|
|
1202
|
-
http_res.text, errors.TooManyRequestsErrorData
|
|
1203
|
-
)
|
|
1204
|
-
raise errors.TooManyRequestsError(data=response_data)
|
|
1205
|
-
if utils.match_response(http_res, "500", "application/json"):
|
|
1206
|
-
response_data = utils.unmarshal_json(
|
|
1207
|
-
http_res.text, errors.InternalServerErrorData
|
|
1208
|
-
)
|
|
1209
|
-
raise errors.InternalServerError(data=response_data)
|
|
1210
|
-
if utils.match_response(http_res, "4XX", "*"):
|
|
1211
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1212
|
-
raise errors.APIError(
|
|
1213
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1214
|
-
)
|
|
1215
|
-
if utils.match_response(http_res, "5XX", "*"):
|
|
1216
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1217
|
-
raise errors.APIError(
|
|
1218
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1219
|
-
)
|
|
1220
|
-
|
|
1221
|
-
content_type = http_res.headers.get("Content-Type")
|
|
1222
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1223
|
-
raise errors.APIError(
|
|
1224
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1225
|
-
http_res.status_code,
|
|
1226
|
-
http_res_text,
|
|
1227
|
-
http_res,
|
|
1228
|
-
)
|