| 1 |
|
| 2 |
|
| 3 |
import typing |
| 4 |
from json.decoder import JSONDecodeError |
| 5 |
|
| 6 |
from ..core.api_error import ApiError |
| 7 |
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper |
| 8 |
from ..core.http_response import AsyncHttpResponse, HttpResponse |
| 9 |
from ..core.jsonable_encoder import encode_path_param |
| 10 |
from ..core.pagination import AsyncPager, SyncPager |
| 11 |
from ..core.parse_error import ParsingError |
| 12 |
from ..core.pydantic_utilities import parse_obj_as |
| 13 |
from ..core.request_options import RequestOptions |
| 14 |
from ..core.serialization import convert_and_respect_annotation_metadata |
| 15 |
from ..errors.bad_request_error import BadRequestError |
| 16 |
from ..errors.conflict_error import ConflictError |
| 17 |
from ..errors.forbidden_error import ForbiddenError |
| 18 |
from ..errors.not_found_error import NotFoundError |
| 19 |
from ..errors.too_many_requests_error import TooManyRequestsError |
| 20 |
from ..errors.unauthorized_error import UnauthorizedError |
| 21 |
from ..types.connection_name_prefix_template import ConnectionNamePrefixTemplate |
| 22 |
from ..types.connection_profile import ConnectionProfile |
| 23 |
from ..types.connection_profile_config import ConnectionProfileConfig |
| 24 |
from ..types.connection_profile_enabled_features import ConnectionProfileEnabledFeatures |
| 25 |
from ..types.connection_profile_name import ConnectionProfileName |
| 26 |
from ..types.connection_profile_organization import ConnectionProfileOrganization |
| 27 |
from ..types.connection_profile_strategy_overrides import ConnectionProfileStrategyOverrides |
| 28 |
from ..types.create_connection_profile_response_content import CreateConnectionProfileResponseContent |
| 29 |
from ..types.get_connection_profile_response_content import GetConnectionProfileResponseContent |
| 30 |
from ..types.get_connection_profile_template_response_content import GetConnectionProfileTemplateResponseContent |
| 31 |
from ..types.list_connection_profile_template_response_content import ListConnectionProfileTemplateResponseContent |
| 32 |
from ..types.list_connection_profiles_paginated_response_content import ListConnectionProfilesPaginatedResponseContent |
| 33 |
from ..types.update_connection_profile_response_content import UpdateConnectionProfileResponseContent |
| 34 |
from pydantic import ValidationError |
| 35 |
|
| 36 |
|
| 37 |
OMIT = typing.cast(typing.Any, ...) |
| 38 |
|
| 39 |
|
| 40 |
class RawConnectionProfilesClient: |
| 41 |
def __init__(self, *, client_wrapper: SyncClientWrapper): |
| 42 |
self._client_wrapper = client_wrapper |
| 43 |
|
| 44 |
def list( |
| 45 |
self, |
| 46 |
*, |
| 47 |
from_: typing.Optional[str] = None, |
| 48 |
take: typing.Optional[int] = 50, |
| 49 |
request_options: typing.Optional[RequestOptions] = None, |
| 50 |
) -> SyncPager[ConnectionProfile, ListConnectionProfilesPaginatedResponseContent]: |
| 51 |
""" |
| 52 |
Retrieve a list of Connection Profiles. This endpoint supports Checkpoint pagination. |
| 53 |
|
| 54 |
Parameters |
| 55 |
---------- |
| 56 |
from_ : typing.Optional[str] |
| 57 |
Optional Id from which to start selection. |
| 58 |
|
| 59 |
take : typing.Optional[int] |
| 60 |
Number of results per page. Defaults to 5. |
| 61 |
|
| 62 |
request_options : typing.Optional[RequestOptions] |
| 63 |
Request-specific configuration. |
| 64 |
|
| 65 |
Returns |
| 66 |
------- |
| 67 |
SyncPager[ConnectionProfile, ListConnectionProfilesPaginatedResponseContent] |
| 68 |
Connection Profiles successfully retrieved. |
| 69 |
""" |
| 70 |
_response = self._client_wrapper.httpx_client.request( |
| 71 |
"connection-profiles", |
| 72 |
method="GET", |
| 73 |
params={ |
| 74 |
"from": from_, |
| 75 |
"take": take, |
| 76 |
}, |
| 77 |
request_options=request_options, |
| 78 |
) |
| 79 |
try: |
| 80 |
if 200 <= _response.status_code < 300: |
| 81 |
_parsed_response = typing.cast( |
| 82 |
ListConnectionProfilesPaginatedResponseContent, |
| 83 |
parse_obj_as( |
| 84 |
type_=ListConnectionProfilesPaginatedResponseContent, |
| 85 |
object_=_response.json(), |
| 86 |
), |
| 87 |
) |
| 88 |
_items = _parsed_response.connection_profiles |
| 89 |
_parsed_next = _parsed_response.next |
| 90 |
_has_next = _parsed_next is not None and _parsed_next != "" |
| 91 |
_get_next = lambda: self.list( |
| 92 |
from_=_parsed_next, |
| 93 |
take=take, |
| 94 |
request_options=request_options, |
| 95 |
) |
| 96 |
return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response) |
| 97 |
if _response.status_code == 400: |
| 98 |
raise BadRequestError( |
| 99 |
headers=dict(_response.headers), |
| 100 |
body=typing.cast( |
| 101 |
typing.Any, |
| 102 |
parse_obj_as( |
| 103 |
type_=typing.Any, |
| 104 |
object_=_response.json(), |
| 105 |
), |
| 106 |
), |
| 107 |
) |
| 108 |
if _response.status_code == 401: |
| 109 |
raise UnauthorizedError( |
| 110 |
headers=dict(_response.headers), |
| 111 |
body=typing.cast( |
| 112 |
typing.Any, |
| 113 |
parse_obj_as( |
| 114 |
type_=typing.Any, |
| 115 |
object_=_response.json(), |
| 116 |
), |
| 117 |
), |
| 118 |
) |
| 119 |
if _response.status_code == 403: |
| 120 |
raise ForbiddenError( |
| 121 |
headers=dict(_response.headers), |
| 122 |
body=typing.cast( |
| 123 |
typing.Any, |
| 124 |
parse_obj_as( |
| 125 |
type_=typing.Any, |
| 126 |
object_=_response.json(), |
| 127 |
), |
| 128 |
), |
| 129 |
) |
| 130 |
if _response.status_code == 429: |
| 131 |
raise TooManyRequestsError( |
| 132 |
headers=dict(_response.headers), |
| 133 |
body=typing.cast( |
| 134 |
typing.Any, |
| 135 |
parse_obj_as( |
| 136 |
type_=typing.Any, |
| 137 |
object_=_response.json(), |
| 138 |
), |
| 139 |
), |
| 140 |
) |
| 141 |
_response_json = _response.json() |
| 142 |
except JSONDecodeError: |
| 143 |
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) |
| 144 |
except ValidationError as e: |
| 145 |
raise ParsingError( |
| 146 |
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e |
| 147 |
) |
| 148 |
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) |
| 149 |
|
| 150 |
def create( |
| 151 |
self, |
| 152 |
*, |
| 153 |
name: ConnectionProfileName, |
| 154 |
organization: typing.Optional[ConnectionProfileOrganization] = OMIT, |
| 155 |
connection_name_prefix_template: typing.Optional[ConnectionNamePrefixTemplate] = OMIT, |
| 156 |
enabled_features: typing.Optional[ConnectionProfileEnabledFeatures] = OMIT, |
| 157 |
connection_config: typing.Optional[ConnectionProfileConfig] = OMIT, |
| 158 |
strategy_overrides: typing.Optional[ConnectionProfileStrategyOverrides] = OMIT, |
| 159 |
request_options: typing.Optional[RequestOptions] = None, |
| 160 |
) -> HttpResponse[CreateConnectionProfileResponseContent]: |
| 161 |
""" |
| 162 |
Create a Connection Profile. |
| 163 |
|
| 164 |
Parameters |
| 165 |
---------- |
| 166 |
name : ConnectionProfileName |
| 167 |
|
| 168 |
organization : typing.Optional[ConnectionProfileOrganization] |
| 169 |
|
| 170 |
connection_name_prefix_template : typing.Optional[ConnectionNamePrefixTemplate] |
| 171 |
|
| 172 |
enabled_features : typing.Optional[ConnectionProfileEnabledFeatures] |
| 173 |
|
| 174 |
connection_config : typing.Optional[ConnectionProfileConfig] |
| 175 |
|
| 176 |
strategy_overrides : typing.Optional[ConnectionProfileStrategyOverrides] |
| 177 |
|
| 178 |
request_options : typing.Optional[RequestOptions] |
| 179 |
Request-specific configuration. |
| 180 |
|
| 181 |
Returns |
| 182 |
------- |
| 183 |
HttpResponse[CreateConnectionProfileResponseContent] |
| 184 |
Connection profile successfully created. |
| 185 |
""" |
| 186 |
_response = self._client_wrapper.httpx_client.request( |
| 187 |
"connection-profiles", |
| 188 |
method="POST", |
| 189 |
json={ |
| 190 |
"name": name, |
| 191 |
"organization": convert_and_respect_annotation_metadata( |
| 192 |
object_=organization, annotation=ConnectionProfileOrganization, direction="write" |
| 193 |
), |
| 194 |
"connection_name_prefix_template": connection_name_prefix_template, |
| 195 |
"enabled_features": enabled_features, |
| 196 |
"connection_config": convert_and_respect_annotation_metadata( |
| 197 |
object_=connection_config, annotation=ConnectionProfileConfig, direction="write" |
| 198 |
), |
| 199 |
"strategy_overrides": convert_and_respect_annotation_metadata( |
| 200 |
object_=strategy_overrides, annotation=ConnectionProfileStrategyOverrides, direction="write" |
| 201 |
), |
| 202 |
}, |
| 203 |
headers={ |
| 204 |
"content-type": "application/json", |
| 205 |
}, |
| 206 |
request_options=request_options, |
| 207 |
omit=OMIT, |
| 208 |
) |
| 209 |
try: |
| 210 |
if 200 <= _response.status_code < 300: |
| 211 |
_data = typing.cast( |
| 212 |
CreateConnectionProfileResponseContent, |
| 213 |
parse_obj_as( |
| 214 |
type_=CreateConnectionProfileResponseContent, |
| 215 |
object_=_response.json(), |
| 216 |
), |
| 217 |
) |
| 218 |
return HttpResponse(response=_response, data=_data) |
| 219 |
if _response.status_code == 400: |
| 220 |
raise BadRequestError( |
| 221 |
headers=dict(_response.headers), |
| 222 |
body=typing.cast( |
| 223 |
typing.Any, |
| 224 |
parse_obj_as( |
| 225 |
type_=typing.Any, |
| 226 |
object_=_response.json(), |
| 227 |
), |
| 228 |
), |
| 229 |
) |
| 230 |
if _response.status_code == 401: |
| 231 |
raise UnauthorizedError( |
| 232 |
headers=dict(_response.headers), |
| 233 |
body=typing.cast( |
| 234 |
typing.Any, |
| 235 |
parse_obj_as( |
| 236 |
type_=typing.Any, |
| 237 |
object_=_response.json(), |
| 238 |
), |
| 239 |
), |
| 240 |
) |
| 241 |
if _response.status_code == 403: |
| 242 |
raise ForbiddenError( |
| 243 |
headers=dict(_response.headers), |
| 244 |
body=typing.cast( |
| 245 |
typing.Any, |
| 246 |
parse_obj_as( |
| 247 |
type_=typing.Any, |
| 248 |
object_=_response.json(), |
| 249 |
), |
| 250 |
), |
| 251 |
) |
| 252 |
if _response.status_code == 409: |
| 253 |
raise ConflictError( |
| 254 |
headers=dict(_response.headers), |
| 255 |
body=typing.cast( |
| 256 |
typing.Any, |
| 257 |
parse_obj_as( |
| 258 |
type_=typing.Any, |
| 259 |
object_=_response.json(), |
| 260 |
), |
| 261 |
), |
| 262 |
) |
| 263 |
if _response.status_code == 429: |
| 264 |
raise TooManyRequestsError( |
| 265 |
headers=dict(_response.headers), |
| 266 |
body=typing.cast( |
| 267 |
typing.Any, |
| 268 |
parse_obj_as( |
| 269 |
type_=typing.Any, |
| 270 |
object_=_response.json(), |
| 271 |
), |
| 272 |
), |
| 273 |
) |
| 274 |
_response_json = _response.json() |
| 275 |
except JSONDecodeError: |
| 276 |
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) |
| 277 |
except ValidationError as e: |
| 278 |
raise ParsingError( |
| 279 |
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e |
| 280 |
) |
| 281 |
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) |
| 282 |
|
| 283 |
def list_templates( |
| 284 |
self, *, request_options: typing.Optional[RequestOptions] = None |
| 285 |
) -> HttpResponse[ListConnectionProfileTemplateResponseContent]: |
| 286 |
""" |
| 287 |
Retrieve a list of Connection Profile Templates. |
| 288 |
|
| 289 |
Parameters |
| 290 |
---------- |
| 291 |
request_options : typing.Optional[RequestOptions] |
| 292 |
Request-specific configuration. |
| 293 |
|
| 294 |
Returns |
| 295 |
------- |
| 296 |
HttpResponse[ListConnectionProfileTemplateResponseContent] |
| 297 |
Connection Profile Templates successfully retrieved. |
| 298 |
""" |
| 299 |
_response = self._client_wrapper.httpx_client.request( |
| 300 |
"connection-profiles/templates", |
| 301 |
method="GET", |
| 302 |
request_options=request_options, |
| 303 |
) |
| 304 |
try: |
| 305 |
if 200 <= _response.status_code < 300: |
| 306 |
_data = typing.cast( |
| 307 |
ListConnectionProfileTemplateResponseContent, |
| 308 |
parse_obj_as( |
| 309 |
type_=ListConnectionProfileTemplateResponseContent, |
| 310 |
object_=_response.json(), |
| 311 |
), |
| 312 |
) |
| 313 |
return HttpResponse(response=_response, data=_data) |
| 314 |
if _response.status_code == 401: |
| 315 |
raise UnauthorizedError( |
| 316 |
headers=dict(_response.headers), |
| 317 |
body=typing.cast( |
| 318 |
typing.Any, |
| 319 |
parse_obj_as( |
| 320 |
type_=typing.Any, |
| 321 |
object_=_response.json(), |
| 322 |
), |
| 323 |
), |
| 324 |
) |
| 325 |
if _response.status_code == 403: |
| 326 |
raise ForbiddenError( |
| 327 |
headers=dict(_response.headers), |
| 328 |
body=typing.cast( |
| 329 |
typing.Any, |
| 330 |
parse_obj_as( |
| 331 |
type_=typing.Any, |
| 332 |
object_=_response.json(), |
| 333 |
), |
| 334 |
), |
| 335 |
) |
| 336 |
if _response.status_code == 429: |
| 337 |
raise TooManyRequestsError( |
| 338 |
headers=dict(_response.headers), |
| 339 |
body=typing.cast( |
| 340 |
typing.Any, |
| 341 |
parse_obj_as( |
| 342 |
type_=typing.Any, |
| 343 |
object_=_response.json(), |
| 344 |
), |
| 345 |
), |
| 346 |
) |
| 347 |
_response_json = _response.json() |
| 348 |
except JSONDecodeError: |
| 349 |
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) |
| 350 |
except ValidationError as e: |
| 351 |
raise ParsingError( |
| 352 |
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e |
| 353 |
) |
| 354 |
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) |
| 355 |
|
| 356 |
def get_template( |
| 357 |
self, id: str, *, request_options: typing.Optional[RequestOptions] = None |
| 358 |
) -> HttpResponse[GetConnectionProfileTemplateResponseContent]: |
| 359 |
""" |
| 360 |
Retrieve a Connection Profile Template. |
| 361 |
|
| 362 |
Parameters |
| 363 |
---------- |
| 364 |
id : str |
| 365 |
ID of the connection-profile-template to retrieve. |
| 366 |
|
| 367 |
request_options : typing.Optional[RequestOptions] |
| 368 |
Request-specific configuration. |
| 369 |
|
| 370 |
Returns |
| 371 |
------- |
| 372 |
HttpResponse[GetConnectionProfileTemplateResponseContent] |
| 373 |
Connection Profile Template successfully retrieved. |
| 374 |
""" |
| 375 |
_response = self._client_wrapper.httpx_client.request( |
| 376 |
f"connection-profiles/templates/{encode_path_param(id)}", |
| 377 |
method="GET", |
| 378 |
request_options=request_options, |
| 379 |
) |
| 380 |
try: |
| 381 |
if 200 <= _response.status_code < 300: |
| 382 |
_data = typing.cast( |
| 383 |
GetConnectionProfileTemplateResponseContent, |
| 384 |
parse_obj_as( |
| 385 |
type_=GetConnectionProfileTemplateResponseContent, |
| 386 |
object_=_response.json(), |
| 387 |
), |
| 388 |
) |
| 389 |
return HttpResponse(response=_response, data=_data) |
| 390 |
if _response.status_code == 401: |
| 391 |
raise UnauthorizedError( |
| 392 |
headers=dict(_response.headers), |
| 393 |
body=typing.cast( |
| 394 |
typing.Any, |
| 395 |
parse_obj_as( |
| 396 |
type_=typing.Any, |
| 397 |
object_=_response.json(), |
| 398 |
), |
| 399 |
), |
| 400 |
) |
| 401 |
if _response.status_code == 403: |
| 402 |
raise ForbiddenError( |
| 403 |
headers=dict(_response.headers), |
| 404 |
body=typing.cast( |
| 405 |
typing.Any, |
| 406 |
parse_obj_as( |
| 407 |
type_=typing.Any, |
| 408 |
object_=_response.json(), |
| 409 |
), |
| 410 |
), |
| 411 |
) |
| 412 |
if _response.status_code == 404: |
| 413 |
raise NotFoundError( |
| 414 |
headers=dict(_response.headers), |
| 415 |
body=typing.cast( |
| 416 |
typing.Any, |
| 417 |
parse_obj_as( |
| 418 |
type_=typing.Any, |
| 419 |
object_=_response.json(), |
| 420 |
), |
| 421 |
), |
| 422 |
) |
| 423 |
if _response.status_code == 429: |
| 424 |
raise TooManyRequestsError( |
| 425 |
headers=dict(_response.headers), |
| 426 |
body=typing.cast( |
| 427 |
typing.Any, |
| 428 |
parse_obj_as( |
| 429 |
type_=typing.Any, |
| 430 |
object_=_response.json(), |
| 431 |
), |
| 432 |
), |
| 433 |
) |
| 434 |
_response_json = _response.json() |
| 435 |
except JSONDecodeError: |
| 436 |
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) |
| 437 |
except ValidationError as e: |
| 438 |
raise ParsingError( |
| 439 |
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e |
| 440 |
) |
| 441 |
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) |
| 442 |
|
| 443 |
def get( |
| 444 |
self, id: str, *, request_options: typing.Optional[RequestOptions] = None |
| 445 |
) -> HttpResponse[GetConnectionProfileResponseContent]: |
| 446 |
""" |
| 447 |
Retrieve details about a single Connection Profile specified by ID. |
| 448 |
|
| 449 |
Parameters |
| 450 |
---------- |
| 451 |
id : str |
| 452 |
ID of the connection-profile to retrieve. |
| 453 |
|
| 454 |
request_options : typing.Optional[RequestOptions] |
| 455 |
Request-specific configuration. |
| 456 |
|
| 457 |
Returns |
| 458 |
------- |
| 459 |
HttpResponse[GetConnectionProfileResponseContent] |
| 460 |
Record for existing connection profile. |
| 461 |
""" |
| 462 |
_response = self._client_wrapper.httpx_client.request( |
| 463 |
f"connection-profiles/{encode_path_param(id)}", |
| 464 |
method="GET", |
| 465 |
request_options=request_options, |
| 466 |
) |
| 467 |
try: |
| 468 |
if 200 <= _response.status_code < 300: |
| 469 |
_data = typing.cast( |
| 470 |
GetConnectionProfileResponseContent, |
| 471 |
parse_obj_as( |
| 472 |
type_=GetConnectionProfileResponseContent, |
| 473 |
object_=_response.json(), |
| 474 |
), |
| 475 |
) |
| 476 |
return HttpResponse(response=_response, data=_data) |
| 477 |
if _response.status_code == 401: |
| 478 |
raise UnauthorizedError( |
| 479 |
headers=dict(_response.headers), |
| 480 |
body=typing.cast( |
| 481 |
typing.Any, |
| 482 |
parse_obj_as( |
| 483 |
type_=typing.Any, |
| 484 |
object_=_response.json(), |
| 485 |
), |
| 486 |
), |
| 487 |
) |
| 488 |
if _response.status_code == 403: |
| 489 |
raise ForbiddenError( |
| 490 |
headers=dict(_response.headers), |
| 491 |
body=typing.cast( |
| 492 |
typing.Any, |
| 493 |
parse_obj_as( |
| 494 |
type_=typing.Any, |
| 495 |
object_=_response.json(), |
| 496 |
), |
| 497 |
), |
| 498 |
) |
| 499 |
if _response.status_code == 404: |
| 500 |
raise NotFoundError( |
| 501 |
headers=dict(_response.headers), |
| 502 |
body=typing.cast( |
| 503 |
typing.Any, |
| 504 |
parse_obj_as( |
| 505 |
type_=typing.Any, |
| 506 |
object_=_response.json(), |
| 507 |
), |
| 508 |
), |
| 509 |
) |
| 510 |
if _response.status_code == 429: |
| 511 |
raise TooManyRequestsError( |
| 512 |
headers=dict(_response.headers), |
| 513 |
body=typing.cast( |
| 514 |
typing.Any, |
| 515 |
parse_obj_as( |
| 516 |
type_=typing.Any, |
| 517 |
object_=_response.json(), |
| 518 |
), |
| 519 |
), |
| 520 |
) |
| 521 |
_response_json = _response.json() |
| 522 |
except JSONDecodeError: |
| 523 |
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) |
| 524 |
except ValidationError as e: |
| 525 |
raise ParsingError( |
| 526 |
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e |
| 527 |
) |
| 528 |
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) |
| 529 |
|
| 530 |
def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[None]: |
| 531 |
""" |
| 532 |
Delete a single Connection Profile specified by ID. |
| 533 |
|
| 534 |
Parameters |
| 535 |
---------- |
| 536 |
id : str |
| 537 |
ID of the connection-profile to delete. |
| 538 |
|
| 539 |
request_options : typing.Optional[RequestOptions] |
| 540 |
Request-specific configuration. |
| 541 |
|
| 542 |
Returns |
| 543 |
------- |
| 544 |
HttpResponse[None] |
| 545 |
""" |
| 546 |
_response = self._client_wrapper.httpx_client.request( |
| 547 |
f"connection-profiles/{encode_path_param(id)}", |
| 548 |
method="DELETE", |
| 549 |
request_options=request_options, |
| 550 |
) |
| 551 |
try: |
| 552 |
if 200 <= _response.status_code < 300: |
| 553 |
return HttpResponse(response=_response, data=None) |
| 554 |
if _response.status_code == 401: |
| 555 |
raise UnauthorizedError( |
| 556 |
headers=dict(_response.headers), |
| 557 |
body=typing.cast( |
| 558 |
typing.Any, |
| 559 |
parse_obj_as( |
| 560 |
type_=typing.Any, |
| 561 |
object_=_response.json(), |
| 562 |
), |
| 563 |
), |
| 564 |
) |
| 565 |
if _response.status_code == 403: |
| 566 |
raise ForbiddenError( |
| 567 |
headers=dict(_response.headers), |
| 568 |
body=typing.cast( |
| 569 |
typing.Any, |
| 570 |
parse_obj_as( |
| 571 |
type_=typing.Any, |
| 572 |
object_=_response.json(), |
| 573 |
), |
| 574 |
), |
| 575 |
) |
| 576 |
if _response.status_code == 429: |
| 577 |
raise TooManyRequestsError( |
| 578 |
headers=dict(_response.headers), |
| 579 |
body=typing.cast( |
| 580 |
typing.Any, |
| 581 |
parse_obj_as( |
| 582 |
type_=typing.Any, |
| 583 |
object_=_response.json(), |
| 584 |
), |
| 585 |
), |
| 586 |
) |
| 587 |
_response_json = _response.json() |
| 588 |
except JSONDecodeError: |
| 589 |
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) |
| 590 |
except ValidationError as e: |
| 591 |
raise ParsingError( |
| 592 |
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e |
| 593 |
) |
| 594 |
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) |
| 595 |
|
| 596 |
def update( |
| 597 |
self, |
| 598 |
id: str, |
| 599 |
*, |
| 600 |
name: typing.Optional[ConnectionProfileName] = OMIT, |
| 601 |
organization: typing.Optional[ConnectionProfileOrganization] = OMIT, |
| 602 |
connection_name_prefix_template: typing.Optional[ConnectionNamePrefixTemplate] = OMIT, |
| 603 |
enabled_features: typing.Optional[ConnectionProfileEnabledFeatures] = OMIT, |
| 604 |
connection_config: typing.Optional[ConnectionProfileConfig] = OMIT, |
| 605 |
strategy_overrides: typing.Optional[ConnectionProfileStrategyOverrides] = OMIT, |
| 606 |
request_options: typing.Optional[RequestOptions] = None, |
| 607 |
) -> HttpResponse[UpdateConnectionProfileResponseContent]: |
| 608 |
""" |
| 609 |
Update the details of a specific Connection Profile. |
| 610 |
|
| 611 |
Parameters |
| 612 |
---------- |
| 613 |
id : str |
| 614 |
ID of the connection profile to update. |
| 615 |
|
| 616 |
name : typing.Optional[ConnectionProfileName] |
| 617 |
|
| 618 |
organization : typing.Optional[ConnectionProfileOrganization] |
| 619 |
|
| 620 |
connection_name_prefix_template : typing.Optional[ConnectionNamePrefixTemplate] |
| 621 |
|
| 622 |
enabled_features : typing.Optional[ConnectionProfileEnabledFeatures] |
| 623 |
|
| 624 |
connection_config : typing.Optional[ConnectionProfileConfig] |
| 625 |
|
| 626 |
strategy_overrides : typing.Optional[ConnectionProfileStrategyOverrides] |
| 627 |
|
| 628 |
request_options : typing.Optional[RequestOptions] |
| 629 |
Request-specific configuration. |
| 630 |
|
| 631 |
Returns |
| 632 |
------- |
| 633 |
HttpResponse[UpdateConnectionProfileResponseContent] |
| 634 |
Connection profile successfully updated. |
| 635 |
""" |
| 636 |
_response = self._client_wrapper.httpx_client.request( |
| 637 |
f"connection-profiles/{encode_path_param(id)}", |
| 638 |
method="PATCH", |
| 639 |
json={ |
| 640 |
"name": name, |
| 641 |
"organization": convert_and_respect_annotation_metadata( |
| 642 |
object_=organization, annotation=ConnectionProfileOrganization, direction="write" |
| 643 |
), |
| 644 |
"connection_name_prefix_template": connection_name_prefix_template, |
| 645 |
"enabled_features": enabled_features, |
| 646 |
"connection_config": convert_and_respect_annotation_metadata( |
| 647 |
object_=connection_config, annotation=ConnectionProfileConfig, direction="write" |
| 648 |
), |
| 649 |
"strategy_overrides": convert_and_respect_annotation_metadata( |
| 650 |
object_=strategy_overrides, annotation=ConnectionProfileStrategyOverrides, direction="write" |
| 651 |
), |
| 652 |
}, |
| 653 |
headers={ |
| 654 |
"content-type": "application/json", |
| 655 |
}, |
| 656 |
request_options=request_options, |
| 657 |
omit=OMIT, |
| 658 |
) |
| 659 |
try: |
| 660 |
if 200 <= _response.status_code < 300: |
| 661 |
_data = typing.cast( |
| 662 |
UpdateConnectionProfileResponseContent, |
| 663 |
parse_obj_as( |
| 664 |
type_=UpdateConnectionProfileResponseContent, |
| 665 |
object_=_response.json(), |
| 666 |
), |
| 667 |
) |
| 668 |
return HttpResponse(response=_response, data=_data) |
| 669 |
if _response.status_code == 400: |
| 670 |
raise BadRequestError( |
| 671 |
headers=dict(_response.headers), |
| 672 |
body=typing.cast( |
| 673 |
typing.Any, |
| 674 |
parse_obj_as( |
| 675 |
type_=typing.Any, |
| 676 |
object_=_response.json(), |
| 677 |
), |
| 678 |
), |
| 679 |
) |
| 680 |
if _response.status_code == 401: |
| 681 |
raise UnauthorizedError( |
| 682 |
headers=dict(_response.headers), |
| 683 |
body=typing.cast( |
| 684 |
typing.Any, |
| 685 |
parse_obj_as( |
| 686 |
type_=typing.Any, |
| 687 |
object_=_response.json(), |
| 688 |
), |
| 689 |
), |
| 690 |
) |
| 691 |
if _response.status_code == 403: |
| 692 |
raise ForbiddenError( |
| 693 |
headers=dict(_response.headers), |
| 694 |
body=typing.cast( |
| 695 |
typing.Any, |
| 696 |
parse_obj_as( |
| 697 |
type_=typing.Any, |
| 698 |
object_=_response.json(), |
| 699 |
), |
| 700 |
), |
| 701 |
) |
| 702 |
if _response.status_code == 404: |
| 703 |
raise NotFoundError( |
| 704 |
headers=dict(_response.headers), |
| 705 |
body=typing.cast( |
| 706 |
typing.Any, |
| 707 |
parse_obj_as( |
| 708 |
type_=typing.Any, |
| 709 |
object_=_response.json(), |
| 710 |
), |
| 711 |
), |
| 712 |
) |
| 713 |
if _response.status_code == 429: |
| 714 |
raise TooManyRequestsError( |
| 715 |
headers=dict(_response.headers), |
| 716 |
body=typing.cast( |
| 717 |
typing.Any, |
| 718 |
parse_obj_as( |
| 719 |
type_=typing.Any, |
| 720 |
object_=_response.json(), |
| 721 |
), |
| 722 |
), |
| 723 |
) |
| 724 |
_response_json = _response.json() |
| 725 |
except JSONDecodeError: |
| 726 |
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) |
| 727 |
except ValidationError as e: |
| 728 |
raise ParsingError( |
| 729 |
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e |
| 730 |
) |
| 731 |
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) |
| 732 |
|
| 733 |
|
| 734 |
class AsyncRawConnectionProfilesClient: |
| 735 |
def __init__(self, *, client_wrapper: AsyncClientWrapper): |
| 736 |
self._client_wrapper = client_wrapper |
| 737 |
|
| 738 |
async def list( |
| 739 |
self, |
| 740 |
*, |
| 741 |
from_: typing.Optional[str] = None, |
| 742 |
take: typing.Optional[int] = 50, |
| 743 |
request_options: typing.Optional[RequestOptions] = None, |
| 744 |
) -> AsyncPager[ConnectionProfile, ListConnectionProfilesPaginatedResponseContent]: |
| 745 |
""" |
| 746 |
Retrieve a list of Connection Profiles. This endpoint supports Checkpoint pagination. |
| 747 |
|
| 748 |
Parameters |
| 749 |
---------- |
| 750 |
from_ : typing.Optional[str] |
| 751 |
Optional Id from which to start selection. |
| 752 |
|
| 753 |
take : typing.Optional[int] |
| 754 |
Number of results per page. Defaults to 5. |
| 755 |
|
| 756 |
request_options : typing.Optional[RequestOptions] |
| 757 |
Request-specific configuration. |
| 758 |
|
| 759 |
Returns |
| 760 |
------- |
| 761 |
AsyncPager[ConnectionProfile, ListConnectionProfilesPaginatedResponseContent] |
| 762 |
Connection Profiles successfully retrieved. |
| 763 |
""" |
| 764 |
_response = await self._client_wrapper.httpx_client.request( |
| 765 |
"connection-profiles", |
| 766 |
method="GET", |
| 767 |
params={ |
| 768 |
"from": from_, |
| 769 |
"take": take, |
| 770 |
}, |
| 771 |
request_options=request_options, |
| 772 |
) |
| 773 |
try: |
| 774 |
if 200 <= _response.status_code < 300: |
| 775 |
_parsed_response = typing.cast( |
| 776 |
ListConnectionProfilesPaginatedResponseContent, |
| 777 |
parse_obj_as( |
| 778 |
type_=ListConnectionProfilesPaginatedResponseContent, |
| 779 |
object_=_response.json(), |
| 780 |
), |
| 781 |
) |
| 782 |
_items = _parsed_response.connection_profiles |
| 783 |
_parsed_next = _parsed_response.next |
| 784 |
_has_next = _parsed_next is not None and _parsed_next != "" |
| 785 |
|
| 786 |
async def _get_next(): |
| 787 |
return await self.list( |
| 788 |
from_=_parsed_next, |
| 789 |
take=take, |
| 790 |
request_options=request_options, |
| 791 |
) |
| 792 |
|
| 793 |
return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response) |
| 794 |
if _response.status_code == 400: |
| 795 |
raise BadRequestError( |
| 796 |
headers=dict(_response.headers), |
| 797 |
body=typing.cast( |
| 798 |
typing.Any, |
| 799 |
parse_obj_as( |
| 800 |
type_=typing.Any, |
| 801 |
object_=_response.json(), |
| 802 |
), |
| 803 |
), |
| 804 |
) |
| 805 |
if _response.status_code == 401: |
| 806 |
raise UnauthorizedError( |
| 807 |
headers=dict(_response.headers), |
| 808 |
body=typing.cast( |
| 809 |
typing.Any, |
| 810 |
parse_obj_as( |
| 811 |
type_=typing.Any, |
| 812 |
object_=_response.json(), |
| 813 |
), |
| 814 |
), |
| 815 |
) |
| 816 |
if _response.status_code == 403: |
| 817 |
raise ForbiddenError( |
| 818 |
headers=dict(_response.headers), |
| 819 |
body=typing.cast( |
| 820 |
typing.Any, |
| 821 |
parse_obj_as( |
| 822 |
type_=typing.Any, |
| 823 |
object_=_response.json(), |
| 824 |
), |
| 825 |
), |
| 826 |
) |
| 827 |
if _response.status_code == 429: |
| 828 |
raise TooManyRequestsError( |
| 829 |
headers=dict(_response.headers), |
| 830 |
body=typing.cast( |
| 831 |
typing.Any, |
| 832 |
parse_obj_as( |
| 833 |
type_=typing.Any, |
| 834 |
object_=_response.json(), |
| 835 |
), |
| 836 |
), |
| 837 |
) |
| 838 |
_response_json = _response.json() |
| 839 |
except JSONDecodeError: |
| 840 |
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) |
| 841 |
except ValidationError as e: |
| 842 |
raise ParsingError( |
| 843 |
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e |
| 844 |
) |
| 845 |
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) |
| 846 |
|
| 847 |
async def create( |
| 848 |
self, |
| 849 |
*, |
| 850 |
name: ConnectionProfileName, |
| 851 |
organization: typing.Optional[ConnectionProfileOrganization] = OMIT, |
| 852 |
connection_name_prefix_template: typing.Optional[ConnectionNamePrefixTemplate] = OMIT, |
| 853 |
enabled_features: typing.Optional[ConnectionProfileEnabledFeatures] = OMIT, |
| 854 |
connection_config: typing.Optional[ConnectionProfileConfig] = OMIT, |
| 855 |
strategy_overrides: typing.Optional[ConnectionProfileStrategyOverrides] = OMIT, |
| 856 |
request_options: typing.Optional[RequestOptions] = None, |
| 857 |
) -> AsyncHttpResponse[CreateConnectionProfileResponseContent]: |
| 858 |
""" |
| 859 |
Create a Connection Profile. |
| 860 |
|
| 861 |
Parameters |
| 862 |
---------- |
| 863 |
name : ConnectionProfileName |
| 864 |
|
| 865 |
organization : typing.Optional[ConnectionProfileOrganization] |
| 866 |
|
| 867 |
connection_name_prefix_template : typing.Optional[ConnectionNamePrefixTemplate] |
| 868 |
|
| 869 |
enabled_features : typing.Optional[ConnectionProfileEnabledFeatures] |
| 870 |
|
| 871 |
connection_config : typing.Optional[ConnectionProfileConfig] |
| 872 |
|
| 873 |
strategy_overrides : typing.Optional[ConnectionProfileStrategyOverrides] |
| 874 |
|
| 875 |
request_options : typing.Optional[RequestOptions] |
| 876 |
Request-specific configuration. |
| 877 |
|
| 878 |
Returns |
| 879 |
------- |
| 880 |
AsyncHttpResponse[CreateConnectionProfileResponseContent] |
| 881 |
Connection profile successfully created. |
| 882 |
""" |
| 883 |
_response = await self._client_wrapper.httpx_client.request( |
| 884 |
"connection-profiles", |
| 885 |
method="POST", |
| 886 |
json={ |
| 887 |
"name": name, |
| 888 |
"organization": convert_and_respect_annotation_metadata( |
| 889 |
object_=organization, annotation=ConnectionProfileOrganization, direction="write" |
| 890 |
), |
| 891 |
"connection_name_prefix_template": connection_name_prefix_template, |
| 892 |
"enabled_features": enabled_features, |
| 893 |
"connection_config": convert_and_respect_annotation_metadata( |
| 894 |
object_=connection_config, annotation=ConnectionProfileConfig, direction="write" |
| 895 |
), |
| 896 |
"strategy_overrides": convert_and_respect_annotation_metadata( |
| 897 |
object_=strategy_overrides, annotation=ConnectionProfileStrategyOverrides, direction="write" |
| 898 |
), |
| 899 |
}, |
| 900 |
headers={ |
| 901 |
"content-type": "application/json", |
| 902 |
}, |
| 903 |
request_options=request_options, |
| 904 |
omit=OMIT, |
| 905 |
) |
| 906 |
try: |
| 907 |
if 200 <= _response.status_code < 300: |
| 908 |
_data = typing.cast( |
| 909 |
CreateConnectionProfileResponseContent, |
| 910 |
parse_obj_as( |
| 911 |
type_=CreateConnectionProfileResponseContent, |
| 912 |
object_=_response.json(), |
| 913 |
), |
| 914 |
) |
| 915 |
return AsyncHttpResponse(response=_response, data=_data) |
| 916 |
if _response.status_code == 400: |
| 917 |
raise BadRequestError( |
| 918 |
headers=dict(_response.headers), |
| 919 |
body=typing.cast( |
| 920 |
typing.Any, |
| 921 |
parse_obj_as( |
| 922 |
type_=typing.Any, |
| 923 |
object_=_response.json(), |
| 924 |
), |
| 925 |
), |
| 926 |
) |
| 927 |
if _response.status_code == 401: |
| 928 |
raise UnauthorizedError( |
| 929 |
headers=dict(_response.headers), |
| 930 |
body=typing.cast( |
| 931 |
typing.Any, |
| 932 |
parse_obj_as( |
| 933 |
type_=typing.Any, |
| 934 |
object_=_response.json(), |
| 935 |
), |
| 936 |
), |
| 937 |
) |
| 938 |
if _response.status_code == 403: |
| 939 |
raise ForbiddenError( |
| 940 |
headers=dict(_response.headers), |
| 941 |
body=typing.cast( |
| 942 |
typing.Any, |
| 943 |
parse_obj_as( |
| 944 |
type_=typing.Any, |
| 945 |
object_=_response.json(), |
| 946 |
), |
| 947 |
), |
| 948 |
) |
| 949 |
if _response.status_code == 409: |
| 950 |
raise ConflictError( |
| 951 |
headers=dict(_response.headers), |
| 952 |
body=typing.cast( |
| 953 |
typing.Any, |
| 954 |
parse_obj_as( |
| 955 |
type_=typing.Any, |
| 956 |
object_=_response.json(), |
| 957 |
), |
| 958 |
), |
| 959 |
) |
| 960 |
if _response.status_code == 429: |
| 961 |
raise TooManyRequestsError( |
| 962 |
headers=dict(_response.headers), |
| 963 |
body=typing.cast( |
| 964 |
typing.Any, |
| 965 |
parse_obj_as( |
| 966 |
type_=typing.Any, |
| 967 |
object_=_response.json(), |
| 968 |
), |
| 969 |
), |
| 970 |
) |
| 971 |
_response_json = _response.json() |
| 972 |
except JSONDecodeError: |
| 973 |
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) |
| 974 |
except ValidationError as e: |
| 975 |
raise ParsingError( |
| 976 |
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e |
| 977 |
) |
| 978 |
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) |
| 979 |
|
| 980 |
async def list_templates( |
| 981 |
self, *, request_options: typing.Optional[RequestOptions] = None |
| 982 |
) -> AsyncHttpResponse[ListConnectionProfileTemplateResponseContent]: |
| 983 |
""" |
| 984 |
Retrieve a list of Connection Profile Templates. |
| 985 |
|
| 986 |
Parameters |
| 987 |
---------- |
| 988 |
request_options : typing.Optional[RequestOptions] |
| 989 |
Request-specific configuration. |
| 990 |
|
| 991 |
Returns |
| 992 |
------- |
| 993 |
AsyncHttpResponse[ListConnectionProfileTemplateResponseContent] |
| 994 |
Connection Profile Templates successfully retrieved. |
| 995 |
""" |
| 996 |
_response = await self._client_wrapper.httpx_client.request( |
| 997 |
"connection-profiles/templates", |
| 998 |
method="GET", |
| 999 |
request_options=request_options, |
| 1000 |
) |
| 1001 |
try: |
| 1002 |
if 200 <= _response.status_code < 300: |
| 1003 |
_data = typing.cast( |
| 1004 |
ListConnectionProfileTemplateResponseContent, |
| 1005 |
parse_obj_as( |
| 1006 |
type_=ListConnectionProfileTemplateResponseContent, |
| 1007 |
object_=_response.json(), |
| 1008 |
), |
| 1009 |
) |
| 1010 |
return AsyncHttpResponse(response=_response, data=_data) |
| 1011 |
if _response.status_code == 401: |
| 1012 |
raise UnauthorizedError( |
| 1013 |
headers=dict(_response.headers), |
| 1014 |
body=typing.cast( |
| 1015 |
typing.Any, |
| 1016 |
parse_obj_as( |
| 1017 |
type_=typing.Any, |
| 1018 |
object_=_response.json(), |
| 1019 |
), |
| 1020 |
), |
| 1021 |
) |
| 1022 |
if _response.status_code == 403: |
| 1023 |
raise ForbiddenError( |
| 1024 |
headers=dict(_response.headers), |
| 1025 |
body=typing.cast( |
| 1026 |
typing.Any, |
| 1027 |
parse_obj_as( |
| 1028 |
type_=typing.Any, |
| 1029 |
object_=_response.json(), |
| 1030 |
), |
| 1031 |
), |
| 1032 |
) |
| 1033 |
if _response.status_code == 429: |
| 1034 |
raise TooManyRequestsError( |
| 1035 |
headers=dict(_response.headers), |
| 1036 |
body=typing.cast( |
| 1037 |
typing.Any, |
| 1038 |
parse_obj_as( |
| 1039 |
type_=typing.Any, |
| 1040 |
object_=_response.json(), |
| 1041 |
), |
| 1042 |
), |
| 1043 |
) |
| 1044 |
_response_json = _response.json() |
| 1045 |
except JSONDecodeError: |
| 1046 |
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) |
| 1047 |
except ValidationError as e: |
| 1048 |
raise ParsingError( |
| 1049 |
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e |
| 1050 |
) |
| 1051 |
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) |
| 1052 |
|
| 1053 |
async def get_template( |
| 1054 |
self, id: str, *, request_options: typing.Optional[RequestOptions] = None |
| 1055 |
) -> AsyncHttpResponse[GetConnectionProfileTemplateResponseContent]: |
| 1056 |
""" |
| 1057 |
Retrieve a Connection Profile Template. |
| 1058 |
|
| 1059 |
Parameters |
| 1060 |
---------- |
| 1061 |
id : str |
| 1062 |
ID of the connection-profile-template to retrieve. |
| 1063 |
|
| 1064 |
request_options : typing.Optional[RequestOptions] |
| 1065 |
Request-specific configuration. |
| 1066 |
|
| 1067 |
Returns |
| 1068 |
------- |
| 1069 |
AsyncHttpResponse[GetConnectionProfileTemplateResponseContent] |
| 1070 |
Connection Profile Template successfully retrieved. |
| 1071 |
""" |
| 1072 |
_response = await self._client_wrapper.httpx_client.request( |
| 1073 |
f"connection-profiles/templates/{encode_path_param(id)}", |
| 1074 |
method="GET", |
| 1075 |
request_options=request_options, |
| 1076 |
) |
| 1077 |
try: |
| 1078 |
if 200 <= _response.status_code < 300: |
| 1079 |
_data = typing.cast( |
| 1080 |
GetConnectionProfileTemplateResponseContent, |
| 1081 |
parse_obj_as( |
| 1082 |
type_=GetConnectionProfileTemplateResponseContent, |
| 1083 |
object_=_response.json(), |
| 1084 |
), |
| 1085 |
) |
| 1086 |
return AsyncHttpResponse(response=_response, data=_data) |
| 1087 |
if _response.status_code == 401: |
| 1088 |
raise UnauthorizedError( |
| 1089 |
headers=dict(_response.headers), |
| 1090 |
body=typing.cast( |
| 1091 |
typing.Any, |
| 1092 |
parse_obj_as( |
| 1093 |
type_=typing.Any, |
| 1094 |
object_=_response.json(), |
| 1095 |
), |
| 1096 |
), |
| 1097 |
) |
| 1098 |
if _response.status_code == 403: |
| 1099 |
raise ForbiddenError( |
| 1100 |
headers=dict(_response.headers), |
| 1101 |
body=typing.cast( |
| 1102 |
typing.Any, |
| 1103 |
parse_obj_as( |
| 1104 |
type_=typing.Any, |
| 1105 |
object_=_response.json(), |
| 1106 |
), |
| 1107 |
), |
| 1108 |
) |
| 1109 |
if _response.status_code == 404: |
| 1110 |
raise NotFoundError( |
| 1111 |
headers=dict(_response.headers), |
| 1112 |
body=typing.cast( |
| 1113 |
typing.Any, |
| 1114 |
parse_obj_as( |
| 1115 |
type_=typing.Any, |
| 1116 |
object_=_response.json(), |
| 1117 |
), |
| 1118 |
), |
| 1119 |
) |
| 1120 |
if _response.status_code == 429: |
| 1121 |
raise TooManyRequestsError( |
| 1122 |
headers=dict(_response.headers), |
| 1123 |
body=typing.cast( |
| 1124 |
typing.Any, |
| 1125 |
parse_obj_as( |
| 1126 |
type_=typing.Any, |
| 1127 |
object_=_response.json(), |
| 1128 |
), |
| 1129 |
), |
| 1130 |
) |
| 1131 |
_response_json = _response.json() |
| 1132 |
except JSONDecodeError: |
| 1133 |
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) |
| 1134 |
except ValidationError as e: |
| 1135 |
raise ParsingError( |
| 1136 |
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e |
| 1137 |
) |
| 1138 |
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) |
| 1139 |
|
| 1140 |
async def get( |
| 1141 |
self, id: str, *, request_options: typing.Optional[RequestOptions] = None |
| 1142 |
) -> AsyncHttpResponse[GetConnectionProfileResponseContent]: |
| 1143 |
""" |
| 1144 |
Retrieve details about a single Connection Profile specified by ID. |
| 1145 |
|
| 1146 |
Parameters |
| 1147 |
---------- |
| 1148 |
id : str |
| 1149 |
ID of the connection-profile to retrieve. |
| 1150 |
|
| 1151 |
request_options : typing.Optional[RequestOptions] |
| 1152 |
Request-specific configuration. |
| 1153 |
|
| 1154 |
Returns |
| 1155 |
------- |
| 1156 |
AsyncHttpResponse[GetConnectionProfileResponseContent] |
| 1157 |
Record for existing connection profile. |
| 1158 |
""" |
| 1159 |
_response = await self._client_wrapper.httpx_client.request( |
| 1160 |
f"connection-profiles/{encode_path_param(id)}", |
| 1161 |
method="GET", |
| 1162 |
request_options=request_options, |
| 1163 |
) |
| 1164 |
try: |
| 1165 |
if 200 <= _response.status_code < 300: |
| 1166 |
_data = typing.cast( |
| 1167 |
GetConnectionProfileResponseContent, |
| 1168 |
parse_obj_as( |
| 1169 |
type_=GetConnectionProfileResponseContent, |
| 1170 |
object_=_response.json(), |
| 1171 |
), |
| 1172 |
) |
| 1173 |
return AsyncHttpResponse(response=_response, data=_data) |
| 1174 |
if _response.status_code == 401: |
| 1175 |
raise UnauthorizedError( |
| 1176 |
headers=dict(_response.headers), |
| 1177 |
body=typing.cast( |
| 1178 |
typing.Any, |
| 1179 |
parse_obj_as( |
| 1180 |
type_=typing.Any, |
| 1181 |
object_=_response.json(), |
| 1182 |
), |
| 1183 |
), |
| 1184 |
) |
| 1185 |
if _response.status_code == 403: |
| 1186 |
raise ForbiddenError( |
| 1187 |
headers=dict(_response.headers), |
| 1188 |
body=typing.cast( |
| 1189 |
typing.Any, |
| 1190 |
parse_obj_as( |
| 1191 |
type_=typing.Any, |
| 1192 |
object_=_response.json(), |
| 1193 |
), |
| 1194 |
), |
| 1195 |
) |
| 1196 |
if _response.status_code == 404: |
| 1197 |
raise NotFoundError( |
| 1198 |
headers=dict(_response.headers), |
| 1199 |
body=typing.cast( |
| 1200 |
typing.Any, |
| 1201 |
parse_obj_as( |
| 1202 |
type_=typing.Any, |
| 1203 |
object_=_response.json(), |
| 1204 |
), |
| 1205 |
), |
| 1206 |
) |
| 1207 |
if _response.status_code == 429: |
| 1208 |
raise TooManyRequestsError( |
| 1209 |
headers=dict(_response.headers), |
| 1210 |
body=typing.cast( |
| 1211 |
typing.Any, |
| 1212 |
parse_obj_as( |
| 1213 |
type_=typing.Any, |
| 1214 |
object_=_response.json(), |
| 1215 |
), |
| 1216 |
), |
| 1217 |
) |
| 1218 |
_response_json = _response.json() |
| 1219 |
except JSONDecodeError: |
| 1220 |
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) |
| 1221 |
except ValidationError as e: |
| 1222 |
raise ParsingError( |
| 1223 |
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e |
| 1224 |
) |
| 1225 |
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) |
| 1226 |
|
| 1227 |
async def delete( |
| 1228 |
self, id: str, *, request_options: typing.Optional[RequestOptions] = None |
| 1229 |
) -> AsyncHttpResponse[None]: |
| 1230 |
""" |
| 1231 |
Delete a single Connection Profile specified by ID. |
| 1232 |
|
| 1233 |
Parameters |
| 1234 |
---------- |
| 1235 |
id : str |
| 1236 |
ID of the connection-profile to delete. |
| 1237 |
|
| 1238 |
request_options : typing.Optional[RequestOptions] |
| 1239 |
Request-specific configuration. |
| 1240 |
|
| 1241 |
Returns |
| 1242 |
------- |
| 1243 |
AsyncHttpResponse[None] |
| 1244 |
""" |
| 1245 |
_response = await self._client_wrapper.httpx_client.request( |
| 1246 |
f"connection-profiles/{encode_path_param(id)}", |
| 1247 |
method="DELETE", |
| 1248 |
request_options=request_options, |
| 1249 |
) |
| 1250 |
try: |
| 1251 |
if 200 <= _response.status_code < 300: |
| 1252 |
return AsyncHttpResponse(response=_response, data=None) |
| 1253 |
if _response.status_code == 401: |
| 1254 |
raise UnauthorizedError( |
| 1255 |
headers=dict(_response.headers), |
| 1256 |
body=typing.cast( |
| 1257 |
typing.Any, |
| 1258 |
parse_obj_as( |
| 1259 |
type_=typing.Any, |
| 1260 |
object_=_response.json(), |
| 1261 |
), |
| 1262 |
), |
| 1263 |
) |
| 1264 |
if _response.status_code == 403: |
| 1265 |
raise ForbiddenError( |
| 1266 |
headers=dict(_response.headers), |
| 1267 |
body=typing.cast( |
| 1268 |
typing.Any, |
| 1269 |
parse_obj_as( |
| 1270 |
type_=typing.Any, |
| 1271 |
object_=_response.json(), |
| 1272 |
), |
| 1273 |
), |
| 1274 |
) |
| 1275 |
if _response.status_code == 429: |
| 1276 |
raise TooManyRequestsError( |
| 1277 |
headers=dict(_response.headers), |
| 1278 |
body=typing.cast( |
| 1279 |
typing.Any, |
| 1280 |
parse_obj_as( |
| 1281 |
type_=typing.Any, |
| 1282 |
object_=_response.json(), |
| 1283 |
), |
| 1284 |
), |
| 1285 |
) |
| 1286 |
_response_json = _response.json() |
| 1287 |
except JSONDecodeError: |
| 1288 |
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) |
| 1289 |
except ValidationError as e: |
| 1290 |
raise ParsingError( |
| 1291 |
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e |
| 1292 |
) |
| 1293 |
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) |
| 1294 |
|
| 1295 |
async def update( |
| 1296 |
self, |
| 1297 |
id: str, |
| 1298 |
*, |
| 1299 |
name: typing.Optional[ConnectionProfileName] = OMIT, |
| 1300 |
organization: typing.Optional[ConnectionProfileOrganization] = OMIT, |
| 1301 |
connection_name_prefix_template: typing.Optional[ConnectionNamePrefixTemplate] = OMIT, |
| 1302 |
enabled_features: typing.Optional[ConnectionProfileEnabledFeatures] = OMIT, |
| 1303 |
connection_config: typing.Optional[ConnectionProfileConfig] = OMIT, |
| 1304 |
strategy_overrides: typing.Optional[ConnectionProfileStrategyOverrides] = OMIT, |
| 1305 |
request_options: typing.Optional[RequestOptions] = None, |
| 1306 |
) -> AsyncHttpResponse[UpdateConnectionProfileResponseContent]: |
| 1307 |
""" |
| 1308 |
Update the details of a specific Connection Profile. |
| 1309 |
|
| 1310 |
Parameters |
| 1311 |
---------- |
| 1312 |
id : str |
| 1313 |
ID of the connection profile to update. |
| 1314 |
|
| 1315 |
name : typing.Optional[ConnectionProfileName] |
| 1316 |
|
| 1317 |
organization : typing.Optional[ConnectionProfileOrganization] |
| 1318 |
|
| 1319 |
connection_name_prefix_template : typing.Optional[ConnectionNamePrefixTemplate] |
| 1320 |
|
| 1321 |
enabled_features : typing.Optional[ConnectionProfileEnabledFeatures] |
| 1322 |
|
| 1323 |
connection_config : typing.Optional[ConnectionProfileConfig] |
| 1324 |
|
| 1325 |
strategy_overrides : typing.Optional[ConnectionProfileStrategyOverrides] |
| 1326 |
|
| 1327 |
request_options : typing.Optional[RequestOptions] |
| 1328 |
Request-specific configuration. |
| 1329 |
|
| 1330 |
Returns |
| 1331 |
------- |
| 1332 |
AsyncHttpResponse[UpdateConnectionProfileResponseContent] |
| 1333 |
Connection profile successfully updated. |
| 1334 |
""" |
| 1335 |
_response = await self._client_wrapper.httpx_client.request( |
| 1336 |
f"connection-profiles/{encode_path_param(id)}", |
| 1337 |
method="PATCH", |
| 1338 |
json={ |
| 1339 |
"name": name, |
| 1340 |
"organization": convert_and_respect_annotation_metadata( |
| 1341 |
object_=organization, annotation=ConnectionProfileOrganization, direction="write" |
| 1342 |
), |
| 1343 |
"connection_name_prefix_template": connection_name_prefix_template, |
| 1344 |
"enabled_features": enabled_features, |
| 1345 |
"connection_config": convert_and_respect_annotation_metadata( |
| 1346 |
object_=connection_config, annotation=ConnectionProfileConfig, direction="write" |
| 1347 |
), |
| 1348 |
"strategy_overrides": convert_and_respect_annotation_metadata( |
| 1349 |
object_=strategy_overrides, annotation=ConnectionProfileStrategyOverrides, direction="write" |
| 1350 |
), |
| 1351 |
}, |
| 1352 |
headers={ |
| 1353 |
"content-type": "application/json", |
| 1354 |
}, |
| 1355 |
request_options=request_options, |
| 1356 |
omit=OMIT, |
| 1357 |
) |
| 1358 |
try: |
| 1359 |
if 200 <= _response.status_code < 300: |
| 1360 |
_data = typing.cast( |
| 1361 |
UpdateConnectionProfileResponseContent, |
| 1362 |
parse_obj_as( |
| 1363 |
type_=UpdateConnectionProfileResponseContent, |
| 1364 |
object_=_response.json(), |
| 1365 |
), |
| 1366 |
) |
| 1367 |
return AsyncHttpResponse(response=_response, data=_data) |
| 1368 |
if _response.status_code == 400: |
| 1369 |
raise BadRequestError( |
| 1370 |
headers=dict(_response.headers), |
| 1371 |
body=typing.cast( |
| 1372 |
typing.Any, |
| 1373 |
parse_obj_as( |
| 1374 |
type_=typing.Any, |
| 1375 |
object_=_response.json(), |
| 1376 |
), |
| 1377 |
), |
| 1378 |
) |
| 1379 |
if _response.status_code == 401: |
| 1380 |
raise UnauthorizedError( |
| 1381 |
headers=dict(_response.headers), |
| 1382 |
body=typing.cast( |
| 1383 |
typing.Any, |
| 1384 |
parse_obj_as( |
| 1385 |
type_=typing.Any, |
| 1386 |
object_=_response.json(), |
| 1387 |
), |
| 1388 |
), |
| 1389 |
) |
| 1390 |
if _response.status_code == 403: |
| 1391 |
raise ForbiddenError( |
| 1392 |
headers=dict(_response.headers), |
| 1393 |
body=typing.cast( |
| 1394 |
typing.Any, |
| 1395 |
parse_obj_as( |
| 1396 |
type_=typing.Any, |
| 1397 |
object_=_response.json(), |
| 1398 |
), |
| 1399 |
), |
| 1400 |
) |
| 1401 |
if _response.status_code == 404: |
| 1402 |
raise NotFoundError( |
| 1403 |
headers=dict(_response.headers), |
| 1404 |
body=typing.cast( |
| 1405 |
typing.Any, |
| 1406 |
parse_obj_as( |
| 1407 |
type_=typing.Any, |
| 1408 |
object_=_response.json(), |
| 1409 |
), |
| 1410 |
), |
| 1411 |
) |
| 1412 |
if _response.status_code == 429: |
| 1413 |
raise TooManyRequestsError( |
| 1414 |
headers=dict(_response.headers), |
| 1415 |
body=typing.cast( |
| 1416 |
typing.Any, |
| 1417 |
parse_obj_as( |
| 1418 |
type_=typing.Any, |
| 1419 |
object_=_response.json(), |
| 1420 |
), |
| 1421 |
), |
| 1422 |
) |
| 1423 |
_response_json = _response.json() |
| 1424 |
except JSONDecodeError: |
| 1425 |
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) |
| 1426 |
except ValidationError as e: |
| 1427 |
raise ParsingError( |
| 1428 |
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e |
| 1429 |
) |
| 1430 |
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) |