forked from Azure/azure-sdk-for-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AutoRelease] t2-postgresqlflexibleservers-2024-10-30-49242(can only …
…be merged by SDK owner) (Azure#38188) * code and test * update-testcase * Update CHANGELOG.md * Update CHANGELOG.md --------- Co-authored-by: azure-sdk <PythonSdkPipelines> Co-authored-by: ChenxiJiang333 <[email protected]> Co-authored-by: ChenxiJiang333 <[email protected]>
- Loading branch information
1 parent
a1deb0d
commit 7be2915
Showing
141 changed files
with
2,344 additions
and
224 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/CHANGELOG.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/_meta.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
{ | ||
"commit": "9a8af2acfafc4d7a23eff41b859d2d332f51b0bc", | ||
"commit": "8abf88fb9caa0bfea8d4026a4b7628bbe47961ed", | ||
"repository_url": "https://github.com/Azure/azure-rest-api-specs", | ||
"autorest": "3.10.2", | ||
"use": [ | ||
"@autorest/[email protected]", | ||
"@autorest/[email protected]" | ||
], | ||
"autorest_command": "autorest specification/postgresql/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/azure-sdk-for-python/sdk --tag=package-flexibleserver-2024-08-01 --use=@autorest/[email protected] --use=@autorest/[email protected] --version=3.10.2 --version-tolerant=False", | ||
"autorest_command": "autorest specification/postgresql/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/azure-sdk-for-python/sdk --tag=package-flexibleserver-2024-11-01-preview --use=@autorest/[email protected] --use=@autorest/[email protected] --version=3.10.2 --version-tolerant=False", | ||
"readme": "specification/postgresql/resource-manager/readme.md" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
135 changes: 135 additions & 0 deletions
135
...leservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_quota_usages_operations.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
# pylint: disable=too-many-lines,too-many-statements | ||
# coding=utf-8 | ||
# -------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for license information. | ||
# Code generated by Microsoft (R) AutoRest Code Generator. | ||
# Changes may cause incorrect behavior and will be lost if the code is regenerated. | ||
# -------------------------------------------------------------------------- | ||
import sys | ||
from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar | ||
import urllib.parse | ||
|
||
from azure.core.async_paging import AsyncItemPaged, AsyncList | ||
from azure.core.exceptions import ( | ||
ClientAuthenticationError, | ||
HttpResponseError, | ||
ResourceExistsError, | ||
ResourceNotFoundError, | ||
ResourceNotModifiedError, | ||
map_error, | ||
) | ||
from azure.core.pipeline import PipelineResponse | ||
from azure.core.rest import AsyncHttpResponse, HttpRequest | ||
from azure.core.tracing.decorator import distributed_trace | ||
from azure.core.utils import case_insensitive_dict | ||
from azure.mgmt.core.exceptions import ARMErrorFormat | ||
|
||
from ... import models as _models | ||
from ...operations._quota_usages_operations import build_list_request | ||
|
||
if sys.version_info >= (3, 9): | ||
from collections.abc import MutableMapping | ||
else: | ||
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports | ||
T = TypeVar("T") | ||
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] | ||
|
||
|
||
class QuotaUsagesOperations: | ||
""" | ||
.. warning:: | ||
**DO NOT** instantiate this class directly. | ||
Instead, you should access the following operations through | ||
:class:`~azure.mgmt.postgresqlflexibleservers.aio.PostgreSQLManagementClient`'s | ||
:attr:`quota_usages` attribute. | ||
""" | ||
|
||
models = _models | ||
|
||
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 | ||
def list(self, location_name: str, **kwargs: Any) -> AsyncIterable["_models.QuotaUsage"]: | ||
"""Get quota usages at specified location in a given subscription. | ||
:param location_name: The name of the location. Required. | ||
:type location_name: str | ||
:return: An iterator like instance of either QuotaUsage or the result of cls(response) | ||
:rtype: | ||
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.postgresqlflexibleservers.models.QuotaUsage] | ||
:raises ~azure.core.exceptions.HttpResponseError: | ||
""" | ||
_headers = kwargs.pop("headers", {}) or {} | ||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {}) | ||
|
||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) | ||
cls: ClsType[_models.QuotaUsagesListResult] = kwargs.pop("cls", None) | ||
|
||
error_map: MutableMapping[int, Type[HttpResponseError]] = { | ||
401: ClientAuthenticationError, | ||
404: ResourceNotFoundError, | ||
409: ResourceExistsError, | ||
304: ResourceNotModifiedError, | ||
} | ||
error_map.update(kwargs.pop("error_map", {}) or {}) | ||
|
||
def prepare_request(next_link=None): | ||
if not next_link: | ||
|
||
_request = build_list_request( | ||
location_name=location_name, | ||
subscription_id=self._config.subscription_id, | ||
api_version=api_version, | ||
headers=_headers, | ||
params=_params, | ||
) | ||
_request.url = self._client.format_url(_request.url) | ||
|
||
else: | ||
# make call to next link with the client's api-version | ||
_parsed_next_link = urllib.parse.urlparse(next_link) | ||
_next_request_params = case_insensitive_dict( | ||
{ | ||
key: [urllib.parse.quote(v) for v in value] | ||
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() | ||
} | ||
) | ||
_next_request_params["api-version"] = self._config.api_version | ||
_request = HttpRequest( | ||
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params | ||
) | ||
_request.url = self._client.format_url(_request.url) | ||
_request.method = "GET" | ||
return _request | ||
|
||
async def extract_data(pipeline_response): | ||
deserialized = self._deserialize("QuotaUsagesListResult", pipeline_response) | ||
list_of_elem = deserialized.value | ||
if cls: | ||
list_of_elem = cls(list_of_elem) # type: ignore | ||
return deserialized.next_link or None, AsyncList(list_of_elem) | ||
|
||
async def get_next(next_link=None): | ||
_request = prepare_request(next_link) | ||
|
||
_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]: | ||
map_error(status_code=response.status_code, response=response, error_map=error_map) | ||
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) | ||
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) | ||
|
||
return pipeline_response | ||
|
||
return AsyncItemPaged(get_next, extract_data) |
Oops, something went wrong.