Skip to content

Commit 7398eca

Browse files
author
SDKAuto
committed
CodeGen from PR 20574 in Azure/azure-rest-api-specs
Merge 405ad7afff83cae36f6fcfec99e7bf2c5bc71c60 into d7c9be23749467be1aea18f02ba2f4948a39db6a
1 parent 19f6348 commit 7398eca

37 files changed

+7921
-4396
lines changed
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"autorest": "3.7.2",
2+
"autorest": "3.8.4",
33
"use": [
4-
"@autorest/python@5.13.0",
5-
"@autorest/modelerfour@4.19.3"
4+
"@autorest/python@6.1.4",
5+
"@autorest/modelerfour@4.23.5"
66
],
7-
"commit": "b1bbbab2f04c23e279c717f955d9a86bc4757946",
7+
"commit": "1bfb2b8970b7b1f44896d52753adcd626137b6a5",
88
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
9-
"autorest_command": "autorest specification/reservations/resource-manager/readme.md --multiapi --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.13.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2",
9+
"autorest_command": "autorest specification/reservations/resource-manager/readme.md --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.1.4 --use=@autorest/modelerfour@4.23.5 --version=3.8.4 --version-tolerant=False",
1010
"readme": "specification/reservations/resource-manager/readme.md"
1111
}

sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/__init__.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,15 @@
1010
from ._version import VERSION
1111

1212
__version__ = VERSION
13-
__all__ = ['AzureReservationAPI']
1413

15-
# `._patch.py` is used for handwritten extensions to the generated code
16-
# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
17-
from ._patch import patch_sdk
18-
patch_sdk()
14+
try:
15+
from ._patch import __all__ as _patch_all
16+
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
17+
except ImportError:
18+
_patch_all = []
19+
from ._patch import patch_sdk as _patch_sdk
20+
21+
__all__ = ["AzureReservationAPI"]
22+
__all__.extend([p for p in _patch_all if p not in __all__])
23+
24+
_patch_sdk()

sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_azure_reservation_api.py

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,31 @@
99
from copy import deepcopy
1010
from typing import Any, TYPE_CHECKING
1111

12-
from msrest import Deserializer, Serializer
13-
1412
from azure.core.rest import HttpRequest, HttpResponse
1513
from azure.mgmt.core import ARMPipelineClient
1614

1715
from . import models
1816
from ._configuration import AzureReservationAPIConfiguration
19-
from .operations import AzureReservationAPIOperationsMixin, CalculateExchangeOperations, ExchangeOperations, OperationOperations, QuotaOperations, QuotaRequestStatusOperations, ReservationOperations, ReservationOrderOperations
17+
from ._serialization import Deserializer, Serializer
18+
from .operations import (
19+
AzureReservationAPIOperationsMixin,
20+
CalculateExchangeOperations,
21+
ExchangeOperations,
22+
OperationOperations,
23+
QuotaOperations,
24+
QuotaRequestStatusOperations,
25+
ReservationOperations,
26+
ReservationOrderOperations,
27+
)
2028

2129
if TYPE_CHECKING:
2230
# pylint: disable=unused-import,ungrouped-imports
2331
from azure.core.credentials import TokenCredential
2432

25-
class AzureReservationAPI(AzureReservationAPIOperationsMixin): # pylint: disable=too-many-instance-attributes
33+
34+
class AzureReservationAPI(
35+
AzureReservationAPIOperationsMixin
36+
): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
2637
"""This API describe Azure Reservation.
2738
2839
:ivar reservation: ReservationOperations operations
@@ -39,7 +50,7 @@ class AzureReservationAPI(AzureReservationAPIOperationsMixin): # pylint: disa
3950
:vartype quota: azure.mgmt.reservations.operations.QuotaOperations
4051
:ivar quota_request_status: QuotaRequestStatusOperations operations
4152
:vartype quota_request_status: azure.mgmt.reservations.operations.QuotaRequestStatusOperations
42-
:param credential: Credential needed for the client to connect to Azure.
53+
:param credential: Credential needed for the client to connect to Azure. Required.
4354
:type credential: ~azure.core.credentials.TokenCredential
4455
:param base_url: Service URL. Default value is "https://management.azure.com".
4556
:type base_url: str
@@ -48,10 +59,7 @@ class AzureReservationAPI(AzureReservationAPIOperationsMixin): # pylint: disa
4859
"""
4960

