Skip to content

Commit

Permalink
CodeGen from PR 22367 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
[Hub Generated] Review request for Microsoft.Quota to add version stable/2023-02-01 (Azure#22367)

* Adds base for updating Microsoft.Quota from version preview/2021-03-15-preview to version 2023-02-01

* Updates readme

* Updates API version in new specs and examples

* Fix version in readme

* Remove stale version, update readme

* Mark parameter as optional
  • Loading branch information
SDKAuto committed Mar 22, 2023
1 parent cd49708 commit b2e0cec
Show file tree
Hide file tree
Showing 43 changed files with 516 additions and 436 deletions.
6 changes: 3 additions & 3 deletions sdk/quota/azure-mgmt-quota/_meta.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"commit": "7d6c14d986a67dca3451d7d92d8f6b9416d61fbf",
"commit": "806d1616c2ce4c0a93fda266bd020903733ac326",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest": "3.9.2",
"use": [
"@autorest/python@6.2.1",
"@autorest/python@6.4.3",
"@autorest/modelerfour@4.24.3"
],
"autorest_command": "autorest specification/quota/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.1 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
"autorest_command": "autorest specification/quota/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.4.3 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
"readme": "specification/quota/resource-manager/readme.md"
}
2 changes: 1 addition & 1 deletion sdk/quota/azure-mgmt-quota/azure/mgmt/quota/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

try:
from ._patch import __all__ as _patch_all
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
from ._patch import * # pylint: disable=unused-wildcard-import
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from azure.core.rest import HttpRequest, HttpResponse
from azure.mgmt.core import ARMPipelineClient

from . import models
from . import models as _models
from ._configuration import AzureQuotaExtensionAPIConfiguration
from ._serialization import Deserializer, Serializer
from .operations import QuotaOperationOperations, QuotaOperations, QuotaRequestStatusOperations, UsagesOperations
Expand All @@ -37,8 +37,8 @@ class AzureQuotaExtensionAPI: # pylint: disable=client-accepts-api-version-keyw
:type credential: ~azure.core.credentials.TokenCredential
:param base_url: Service URL. Default value is "https://management.azure.com".
:type base_url: str
:keyword api_version: Api Version. Default value is "2021-03-15-preview". Note that overriding
this default value may result in unsupported behavior.
:keyword api_version: Api Version. Default value is "2023-02-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
Expand All @@ -48,9 +48,9 @@ def __init__(
self, credential: "TokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any
) -> None:
self._config = AzureQuotaExtensionAPIConfiguration(credential=credential, **kwargs)
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
Expand Down Expand Up @@ -83,15 +83,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
request_copy.url = self._client.format_url(request_copy.url)
return self._client.send_request(request_copy, **kwargs)

def close(self):
# type: () -> None
def close(self) -> None:
self._client.close()

def __enter__(self):
# type: () -> AzureQuotaExtensionAPI
def __enter__(self) -> "AzureQuotaExtensionAPI":
self._client.__enter__()
return self

def __exit__(self, *exc_details):
# type: (Any) -> None
def __exit__(self, *exc_details: Any) -> None:
self._client.__exit__(*exc_details)
11 changes: 4 additions & 7 deletions sdk/quota/azure-mgmt-quota/azure/mgmt/quota/_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ class AzureQuotaExtensionAPIConfiguration(Configuration): # pylint: disable=too
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials.TokenCredential
:keyword api_version: Api Version. Default value is "2021-03-15-preview". Note that overriding
this default value may result in unsupported behavior.
:keyword api_version: Api Version. Default value is "2023-02-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
"""

def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None:
super(AzureQuotaExtensionAPIConfiguration, self).__init__(**kwargs)
api_version = kwargs.pop("api_version", "2021-03-15-preview") # type: Literal["2021-03-15-preview"]
api_version: Literal["2023-02-01"] = kwargs.pop("api_version", "2023-02-01")

if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
Expand All @@ -51,10 +51,7 @@ def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None:
kwargs.setdefault("sdk_moniker", "mgmt-quota/{}".format(VERSION))
self._configure(**kwargs)

def _configure(
self, **kwargs # type: Any
):
# type: (...) -> None
def _configure(self, **kwargs: Any) -> None:
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
Expand Down
Loading

0 comments on commit b2e0cec

Please sign in to comment.