diff --git a/DO_OPENAPI_COMMIT_SHA.txt b/DO_OPENAPI_COMMIT_SHA.txt index d6258c8..e247ade 100644 --- a/DO_OPENAPI_COMMIT_SHA.txt +++ b/DO_OPENAPI_COMMIT_SHA.txt @@ -1 +1 @@ -5c389af +932526c diff --git a/requirements.txt b/requirements.txt index d81dee9..701b5e7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,12 +10,12 @@ azure-core==1.30.1 ; python_version >= "3.8" and python_full_version < "4.0.0" azure-identity==1.16.1 ; python_version >= "3.8" and python_full_version < "4.0.0" babel==2.15.0 ; python_version >= "3.8" and python_full_version < "4.0.0" black==24.3.0 ; python_version >= "3.8" and python_full_version < "4.0.0" -certifi==2024.2.2 ; python_version >= "3.8" and python_full_version < "4.0.0" +certifi==2024.7.4 ; python_version >= "3.8" and python_full_version < "4.0.0" cffi==1.16.0 ; python_version >= "3.8" and python_full_version < "4.0.0" and platform_python_implementation != "PyPy" charset-normalizer==3.3.2 ; python_version >= "3.8" and python_full_version < "4.0.0" click==8.1.7 ; python_version >= "3.8" and python_full_version < "4.0.0" colorama==0.4.6 ; python_version >= "3.8" and python_full_version < "4.0.0" and (sys_platform == "win32" or platform_system == "Windows") -cryptography==42.0.7 ; python_version >= "3.8" and python_full_version < "4.0.0" +cryptography==43.0.1 ; python_version >= "3.8" and python_full_version < "4.0.0" dill==0.3.8 ; python_version >= "3.8" and python_full_version < "4.0.0" docutils==0.18.1 ; python_full_version >= "3.8.0" and python_full_version < "4.0.0" exceptiongroup==1.2.1 ; python_full_version >= "3.8.0" and python_version < "3.11" @@ -69,4 +69,4 @@ typing-extensions==4.12.0 ; python_version >= "3.8" and python_full_version < "4 urllib3==2.2.2 ; python_version >= "3.8" and python_full_version < "4.0.0" wrapt==1.16.0 ; python_full_version >= "3.8.0" and python_full_version < "4.0.0" yarl==1.9.4 ; python_version >= "3.8" and python_full_version < "4.0.0" -zipp==3.19.0 ; python_version >= "3.8" and python_version < "3.10" +zipp==3.19.1 ; python_version >= "3.8" and python_version < "3.10" diff --git a/src/pydo/_client.py b/src/pydo/_client.py index 0452865..13108ce 100644 --- a/src/pydo/_client.py +++ b/src/pydo/_client.py @@ -56,6 +56,7 @@ VolumeSnapshotsOperations, VolumesOperations, VpcPeeringsOperations, + VpcnatgatewaysOperations, VpcsOperations, ) @@ -651,6 +652,8 @@ class GeneratedClient: # pylint: disable=client-accepts-api-version-keyword,too :vartype vpcs: pydo.operations.VpcsOperations :ivar vpc_peerings: VpcPeeringsOperations operations :vartype vpc_peerings: pydo.operations.VpcPeeringsOperations + :ivar vpcnatgateways: VpcnatgatewaysOperations operations + :vartype vpcnatgateways: pydo.operations.VpcnatgatewaysOperations :ivar uptime: UptimeOperations operations :vartype uptime: pydo.operations.UptimeOperations :ivar genai: GenaiOperations operations @@ -820,6 +823,9 @@ def __init__( self.vpc_peerings = VpcPeeringsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.vpcnatgateways = VpcnatgatewaysOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.uptime = UptimeOperations( self._client, self._config, self._serialize, self._deserialize ) diff --git a/src/pydo/aio/_client.py b/src/pydo/aio/_client.py index a667f89..1cf0670 100644 --- a/src/pydo/aio/_client.py +++ b/src/pydo/aio/_client.py @@ -56,6 +56,7 @@ VolumeSnapshotsOperations, VolumesOperations, VpcPeeringsOperations, + VpcnatgatewaysOperations, VpcsOperations, ) @@ -651,6 +652,8 @@ class GeneratedClient: # pylint: disable=client-accepts-api-version-keyword,too :vartype vpcs: pydo.aio.operations.VpcsOperations :ivar vpc_peerings: VpcPeeringsOperations operations :vartype vpc_peerings: pydo.aio.operations.VpcPeeringsOperations + :ivar vpcnatgateways: VpcnatgatewaysOperations operations + :vartype vpcnatgateways: pydo.aio.operations.VpcnatgatewaysOperations :ivar uptime: UptimeOperations operations :vartype uptime: pydo.aio.operations.UptimeOperations :ivar genai: GenaiOperations operations @@ -820,6 +823,9 @@ def __init__( self.vpc_peerings = VpcPeeringsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.vpcnatgateways = VpcnatgatewaysOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.uptime = UptimeOperations( self._client, self._config, self._serialize, self._deserialize ) diff --git a/src/pydo/aio/operations/__init__.py b/src/pydo/aio/operations/__init__.py index a30d54a..e0bfa5c 100644 --- a/src/pydo/aio/operations/__init__.py +++ b/src/pydo/aio/operations/__init__.py @@ -45,6 +45,7 @@ from ._operations import VolumeSnapshotsOperations from ._operations import VpcsOperations from ._operations import VpcPeeringsOperations +from ._operations import VpcnatgatewaysOperations from ._operations import UptimeOperations from ._operations import GenaiOperations @@ -94,6 +95,7 @@ "VolumeSnapshotsOperations", "VpcsOperations", "VpcPeeringsOperations", + "VpcnatgatewaysOperations", "UptimeOperations", "GenaiOperations", ] diff --git a/src/pydo/aio/operations/_operations.py b/src/pydo/aio/operations/_operations.py index 79ba020..13a233c 100644 --- a/src/pydo/aio/operations/_operations.py +++ b/src/pydo/aio/operations/_operations.py @@ -112,6 +112,7 @@ build_databases_delete_user_request, build_databases_destroy_cluster_request, build_databases_destroy_replica_request, + build_databases_get_autoscale_request, build_databases_get_ca_request, build_databases_get_cluster_metrics_credentials_request, build_databases_get_cluster_request, @@ -146,6 +147,7 @@ build_databases_patch_config_request, build_databases_promote_replica_request, build_databases_reset_auth_request, + build_databases_update_autoscale_request, build_databases_update_cluster_metrics_credentials_request, build_databases_update_cluster_size_request, build_databases_update_connection_pool_request, @@ -222,6 +224,7 @@ build_genai_create_agent_api_key_request, build_genai_create_agent_request, build_genai_create_anthropic_api_key_request, + build_genai_create_data_source_file_upload_presigned_urls_request, build_genai_create_evaluation_dataset_file_upload_presigned_urls_request, build_genai_create_evaluation_dataset_request, build_genai_create_evaluation_test_case_request, @@ -526,6 +529,11 @@ build_vpc_peerings_get_request, build_vpc_peerings_list_request, build_vpc_peerings_patch_request, + build_vpcnatgateways_create_request, + build_vpcnatgateways_delete_request, + build_vpcnatgateways_get_request, + build_vpcnatgateways_list_request, + build_vpcnatgateways_update_request, build_vpcs_create_peerings_request, build_vpcs_create_request, build_vpcs_delete_request, @@ -102809,6 +102817,17 @@ async def create_cluster( cluster is located. Required. "size": "str", # The slug identifier representing the size of the nodes in the database cluster. Required. + "autoscale": { + "storage": { + "enabled": bool, # Whether storage autoscaling is enabled + for the cluster. Required. + "increment_gib": 0, # Optional. The amount of additional + storage to add (in GiB) when autoscaling is triggered. + "threshold_percent": 0 # Optional. The storage usage + threshold percentage that triggers autoscaling. When storage usage + exceeds this percentage, additional storage will be added automatically. + } + }, "backup_restore": { "database_name": "str", # The name of an existing database cluster from which the backup will be restored. Required. @@ -103786,6 +103805,17 @@ async def create_cluster(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> J cluster is located. Required. "size": "str", # The slug identifier representing the size of the nodes in the database cluster. Required. + "autoscale": { + "storage": { + "enabled": bool, # Whether storage autoscaling is enabled + for the cluster. Required. + "increment_gib": 0, # Optional. The amount of additional + storage to add (in GiB) when autoscaling is triggered. + "threshold_percent": 0 # Optional. The storage usage + threshold percentage that triggers autoscaling. When storage usage + exceeds this percentage, additional storage will be added automatically. + } + }, "backup_restore": { "database_name": "str", # The name of an existing database cluster from which the backup will be restored. Required. @@ -113875,6 +113905,378 @@ async def update_major_version( return deserialized # type: ignore + @distributed_trace_async + async def get_autoscale(self, database_cluster_uuid: str, **kwargs: Any) -> JSON: + # pylint: disable=line-too-long + """Retrieve Autoscale Configuration for a Database Cluster. + + To retrieve the autoscale configuration for an existing database cluster, send a GET request to + ``/v2/databases/$DATABASE_ID/autoscale``. + The response will be a JSON object with autoscaling configuration details. + + :param database_cluster_uuid: A unique identifier for a database cluster. Required. + :type database_cluster_uuid: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "autoscale": { + "storage": { + "enabled": bool, # Whether storage autoscaling is enabled + for the cluster. Required. + "increment_gib": 0, # Optional. The amount of additional + storage to add (in GiB) when autoscaling is triggered. + "threshold_percent": 0 # Optional. The storage usage + threshold percentage that triggers autoscaling. When storage usage + exceeds this percentage, additional storage will be added automatically. + } + } + } + # response body for status code(s): 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + 401: cast( + Type[HttpResponseError], + lambda response: ClientAuthenticationError(response=response), + ), + 429: HttpResponseError, + 500: HttpResponseError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[JSON] = kwargs.pop("cls", None) + + _request = build_databases_get_autoscale_request( + database_cluster_uuid=database_cluster_uuid, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = ( + await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response) + + response_headers = {} + if response.status_code == 200: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 404: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + + return cast(JSON, deserialized) # type: ignore + + @overload + async def update_autoscale( + self, + database_cluster_uuid: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[JSON]: + # pylint: disable=line-too-long + """Configure Autoscale Settings for a Database Cluster. + + To configure autoscale settings for an existing database cluster, send a PUT request to + ``/v2/databases/$DATABASE_ID/autoscale``\\ , specifying the autoscale configuration. + A successful request will receive a 204 No Content status code with no body in response. + + :param database_cluster_uuid: A unique identifier for a database cluster. Required. + :type database_cluster_uuid: str + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON object or None + :rtype: JSON or None + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "storage": { + "enabled": bool, # Whether storage autoscaling is enabled for the + cluster. Required. + "increment_gib": 0, # Optional. The amount of additional storage to + add (in GiB) when autoscaling is triggered. + "threshold_percent": 0 # Optional. The storage usage threshold + percentage that triggers autoscaling. When storage usage exceeds this + percentage, additional storage will be added automatically. + } + } + + # response body for status code(s): 404, 422 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @overload + async def update_autoscale( + self, + database_cluster_uuid: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[JSON]: + # pylint: disable=line-too-long + """Configure Autoscale Settings for a Database Cluster. + + To configure autoscale settings for an existing database cluster, send a PUT request to + ``/v2/databases/$DATABASE_ID/autoscale``\\ , specifying the autoscale configuration. + A successful request will receive a 204 No Content status code with no body in response. + + :param database_cluster_uuid: A unique identifier for a database cluster. Required. + :type database_cluster_uuid: str + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON object or None + :rtype: JSON or None + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 404, 422 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @distributed_trace_async + async def update_autoscale( + self, database_cluster_uuid: str, body: Union[JSON, IO[bytes]], **kwargs: Any + ) -> Optional[JSON]: + # pylint: disable=line-too-long + """Configure Autoscale Settings for a Database Cluster. + + To configure autoscale settings for an existing database cluster, send a PUT request to + ``/v2/databases/$DATABASE_ID/autoscale``\\ , specifying the autoscale configuration. + A successful request will receive a 204 No Content status code with no body in response. + + :param database_cluster_uuid: A unique identifier for a database cluster. Required. + :type database_cluster_uuid: str + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :return: JSON object or None + :rtype: JSON or None + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "storage": { + "enabled": bool, # Whether storage autoscaling is enabled for the + cluster. Required. + "increment_gib": 0, # Optional. The amount of additional storage to + add (in GiB) when autoscaling is triggered. + "threshold_percent": 0 # Optional. The storage usage threshold + percentage that triggers autoscaling. When storage usage exceeds this + percentage, additional storage will be added automatically. + } + } + + # response body for status code(s): 404, 422 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + 401: cast( + Type[HttpResponseError], + lambda response: ClientAuthenticationError(response=response), + ), + 429: HttpResponseError, + 500: HttpResponseError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) + cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = body + + _request = build_databases_update_autoscale_request( + database_cluster_uuid=database_cluster_uuid, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = ( + await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + ) + + response = pipeline_response.http_response + + if response.status_code not in [204, 404, 422]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response) + + deserialized = None + response_headers = {} + if response.status_code == 204: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.status_code == 404: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 422: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + @distributed_trace_async async def list_kafka_topics( self, database_cluster_uuid: str, **kwargs: Any @@ -177703,14 +178105,915 @@ async def patch_peerings( return cast(JSON, deserialized) # type: ignore -class VpcPeeringsOperations: +class VpcPeeringsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~pydo.aio.GeneratedClient`'s + :attr:`vpc_peerings` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = ( + input_args.pop(0) if input_args else kwargs.pop("deserializer") + ) + + @distributed_trace_async + async def list( + self, + *, + per_page: int = 20, + page: int = 1, + region: Optional[str] = None, + **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """List All VPC Peerings. + + To list all of the VPC peerings on your account, send a GET request to ``/v2/vpc_peerings``. + + :keyword per_page: Number of items returned per page. Default value is 20. + :paramtype per_page: int + :keyword page: Which 'page' of paginated results to return. Default value is 1. + :paramtype page: int + :keyword region: The slug identifier for the region where the resource is available. Known + values are: "ams1", "ams2", "ams3", "blr1", "fra1", "lon1", "nyc1", "nyc2", "nyc3", "sfo1", + "sfo2", "sfo3", "sgp1", "tor1", and "syd1". Default value is None. + :paramtype region: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "meta": { + "total": 0 # Optional. Number of objects returned by the request. + }, + "links": { + "pages": {} + }, + "vpc_peerings": [ + { + "created_at": "2020-02-20 00:00:00", # Optional. A time + value given in ISO8601 combined date and time format. + "id": "str", # Optional. A unique ID that can be used to + identify and reference the VPC peering. + "name": "str", # Optional. The name of the VPC peering. Must + be unique within the team and may only contain alphanumeric characters + and dashes. + "status": "str", # Optional. The current status of the VPC + peering. Known values are: "PROVISIONING", "ACTIVE", and "DELETING". + "vpc_ids": [ + "str" # Optional. An array of the two peered VPCs + IDs. + ] + } + ] + } + # response body for status code(s): 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + 401: cast( + Type[HttpResponseError], + lambda response: ClientAuthenticationError(response=response), + ), + 429: HttpResponseError, + 500: HttpResponseError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[JSON] = kwargs.pop("cls", None) + + _request = build_vpc_peerings_list_request( + per_page=per_page, + page=page, + region=region, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = ( + await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response) + + response_headers = {} + if response.status_code == 200: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 404: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + + return cast(JSON, deserialized) # type: ignore + + @overload + async def create( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Create a New VPC Peering. + + To create a new VPC Peering, send a POST request to ``/v2/vpc_peerings`` + specifying a name and a list of two VPC IDs to peer. The response code, 202 + Accepted, does not indicate the success or failure of the operation, just + that the request has been accepted for processing. + + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "name": "str", # Optional. The name of the VPC peering. Must be unique + within the team and may only contain alphanumeric characters and dashes. + "vpc_ids": [ + "str" # Optional. An array of the two peered VPCs IDs. + ] + } + + # response body for status code(s): 202 + response == { + "vpc_peering": { + "created_at": "2020-02-20 00:00:00", # Optional. A time value given + in ISO8601 combined date and time format. + "id": "str", # Optional. A unique ID that can be used to identify + and reference the VPC peering. + "name": "str", # Optional. The name of the VPC peering. Must be + unique within the team and may only contain alphanumeric characters and + dashes. + "status": "str", # Optional. The current status of the VPC peering. + Known values are: "PROVISIONING", "ACTIVE", and "DELETING". + "vpc_ids": [ + "str" # Optional. An array of the two peered VPCs IDs. + ] + } + } + """ + + @overload + async def create( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Create a New VPC Peering. + + To create a new VPC Peering, send a POST request to ``/v2/vpc_peerings`` + specifying a name and a list of two VPC IDs to peer. The response code, 202 + Accepted, does not indicate the success or failure of the operation, just + that the request has been accepted for processing. + + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 202 + response == { + "vpc_peering": { + "created_at": "2020-02-20 00:00:00", # Optional. A time value given + in ISO8601 combined date and time format. + "id": "str", # Optional. A unique ID that can be used to identify + and reference the VPC peering. + "name": "str", # Optional. The name of the VPC peering. Must be + unique within the team and may only contain alphanumeric characters and + dashes. + "status": "str", # Optional. The current status of the VPC peering. + Known values are: "PROVISIONING", "ACTIVE", and "DELETING". + "vpc_ids": [ + "str" # Optional. An array of the two peered VPCs IDs. + ] + } + } + """ + + @distributed_trace_async + async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: + # pylint: disable=line-too-long + """Create a New VPC Peering. + + To create a new VPC Peering, send a POST request to ``/v2/vpc_peerings`` + specifying a name and a list of two VPC IDs to peer. The response code, 202 + Accepted, does not indicate the success or failure of the operation, just + that the request has been accepted for processing. + + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "name": "str", # Optional. The name of the VPC peering. Must be unique + within the team and may only contain alphanumeric characters and dashes. + "vpc_ids": [ + "str" # Optional. An array of the two peered VPCs IDs. + ] + } + + # response body for status code(s): 202 + response == { + "vpc_peering": { + "created_at": "2020-02-20 00:00:00", # Optional. A time value given + in ISO8601 combined date and time format. + "id": "str", # Optional. A unique ID that can be used to identify + and reference the VPC peering. + "name": "str", # Optional. The name of the VPC peering. Must be + unique within the team and may only contain alphanumeric characters and + dashes. + "status": "str", # Optional. The current status of the VPC peering. + Known values are: "PROVISIONING", "ACTIVE", and "DELETING". + "vpc_ids": [ + "str" # Optional. An array of the two peered VPCs IDs. + ] + } + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + 401: cast( + Type[HttpResponseError], + lambda response: ClientAuthenticationError(response=response), + ), + 429: HttpResponseError, + 500: HttpResponseError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) + cls: ClsType[JSON] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = body + + _request = build_vpc_peerings_create_request( + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = ( + await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + + return cast(JSON, deserialized) # type: ignore + + @distributed_trace_async + async def get(self, vpc_peering_id: str, **kwargs: Any) -> JSON: + # pylint: disable=line-too-long + """Retrieve an Existing VPC Peering. + + To show information about an existing VPC Peering, send a GET request to + ``/v2/vpc_peerings/$VPC_PEERING_ID``. + + :param vpc_peering_id: A unique identifier for a VPC peering. Required. + :type vpc_peering_id: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "vpc_peering": { + "created_at": "2020-02-20 00:00:00", # Optional. A time value given + in ISO8601 combined date and time format. + "id": "str", # Optional. A unique ID that can be used to identify + and reference the VPC peering. + "name": "str", # Optional. The name of the VPC peering. Must be + unique within the team and may only contain alphanumeric characters and + dashes. + "status": "str", # Optional. The current status of the VPC peering. + Known values are: "PROVISIONING", "ACTIVE", and "DELETING". + "vpc_ids": [ + "str" # Optional. An array of the two peered VPCs IDs. + ] + } + } + # response body for status code(s): 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + 401: cast( + Type[HttpResponseError], + lambda response: ClientAuthenticationError(response=response), + ), + 429: HttpResponseError, + 500: HttpResponseError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[JSON] = kwargs.pop("cls", None) + + _request = build_vpc_peerings_get_request( + vpc_peering_id=vpc_peering_id, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = ( + await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response) + + response_headers = {} + if response.status_code == 200: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 404: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + + return cast(JSON, deserialized) # type: ignore + + @overload + async def patch( + self, + vpc_peering_id: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Update a VPC peering. + + To update the name of a VPC peering, send a PATCH request to + ``/v2/vpc_peerings/$VPC_PEERING_ID`` with the new ``name`` in the request body. + + :param vpc_peering_id: A unique identifier for a VPC peering. Required. + :type vpc_peering_id: str + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "name": "str" # Optional. The name of the VPC peering. Must be unique within + the team and may only contain alphanumeric characters and dashes. + } + + # response body for status code(s): 200 + response == { + "vpc_peering": { + "created_at": "2020-02-20 00:00:00", # Optional. A time value given + in ISO8601 combined date and time format. + "id": "str", # Optional. A unique ID that can be used to identify + and reference the VPC peering. + "name": "str", # Optional. The name of the VPC peering. Must be + unique within the team and may only contain alphanumeric characters and + dashes. + "status": "str", # Optional. The current status of the VPC peering. + Known values are: "PROVISIONING", "ACTIVE", and "DELETING". + "vpc_ids": [ + "str" # Optional. An array of the two peered VPCs IDs. + ] + } + } + # response body for status code(s): 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @overload + async def patch( + self, + vpc_peering_id: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Update a VPC peering. + + To update the name of a VPC peering, send a PATCH request to + ``/v2/vpc_peerings/$VPC_PEERING_ID`` with the new ``name`` in the request body. + + :param vpc_peering_id: A unique identifier for a VPC peering. Required. + :type vpc_peering_id: str + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "vpc_peering": { + "created_at": "2020-02-20 00:00:00", # Optional. A time value given + in ISO8601 combined date and time format. + "id": "str", # Optional. A unique ID that can be used to identify + and reference the VPC peering. + "name": "str", # Optional. The name of the VPC peering. Must be + unique within the team and may only contain alphanumeric characters and + dashes. + "status": "str", # Optional. The current status of the VPC peering. + Known values are: "PROVISIONING", "ACTIVE", and "DELETING". + "vpc_ids": [ + "str" # Optional. An array of the two peered VPCs IDs. + ] + } + } + # response body for status code(s): 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @distributed_trace_async + async def patch( + self, vpc_peering_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Update a VPC peering. + + To update the name of a VPC peering, send a PATCH request to + ``/v2/vpc_peerings/$VPC_PEERING_ID`` with the new ``name`` in the request body. + + :param vpc_peering_id: A unique identifier for a VPC peering. Required. + :type vpc_peering_id: str + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "name": "str" # Optional. The name of the VPC peering. Must be unique within + the team and may only contain alphanumeric characters and dashes. + } + + # response body for status code(s): 200 + response == { + "vpc_peering": { + "created_at": "2020-02-20 00:00:00", # Optional. A time value given + in ISO8601 combined date and time format. + "id": "str", # Optional. A unique ID that can be used to identify + and reference the VPC peering. + "name": "str", # Optional. The name of the VPC peering. Must be + unique within the team and may only contain alphanumeric characters and + dashes. + "status": "str", # Optional. The current status of the VPC peering. + Known values are: "PROVISIONING", "ACTIVE", and "DELETING". + "vpc_ids": [ + "str" # Optional. An array of the two peered VPCs IDs. + ] + } + } + # response body for status code(s): 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + 401: cast( + Type[HttpResponseError], + lambda response: ClientAuthenticationError(response=response), + ), + 429: HttpResponseError, + 500: HttpResponseError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) + cls: ClsType[JSON] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = body + + _request = build_vpc_peerings_patch_request( + vpc_peering_id=vpc_peering_id, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = ( + await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response) + + response_headers = {} + if response.status_code == 200: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 404: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + + return cast(JSON, deserialized) # type: ignore + + @distributed_trace_async + async def delete(self, vpc_peering_id: str, **kwargs: Any) -> JSON: + # pylint: disable=line-too-long + """Delete a VPC peering. + + To delete a VPC peering, send a DELETE request to ``/v2/vpc_peerings/$VPC_PEERING_ID``. + + :param vpc_peering_id: A unique identifier for a VPC peering. Required. + :type vpc_peering_id: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 202 + response == { + "vpc_peering": { + "created_at": "2020-02-20 00:00:00", # Optional. A time value given + in ISO8601 combined date and time format. + "id": "str", # Optional. A unique ID that can be used to identify + and reference the VPC peering. + "name": "str", # Optional. The name of the VPC peering. Must be + unique within the team and may only contain alphanumeric characters and + dashes. + "status": "str", # Optional. The current status of the VPC peering. + Known values are: "PROVISIONING", "ACTIVE", and "DELETING". + "vpc_ids": [ + "str" # Optional. An array of the two peered VPCs IDs. + ] + } + } + # response body for status code(s): 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + 401: cast( + Type[HttpResponseError], + lambda response: ClientAuthenticationError(response=response), + ), + 429: HttpResponseError, + 500: HttpResponseError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[JSON] = kwargs.pop("cls", None) + + _request = build_vpc_peerings_delete_request( + vpc_peering_id=vpc_peering_id, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = ( + await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response) + + response_headers = {} + if response.status_code == 202: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 404: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + + return cast(JSON, deserialized) # type: ignore + + +class VpcnatgatewaysOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~pydo.aio.GeneratedClient`'s - :attr:`vpc_peerings` attribute. + :attr:`vpcnatgateways` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -177728,22 +179031,35 @@ async def list( *, per_page: int = 20, page: int = 1, + state: Optional[str] = None, region: Optional[str] = None, + type: Optional[str] = None, + name: Optional[str] = None, **kwargs: Any ) -> JSON: # pylint: disable=line-too-long - """List All VPC Peerings. + """List All VPC NAT Gateways. - To list all of the VPC peerings on your account, send a GET request to ``/v2/vpc_peerings``. + To list all VPC NAT gateways in your team, send a GET request to ``/v2/vpc_nat_gateways``. + The response body will be a JSON object with a key of ``vpc_nat_gateways`` containing an array + of VPC NAT gateway objects. + These each contain the standard VPC NAT gateway attributes. :keyword per_page: Number of items returned per page. Default value is 20. :paramtype per_page: int :keyword page: Which 'page' of paginated results to return. Default value is 1. :paramtype page: int - :keyword region: The slug identifier for the region where the resource is available. Known - values are: "ams1", "ams2", "ams3", "blr1", "fra1", "lon1", "nyc1", "nyc2", "nyc3", "sfo1", - "sfo2", "sfo3", "sgp1", "tor1", and "syd1". Default value is None. + :keyword state: The current state of the VPC NAT gateway. Known values are: "new", + "provisioning", "active", "deleting", "error", and "invalid". Default value is None. + :paramtype state: str + :keyword region: The region where the VPC NAT gateway is located. Known values are: "nyc1", + "nyc2", "nyc3", "ams2", "ams3", "sfo1", "sfo2", "sfo3", "sgp1", "lon1", "fra1", "tor1", "blr1", + "syd1", and "atl1". Default value is None. :paramtype region: str + :keyword type: The type of the VPC NAT gateway. "public" Default value is None. + :paramtype type: str + :keyword name: The name of the VPC NAT gateway. Default value is None. + :paramtype name: str :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: @@ -177759,35 +179075,53 @@ async def list( "links": { "pages": {} }, - "vpc_peerings": [ + "vpc_nat_gateways": [ { "created_at": "2020-02-20 00:00:00", # Optional. A time - value given in ISO8601 combined date and time format. - "id": "str", # Optional. A unique ID that can be used to - identify and reference the VPC peering. - "name": "str", # Optional. The name of the VPC peering. Must - be unique within the team and may only contain alphanumeric characters - and dashes. - "status": "str", # Optional. The current status of the VPC - peering. Known values are: "PROVISIONING", "ACTIVE", and "DELETING". - "vpc_ids": [ - "str" # Optional. An array of the two peered VPCs - IDs. + value given in ISO8601 combined date and time format that represents when + the VPC NAT gateway was created. + "egresses": { + "public_gateways": [ + { + "ipv4": "str" # Optional. IPv4 + address of the public gateway. + } + ] + }, + "icmp_timeout_seconds": 0, # Optional. The ICMP timeout in + seconds for the VPC NAT gateway. + "id": "str", # Optional. The unique identifier for the VPC + NAT gateway. This is automatically generated upon creation. + "name": "str", # Optional. The human-readable name of the + VPC NAT gateway. + "region": "str", # Optional. The region in which the VPC NAT + gateway is created. Known values are: "nyc1", "nyc2", "nyc3", "ams2", + "ams3", "sfo1", "sfo2", "sfo3", "sgp1", "lon1", "fra1", "tor1", "blr1", + "syd1", and "atl1". + "size": 0, # Optional. The size of the VPC NAT gateway. + "state": "str", # Optional. The current state of the VPC NAT + gateway. Known values are: "NEW", "PROVISIONING", "ACTIVE", "DELETING", + "ERROR", and "INVALID". + "tcp_timeout_seconds": 0, # Optional. The TCP timeout in + seconds for the VPC NAT gateway. + "type": "str", # Optional. The type of the VPC NAT gateway. + "PUBLIC" + "udp_timeout_seconds": 0, # Optional. The UDP timeout in + seconds for the VPC NAT gateway. + "updated_at": "2020-02-20 00:00:00", # Optional. A time + value given in ISO8601 combined date and time format that represents when + the VPC NAT gateway was last updated. + "vpcs": [ + { + "gateway_ip": "str", # Optional. The gateway + IP address of the VPC NAT gateway. + "vpc_uuid": "str" # Optional. The unique + identifier of the VPC to which the NAT gateway is attached. + } ] } ] } - # response body for status code(s): 404 - response == { - "id": "str", # A short identifier corresponding to the HTTP status code - returned. For example, the ID for a response returning a 404 status code would - be "not_found.". Required. - "message": "str", # A message providing additional information about the - error, including details to help resolve it when possible. Required. - "request_id": "str" # Optional. Optionally, some endpoints may include a - request ID that should be provided when reporting bugs or opening support - tickets to help identify the issue. - } """ error_map: MutableMapping[int, Type[HttpResponseError]] = { 404: ResourceNotFoundError, @@ -177807,10 +179141,13 @@ async def list( cls: ClsType[JSON] = kwargs.pop("cls", None) - _request = build_vpc_peerings_list_request( + _request = build_vpcnatgateways_list_request( per_page=per_page, page=page, + state=state, region=region, + type=type, + name=name, headers=_headers, params=_params, ) @@ -177825,44 +179162,27 @@ async def list( response = pipeline_response.http_response - if response.status_code not in [200, 404]: + if response.status_code not in [200]: if _stream: await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore raise HttpResponseError(response=response) response_headers = {} - if response.status_code == 200: - response_headers["ratelimit-limit"] = self._deserialize( - "int", response.headers.get("ratelimit-limit") - ) - response_headers["ratelimit-remaining"] = self._deserialize( - "int", response.headers.get("ratelimit-remaining") - ) - response_headers["ratelimit-reset"] = self._deserialize( - "int", response.headers.get("ratelimit-reset") - ) - - if response.content: - deserialized = response.json() - else: - deserialized = None - - if response.status_code == 404: - response_headers["ratelimit-limit"] = self._deserialize( - "int", response.headers.get("ratelimit-limit") - ) - response_headers["ratelimit-remaining"] = self._deserialize( - "int", response.headers.get("ratelimit-remaining") - ) - response_headers["ratelimit-reset"] = self._deserialize( - "int", response.headers.get("ratelimit-reset") - ) + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) - if response.content: - deserialized = response.json() - else: - deserialized = None + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore @@ -177871,17 +179191,22 @@ async def list( @overload async def create( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + self, + body: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any ) -> JSON: # pylint: disable=line-too-long - """Create a New VPC Peering. + """Create a New VPC NAT Gateway. - To create a new VPC Peering, send a POST request to ``/v2/vpc_peerings`` - specifying a name and a list of two VPC IDs to peer. The response code, 202 - Accepted, does not indicate the success or failure of the operation, just - that the request has been accepted for processing. + To create a new VPC NAT gateway, send a POST request to ``/v2/vpc_nat_gateways`` setting the + required attributes. - :param body: Required. + The response body will contain a JSON object with a key called ``vpc_nat_gateway`` containing + the standard attributes for the new VPC NAT gateway. + + :param body: Default value is None. :type body: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -177895,27 +179220,68 @@ async def create( # JSON input template you can fill out and use as your body input. body = { - "name": "str", # Optional. The name of the VPC peering. Must be unique - within the team and may only contain alphanumeric characters and dashes. - "vpc_ids": [ - "str" # Optional. An array of the two peered VPCs IDs. - ] + "name": "str", # The human-readable name of the VPC NAT gateway. Required. + "region": "str", # The region in which the VPC NAT gateway is created. + Required. Known values are: "nyc1", "nyc2", "nyc3", "ams2", "ams3", "sfo1", + "sfo2", "sfo3", "sgp1", "lon1", "fra1", "tor1", "blr1", "syd1", and "atl1". + "size": 0, # The size of the VPC NAT gateway. Required. + "type": "str", # The type of the VPC NAT gateway. Required. "PUBLIC" + "vpcs": [ + { + "vpc_uuid": "str" # Optional. The unique identifier of the + VPC to which the NAT gateway is attached. + } + ], + "icmp_timeout_seconds": 0, # Optional. The ICMP timeout in seconds for the + VPC NAT gateway. + "tcp_timeout_seconds": 0, # Optional. The TCP timeout in seconds for the VPC + NAT gateway. + "udp_timeout_seconds": 0 # Optional. The UDP timeout in seconds for the VPC + NAT gateway. } # response body for status code(s): 202 response == { - "vpc_peering": { + "vpc_nat_gateway": { "created_at": "2020-02-20 00:00:00", # Optional. A time value given - in ISO8601 combined date and time format. - "id": "str", # Optional. A unique ID that can be used to identify - and reference the VPC peering. - "name": "str", # Optional. The name of the VPC peering. Must be - unique within the team and may only contain alphanumeric characters and - dashes. - "status": "str", # Optional. The current status of the VPC peering. - Known values are: "PROVISIONING", "ACTIVE", and "DELETING". - "vpc_ids": [ - "str" # Optional. An array of the two peered VPCs IDs. + in ISO8601 combined date and time format that represents when the VPC NAT + gateway was created. + "egresses": { + "public_gateways": [ + { + "ipv4": "str" # Optional. IPv4 address of + the public gateway. + } + ] + }, + "icmp_timeout_seconds": 0, # Optional. The ICMP timeout in seconds + for the VPC NAT gateway. + "id": "str", # Optional. The unique identifier for the VPC NAT + gateway. This is automatically generated upon creation. + "name": "str", # Optional. The human-readable name of the VPC NAT + gateway. + "region": "str", # Optional. The region in which the VPC NAT gateway + is created. Known values are: "nyc1", "nyc2", "nyc3", "ams2", "ams3", "sfo1", + "sfo2", "sfo3", "sgp1", "lon1", "fra1", "tor1", "blr1", "syd1", and "atl1". + "size": 0, # Optional. The size of the VPC NAT gateway. + "state": "str", # Optional. The current state of the VPC NAT + gateway. Known values are: "NEW", "PROVISIONING", "ACTIVE", "DELETING", + "ERROR", and "INVALID". + "tcp_timeout_seconds": 0, # Optional. The TCP timeout in seconds for + the VPC NAT gateway. + "type": "str", # Optional. The type of the VPC NAT gateway. "PUBLIC" + "udp_timeout_seconds": 0, # Optional. The UDP timeout in seconds for + the VPC NAT gateway. + "updated_at": "2020-02-20 00:00:00", # Optional. A time value given + in ISO8601 combined date and time format that represents when the VPC NAT + gateway was last updated. + "vpcs": [ + { + "gateway_ip": "str", # Optional. The gateway IP + address of the VPC NAT gateway. + "vpc_uuid": "str" # Optional. The unique identifier + of the VPC to which the NAT gateway is attached. + } ] } } @@ -177923,17 +179289,22 @@ async def create( @overload async def create( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + self, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any ) -> JSON: # pylint: disable=line-too-long - """Create a New VPC Peering. + """Create a New VPC NAT Gateway. - To create a new VPC Peering, send a POST request to ``/v2/vpc_peerings`` - specifying a name and a list of two VPC IDs to peer. The response code, 202 - Accepted, does not indicate the success or failure of the operation, just - that the request has been accepted for processing. + To create a new VPC NAT gateway, send a POST request to ``/v2/vpc_nat_gateways`` setting the + required attributes. - :param body: Required. + The response body will contain a JSON object with a key called ``vpc_nat_gateway`` containing + the standard attributes for the new VPC NAT gateway. + + :param body: Default value is None. :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -177947,34 +179318,65 @@ async def create( # response body for status code(s): 202 response == { - "vpc_peering": { + "vpc_nat_gateway": { "created_at": "2020-02-20 00:00:00", # Optional. A time value given - in ISO8601 combined date and time format. - "id": "str", # Optional. A unique ID that can be used to identify - and reference the VPC peering. - "name": "str", # Optional. The name of the VPC peering. Must be - unique within the team and may only contain alphanumeric characters and - dashes. - "status": "str", # Optional. The current status of the VPC peering. - Known values are: "PROVISIONING", "ACTIVE", and "DELETING". - "vpc_ids": [ - "str" # Optional. An array of the two peered VPCs IDs. + in ISO8601 combined date and time format that represents when the VPC NAT + gateway was created. + "egresses": { + "public_gateways": [ + { + "ipv4": "str" # Optional. IPv4 address of + the public gateway. + } + ] + }, + "icmp_timeout_seconds": 0, # Optional. The ICMP timeout in seconds + for the VPC NAT gateway. + "id": "str", # Optional. The unique identifier for the VPC NAT + gateway. This is automatically generated upon creation. + "name": "str", # Optional. The human-readable name of the VPC NAT + gateway. + "region": "str", # Optional. The region in which the VPC NAT gateway + is created. Known values are: "nyc1", "nyc2", "nyc3", "ams2", "ams3", "sfo1", + "sfo2", "sfo3", "sgp1", "lon1", "fra1", "tor1", "blr1", "syd1", and "atl1". + "size": 0, # Optional. The size of the VPC NAT gateway. + "state": "str", # Optional. The current state of the VPC NAT + gateway. Known values are: "NEW", "PROVISIONING", "ACTIVE", "DELETING", + "ERROR", and "INVALID". + "tcp_timeout_seconds": 0, # Optional. The TCP timeout in seconds for + the VPC NAT gateway. + "type": "str", # Optional. The type of the VPC NAT gateway. "PUBLIC" + "udp_timeout_seconds": 0, # Optional. The UDP timeout in seconds for + the VPC NAT gateway. + "updated_at": "2020-02-20 00:00:00", # Optional. A time value given + in ISO8601 combined date and time format that represents when the VPC NAT + gateway was last updated. + "vpcs": [ + { + "gateway_ip": "str", # Optional. The gateway IP + address of the VPC NAT gateway. + "vpc_uuid": "str" # Optional. The unique identifier + of the VPC to which the NAT gateway is attached. + } ] } } """ @distributed_trace_async - async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: + async def create( + self, body: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any + ) -> JSON: # pylint: disable=line-too-long - """Create a New VPC Peering. + """Create a New VPC NAT Gateway. - To create a new VPC Peering, send a POST request to ``/v2/vpc_peerings`` - specifying a name and a list of two VPC IDs to peer. The response code, 202 - Accepted, does not indicate the success or failure of the operation, just - that the request has been accepted for processing. + To create a new VPC NAT gateway, send a POST request to ``/v2/vpc_nat_gateways`` setting the + required attributes. - :param body: Is either a JSON type or a IO[bytes] type. Required. + The response body will contain a JSON object with a key called ``vpc_nat_gateway`` containing + the standard attributes for the new VPC NAT gateway. + + :param body: Is either a JSON type or a IO[bytes] type. Default value is None. :type body: JSON or IO[bytes] :return: JSON object :rtype: JSON @@ -177985,27 +179387,68 @@ async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: # JSON input template you can fill out and use as your body input. body = { - "name": "str", # Optional. The name of the VPC peering. Must be unique - within the team and may only contain alphanumeric characters and dashes. - "vpc_ids": [ - "str" # Optional. An array of the two peered VPCs IDs. - ] + "name": "str", # The human-readable name of the VPC NAT gateway. Required. + "region": "str", # The region in which the VPC NAT gateway is created. + Required. Known values are: "nyc1", "nyc2", "nyc3", "ams2", "ams3", "sfo1", + "sfo2", "sfo3", "sgp1", "lon1", "fra1", "tor1", "blr1", "syd1", and "atl1". + "size": 0, # The size of the VPC NAT gateway. Required. + "type": "str", # The type of the VPC NAT gateway. Required. "PUBLIC" + "vpcs": [ + { + "vpc_uuid": "str" # Optional. The unique identifier of the + VPC to which the NAT gateway is attached. + } + ], + "icmp_timeout_seconds": 0, # Optional. The ICMP timeout in seconds for the + VPC NAT gateway. + "tcp_timeout_seconds": 0, # Optional. The TCP timeout in seconds for the VPC + NAT gateway. + "udp_timeout_seconds": 0 # Optional. The UDP timeout in seconds for the VPC + NAT gateway. } # response body for status code(s): 202 response == { - "vpc_peering": { + "vpc_nat_gateway": { "created_at": "2020-02-20 00:00:00", # Optional. A time value given - in ISO8601 combined date and time format. - "id": "str", # Optional. A unique ID that can be used to identify - and reference the VPC peering. - "name": "str", # Optional. The name of the VPC peering. Must be - unique within the team and may only contain alphanumeric characters and - dashes. - "status": "str", # Optional. The current status of the VPC peering. - Known values are: "PROVISIONING", "ACTIVE", and "DELETING". - "vpc_ids": [ - "str" # Optional. An array of the two peered VPCs IDs. + in ISO8601 combined date and time format that represents when the VPC NAT + gateway was created. + "egresses": { + "public_gateways": [ + { + "ipv4": "str" # Optional. IPv4 address of + the public gateway. + } + ] + }, + "icmp_timeout_seconds": 0, # Optional. The ICMP timeout in seconds + for the VPC NAT gateway. + "id": "str", # Optional. The unique identifier for the VPC NAT + gateway. This is automatically generated upon creation. + "name": "str", # Optional. The human-readable name of the VPC NAT + gateway. + "region": "str", # Optional. The region in which the VPC NAT gateway + is created. Known values are: "nyc1", "nyc2", "nyc3", "ams2", "ams3", "sfo1", + "sfo2", "sfo3", "sgp1", "lon1", "fra1", "tor1", "blr1", "syd1", and "atl1". + "size": 0, # Optional. The size of the VPC NAT gateway. + "state": "str", # Optional. The current state of the VPC NAT + gateway. Known values are: "NEW", "PROVISIONING", "ACTIVE", "DELETING", + "ERROR", and "INVALID". + "tcp_timeout_seconds": 0, # Optional. The TCP timeout in seconds for + the VPC NAT gateway. + "type": "str", # Optional. The type of the VPC NAT gateway. "PUBLIC" + "udp_timeout_seconds": 0, # Optional. The UDP timeout in seconds for + the VPC NAT gateway. + "updated_at": "2020-02-20 00:00:00", # Optional. A time value given + in ISO8601 combined date and time format that represents when the VPC NAT + gateway was last updated. + "vpcs": [ + { + "gateway_ip": "str", # Optional. The gateway IP + address of the VPC NAT gateway. + "vpc_uuid": "str" # Optional. The unique identifier + of the VPC to which the NAT gateway is attached. + } ] } } @@ -178037,9 +179480,12 @@ async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: if isinstance(body, (IOBase, bytes)): _content = body else: - _json = body + if body is not None: + _json = body + else: + _json = None - _request = build_vpc_peerings_create_request( + _request = build_vpcnatgateways_create_request( content_type=content_type, json=_json, content=_content, @@ -178085,15 +179531,15 @@ async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: return cast(JSON, deserialized) # type: ignore @distributed_trace_async - async def get(self, vpc_peering_id: str, **kwargs: Any) -> JSON: + async def get(self, id: str, **kwargs: Any) -> JSON: # pylint: disable=line-too-long - """Retrieve an Existing VPC Peering. + """Retrieve an Existing VPC NAT Gateway. - To show information about an existing VPC Peering, send a GET request to - ``/v2/vpc_peerings/$VPC_PEERING_ID``. + To show information about an individual VPC NAT gateway, send a GET request to + ``/v2/vpc_nat_gateways/$VPC_NAT_GATEWAY_ID``. - :param vpc_peering_id: A unique identifier for a VPC peering. Required. - :type vpc_peering_id: str + :param id: The unique identifier of the VPC NAT gateway. Required. + :type id: str :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: @@ -178103,18 +179549,46 @@ async def get(self, vpc_peering_id: str, **kwargs: Any) -> JSON: # response body for status code(s): 200 response == { - "vpc_peering": { + "vpc_nat_gateway": { "created_at": "2020-02-20 00:00:00", # Optional. A time value given - in ISO8601 combined date and time format. - "id": "str", # Optional. A unique ID that can be used to identify - and reference the VPC peering. - "name": "str", # Optional. The name of the VPC peering. Must be - unique within the team and may only contain alphanumeric characters and - dashes. - "status": "str", # Optional. The current status of the VPC peering. - Known values are: "PROVISIONING", "ACTIVE", and "DELETING". - "vpc_ids": [ - "str" # Optional. An array of the two peered VPCs IDs. + in ISO8601 combined date and time format that represents when the VPC NAT + gateway was created. + "egresses": { + "public_gateways": [ + { + "ipv4": "str" # Optional. IPv4 address of + the public gateway. + } + ] + }, + "icmp_timeout_seconds": 0, # Optional. The ICMP timeout in seconds + for the VPC NAT gateway. + "id": "str", # Optional. The unique identifier for the VPC NAT + gateway. This is automatically generated upon creation. + "name": "str", # Optional. The human-readable name of the VPC NAT + gateway. + "region": "str", # Optional. The region in which the VPC NAT gateway + is created. Known values are: "nyc1", "nyc2", "nyc3", "ams2", "ams3", "sfo1", + "sfo2", "sfo3", "sgp1", "lon1", "fra1", "tor1", "blr1", "syd1", and "atl1". + "size": 0, # Optional. The size of the VPC NAT gateway. + "state": "str", # Optional. The current state of the VPC NAT + gateway. Known values are: "NEW", "PROVISIONING", "ACTIVE", "DELETING", + "ERROR", and "INVALID". + "tcp_timeout_seconds": 0, # Optional. The TCP timeout in seconds for + the VPC NAT gateway. + "type": "str", # Optional. The type of the VPC NAT gateway. "PUBLIC" + "udp_timeout_seconds": 0, # Optional. The UDP timeout in seconds for + the VPC NAT gateway. + "updated_at": "2020-02-20 00:00:00", # Optional. A time value given + in ISO8601 combined date and time format that represents when the VPC NAT + gateway was last updated. + "vpcs": [ + { + "gateway_ip": "str", # Optional. The gateway IP + address of the VPC NAT gateway. + "vpc_uuid": "str" # Optional. The unique identifier + of the VPC to which the NAT gateway is attached. + } ] } } @@ -178148,8 +179622,8 @@ async def get(self, vpc_peering_id: str, **kwargs: Any) -> JSON: cls: ClsType[JSON] = kwargs.pop("cls", None) - _request = build_vpc_peerings_get_request( - vpc_peering_id=vpc_peering_id, + _request = build_vpcnatgateways_get_request( + id=id, headers=_headers, params=_params, ) @@ -178209,23 +179683,24 @@ async def get(self, vpc_peering_id: str, **kwargs: Any) -> JSON: return cast(JSON, deserialized) # type: ignore @overload - async def patch( + async def update( self, - vpc_peering_id: str, - body: JSON, + id: str, + body: Optional[JSON] = None, *, content_type: str = "application/json", **kwargs: Any ) -> JSON: # pylint: disable=line-too-long - """Update a VPC peering. + """Update VPC NAT Gateway. - To update the name of a VPC peering, send a PATCH request to - ``/v2/vpc_peerings/$VPC_PEERING_ID`` with the new ``name`` in the request body. + To update the configuration of an existing VPC NAT Gateway, send a PUT request to + ``/v2/vpc_nat_gateways/$VPC_NAT_GATEWAY_ID``. The request must contain a full representation + of the VPC NAT Gateway including existing attributes. - :param vpc_peering_id: A unique identifier for a VPC peering. Required. - :type vpc_peering_id: str - :param body: Required. + :param id: The unique identifier of the VPC NAT gateway. Required. + :type id: str + :param body: Default value is None. :type body: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -178239,24 +179714,58 @@ async def patch( # JSON input template you can fill out and use as your body input. body = { - "name": "str" # Optional. The name of the VPC peering. Must be unique within - the team and may only contain alphanumeric characters and dashes. + "name": "str", # The human-readable name of the VPC NAT gateway. Required. + "size": 0, # The size of the VPC NAT gateway. Required. + "icmp_timeout_seconds": 0, # Optional. The ICMP timeout in seconds for the + VPC NAT gateway. + "tcp_timeout_seconds": 0, # Optional. The TCP timeout in seconds for the VPC + NAT gateway. + "udp_timeout_seconds": 0 # Optional. The UDP timeout in seconds for the VPC + NAT gateway. } # response body for status code(s): 200 response == { - "vpc_peering": { + "vpc_nat_gateway": { "created_at": "2020-02-20 00:00:00", # Optional. A time value given - in ISO8601 combined date and time format. - "id": "str", # Optional. A unique ID that can be used to identify - and reference the VPC peering. - "name": "str", # Optional. The name of the VPC peering. Must be - unique within the team and may only contain alphanumeric characters and - dashes. - "status": "str", # Optional. The current status of the VPC peering. - Known values are: "PROVISIONING", "ACTIVE", and "DELETING". - "vpc_ids": [ - "str" # Optional. An array of the two peered VPCs IDs. + in ISO8601 combined date and time format that represents when the VPC NAT + gateway was created. + "egresses": { + "public_gateways": [ + { + "ipv4": "str" # Optional. IPv4 address of + the public gateway. + } + ] + }, + "icmp_timeout_seconds": 0, # Optional. The ICMP timeout in seconds + for the VPC NAT gateway. + "id": "str", # Optional. The unique identifier for the VPC NAT + gateway. This is automatically generated upon creation. + "name": "str", # Optional. The human-readable name of the VPC NAT + gateway. + "region": "str", # Optional. The region in which the VPC NAT gateway + is created. Known values are: "nyc1", "nyc2", "nyc3", "ams2", "ams3", "sfo1", + "sfo2", "sfo3", "sgp1", "lon1", "fra1", "tor1", "blr1", "syd1", and "atl1". + "size": 0, # Optional. The size of the VPC NAT gateway. + "state": "str", # Optional. The current state of the VPC NAT + gateway. Known values are: "NEW", "PROVISIONING", "ACTIVE", "DELETING", + "ERROR", and "INVALID". + "tcp_timeout_seconds": 0, # Optional. The TCP timeout in seconds for + the VPC NAT gateway. + "type": "str", # Optional. The type of the VPC NAT gateway. "PUBLIC" + "udp_timeout_seconds": 0, # Optional. The UDP timeout in seconds for + the VPC NAT gateway. + "updated_at": "2020-02-20 00:00:00", # Optional. A time value given + in ISO8601 combined date and time format that represents when the VPC NAT + gateway was last updated. + "vpcs": [ + { + "gateway_ip": "str", # Optional. The gateway IP + address of the VPC NAT gateway. + "vpc_uuid": "str" # Optional. The unique identifier + of the VPC to which the NAT gateway is attached. + } ] } } @@ -178274,23 +179783,24 @@ async def patch( """ @overload - async def patch( + async def update( self, - vpc_peering_id: str, - body: IO[bytes], + id: str, + body: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any ) -> JSON: # pylint: disable=line-too-long - """Update a VPC peering. + """Update VPC NAT Gateway. - To update the name of a VPC peering, send a PATCH request to - ``/v2/vpc_peerings/$VPC_PEERING_ID`` with the new ``name`` in the request body. + To update the configuration of an existing VPC NAT Gateway, send a PUT request to + ``/v2/vpc_nat_gateways/$VPC_NAT_GATEWAY_ID``. The request must contain a full representation + of the VPC NAT Gateway including existing attributes. - :param vpc_peering_id: A unique identifier for a VPC peering. Required. - :type vpc_peering_id: str - :param body: Required. + :param id: The unique identifier of the VPC NAT gateway. Required. + :type id: str + :param body: Default value is None. :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -178304,18 +179814,46 @@ async def patch( # response body for status code(s): 200 response == { - "vpc_peering": { + "vpc_nat_gateway": { "created_at": "2020-02-20 00:00:00", # Optional. A time value given - in ISO8601 combined date and time format. - "id": "str", # Optional. A unique ID that can be used to identify - and reference the VPC peering. - "name": "str", # Optional. The name of the VPC peering. Must be - unique within the team and may only contain alphanumeric characters and - dashes. - "status": "str", # Optional. The current status of the VPC peering. - Known values are: "PROVISIONING", "ACTIVE", and "DELETING". - "vpc_ids": [ - "str" # Optional. An array of the two peered VPCs IDs. + in ISO8601 combined date and time format that represents when the VPC NAT + gateway was created. + "egresses": { + "public_gateways": [ + { + "ipv4": "str" # Optional. IPv4 address of + the public gateway. + } + ] + }, + "icmp_timeout_seconds": 0, # Optional. The ICMP timeout in seconds + for the VPC NAT gateway. + "id": "str", # Optional. The unique identifier for the VPC NAT + gateway. This is automatically generated upon creation. + "name": "str", # Optional. The human-readable name of the VPC NAT + gateway. + "region": "str", # Optional. The region in which the VPC NAT gateway + is created. Known values are: "nyc1", "nyc2", "nyc3", "ams2", "ams3", "sfo1", + "sfo2", "sfo3", "sgp1", "lon1", "fra1", "tor1", "blr1", "syd1", and "atl1". + "size": 0, # Optional. The size of the VPC NAT gateway. + "state": "str", # Optional. The current state of the VPC NAT + gateway. Known values are: "NEW", "PROVISIONING", "ACTIVE", "DELETING", + "ERROR", and "INVALID". + "tcp_timeout_seconds": 0, # Optional. The TCP timeout in seconds for + the VPC NAT gateway. + "type": "str", # Optional. The type of the VPC NAT gateway. "PUBLIC" + "udp_timeout_seconds": 0, # Optional. The UDP timeout in seconds for + the VPC NAT gateway. + "updated_at": "2020-02-20 00:00:00", # Optional. A time value given + in ISO8601 combined date and time format that represents when the VPC NAT + gateway was last updated. + "vpcs": [ + { + "gateway_ip": "str", # Optional. The gateway IP + address of the VPC NAT gateway. + "vpc_uuid": "str" # Optional. The unique identifier + of the VPC to which the NAT gateway is attached. + } ] } } @@ -178333,18 +179871,19 @@ async def patch( """ @distributed_trace_async - async def patch( - self, vpc_peering_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any + async def update( + self, id: str, body: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: # pylint: disable=line-too-long - """Update a VPC peering. + """Update VPC NAT Gateway. - To update the name of a VPC peering, send a PATCH request to - ``/v2/vpc_peerings/$VPC_PEERING_ID`` with the new ``name`` in the request body. + To update the configuration of an existing VPC NAT Gateway, send a PUT request to + ``/v2/vpc_nat_gateways/$VPC_NAT_GATEWAY_ID``. The request must contain a full representation + of the VPC NAT Gateway including existing attributes. - :param vpc_peering_id: A unique identifier for a VPC peering. Required. - :type vpc_peering_id: str - :param body: Is either a JSON type or a IO[bytes] type. Required. + :param id: The unique identifier of the VPC NAT gateway. Required. + :type id: str + :param body: Is either a JSON type or a IO[bytes] type. Default value is None. :type body: JSON or IO[bytes] :return: JSON object :rtype: JSON @@ -178355,24 +179894,58 @@ async def patch( # JSON input template you can fill out and use as your body input. body = { - "name": "str" # Optional. The name of the VPC peering. Must be unique within - the team and may only contain alphanumeric characters and dashes. + "name": "str", # The human-readable name of the VPC NAT gateway. Required. + "size": 0, # The size of the VPC NAT gateway. Required. + "icmp_timeout_seconds": 0, # Optional. The ICMP timeout in seconds for the + VPC NAT gateway. + "tcp_timeout_seconds": 0, # Optional. The TCP timeout in seconds for the VPC + NAT gateway. + "udp_timeout_seconds": 0 # Optional. The UDP timeout in seconds for the VPC + NAT gateway. } # response body for status code(s): 200 response == { - "vpc_peering": { + "vpc_nat_gateway": { "created_at": "2020-02-20 00:00:00", # Optional. A time value given - in ISO8601 combined date and time format. - "id": "str", # Optional. A unique ID that can be used to identify - and reference the VPC peering. - "name": "str", # Optional. The name of the VPC peering. Must be - unique within the team and may only contain alphanumeric characters and - dashes. - "status": "str", # Optional. The current status of the VPC peering. - Known values are: "PROVISIONING", "ACTIVE", and "DELETING". - "vpc_ids": [ - "str" # Optional. An array of the two peered VPCs IDs. + in ISO8601 combined date and time format that represents when the VPC NAT + gateway was created. + "egresses": { + "public_gateways": [ + { + "ipv4": "str" # Optional. IPv4 address of + the public gateway. + } + ] + }, + "icmp_timeout_seconds": 0, # Optional. The ICMP timeout in seconds + for the VPC NAT gateway. + "id": "str", # Optional. The unique identifier for the VPC NAT + gateway. This is automatically generated upon creation. + "name": "str", # Optional. The human-readable name of the VPC NAT + gateway. + "region": "str", # Optional. The region in which the VPC NAT gateway + is created. Known values are: "nyc1", "nyc2", "nyc3", "ams2", "ams3", "sfo1", + "sfo2", "sfo3", "sgp1", "lon1", "fra1", "tor1", "blr1", "syd1", and "atl1". + "size": 0, # Optional. The size of the VPC NAT gateway. + "state": "str", # Optional. The current state of the VPC NAT + gateway. Known values are: "NEW", "PROVISIONING", "ACTIVE", "DELETING", + "ERROR", and "INVALID". + "tcp_timeout_seconds": 0, # Optional. The TCP timeout in seconds for + the VPC NAT gateway. + "type": "str", # Optional. The type of the VPC NAT gateway. "PUBLIC" + "udp_timeout_seconds": 0, # Optional. The UDP timeout in seconds for + the VPC NAT gateway. + "updated_at": "2020-02-20 00:00:00", # Optional. A time value given + in ISO8601 combined date and time format that represents when the VPC NAT + gateway was last updated. + "vpcs": [ + { + "gateway_ip": "str", # Optional. The gateway IP + address of the VPC NAT gateway. + "vpc_uuid": "str" # Optional. The unique identifier + of the VPC to which the NAT gateway is attached. + } ] } } @@ -178415,10 +179988,13 @@ async def patch( if isinstance(body, (IOBase, bytes)): _content = body else: - _json = body + if body is not None: + _json = body + else: + _json = None - _request = build_vpc_peerings_patch_request( - vpc_peering_id=vpc_peering_id, + _request = build_vpcnatgateways_update_request( + id=id, content_type=content_type, json=_json, content=_content, @@ -178481,38 +180057,24 @@ async def patch( return cast(JSON, deserialized) # type: ignore @distributed_trace_async - async def delete(self, vpc_peering_id: str, **kwargs: Any) -> JSON: + async def delete(self, id: str, **kwargs: Any) -> Optional[JSON]: # pylint: disable=line-too-long - """Delete a VPC peering. + """Delete VPC NAT Gateway. - To delete a VPC peering, send a DELETE request to ``/v2/vpc_peerings/$VPC_PEERING_ID``. + To destroy a VPC NAT Gateway, send a DELETE request to the + ``/v2/vpc_nat_gateways/$VPC_NAT_GATEWAY_ID`` endpoint. - :param vpc_peering_id: A unique identifier for a VPC peering. Required. - :type vpc_peering_id: str - :return: JSON object - :rtype: JSON + A successful response will include a 202 response code and no content. + + :param id: The unique identifier of the VPC NAT gateway. Required. + :type id: str + :return: JSON object or None + :rtype: JSON or None :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 202 - response == { - "vpc_peering": { - "created_at": "2020-02-20 00:00:00", # Optional. A time value given - in ISO8601 combined date and time format. - "id": "str", # Optional. A unique ID that can be used to identify - and reference the VPC peering. - "name": "str", # Optional. The name of the VPC peering. Must be - unique within the team and may only contain alphanumeric characters and - dashes. - "status": "str", # Optional. The current status of the VPC peering. - Known values are: "PROVISIONING", "ACTIVE", and "DELETING". - "vpc_ids": [ - "str" # Optional. An array of the two peered VPCs IDs. - ] - } - } # response body for status code(s): 404 response == { "id": "str", # A short identifier corresponding to the HTTP status code @@ -178541,10 +180103,10 @@ async def delete(self, vpc_peering_id: str, **kwargs: Any) -> JSON: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None) - _request = build_vpc_peerings_delete_request( - vpc_peering_id=vpc_peering_id, + _request = build_vpcnatgateways_delete_request( + id=id, headers=_headers, params=_params, ) @@ -178565,6 +180127,7 @@ async def delete(self, vpc_peering_id: str, **kwargs: Any) -> JSON: map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore raise HttpResponseError(response=response) + deserialized = None response_headers = {} if response.status_code == 202: response_headers["ratelimit-limit"] = self._deserialize( @@ -178577,11 +180140,6 @@ async def delete(self, vpc_peering_id: str, **kwargs: Any) -> JSON: "int", response.headers.get("ratelimit-reset") ) - if response.content: - deserialized = response.json() - else: - deserialized = None - if response.status_code == 404: response_headers["ratelimit-limit"] = self._deserialize( "int", response.headers.get("ratelimit-limit") @@ -178599,9 +180157,9 @@ async def delete(self, vpc_peering_id: str, **kwargs: Any) -> JSON: deserialized = None if cls: - return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return cast(JSON, deserialized) # type: ignore + return deserialized # type: ignore class UptimeOperations: @@ -205131,6 +206689,282 @@ async def create_knowledge_base( return cast(JSON, deserialized) # type: ignore + @overload + async def create_data_source_file_upload_presigned_urls( # pylint: disable=name-too-long + self, + body: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Create Presigned URLs for Data Source File Upload. + + To create presigned URLs for knowledge base data source file upload, send a POST request to + ``/v2/gen-ai/knowledge_bases/data_sources/file_upload_presigned_urls``. + + :param body: Default value is None. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "files": [ + { + "file_name": "str", # Optional. Local filename. + "file_size": "str" # Optional. The size of the file in + bytes. + } + ] + } + + # response body for status code(s): 200 + response == { + "request_id": "str", # Optional. The ID generated for the request for + Presigned URLs. + "uploads": [ + { + "expires_at": "2020-02-20 00:00:00", # Optional. The time + the url expires at. + "object_key": "str", # Optional. The unique object key to + store the file as. + "original_file_name": "str", # Optional. The original file + name. + "presigned_url": "str" # Optional. The actual presigned URL + the client can use to upload the file directly. + } + ] + } + # response body for status code(s): 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @overload + async def create_data_source_file_upload_presigned_urls( # pylint: disable=name-too-long + self, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Create Presigned URLs for Data Source File Upload. + + To create presigned URLs for knowledge base data source file upload, send a POST request to + ``/v2/gen-ai/knowledge_bases/data_sources/file_upload_presigned_urls``. + + :param body: Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "request_id": "str", # Optional. The ID generated for the request for + Presigned URLs. + "uploads": [ + { + "expires_at": "2020-02-20 00:00:00", # Optional. The time + the url expires at. + "object_key": "str", # Optional. The unique object key to + store the file as. + "original_file_name": "str", # Optional. The original file + name. + "presigned_url": "str" # Optional. The actual presigned URL + the client can use to upload the file directly. + } + ] + } + # response body for status code(s): 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @distributed_trace_async + async def create_data_source_file_upload_presigned_urls( # pylint: disable=name-too-long + self, body: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Create Presigned URLs for Data Source File Upload. + + To create presigned URLs for knowledge base data source file upload, send a POST request to + ``/v2/gen-ai/knowledge_bases/data_sources/file_upload_presigned_urls``. + + :param body: Is either a JSON type or a IO[bytes] type. Default value is None. + :type body: JSON or IO[bytes] + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "files": [ + { + "file_name": "str", # Optional. Local filename. + "file_size": "str" # Optional. The size of the file in + bytes. + } + ] + } + + # response body for status code(s): 200 + response == { + "request_id": "str", # Optional. The ID generated for the request for + Presigned URLs. + "uploads": [ + { + "expires_at": "2020-02-20 00:00:00", # Optional. The time + the url expires at. + "object_key": "str", # Optional. The unique object key to + store the file as. + "original_file_name": "str", # Optional. The original file + name. + "presigned_url": "str" # Optional. The actual presigned URL + the client can use to upload the file directly. + } + ] + } + # response body for status code(s): 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + 401: cast( + Type[HttpResponseError], + lambda response: ClientAuthenticationError(response=response), + ), + 429: HttpResponseError, + 500: HttpResponseError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) + cls: ClsType[JSON] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = body + else: + _json = None + + _request = build_genai_create_data_source_file_upload_presigned_urls_request( + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = ( + await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response) + + response_headers = {} + if response.status_code == 200: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 404: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + + return cast(JSON, deserialized) # type: ignore + @distributed_trace_async async def list_knowledge_base_data_sources( self, diff --git a/src/pydo/operations/__init__.py b/src/pydo/operations/__init__.py index a30d54a..e0bfa5c 100644 --- a/src/pydo/operations/__init__.py +++ b/src/pydo/operations/__init__.py @@ -45,6 +45,7 @@ from ._operations import VolumeSnapshotsOperations from ._operations import VpcsOperations from ._operations import VpcPeeringsOperations +from ._operations import VpcnatgatewaysOperations from ._operations import UptimeOperations from ._operations import GenaiOperations @@ -94,6 +95,7 @@ "VolumeSnapshotsOperations", "VpcsOperations", "VpcPeeringsOperations", + "VpcnatgatewaysOperations", "UptimeOperations", "GenaiOperations", ] diff --git a/src/pydo/operations/_operations.py b/src/pydo/operations/_operations.py index 3e85734..81eaeb5 100644 --- a/src/pydo/operations/_operations.py +++ b/src/pydo/operations/_operations.py @@ -2580,6 +2580,59 @@ def build_databases_update_major_version_request( # pylint: disable=name-too-lo return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) +def build_databases_get_autoscale_request( + database_cluster_uuid: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/v2/databases/{database_cluster_uuid}/autoscale" + path_format_arguments = { + "database_cluster_uuid": _SERIALIZER.url( + "database_cluster_uuid", database_cluster_uuid, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_databases_update_autoscale_request( + database_cluster_uuid: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/v2/databases/{database_cluster_uuid}/autoscale" + path_format_arguments = { + "database_cluster_uuid": _SERIALIZER.url( + "database_cluster_uuid", database_cluster_uuid, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header( + "content_type", content_type, "str" + ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + + def build_databases_list_kafka_topics_request( # pylint: disable=name-too-long database_cluster_uuid: str, **kwargs: Any ) -> HttpRequest: @@ -10250,6 +10303,133 @@ def build_vpc_peerings_delete_request( return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) +def build_vpcnatgateways_list_request( + *, + per_page: int = 20, + page: int = 1, + state: Optional[str] = None, + region: Optional[str] = None, + type: Optional[str] = None, + name: Optional[str] = None, + **kwargs: Any, +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/v2/vpc_nat_gateways" + + # Construct parameters + if per_page is not None: + _params["per_page"] = _SERIALIZER.query( + "per_page", per_page, "int", maximum=200, minimum=1 + ) + if page is not None: + _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) + if state is not None: + _params["state"] = _SERIALIZER.query("state", state, "str") + if region is not None: + _params["region"] = _SERIALIZER.query("region", region, "str") + if type is not None: + _params["type"] = _SERIALIZER.query("type", type, "str") + if name is not None: + _params["name"] = _SERIALIZER.query("name", name, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) + + +def build_vpcnatgateways_create_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/v2/vpc_nat_gateways" + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header( + "content_type", content_type, "str" + ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + +def build_vpcnatgateways_get_request(id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/v2/vpc_nat_gateways/{id}" + path_format_arguments = { + "id": _SERIALIZER.url("id", id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_vpcnatgateways_update_request(id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/v2/vpc_nat_gateways/{id}" + path_format_arguments = { + "id": _SERIALIZER.url("id", id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header( + "content_type", content_type, "str" + ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + + +def build_vpcnatgateways_delete_request(id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/v2/vpc_nat_gateways/{id}" + path_format_arguments = { + "id": _SERIALIZER.url("id", id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + + def build_uptime_list_checks_request( *, per_page: int = 20, page: int = 1, **kwargs: Any ) -> HttpRequest: @@ -11763,6 +11943,29 @@ def build_genai_create_knowledge_base_request( return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) +def build_genai_create_data_source_file_upload_presigned_urls_request( # pylint: disable=name-too-long + **kwargs: Any, +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/v2/gen-ai/knowledge_bases/data_sources/file_upload_presigned_urls" + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header( + "content_type", content_type, "str" + ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + def build_genai_list_knowledge_base_data_sources_request( # pylint: disable=name-too-long knowledge_base_uuid: str, *, @@ -114742,6 +114945,17 @@ def create_cluster( cluster is located. Required. "size": "str", # The slug identifier representing the size of the nodes in the database cluster. Required. + "autoscale": { + "storage": { + "enabled": bool, # Whether storage autoscaling is enabled + for the cluster. Required. + "increment_gib": 0, # Optional. The amount of additional + storage to add (in GiB) when autoscaling is triggered. + "threshold_percent": 0 # Optional. The storage usage + threshold percentage that triggers autoscaling. When storage usage + exceeds this percentage, additional storage will be added automatically. + } + }, "backup_restore": { "database_name": "str", # The name of an existing database cluster from which the backup will be restored. Required. @@ -115719,6 +115933,17 @@ def create_cluster(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: cluster is located. Required. "size": "str", # The slug identifier representing the size of the nodes in the database cluster. Required. + "autoscale": { + "storage": { + "enabled": bool, # Whether storage autoscaling is enabled + for the cluster. Required. + "increment_gib": 0, # Optional. The amount of additional + storage to add (in GiB) when autoscaling is triggered. + "threshold_percent": 0 # Optional. The storage usage + threshold percentage that triggers autoscaling. When storage usage + exceeds this percentage, additional storage will be added automatically. + } + }, "backup_restore": { "database_name": "str", # The name of an existing database cluster from which the backup will be restored. Required. @@ -125800,6 +126025,378 @@ def update_major_version( return deserialized # type: ignore + @distributed_trace + def get_autoscale(self, database_cluster_uuid: str, **kwargs: Any) -> JSON: + # pylint: disable=line-too-long + """Retrieve Autoscale Configuration for a Database Cluster. + + To retrieve the autoscale configuration for an existing database cluster, send a GET request to + ``/v2/databases/$DATABASE_ID/autoscale``. + The response will be a JSON object with autoscaling configuration details. + + :param database_cluster_uuid: A unique identifier for a database cluster. Required. + :type database_cluster_uuid: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "autoscale": { + "storage": { + "enabled": bool, # Whether storage autoscaling is enabled + for the cluster. Required. + "increment_gib": 0, # Optional. The amount of additional + storage to add (in GiB) when autoscaling is triggered. + "threshold_percent": 0 # Optional. The storage usage + threshold percentage that triggers autoscaling. When storage usage + exceeds this percentage, additional storage will be added automatically. + } + } + } + # response body for status code(s): 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + 401: cast( + Type[HttpResponseError], + lambda response: ClientAuthenticationError(response=response), + ), + 429: HttpResponseError, + 500: HttpResponseError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[JSON] = kwargs.pop("cls", None) + + _request = build_databases_get_autoscale_request( + database_cluster_uuid=database_cluster_uuid, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = ( + self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response) + + response_headers = {} + if response.status_code == 200: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 404: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + + return cast(JSON, deserialized) # type: ignore + + @overload + def update_autoscale( + self, + database_cluster_uuid: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> Optional[JSON]: + # pylint: disable=line-too-long + """Configure Autoscale Settings for a Database Cluster. + + To configure autoscale settings for an existing database cluster, send a PUT request to + ``/v2/databases/$DATABASE_ID/autoscale``\\ , specifying the autoscale configuration. + A successful request will receive a 204 No Content status code with no body in response. + + :param database_cluster_uuid: A unique identifier for a database cluster. Required. + :type database_cluster_uuid: str + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON object or None + :rtype: JSON or None + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "storage": { + "enabled": bool, # Whether storage autoscaling is enabled for the + cluster. Required. + "increment_gib": 0, # Optional. The amount of additional storage to + add (in GiB) when autoscaling is triggered. + "threshold_percent": 0 # Optional. The storage usage threshold + percentage that triggers autoscaling. When storage usage exceeds this + percentage, additional storage will be added automatically. + } + } + + # response body for status code(s): 404, 422 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @overload + def update_autoscale( + self, + database_cluster_uuid: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> Optional[JSON]: + # pylint: disable=line-too-long + """Configure Autoscale Settings for a Database Cluster. + + To configure autoscale settings for an existing database cluster, send a PUT request to + ``/v2/databases/$DATABASE_ID/autoscale``\\ , specifying the autoscale configuration. + A successful request will receive a 204 No Content status code with no body in response. + + :param database_cluster_uuid: A unique identifier for a database cluster. Required. + :type database_cluster_uuid: str + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON object or None + :rtype: JSON or None + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 404, 422 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @distributed_trace + def update_autoscale( + self, database_cluster_uuid: str, body: Union[JSON, IO[bytes]], **kwargs: Any + ) -> Optional[JSON]: + # pylint: disable=line-too-long + """Configure Autoscale Settings for a Database Cluster. + + To configure autoscale settings for an existing database cluster, send a PUT request to + ``/v2/databases/$DATABASE_ID/autoscale``\\ , specifying the autoscale configuration. + A successful request will receive a 204 No Content status code with no body in response. + + :param database_cluster_uuid: A unique identifier for a database cluster. Required. + :type database_cluster_uuid: str + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :return: JSON object or None + :rtype: JSON or None + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "storage": { + "enabled": bool, # Whether storage autoscaling is enabled for the + cluster. Required. + "increment_gib": 0, # Optional. The amount of additional storage to + add (in GiB) when autoscaling is triggered. + "threshold_percent": 0 # Optional. The storage usage threshold + percentage that triggers autoscaling. When storage usage exceeds this + percentage, additional storage will be added automatically. + } + } + + # response body for status code(s): 404, 422 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + 401: cast( + Type[HttpResponseError], + lambda response: ClientAuthenticationError(response=response), + ), + 429: HttpResponseError, + 500: HttpResponseError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) + cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = body + + _request = build_databases_update_autoscale_request( + database_cluster_uuid=database_cluster_uuid, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = ( + self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + ) + + response = pipeline_response.http_response + + if response.status_code not in [204, 404, 422]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response) + + deserialized = None + response_headers = {} + if response.status_code == 204: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.status_code == 404: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 422: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + @distributed_trace def list_kafka_topics(self, database_cluster_uuid: str, **kwargs: Any) -> JSON: # pylint: disable=line-too-long @@ -189602,14 +190199,915 @@ def patch_peerings( return cast(JSON, deserialized) # type: ignore -class VpcPeeringsOperations: +class VpcPeeringsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~pydo.GeneratedClient`'s + :attr:`vpc_peerings` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = ( + input_args.pop(0) if input_args else kwargs.pop("deserializer") + ) + + @distributed_trace + def list( + self, + *, + per_page: int = 20, + page: int = 1, + region: Optional[str] = None, + **kwargs: Any, + ) -> JSON: + # pylint: disable=line-too-long + """List All VPC Peerings. + + To list all of the VPC peerings on your account, send a GET request to ``/v2/vpc_peerings``. + + :keyword per_page: Number of items returned per page. Default value is 20. + :paramtype per_page: int + :keyword page: Which 'page' of paginated results to return. Default value is 1. + :paramtype page: int + :keyword region: The slug identifier for the region where the resource is available. Known + values are: "ams1", "ams2", "ams3", "blr1", "fra1", "lon1", "nyc1", "nyc2", "nyc3", "sfo1", + "sfo2", "sfo3", "sgp1", "tor1", and "syd1". Default value is None. + :paramtype region: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "meta": { + "total": 0 # Optional. Number of objects returned by the request. + }, + "links": { + "pages": {} + }, + "vpc_peerings": [ + { + "created_at": "2020-02-20 00:00:00", # Optional. A time + value given in ISO8601 combined date and time format. + "id": "str", # Optional. A unique ID that can be used to + identify and reference the VPC peering. + "name": "str", # Optional. The name of the VPC peering. Must + be unique within the team and may only contain alphanumeric characters + and dashes. + "status": "str", # Optional. The current status of the VPC + peering. Known values are: "PROVISIONING", "ACTIVE", and "DELETING". + "vpc_ids": [ + "str" # Optional. An array of the two peered VPCs + IDs. + ] + } + ] + } + # response body for status code(s): 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + 401: cast( + Type[HttpResponseError], + lambda response: ClientAuthenticationError(response=response), + ), + 429: HttpResponseError, + 500: HttpResponseError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[JSON] = kwargs.pop("cls", None) + + _request = build_vpc_peerings_list_request( + per_page=per_page, + page=page, + region=region, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = ( + self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response) + + response_headers = {} + if response.status_code == 200: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 404: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + + return cast(JSON, deserialized) # type: ignore + + @overload + def create( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Create a New VPC Peering. + + To create a new VPC Peering, send a POST request to ``/v2/vpc_peerings`` + specifying a name and a list of two VPC IDs to peer. The response code, 202 + Accepted, does not indicate the success or failure of the operation, just + that the request has been accepted for processing. + + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "name": "str", # Optional. The name of the VPC peering. Must be unique + within the team and may only contain alphanumeric characters and dashes. + "vpc_ids": [ + "str" # Optional. An array of the two peered VPCs IDs. + ] + } + + # response body for status code(s): 202 + response == { + "vpc_peering": { + "created_at": "2020-02-20 00:00:00", # Optional. A time value given + in ISO8601 combined date and time format. + "id": "str", # Optional. A unique ID that can be used to identify + and reference the VPC peering. + "name": "str", # Optional. The name of the VPC peering. Must be + unique within the team and may only contain alphanumeric characters and + dashes. + "status": "str", # Optional. The current status of the VPC peering. + Known values are: "PROVISIONING", "ACTIVE", and "DELETING". + "vpc_ids": [ + "str" # Optional. An array of the two peered VPCs IDs. + ] + } + } + """ + + @overload + def create( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Create a New VPC Peering. + + To create a new VPC Peering, send a POST request to ``/v2/vpc_peerings`` + specifying a name and a list of two VPC IDs to peer. The response code, 202 + Accepted, does not indicate the success or failure of the operation, just + that the request has been accepted for processing. + + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 202 + response == { + "vpc_peering": { + "created_at": "2020-02-20 00:00:00", # Optional. A time value given + in ISO8601 combined date and time format. + "id": "str", # Optional. A unique ID that can be used to identify + and reference the VPC peering. + "name": "str", # Optional. The name of the VPC peering. Must be + unique within the team and may only contain alphanumeric characters and + dashes. + "status": "str", # Optional. The current status of the VPC peering. + Known values are: "PROVISIONING", "ACTIVE", and "DELETING". + "vpc_ids": [ + "str" # Optional. An array of the two peered VPCs IDs. + ] + } + } + """ + + @distributed_trace + def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: + # pylint: disable=line-too-long + """Create a New VPC Peering. + + To create a new VPC Peering, send a POST request to ``/v2/vpc_peerings`` + specifying a name and a list of two VPC IDs to peer. The response code, 202 + Accepted, does not indicate the success or failure of the operation, just + that the request has been accepted for processing. + + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "name": "str", # Optional. The name of the VPC peering. Must be unique + within the team and may only contain alphanumeric characters and dashes. + "vpc_ids": [ + "str" # Optional. An array of the two peered VPCs IDs. + ] + } + + # response body for status code(s): 202 + response == { + "vpc_peering": { + "created_at": "2020-02-20 00:00:00", # Optional. A time value given + in ISO8601 combined date and time format. + "id": "str", # Optional. A unique ID that can be used to identify + and reference the VPC peering. + "name": "str", # Optional. The name of the VPC peering. Must be + unique within the team and may only contain alphanumeric characters and + dashes. + "status": "str", # Optional. The current status of the VPC peering. + Known values are: "PROVISIONING", "ACTIVE", and "DELETING". + "vpc_ids": [ + "str" # Optional. An array of the two peered VPCs IDs. + ] + } + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + 401: cast( + Type[HttpResponseError], + lambda response: ClientAuthenticationError(response=response), + ), + 429: HttpResponseError, + 500: HttpResponseError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) + cls: ClsType[JSON] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = body + + _request = build_vpc_peerings_create_request( + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = ( + self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + + return cast(JSON, deserialized) # type: ignore + + @distributed_trace + def get(self, vpc_peering_id: str, **kwargs: Any) -> JSON: + # pylint: disable=line-too-long + """Retrieve an Existing VPC Peering. + + To show information about an existing VPC Peering, send a GET request to + ``/v2/vpc_peerings/$VPC_PEERING_ID``. + + :param vpc_peering_id: A unique identifier for a VPC peering. Required. + :type vpc_peering_id: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "vpc_peering": { + "created_at": "2020-02-20 00:00:00", # Optional. A time value given + in ISO8601 combined date and time format. + "id": "str", # Optional. A unique ID that can be used to identify + and reference the VPC peering. + "name": "str", # Optional. The name of the VPC peering. Must be + unique within the team and may only contain alphanumeric characters and + dashes. + "status": "str", # Optional. The current status of the VPC peering. + Known values are: "PROVISIONING", "ACTIVE", and "DELETING". + "vpc_ids": [ + "str" # Optional. An array of the two peered VPCs IDs. + ] + } + } + # response body for status code(s): 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + 401: cast( + Type[HttpResponseError], + lambda response: ClientAuthenticationError(response=response), + ), + 429: HttpResponseError, + 500: HttpResponseError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[JSON] = kwargs.pop("cls", None) + + _request = build_vpc_peerings_get_request( + vpc_peering_id=vpc_peering_id, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = ( + self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response) + + response_headers = {} + if response.status_code == 200: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 404: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + + return cast(JSON, deserialized) # type: ignore + + @overload + def patch( + self, + vpc_peering_id: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> JSON: + # pylint: disable=line-too-long + """Update a VPC peering. + + To update the name of a VPC peering, send a PATCH request to + ``/v2/vpc_peerings/$VPC_PEERING_ID`` with the new ``name`` in the request body. + + :param vpc_peering_id: A unique identifier for a VPC peering. Required. + :type vpc_peering_id: str + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "name": "str" # Optional. The name of the VPC peering. Must be unique within + the team and may only contain alphanumeric characters and dashes. + } + + # response body for status code(s): 200 + response == { + "vpc_peering": { + "created_at": "2020-02-20 00:00:00", # Optional. A time value given + in ISO8601 combined date and time format. + "id": "str", # Optional. A unique ID that can be used to identify + and reference the VPC peering. + "name": "str", # Optional. The name of the VPC peering. Must be + unique within the team and may only contain alphanumeric characters and + dashes. + "status": "str", # Optional. The current status of the VPC peering. + Known values are: "PROVISIONING", "ACTIVE", and "DELETING". + "vpc_ids": [ + "str" # Optional. An array of the two peered VPCs IDs. + ] + } + } + # response body for status code(s): 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @overload + def patch( + self, + vpc_peering_id: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> JSON: + # pylint: disable=line-too-long + """Update a VPC peering. + + To update the name of a VPC peering, send a PATCH request to + ``/v2/vpc_peerings/$VPC_PEERING_ID`` with the new ``name`` in the request body. + + :param vpc_peering_id: A unique identifier for a VPC peering. Required. + :type vpc_peering_id: str + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "vpc_peering": { + "created_at": "2020-02-20 00:00:00", # Optional. A time value given + in ISO8601 combined date and time format. + "id": "str", # Optional. A unique ID that can be used to identify + and reference the VPC peering. + "name": "str", # Optional. The name of the VPC peering. Must be + unique within the team and may only contain alphanumeric characters and + dashes. + "status": "str", # Optional. The current status of the VPC peering. + Known values are: "PROVISIONING", "ACTIVE", and "DELETING". + "vpc_ids": [ + "str" # Optional. An array of the two peered VPCs IDs. + ] + } + } + # response body for status code(s): 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @distributed_trace + def patch( + self, vpc_peering_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Update a VPC peering. + + To update the name of a VPC peering, send a PATCH request to + ``/v2/vpc_peerings/$VPC_PEERING_ID`` with the new ``name`` in the request body. + + :param vpc_peering_id: A unique identifier for a VPC peering. Required. + :type vpc_peering_id: str + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "name": "str" # Optional. The name of the VPC peering. Must be unique within + the team and may only contain alphanumeric characters and dashes. + } + + # response body for status code(s): 200 + response == { + "vpc_peering": { + "created_at": "2020-02-20 00:00:00", # Optional. A time value given + in ISO8601 combined date and time format. + "id": "str", # Optional. A unique ID that can be used to identify + and reference the VPC peering. + "name": "str", # Optional. The name of the VPC peering. Must be + unique within the team and may only contain alphanumeric characters and + dashes. + "status": "str", # Optional. The current status of the VPC peering. + Known values are: "PROVISIONING", "ACTIVE", and "DELETING". + "vpc_ids": [ + "str" # Optional. An array of the two peered VPCs IDs. + ] + } + } + # response body for status code(s): 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + 401: cast( + Type[HttpResponseError], + lambda response: ClientAuthenticationError(response=response), + ), + 429: HttpResponseError, + 500: HttpResponseError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) + cls: ClsType[JSON] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = body + + _request = build_vpc_peerings_patch_request( + vpc_peering_id=vpc_peering_id, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = ( + self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response) + + response_headers = {} + if response.status_code == 200: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 404: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + + return cast(JSON, deserialized) # type: ignore + + @distributed_trace + def delete(self, vpc_peering_id: str, **kwargs: Any) -> JSON: + # pylint: disable=line-too-long + """Delete a VPC peering. + + To delete a VPC peering, send a DELETE request to ``/v2/vpc_peerings/$VPC_PEERING_ID``. + + :param vpc_peering_id: A unique identifier for a VPC peering. Required. + :type vpc_peering_id: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 202 + response == { + "vpc_peering": { + "created_at": "2020-02-20 00:00:00", # Optional. A time value given + in ISO8601 combined date and time format. + "id": "str", # Optional. A unique ID that can be used to identify + and reference the VPC peering. + "name": "str", # Optional. The name of the VPC peering. Must be + unique within the team and may only contain alphanumeric characters and + dashes. + "status": "str", # Optional. The current status of the VPC peering. + Known values are: "PROVISIONING", "ACTIVE", and "DELETING". + "vpc_ids": [ + "str" # Optional. An array of the two peered VPCs IDs. + ] + } + } + # response body for status code(s): 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + 401: cast( + Type[HttpResponseError], + lambda response: ClientAuthenticationError(response=response), + ), + 429: HttpResponseError, + 500: HttpResponseError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[JSON] = kwargs.pop("cls", None) + + _request = build_vpc_peerings_delete_request( + vpc_peering_id=vpc_peering_id, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = ( + self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 404]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response) + + response_headers = {} + if response.status_code == 202: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 404: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + + return cast(JSON, deserialized) # type: ignore + + +class VpcnatgatewaysOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~pydo.GeneratedClient`'s - :attr:`vpc_peerings` attribute. + :attr:`vpcnatgateways` attribute. """ def __init__(self, *args, **kwargs): @@ -189627,22 +191125,35 @@ def list( *, per_page: int = 20, page: int = 1, + state: Optional[str] = None, region: Optional[str] = None, + type: Optional[str] = None, + name: Optional[str] = None, **kwargs: Any, ) -> JSON: # pylint: disable=line-too-long - """List All VPC Peerings. + """List All VPC NAT Gateways. - To list all of the VPC peerings on your account, send a GET request to ``/v2/vpc_peerings``. + To list all VPC NAT gateways in your team, send a GET request to ``/v2/vpc_nat_gateways``. + The response body will be a JSON object with a key of ``vpc_nat_gateways`` containing an array + of VPC NAT gateway objects. + These each contain the standard VPC NAT gateway attributes. :keyword per_page: Number of items returned per page. Default value is 20. :paramtype per_page: int :keyword page: Which 'page' of paginated results to return. Default value is 1. :paramtype page: int - :keyword region: The slug identifier for the region where the resource is available. Known - values are: "ams1", "ams2", "ams3", "blr1", "fra1", "lon1", "nyc1", "nyc2", "nyc3", "sfo1", - "sfo2", "sfo3", "sgp1", "tor1", and "syd1". Default value is None. + :keyword state: The current state of the VPC NAT gateway. Known values are: "new", + "provisioning", "active", "deleting", "error", and "invalid". Default value is None. + :paramtype state: str + :keyword region: The region where the VPC NAT gateway is located. Known values are: "nyc1", + "nyc2", "nyc3", "ams2", "ams3", "sfo1", "sfo2", "sfo3", "sgp1", "lon1", "fra1", "tor1", "blr1", + "syd1", and "atl1". Default value is None. :paramtype region: str + :keyword type: The type of the VPC NAT gateway. "public" Default value is None. + :paramtype type: str + :keyword name: The name of the VPC NAT gateway. Default value is None. + :paramtype name: str :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: @@ -189658,35 +191169,53 @@ def list( "links": { "pages": {} }, - "vpc_peerings": [ + "vpc_nat_gateways": [ { "created_at": "2020-02-20 00:00:00", # Optional. A time - value given in ISO8601 combined date and time format. - "id": "str", # Optional. A unique ID that can be used to - identify and reference the VPC peering. - "name": "str", # Optional. The name of the VPC peering. Must - be unique within the team and may only contain alphanumeric characters - and dashes. - "status": "str", # Optional. The current status of the VPC - peering. Known values are: "PROVISIONING", "ACTIVE", and "DELETING". - "vpc_ids": [ - "str" # Optional. An array of the two peered VPCs - IDs. + value given in ISO8601 combined date and time format that represents when + the VPC NAT gateway was created. + "egresses": { + "public_gateways": [ + { + "ipv4": "str" # Optional. IPv4 + address of the public gateway. + } + ] + }, + "icmp_timeout_seconds": 0, # Optional. The ICMP timeout in + seconds for the VPC NAT gateway. + "id": "str", # Optional. The unique identifier for the VPC + NAT gateway. This is automatically generated upon creation. + "name": "str", # Optional. The human-readable name of the + VPC NAT gateway. + "region": "str", # Optional. The region in which the VPC NAT + gateway is created. Known values are: "nyc1", "nyc2", "nyc3", "ams2", + "ams3", "sfo1", "sfo2", "sfo3", "sgp1", "lon1", "fra1", "tor1", "blr1", + "syd1", and "atl1". + "size": 0, # Optional. The size of the VPC NAT gateway. + "state": "str", # Optional. The current state of the VPC NAT + gateway. Known values are: "NEW", "PROVISIONING", "ACTIVE", "DELETING", + "ERROR", and "INVALID". + "tcp_timeout_seconds": 0, # Optional. The TCP timeout in + seconds for the VPC NAT gateway. + "type": "str", # Optional. The type of the VPC NAT gateway. + "PUBLIC" + "udp_timeout_seconds": 0, # Optional. The UDP timeout in + seconds for the VPC NAT gateway. + "updated_at": "2020-02-20 00:00:00", # Optional. A time + value given in ISO8601 combined date and time format that represents when + the VPC NAT gateway was last updated. + "vpcs": [ + { + "gateway_ip": "str", # Optional. The gateway + IP address of the VPC NAT gateway. + "vpc_uuid": "str" # Optional. The unique + identifier of the VPC to which the NAT gateway is attached. + } ] } ] } - # response body for status code(s): 404 - response == { - "id": "str", # A short identifier corresponding to the HTTP status code - returned. For example, the ID for a response returning a 404 status code would - be "not_found.". Required. - "message": "str", # A message providing additional information about the - error, including details to help resolve it when possible. Required. - "request_id": "str" # Optional. Optionally, some endpoints may include a - request ID that should be provided when reporting bugs or opening support - tickets to help identify the issue. - } """ error_map: MutableMapping[int, Type[HttpResponseError]] = { 404: ResourceNotFoundError, @@ -189706,10 +191235,13 @@ def list( cls: ClsType[JSON] = kwargs.pop("cls", None) - _request = build_vpc_peerings_list_request( + _request = build_vpcnatgateways_list_request( per_page=per_page, page=page, + state=state, region=region, + type=type, + name=name, headers=_headers, params=_params, ) @@ -189724,44 +191256,27 @@ def list( response = pipeline_response.http_response - if response.status_code not in [200, 404]: + if response.status_code not in [200]: if _stream: response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore raise HttpResponseError(response=response) response_headers = {} - if response.status_code == 200: - response_headers["ratelimit-limit"] = self._deserialize( - "int", response.headers.get("ratelimit-limit") - ) - response_headers["ratelimit-remaining"] = self._deserialize( - "int", response.headers.get("ratelimit-remaining") - ) - response_headers["ratelimit-reset"] = self._deserialize( - "int", response.headers.get("ratelimit-reset") - ) - - if response.content: - deserialized = response.json() - else: - deserialized = None - - if response.status_code == 404: - response_headers["ratelimit-limit"] = self._deserialize( - "int", response.headers.get("ratelimit-limit") - ) - response_headers["ratelimit-remaining"] = self._deserialize( - "int", response.headers.get("ratelimit-remaining") - ) - response_headers["ratelimit-reset"] = self._deserialize( - "int", response.headers.get("ratelimit-reset") - ) + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) - if response.content: - deserialized = response.json() - else: - deserialized = None + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore @@ -189770,17 +191285,22 @@ def list( @overload def create( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + self, + body: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any, ) -> JSON: # pylint: disable=line-too-long - """Create a New VPC Peering. + """Create a New VPC NAT Gateway. - To create a new VPC Peering, send a POST request to ``/v2/vpc_peerings`` - specifying a name and a list of two VPC IDs to peer. The response code, 202 - Accepted, does not indicate the success or failure of the operation, just - that the request has been accepted for processing. + To create a new VPC NAT gateway, send a POST request to ``/v2/vpc_nat_gateways`` setting the + required attributes. - :param body: Required. + The response body will contain a JSON object with a key called ``vpc_nat_gateway`` containing + the standard attributes for the new VPC NAT gateway. + + :param body: Default value is None. :type body: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -189794,27 +191314,68 @@ def create( # JSON input template you can fill out and use as your body input. body = { - "name": "str", # Optional. The name of the VPC peering. Must be unique - within the team and may only contain alphanumeric characters and dashes. - "vpc_ids": [ - "str" # Optional. An array of the two peered VPCs IDs. - ] + "name": "str", # The human-readable name of the VPC NAT gateway. Required. + "region": "str", # The region in which the VPC NAT gateway is created. + Required. Known values are: "nyc1", "nyc2", "nyc3", "ams2", "ams3", "sfo1", + "sfo2", "sfo3", "sgp1", "lon1", "fra1", "tor1", "blr1", "syd1", and "atl1". + "size": 0, # The size of the VPC NAT gateway. Required. + "type": "str", # The type of the VPC NAT gateway. Required. "PUBLIC" + "vpcs": [ + { + "vpc_uuid": "str" # Optional. The unique identifier of the + VPC to which the NAT gateway is attached. + } + ], + "icmp_timeout_seconds": 0, # Optional. The ICMP timeout in seconds for the + VPC NAT gateway. + "tcp_timeout_seconds": 0, # Optional. The TCP timeout in seconds for the VPC + NAT gateway. + "udp_timeout_seconds": 0 # Optional. The UDP timeout in seconds for the VPC + NAT gateway. } # response body for status code(s): 202 response == { - "vpc_peering": { + "vpc_nat_gateway": { "created_at": "2020-02-20 00:00:00", # Optional. A time value given - in ISO8601 combined date and time format. - "id": "str", # Optional. A unique ID that can be used to identify - and reference the VPC peering. - "name": "str", # Optional. The name of the VPC peering. Must be - unique within the team and may only contain alphanumeric characters and - dashes. - "status": "str", # Optional. The current status of the VPC peering. - Known values are: "PROVISIONING", "ACTIVE", and "DELETING". - "vpc_ids": [ - "str" # Optional. An array of the two peered VPCs IDs. + in ISO8601 combined date and time format that represents when the VPC NAT + gateway was created. + "egresses": { + "public_gateways": [ + { + "ipv4": "str" # Optional. IPv4 address of + the public gateway. + } + ] + }, + "icmp_timeout_seconds": 0, # Optional. The ICMP timeout in seconds + for the VPC NAT gateway. + "id": "str", # Optional. The unique identifier for the VPC NAT + gateway. This is automatically generated upon creation. + "name": "str", # Optional. The human-readable name of the VPC NAT + gateway. + "region": "str", # Optional. The region in which the VPC NAT gateway + is created. Known values are: "nyc1", "nyc2", "nyc3", "ams2", "ams3", "sfo1", + "sfo2", "sfo3", "sgp1", "lon1", "fra1", "tor1", "blr1", "syd1", and "atl1". + "size": 0, # Optional. The size of the VPC NAT gateway. + "state": "str", # Optional. The current state of the VPC NAT + gateway. Known values are: "NEW", "PROVISIONING", "ACTIVE", "DELETING", + "ERROR", and "INVALID". + "tcp_timeout_seconds": 0, # Optional. The TCP timeout in seconds for + the VPC NAT gateway. + "type": "str", # Optional. The type of the VPC NAT gateway. "PUBLIC" + "udp_timeout_seconds": 0, # Optional. The UDP timeout in seconds for + the VPC NAT gateway. + "updated_at": "2020-02-20 00:00:00", # Optional. A time value given + in ISO8601 combined date and time format that represents when the VPC NAT + gateway was last updated. + "vpcs": [ + { + "gateway_ip": "str", # Optional. The gateway IP + address of the VPC NAT gateway. + "vpc_uuid": "str" # Optional. The unique identifier + of the VPC to which the NAT gateway is attached. + } ] } } @@ -189822,17 +191383,22 @@ def create( @overload def create( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + self, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any, ) -> JSON: # pylint: disable=line-too-long - """Create a New VPC Peering. + """Create a New VPC NAT Gateway. - To create a new VPC Peering, send a POST request to ``/v2/vpc_peerings`` - specifying a name and a list of two VPC IDs to peer. The response code, 202 - Accepted, does not indicate the success or failure of the operation, just - that the request has been accepted for processing. + To create a new VPC NAT gateway, send a POST request to ``/v2/vpc_nat_gateways`` setting the + required attributes. - :param body: Required. + The response body will contain a JSON object with a key called ``vpc_nat_gateway`` containing + the standard attributes for the new VPC NAT gateway. + + :param body: Default value is None. :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -189846,34 +191412,65 @@ def create( # response body for status code(s): 202 response == { - "vpc_peering": { + "vpc_nat_gateway": { "created_at": "2020-02-20 00:00:00", # Optional. A time value given - in ISO8601 combined date and time format. - "id": "str", # Optional. A unique ID that can be used to identify - and reference the VPC peering. - "name": "str", # Optional. The name of the VPC peering. Must be - unique within the team and may only contain alphanumeric characters and - dashes. - "status": "str", # Optional. The current status of the VPC peering. - Known values are: "PROVISIONING", "ACTIVE", and "DELETING". - "vpc_ids": [ - "str" # Optional. An array of the two peered VPCs IDs. + in ISO8601 combined date and time format that represents when the VPC NAT + gateway was created. + "egresses": { + "public_gateways": [ + { + "ipv4": "str" # Optional. IPv4 address of + the public gateway. + } + ] + }, + "icmp_timeout_seconds": 0, # Optional. The ICMP timeout in seconds + for the VPC NAT gateway. + "id": "str", # Optional. The unique identifier for the VPC NAT + gateway. This is automatically generated upon creation. + "name": "str", # Optional. The human-readable name of the VPC NAT + gateway. + "region": "str", # Optional. The region in which the VPC NAT gateway + is created. Known values are: "nyc1", "nyc2", "nyc3", "ams2", "ams3", "sfo1", + "sfo2", "sfo3", "sgp1", "lon1", "fra1", "tor1", "blr1", "syd1", and "atl1". + "size": 0, # Optional. The size of the VPC NAT gateway. + "state": "str", # Optional. The current state of the VPC NAT + gateway. Known values are: "NEW", "PROVISIONING", "ACTIVE", "DELETING", + "ERROR", and "INVALID". + "tcp_timeout_seconds": 0, # Optional. The TCP timeout in seconds for + the VPC NAT gateway. + "type": "str", # Optional. The type of the VPC NAT gateway. "PUBLIC" + "udp_timeout_seconds": 0, # Optional. The UDP timeout in seconds for + the VPC NAT gateway. + "updated_at": "2020-02-20 00:00:00", # Optional. A time value given + in ISO8601 combined date and time format that represents when the VPC NAT + gateway was last updated. + "vpcs": [ + { + "gateway_ip": "str", # Optional. The gateway IP + address of the VPC NAT gateway. + "vpc_uuid": "str" # Optional. The unique identifier + of the VPC to which the NAT gateway is attached. + } ] } } """ @distributed_trace - def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: + def create( + self, body: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any + ) -> JSON: # pylint: disable=line-too-long - """Create a New VPC Peering. + """Create a New VPC NAT Gateway. - To create a new VPC Peering, send a POST request to ``/v2/vpc_peerings`` - specifying a name and a list of two VPC IDs to peer. The response code, 202 - Accepted, does not indicate the success or failure of the operation, just - that the request has been accepted for processing. + To create a new VPC NAT gateway, send a POST request to ``/v2/vpc_nat_gateways`` setting the + required attributes. - :param body: Is either a JSON type or a IO[bytes] type. Required. + The response body will contain a JSON object with a key called ``vpc_nat_gateway`` containing + the standard attributes for the new VPC NAT gateway. + + :param body: Is either a JSON type or a IO[bytes] type. Default value is None. :type body: JSON or IO[bytes] :return: JSON object :rtype: JSON @@ -189884,27 +191481,68 @@ def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: # JSON input template you can fill out and use as your body input. body = { - "name": "str", # Optional. The name of the VPC peering. Must be unique - within the team and may only contain alphanumeric characters and dashes. - "vpc_ids": [ - "str" # Optional. An array of the two peered VPCs IDs. - ] + "name": "str", # The human-readable name of the VPC NAT gateway. Required. + "region": "str", # The region in which the VPC NAT gateway is created. + Required. Known values are: "nyc1", "nyc2", "nyc3", "ams2", "ams3", "sfo1", + "sfo2", "sfo3", "sgp1", "lon1", "fra1", "tor1", "blr1", "syd1", and "atl1". + "size": 0, # The size of the VPC NAT gateway. Required. + "type": "str", # The type of the VPC NAT gateway. Required. "PUBLIC" + "vpcs": [ + { + "vpc_uuid": "str" # Optional. The unique identifier of the + VPC to which the NAT gateway is attached. + } + ], + "icmp_timeout_seconds": 0, # Optional. The ICMP timeout in seconds for the + VPC NAT gateway. + "tcp_timeout_seconds": 0, # Optional. The TCP timeout in seconds for the VPC + NAT gateway. + "udp_timeout_seconds": 0 # Optional. The UDP timeout in seconds for the VPC + NAT gateway. } # response body for status code(s): 202 response == { - "vpc_peering": { + "vpc_nat_gateway": { "created_at": "2020-02-20 00:00:00", # Optional. A time value given - in ISO8601 combined date and time format. - "id": "str", # Optional. A unique ID that can be used to identify - and reference the VPC peering. - "name": "str", # Optional. The name of the VPC peering. Must be - unique within the team and may only contain alphanumeric characters and - dashes. - "status": "str", # Optional. The current status of the VPC peering. - Known values are: "PROVISIONING", "ACTIVE", and "DELETING". - "vpc_ids": [ - "str" # Optional. An array of the two peered VPCs IDs. + in ISO8601 combined date and time format that represents when the VPC NAT + gateway was created. + "egresses": { + "public_gateways": [ + { + "ipv4": "str" # Optional. IPv4 address of + the public gateway. + } + ] + }, + "icmp_timeout_seconds": 0, # Optional. The ICMP timeout in seconds + for the VPC NAT gateway. + "id": "str", # Optional. The unique identifier for the VPC NAT + gateway. This is automatically generated upon creation. + "name": "str", # Optional. The human-readable name of the VPC NAT + gateway. + "region": "str", # Optional. The region in which the VPC NAT gateway + is created. Known values are: "nyc1", "nyc2", "nyc3", "ams2", "ams3", "sfo1", + "sfo2", "sfo3", "sgp1", "lon1", "fra1", "tor1", "blr1", "syd1", and "atl1". + "size": 0, # Optional. The size of the VPC NAT gateway. + "state": "str", # Optional. The current state of the VPC NAT + gateway. Known values are: "NEW", "PROVISIONING", "ACTIVE", "DELETING", + "ERROR", and "INVALID". + "tcp_timeout_seconds": 0, # Optional. The TCP timeout in seconds for + the VPC NAT gateway. + "type": "str", # Optional. The type of the VPC NAT gateway. "PUBLIC" + "udp_timeout_seconds": 0, # Optional. The UDP timeout in seconds for + the VPC NAT gateway. + "updated_at": "2020-02-20 00:00:00", # Optional. A time value given + in ISO8601 combined date and time format that represents when the VPC NAT + gateway was last updated. + "vpcs": [ + { + "gateway_ip": "str", # Optional. The gateway IP + address of the VPC NAT gateway. + "vpc_uuid": "str" # Optional. The unique identifier + of the VPC to which the NAT gateway is attached. + } ] } } @@ -189936,9 +191574,12 @@ def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: if isinstance(body, (IOBase, bytes)): _content = body else: - _json = body + if body is not None: + _json = body + else: + _json = None - _request = build_vpc_peerings_create_request( + _request = build_vpcnatgateways_create_request( content_type=content_type, json=_json, content=_content, @@ -189984,15 +191625,15 @@ def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: return cast(JSON, deserialized) # type: ignore @distributed_trace - def get(self, vpc_peering_id: str, **kwargs: Any) -> JSON: + def get(self, id: str, **kwargs: Any) -> JSON: # pylint: disable=line-too-long - """Retrieve an Existing VPC Peering. + """Retrieve an Existing VPC NAT Gateway. - To show information about an existing VPC Peering, send a GET request to - ``/v2/vpc_peerings/$VPC_PEERING_ID``. + To show information about an individual VPC NAT gateway, send a GET request to + ``/v2/vpc_nat_gateways/$VPC_NAT_GATEWAY_ID``. - :param vpc_peering_id: A unique identifier for a VPC peering. Required. - :type vpc_peering_id: str + :param id: The unique identifier of the VPC NAT gateway. Required. + :type id: str :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: @@ -190002,18 +191643,46 @@ def get(self, vpc_peering_id: str, **kwargs: Any) -> JSON: # response body for status code(s): 200 response == { - "vpc_peering": { + "vpc_nat_gateway": { "created_at": "2020-02-20 00:00:00", # Optional. A time value given - in ISO8601 combined date and time format. - "id": "str", # Optional. A unique ID that can be used to identify - and reference the VPC peering. - "name": "str", # Optional. The name of the VPC peering. Must be - unique within the team and may only contain alphanumeric characters and - dashes. - "status": "str", # Optional. The current status of the VPC peering. - Known values are: "PROVISIONING", "ACTIVE", and "DELETING". - "vpc_ids": [ - "str" # Optional. An array of the two peered VPCs IDs. + in ISO8601 combined date and time format that represents when the VPC NAT + gateway was created. + "egresses": { + "public_gateways": [ + { + "ipv4": "str" # Optional. IPv4 address of + the public gateway. + } + ] + }, + "icmp_timeout_seconds": 0, # Optional. The ICMP timeout in seconds + for the VPC NAT gateway. + "id": "str", # Optional. The unique identifier for the VPC NAT + gateway. This is automatically generated upon creation. + "name": "str", # Optional. The human-readable name of the VPC NAT + gateway. + "region": "str", # Optional. The region in which the VPC NAT gateway + is created. Known values are: "nyc1", "nyc2", "nyc3", "ams2", "ams3", "sfo1", + "sfo2", "sfo3", "sgp1", "lon1", "fra1", "tor1", "blr1", "syd1", and "atl1". + "size": 0, # Optional. The size of the VPC NAT gateway. + "state": "str", # Optional. The current state of the VPC NAT + gateway. Known values are: "NEW", "PROVISIONING", "ACTIVE", "DELETING", + "ERROR", and "INVALID". + "tcp_timeout_seconds": 0, # Optional. The TCP timeout in seconds for + the VPC NAT gateway. + "type": "str", # Optional. The type of the VPC NAT gateway. "PUBLIC" + "udp_timeout_seconds": 0, # Optional. The UDP timeout in seconds for + the VPC NAT gateway. + "updated_at": "2020-02-20 00:00:00", # Optional. A time value given + in ISO8601 combined date and time format that represents when the VPC NAT + gateway was last updated. + "vpcs": [ + { + "gateway_ip": "str", # Optional. The gateway IP + address of the VPC NAT gateway. + "vpc_uuid": "str" # Optional. The unique identifier + of the VPC to which the NAT gateway is attached. + } ] } } @@ -190047,8 +191716,8 @@ def get(self, vpc_peering_id: str, **kwargs: Any) -> JSON: cls: ClsType[JSON] = kwargs.pop("cls", None) - _request = build_vpc_peerings_get_request( - vpc_peering_id=vpc_peering_id, + _request = build_vpcnatgateways_get_request( + id=id, headers=_headers, params=_params, ) @@ -190108,23 +191777,24 @@ def get(self, vpc_peering_id: str, **kwargs: Any) -> JSON: return cast(JSON, deserialized) # type: ignore @overload - def patch( + def update( self, - vpc_peering_id: str, - body: JSON, + id: str, + body: Optional[JSON] = None, *, content_type: str = "application/json", **kwargs: Any, ) -> JSON: # pylint: disable=line-too-long - """Update a VPC peering. + """Update VPC NAT Gateway. - To update the name of a VPC peering, send a PATCH request to - ``/v2/vpc_peerings/$VPC_PEERING_ID`` with the new ``name`` in the request body. + To update the configuration of an existing VPC NAT Gateway, send a PUT request to + ``/v2/vpc_nat_gateways/$VPC_NAT_GATEWAY_ID``. The request must contain a full representation + of the VPC NAT Gateway including existing attributes. - :param vpc_peering_id: A unique identifier for a VPC peering. Required. - :type vpc_peering_id: str - :param body: Required. + :param id: The unique identifier of the VPC NAT gateway. Required. + :type id: str + :param body: Default value is None. :type body: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -190138,24 +191808,58 @@ def patch( # JSON input template you can fill out and use as your body input. body = { - "name": "str" # Optional. The name of the VPC peering. Must be unique within - the team and may only contain alphanumeric characters and dashes. + "name": "str", # The human-readable name of the VPC NAT gateway. Required. + "size": 0, # The size of the VPC NAT gateway. Required. + "icmp_timeout_seconds": 0, # Optional. The ICMP timeout in seconds for the + VPC NAT gateway. + "tcp_timeout_seconds": 0, # Optional. The TCP timeout in seconds for the VPC + NAT gateway. + "udp_timeout_seconds": 0 # Optional. The UDP timeout in seconds for the VPC + NAT gateway. } # response body for status code(s): 200 response == { - "vpc_peering": { + "vpc_nat_gateway": { "created_at": "2020-02-20 00:00:00", # Optional. A time value given - in ISO8601 combined date and time format. - "id": "str", # Optional. A unique ID that can be used to identify - and reference the VPC peering. - "name": "str", # Optional. The name of the VPC peering. Must be - unique within the team and may only contain alphanumeric characters and - dashes. - "status": "str", # Optional. The current status of the VPC peering. - Known values are: "PROVISIONING", "ACTIVE", and "DELETING". - "vpc_ids": [ - "str" # Optional. An array of the two peered VPCs IDs. + in ISO8601 combined date and time format that represents when the VPC NAT + gateway was created. + "egresses": { + "public_gateways": [ + { + "ipv4": "str" # Optional. IPv4 address of + the public gateway. + } + ] + }, + "icmp_timeout_seconds": 0, # Optional. The ICMP timeout in seconds + for the VPC NAT gateway. + "id": "str", # Optional. The unique identifier for the VPC NAT + gateway. This is automatically generated upon creation. + "name": "str", # Optional. The human-readable name of the VPC NAT + gateway. + "region": "str", # Optional. The region in which the VPC NAT gateway + is created. Known values are: "nyc1", "nyc2", "nyc3", "ams2", "ams3", "sfo1", + "sfo2", "sfo3", "sgp1", "lon1", "fra1", "tor1", "blr1", "syd1", and "atl1". + "size": 0, # Optional. The size of the VPC NAT gateway. + "state": "str", # Optional. The current state of the VPC NAT + gateway. Known values are: "NEW", "PROVISIONING", "ACTIVE", "DELETING", + "ERROR", and "INVALID". + "tcp_timeout_seconds": 0, # Optional. The TCP timeout in seconds for + the VPC NAT gateway. + "type": "str", # Optional. The type of the VPC NAT gateway. "PUBLIC" + "udp_timeout_seconds": 0, # Optional. The UDP timeout in seconds for + the VPC NAT gateway. + "updated_at": "2020-02-20 00:00:00", # Optional. A time value given + in ISO8601 combined date and time format that represents when the VPC NAT + gateway was last updated. + "vpcs": [ + { + "gateway_ip": "str", # Optional. The gateway IP + address of the VPC NAT gateway. + "vpc_uuid": "str" # Optional. The unique identifier + of the VPC to which the NAT gateway is attached. + } ] } } @@ -190173,23 +191877,24 @@ def patch( """ @overload - def patch( + def update( self, - vpc_peering_id: str, - body: IO[bytes], + id: str, + body: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any, ) -> JSON: # pylint: disable=line-too-long - """Update a VPC peering. + """Update VPC NAT Gateway. - To update the name of a VPC peering, send a PATCH request to - ``/v2/vpc_peerings/$VPC_PEERING_ID`` with the new ``name`` in the request body. + To update the configuration of an existing VPC NAT Gateway, send a PUT request to + ``/v2/vpc_nat_gateways/$VPC_NAT_GATEWAY_ID``. The request must contain a full representation + of the VPC NAT Gateway including existing attributes. - :param vpc_peering_id: A unique identifier for a VPC peering. Required. - :type vpc_peering_id: str - :param body: Required. + :param id: The unique identifier of the VPC NAT gateway. Required. + :type id: str + :param body: Default value is None. :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -190203,18 +191908,46 @@ def patch( # response body for status code(s): 200 response == { - "vpc_peering": { + "vpc_nat_gateway": { "created_at": "2020-02-20 00:00:00", # Optional. A time value given - in ISO8601 combined date and time format. - "id": "str", # Optional. A unique ID that can be used to identify - and reference the VPC peering. - "name": "str", # Optional. The name of the VPC peering. Must be - unique within the team and may only contain alphanumeric characters and - dashes. - "status": "str", # Optional. The current status of the VPC peering. - Known values are: "PROVISIONING", "ACTIVE", and "DELETING". - "vpc_ids": [ - "str" # Optional. An array of the two peered VPCs IDs. + in ISO8601 combined date and time format that represents when the VPC NAT + gateway was created. + "egresses": { + "public_gateways": [ + { + "ipv4": "str" # Optional. IPv4 address of + the public gateway. + } + ] + }, + "icmp_timeout_seconds": 0, # Optional. The ICMP timeout in seconds + for the VPC NAT gateway. + "id": "str", # Optional. The unique identifier for the VPC NAT + gateway. This is automatically generated upon creation. + "name": "str", # Optional. The human-readable name of the VPC NAT + gateway. + "region": "str", # Optional. The region in which the VPC NAT gateway + is created. Known values are: "nyc1", "nyc2", "nyc3", "ams2", "ams3", "sfo1", + "sfo2", "sfo3", "sgp1", "lon1", "fra1", "tor1", "blr1", "syd1", and "atl1". + "size": 0, # Optional. The size of the VPC NAT gateway. + "state": "str", # Optional. The current state of the VPC NAT + gateway. Known values are: "NEW", "PROVISIONING", "ACTIVE", "DELETING", + "ERROR", and "INVALID". + "tcp_timeout_seconds": 0, # Optional. The TCP timeout in seconds for + the VPC NAT gateway. + "type": "str", # Optional. The type of the VPC NAT gateway. "PUBLIC" + "udp_timeout_seconds": 0, # Optional. The UDP timeout in seconds for + the VPC NAT gateway. + "updated_at": "2020-02-20 00:00:00", # Optional. A time value given + in ISO8601 combined date and time format that represents when the VPC NAT + gateway was last updated. + "vpcs": [ + { + "gateway_ip": "str", # Optional. The gateway IP + address of the VPC NAT gateway. + "vpc_uuid": "str" # Optional. The unique identifier + of the VPC to which the NAT gateway is attached. + } ] } } @@ -190232,18 +191965,19 @@ def patch( """ @distributed_trace - def patch( - self, vpc_peering_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any + def update( + self, id: str, body: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: # pylint: disable=line-too-long - """Update a VPC peering. + """Update VPC NAT Gateway. - To update the name of a VPC peering, send a PATCH request to - ``/v2/vpc_peerings/$VPC_PEERING_ID`` with the new ``name`` in the request body. + To update the configuration of an existing VPC NAT Gateway, send a PUT request to + ``/v2/vpc_nat_gateways/$VPC_NAT_GATEWAY_ID``. The request must contain a full representation + of the VPC NAT Gateway including existing attributes. - :param vpc_peering_id: A unique identifier for a VPC peering. Required. - :type vpc_peering_id: str - :param body: Is either a JSON type or a IO[bytes] type. Required. + :param id: The unique identifier of the VPC NAT gateway. Required. + :type id: str + :param body: Is either a JSON type or a IO[bytes] type. Default value is None. :type body: JSON or IO[bytes] :return: JSON object :rtype: JSON @@ -190254,24 +191988,58 @@ def patch( # JSON input template you can fill out and use as your body input. body = { - "name": "str" # Optional. The name of the VPC peering. Must be unique within - the team and may only contain alphanumeric characters and dashes. + "name": "str", # The human-readable name of the VPC NAT gateway. Required. + "size": 0, # The size of the VPC NAT gateway. Required. + "icmp_timeout_seconds": 0, # Optional. The ICMP timeout in seconds for the + VPC NAT gateway. + "tcp_timeout_seconds": 0, # Optional. The TCP timeout in seconds for the VPC + NAT gateway. + "udp_timeout_seconds": 0 # Optional. The UDP timeout in seconds for the VPC + NAT gateway. } # response body for status code(s): 200 response == { - "vpc_peering": { + "vpc_nat_gateway": { "created_at": "2020-02-20 00:00:00", # Optional. A time value given - in ISO8601 combined date and time format. - "id": "str", # Optional. A unique ID that can be used to identify - and reference the VPC peering. - "name": "str", # Optional. The name of the VPC peering. Must be - unique within the team and may only contain alphanumeric characters and - dashes. - "status": "str", # Optional. The current status of the VPC peering. - Known values are: "PROVISIONING", "ACTIVE", and "DELETING". - "vpc_ids": [ - "str" # Optional. An array of the two peered VPCs IDs. + in ISO8601 combined date and time format that represents when the VPC NAT + gateway was created. + "egresses": { + "public_gateways": [ + { + "ipv4": "str" # Optional. IPv4 address of + the public gateway. + } + ] + }, + "icmp_timeout_seconds": 0, # Optional. The ICMP timeout in seconds + for the VPC NAT gateway. + "id": "str", # Optional. The unique identifier for the VPC NAT + gateway. This is automatically generated upon creation. + "name": "str", # Optional. The human-readable name of the VPC NAT + gateway. + "region": "str", # Optional. The region in which the VPC NAT gateway + is created. Known values are: "nyc1", "nyc2", "nyc3", "ams2", "ams3", "sfo1", + "sfo2", "sfo3", "sgp1", "lon1", "fra1", "tor1", "blr1", "syd1", and "atl1". + "size": 0, # Optional. The size of the VPC NAT gateway. + "state": "str", # Optional. The current state of the VPC NAT + gateway. Known values are: "NEW", "PROVISIONING", "ACTIVE", "DELETING", + "ERROR", and "INVALID". + "tcp_timeout_seconds": 0, # Optional. The TCP timeout in seconds for + the VPC NAT gateway. + "type": "str", # Optional. The type of the VPC NAT gateway. "PUBLIC" + "udp_timeout_seconds": 0, # Optional. The UDP timeout in seconds for + the VPC NAT gateway. + "updated_at": "2020-02-20 00:00:00", # Optional. A time value given + in ISO8601 combined date and time format that represents when the VPC NAT + gateway was last updated. + "vpcs": [ + { + "gateway_ip": "str", # Optional. The gateway IP + address of the VPC NAT gateway. + "vpc_uuid": "str" # Optional. The unique identifier + of the VPC to which the NAT gateway is attached. + } ] } } @@ -190314,10 +192082,13 @@ def patch( if isinstance(body, (IOBase, bytes)): _content = body else: - _json = body + if body is not None: + _json = body + else: + _json = None - _request = build_vpc_peerings_patch_request( - vpc_peering_id=vpc_peering_id, + _request = build_vpcnatgateways_update_request( + id=id, content_type=content_type, json=_json, content=_content, @@ -190380,38 +192151,24 @@ def patch( return cast(JSON, deserialized) # type: ignore @distributed_trace - def delete(self, vpc_peering_id: str, **kwargs: Any) -> JSON: + def delete(self, id: str, **kwargs: Any) -> Optional[JSON]: # pylint: disable=line-too-long - """Delete a VPC peering. + """Delete VPC NAT Gateway. - To delete a VPC peering, send a DELETE request to ``/v2/vpc_peerings/$VPC_PEERING_ID``. + To destroy a VPC NAT Gateway, send a DELETE request to the + ``/v2/vpc_nat_gateways/$VPC_NAT_GATEWAY_ID`` endpoint. - :param vpc_peering_id: A unique identifier for a VPC peering. Required. - :type vpc_peering_id: str - :return: JSON object - :rtype: JSON + A successful response will include a 202 response code and no content. + + :param id: The unique identifier of the VPC NAT gateway. Required. + :type id: str + :return: JSON object or None + :rtype: JSON or None :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 202 - response == { - "vpc_peering": { - "created_at": "2020-02-20 00:00:00", # Optional. A time value given - in ISO8601 combined date and time format. - "id": "str", # Optional. A unique ID that can be used to identify - and reference the VPC peering. - "name": "str", # Optional. The name of the VPC peering. Must be - unique within the team and may only contain alphanumeric characters and - dashes. - "status": "str", # Optional. The current status of the VPC peering. - Known values are: "PROVISIONING", "ACTIVE", and "DELETING". - "vpc_ids": [ - "str" # Optional. An array of the two peered VPCs IDs. - ] - } - } # response body for status code(s): 404 response == { "id": "str", # A short identifier corresponding to the HTTP status code @@ -190440,10 +192197,10 @@ def delete(self, vpc_peering_id: str, **kwargs: Any) -> JSON: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None) - _request = build_vpc_peerings_delete_request( - vpc_peering_id=vpc_peering_id, + _request = build_vpcnatgateways_delete_request( + id=id, headers=_headers, params=_params, ) @@ -190464,6 +192221,7 @@ def delete(self, vpc_peering_id: str, **kwargs: Any) -> JSON: map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore raise HttpResponseError(response=response) + deserialized = None response_headers = {} if response.status_code == 202: response_headers["ratelimit-limit"] = self._deserialize( @@ -190476,11 +192234,6 @@ def delete(self, vpc_peering_id: str, **kwargs: Any) -> JSON: "int", response.headers.get("ratelimit-reset") ) - if response.content: - deserialized = response.json() - else: - deserialized = None - if response.status_code == 404: response_headers["ratelimit-limit"] = self._deserialize( "int", response.headers.get("ratelimit-limit") @@ -190498,9 +192251,9 @@ def delete(self, vpc_peering_id: str, **kwargs: Any) -> JSON: deserialized = None if cls: - return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return cast(JSON, deserialized) # type: ignore + return deserialized # type: ignore class UptimeOperations: @@ -217028,6 +218781,282 @@ def create_knowledge_base( return cast(JSON, deserialized) # type: ignore + @overload + def create_data_source_file_upload_presigned_urls( # pylint: disable=name-too-long + self, + body: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> JSON: + # pylint: disable=line-too-long + """Create Presigned URLs for Data Source File Upload. + + To create presigned URLs for knowledge base data source file upload, send a POST request to + ``/v2/gen-ai/knowledge_bases/data_sources/file_upload_presigned_urls``. + + :param body: Default value is None. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "files": [ + { + "file_name": "str", # Optional. Local filename. + "file_size": "str" # Optional. The size of the file in + bytes. + } + ] + } + + # response body for status code(s): 200 + response == { + "request_id": "str", # Optional. The ID generated for the request for + Presigned URLs. + "uploads": [ + { + "expires_at": "2020-02-20 00:00:00", # Optional. The time + the url expires at. + "object_key": "str", # Optional. The unique object key to + store the file as. + "original_file_name": "str", # Optional. The original file + name. + "presigned_url": "str" # Optional. The actual presigned URL + the client can use to upload the file directly. + } + ] + } + # response body for status code(s): 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @overload + def create_data_source_file_upload_presigned_urls( # pylint: disable=name-too-long + self, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> JSON: + # pylint: disable=line-too-long + """Create Presigned URLs for Data Source File Upload. + + To create presigned URLs for knowledge base data source file upload, send a POST request to + ``/v2/gen-ai/knowledge_bases/data_sources/file_upload_presigned_urls``. + + :param body: Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "request_id": "str", # Optional. The ID generated for the request for + Presigned URLs. + "uploads": [ + { + "expires_at": "2020-02-20 00:00:00", # Optional. The time + the url expires at. + "object_key": "str", # Optional. The unique object key to + store the file as. + "original_file_name": "str", # Optional. The original file + name. + "presigned_url": "str" # Optional. The actual presigned URL + the client can use to upload the file directly. + } + ] + } + # response body for status code(s): 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @distributed_trace + def create_data_source_file_upload_presigned_urls( # pylint: disable=name-too-long + self, body: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Create Presigned URLs for Data Source File Upload. + + To create presigned URLs for knowledge base data source file upload, send a POST request to + ``/v2/gen-ai/knowledge_bases/data_sources/file_upload_presigned_urls``. + + :param body: Is either a JSON type or a IO[bytes] type. Default value is None. + :type body: JSON or IO[bytes] + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "files": [ + { + "file_name": "str", # Optional. Local filename. + "file_size": "str" # Optional. The size of the file in + bytes. + } + ] + } + + # response body for status code(s): 200 + response == { + "request_id": "str", # Optional. The ID generated for the request for + Presigned URLs. + "uploads": [ + { + "expires_at": "2020-02-20 00:00:00", # Optional. The time + the url expires at. + "object_key": "str", # Optional. The unique object key to + store the file as. + "original_file_name": "str", # Optional. The original file + name. + "presigned_url": "str" # Optional. The actual presigned URL + the client can use to upload the file directly. + } + ] + } + # response body for status code(s): 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + 401: cast( + Type[HttpResponseError], + lambda response: ClientAuthenticationError(response=response), + ), + 429: HttpResponseError, + 500: HttpResponseError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) + cls: ClsType[JSON] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = body + else: + _json = None + + _request = build_genai_create_data_source_file_upload_presigned_urls_request( + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = ( + self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response) + + response_headers = {} + if response.status_code == 200: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 404: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + + return cast(JSON, deserialized) # type: ignore + @distributed_trace def list_knowledge_base_data_sources( self,