5061
def __init__(
51-
self,
52-
credential: "TokenCredential",
53-
base_url: str = "https://management.azure.com",
54-
**kwargs: Any
62+
self, credential: "TokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any
5563
) -> None:
5664
self._config = AzureReservationAPIConfiguration(credential=credential, **kwargs)
5765
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
@@ -61,19 +69,20 @@ def __init__(
6169
self._deserialize = Deserializer(client_models)
6270
self._serialize.client_side_validation = False
6371
self.reservation = ReservationOperations(self._client, self._config, self._serialize, self._deserialize)
64-
self.reservation_order = ReservationOrderOperations(self._client, self._config, self._serialize, self._deserialize)
72+
self.reservation_order = ReservationOrderOperations(
73+
self._client, self._config, self._serialize, self._deserialize
74+
)
6575
self.operation = OperationOperations(self._client, self._config, self._serialize, self._deserialize)
66-
self.calculate_exchange = CalculateExchangeOperations(self._client, self._config, self._serialize, self._deserialize)
76+
self.calculate_exchange = CalculateExchangeOperations(
77+
self._client, self._config, self._serialize, self._deserialize
78+
)
6779
self.exchange = ExchangeOperations(self._client, self._config, self._serialize, self._deserialize)
6880
self.quota = QuotaOperations(self._client, self._config, self._serialize, self._deserialize)
69-
self.quota_request_status = QuotaRequestStatusOperations(self._client, self._config, self._serialize, self._deserialize)
70-
81+
self.quota_request_status = QuotaRequestStatusOperations(
82+
self._client, self._config, self._serialize, self._deserialize
83+
)
7184

72-
def _send_request(
73-
self,
74-
request: HttpRequest,
75-
**kwargs: Any
76-
) -> HttpResponse:
85+
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
7786
"""Runs the network request through the client's chained policies.
7887
7988
>>> from azure.core.rest import HttpRequest
@@ -82,7 +91,7 @@ def _send_request(
8291
>>> response = client._send_request(request)
8392
<HttpResponse: 200 OK>
8493
85-
For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart
94+
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
8695
8796
:param request: The network request you want to make. Required.
8897
:type request: ~azure.core.rest.HttpRequest

sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_configuration.py

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -25,37 +25,34 @@ class AzureReservationAPIConfiguration(Configuration): # pylint: disable=too-ma
2525
Note that all parameters used to create this instance are saved as instance
2626
attributes.
2727
28-
:param credential: Credential needed for the client to connect to Azure.
28+
:param credential: Credential needed for the client to connect to Azure. Required.
2929
:type credential: ~azure.core.credentials.TokenCredential
3030
"""
3131

32-
def __init__(
33-
self,
34-
credential: "TokenCredential",
35-
**kwargs: Any
36-
) -> None:
32+
def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None:
3733
super(AzureReservationAPIConfiguration, self).__init__(**kwargs)
3834
if credential is None:
3935
raise ValueError("Parameter 'credential' must not be None.")
4036

4137
self.credential = credential
42-
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
43-
kwargs.setdefault('sdk_moniker', 'mgmt-reservations/{}'.format(VERSION))
38+
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
39+
kwargs.setdefault("sdk_moniker", "mgmt-reservations/{}".format(VERSION))
4440
self._configure(**kwargs)
4541

4642
def _configure(
47-
self,
48-
**kwargs # type: Any
43+
self, **kwargs # type: Any
4944
):
5045
# type: (...) -> None
51-
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
52-
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
53-
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
54-
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
55-
self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs)
56-
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
57-
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
58-
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
59-
self.authentication_policy = kwargs.get('authentication_policy')
46+
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
47+
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
48+
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
49+
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
50+
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
51+
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
52+
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
53+
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
54+
self.authentication_policy = kwargs.get("authentication_policy")
6055
if self.credential and not self.authentication_policy:
61-
self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)
56+
self.authentication_policy = ARMChallengeAuthenticationPolicy(
57+
self.credential, *self.credential_scopes, **kwargs
58+
)

sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_patch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@
2828
# This file is used for handwritten extensions to the generated code. Example:
2929
# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
3030
def patch_sdk():
31-
pass
31+
pass

0 commit comments

Comments
 (0)