Skip to content

Commit 12a3b49

Browse files
author
SDKAuto
committed
CodeGen from PR 21677 in Azure/azure-rest-api-specs
Merge 58fd3c4fd642c742f3d9255cf1cf3d5363d73f7a into 9842de8f8f11c09511fc00e903eb947f76cba0e6
1 parent fbca313 commit 12a3b49

File tree

144 files changed

+11525
-5168
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

144 files changed

+11525
-5168
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"autorest": "3.7.2",
2+
"commit": "bf3c3bf450b6a38e5fb694bb524937815922044c",
3+
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
4+
"autorest": "3.9.2",
35
"use": [
4-
"@autorest/python@5.16.0",
5-
"@autorest/modelerfour@4.19.3"
6+
"@autorest/python@6.2.7",
7+
"@autorest/modelerfour@4.24.3"
68
],
7-
"commit": "c2d25c0f023edd1fea753a89d6409f3e7a9f8956",
8-
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
9-
"autorest_command": "autorest specification/consumption/resource-manager/readme.md --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --python3-only --use=@autorest/[email protected] --use=@autorest/[email protected] --version=3.7.2",
9+
"autorest_command": "autorest specification/consumption/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/[email protected] --use=@autorest/[email protected] --version=3.9.2 --version-tolerant=False",
1010
"readme": "specification/consumption/resource-manager/readme.md"
1111
}

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

+5-2
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,14 @@
1313

1414
try:
1515
from ._patch import __all__ as _patch_all
16-
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
16+
from ._patch import * # pylint: disable=unused-wildcard-import
1717
except ImportError:
1818
_patch_all = []
1919
from ._patch import patch_sdk as _patch_sdk
20-
__all__ = ['ConsumptionManagementClient']
20+
21+
__all__ = [
22+
"ConsumptionManagementClient",
23+
]
2124
__all__.extend([p for p in _patch_all if p not in __all__])
2225

2326
_patch_sdk()

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

+25-26
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9+
import sys
910
from typing import Any, TYPE_CHECKING
1011

1112
from azure.core.configuration import Configuration
@@ -14,6 +15,11 @@
1415

1516
from ._version import VERSION
1617

18+
if sys.version_info >= (3, 8):
19+
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
20+
else:
21+
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
22+
1723
if TYPE_CHECKING:
1824
# pylint: disable=unused-import,ungrouped-imports
1925
from azure.core.credentials import TokenCredential
@@ -25,23 +31,18 @@ class ConsumptionManagementClientConfiguration(Configuration): # pylint: disabl
2531
Note that all parameters used to create this instance are saved as instance
2632
attributes.
2733
28-
:param credential: Credential needed for the client to connect to Azure.
34+
:param credential: Credential needed for the client to connect to Azure. Required.
2935
:type credential: ~azure.core.credentials.TokenCredential
30-
:param subscription_id: Azure Subscription ID.
36+
:param subscription_id: Azure Subscription ID. Required.
3137
:type subscription_id: str
3238
:keyword api_version: Api Version. Default value is "2021-10-01". Note that overriding this
3339
default value may result in unsupported behavior.
3440
:paramtype api_version: str
3541
"""
3642

37-
def __init__(
38-
self,
39-
credential: "TokenCredential",
40-
subscription_id: str,
41-
**kwargs: Any
42-
) -> None:
43+
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
4344
super(ConsumptionManagementClientConfiguration, self).__init__(**kwargs)
44-
api_version = kwargs.pop('api_version', "2021-10-01") # type: str
45+
api_version: Literal["2021-10-01"] = kwargs.pop("api_version", "2021-10-01")
4546

4647
if credential is None:
4748
raise ValueError("Parameter 'credential' must not be None.")
@@ -51,23 +52,21 @@ def __init__(
5152
self.credential = credential
5253
self.subscription_id = subscription_id
5354
self.api_version = api_version
54-
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
55-
kwargs.setdefault('sdk_moniker', 'mgmt-consumption/{}'.format(VERSION))
55+
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
56+
kwargs.setdefault("sdk_moniker", "mgmt-consumption/{}".format(VERSION))
5657
self._configure(**kwargs)
5758

58-
def _configure(
59-
self,
60-
**kwargs # type: Any
61-
):
62-
# type: (...) -> None
63-
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
64-
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
65-
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
66-
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
67-
self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs)
68-
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
69-
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
70-
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
71-
self.authentication_policy = kwargs.get('authentication_policy')
59+
def _configure(self, **kwargs: Any) -> None:
60+
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
61+
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
62+
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
63+
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
64+
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
65+
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
66+
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
67+
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
68+
self.authentication_policy = kwargs.get("authentication_policy")
7269
if self.credential and not self.authentication_policy:
73-
self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)
70+
self.authentication_policy = ARMChallengeAuthenticationPolicy(
71+
self.credential, *self.credential_scopes, **kwargs
72+
)

sdk/consumption/azure-mgmt-consumption/azure/mgmt/consumption/_consumption_management_client.py

+46-58
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,38 @@
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

17-
from . import models
15+
from . import models as _models
1816
from ._configuration import ConsumptionManagementClientConfiguration
19-
from .operations import AggregatedCostOperations, BalancesOperations, BudgetsOperations, ChargesOperations, CreditsOperations, EventsOperations, LotsOperations, MarketplacesOperations, Operations, PriceSheetOperations, ReservationRecommendationDetailsOperations, ReservationRecommendationsOperations, ReservationTransactionsOperations, ReservationsDetailsOperations, ReservationsSummariesOperations, TagsOperations, UsageDetailsOperations
17+
from ._serialization import Deserializer, Serializer
18+
from .operations import (
19+
AggregatedCostOperations,
20+
BalancesOperations,
21+
BudgetsOperations,
22+
ChargesOperations,
23+
CreditsOperations,
24+
EventsOperations,
25+
LotsOperations,
26+
MarketplacesOperations,
27+
Operations,
28+
PriceSheetOperations,
29+
ReservationRecommendationDetailsOperations,
30+
ReservationRecommendationsOperations,
31+
ReservationTransactionsOperations,
32+
ReservationsDetailsOperations,
33+
ReservationsSummariesOperations,
34+
TagsOperations,
35+
UsageDetailsOperations,
36+
)
2037

2138
if TYPE_CHECKING:
2239
# pylint: disable=unused-import,ungrouped-imports
2340
from azure.core.credentials import TokenCredential
2441

25-
class ConsumptionManagementClient: # pylint: disable=too-many-instance-attributes
42+
43+
class ConsumptionManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
2644
"""Consumption management client provides access to consumption resources for Azure Enterprise
2745
Subscriptions.
2846
@@ -64,9 +82,9 @@ class ConsumptionManagementClient: # pylint: disable=too-many-instance-attrib
6482
:vartype lots: azure.mgmt.consumption.operations.LotsOperations
6583
:ivar credits: CreditsOperations operations
6684
:vartype credits: azure.mgmt.consumption.operations.CreditsOperations
67-
:param credential: Credential needed for the client to connect to Azure.
85+
:param credential: Credential needed for the client to connect to Azure. Required.
6886
:type credential: ~azure.core.credentials.TokenCredential
69-
:param subscription_id: Azure Subscription ID.
87+
:param subscription_id: Azure Subscription ID. Required.
7088
:type subscription_id: str
7189
:param base_url: Service URL. Default value is "https://management.azure.com".
7290
:type base_url: str
@@ -82,31 +100,21 @@ def __init__(
82100
base_url: str = "https://management.azure.com",
83101
**kwargs: Any
84102
) -> None:
85-
self._config = ConsumptionManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs)
103+
self._config = ConsumptionManagementClientConfiguration(
104+
credential=credential, subscription_id=subscription_id, **kwargs
105+
)
86106
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
87107

88-
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
108+
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
89109
self._serialize = Serializer(client_models)
90110
self._deserialize = Deserializer(client_models)
91111
self._serialize.client_side_validation = False
92-
self.usage_details = UsageDetailsOperations(
93-
self._client, self._config, self._serialize, self._deserialize
94-
)
95-
self.marketplaces = MarketplacesOperations(
96-
self._client, self._config, self._serialize, self._deserialize
97-
)
98-
self.budgets = BudgetsOperations(
99-
self._client, self._config, self._serialize, self._deserialize
100-
)
101-
self.tags = TagsOperations(
102-
self._client, self._config, self._serialize, self._deserialize
103-
)
104-
self.charges = ChargesOperations(
105-
self._client, self._config, self._serialize, self._deserialize
106-
)
107-
self.balances = BalancesOperations(
108-
self._client, self._config, self._serialize, self._deserialize
109-
)
112+
self.usage_details = UsageDetailsOperations(self._client, self._config, self._serialize, self._deserialize)
113+
self.marketplaces = MarketplacesOperations(self._client, self._config, self._serialize, self._deserialize)
114+
self.budgets = BudgetsOperations(self._client, self._config, self._serialize, self._deserialize)
115+
self.tags = TagsOperations(self._client, self._config, self._serialize, self._deserialize)
116+
self.charges = ChargesOperations(self._client, self._config, self._serialize, self._deserialize)
117+
self.balances = BalancesOperations(self._client, self._config, self._serialize, self._deserialize)
110118
self.reservations_summaries = ReservationsSummariesOperations(
111119
self._client, self._config, self._serialize, self._deserialize
112120
)
@@ -122,31 +130,14 @@ def __init__(
122130
self.reservation_transactions = ReservationTransactionsOperations(
123131
self._client, self._config, self._serialize, self._deserialize
124132
)
125-
self.price_sheet = PriceSheetOperations(
126-
self._client, self._config, self._serialize, self._deserialize
127-
)
128-
self.operations = Operations(
129-
self._client, self._config, self._serialize, self._deserialize
130-
)
131-
self.aggregated_cost = AggregatedCostOperations(
132-
self._client, self._config, self._serialize, self._deserialize
133-
)
134-
self.events = EventsOperations(
135-
self._client, self._config, self._serialize, self._deserialize
136-
)
137-
self.lots = LotsOperations(
138-
self._client, self._config, self._serialize, self._deserialize
139-
)
140-
self.credits = CreditsOperations(
141-
self._client, self._config, self._serialize, self._deserialize
142-
)
133+
self.price_sheet = PriceSheetOperations(self._client, self._config, self._serialize, self._deserialize)
134+
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
135+
self.aggregated_cost = AggregatedCostOperations(self._client, self._config, self._serialize, self._deserialize)
136+
self.events = EventsOperations(self._client, self._config, self._serialize, self._deserialize)
137+
self.lots = LotsOperations(self._client, self._config, self._serialize, self._deserialize)
138+
self.credits = CreditsOperations(self._client, self._config, self._serialize, self._deserialize)
143139

144-
145-
def _send_request(
146-
self,
147-
request: HttpRequest,
148-
**kwargs: Any
149-
) -> HttpResponse:
140+
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
150141
"""Runs the network request through the client's chained policies.
151142
152143
>>> from azure.core.rest import HttpRequest
@@ -155,7 +146,7 @@ def _send_request(
155146
>>> response = client._send_request(request)
156147
<HttpResponse: 200 OK>
157148
158-
For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart
149+
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
159150
160151
:param request: The network request you want to make. Required.
161152
:type request: ~azure.core.rest.HttpRequest
@@ -168,15 +159,12 @@ def _send_request(
168159
request_copy.url = self._client.format_url(request_copy.url)
169160
return self._client.send_request(request_copy, **kwargs)
170161

171-
def close(self):
172-
# type: () -> None
162+
def close(self) -> None:
173163
self._client.close()
174164

175-
def __enter__(self):
176-
# type: () -> ConsumptionManagementClient
165+
def __enter__(self) -> "ConsumptionManagementClient":
177166
self._client.__enter__()
178167
return self
179168

180-
def __exit__(self, *exc_details):
181-
# type: (Any) -> None
169+
def __exit__(self, *exc_details) -> None:
182170
self._client.__exit__(*exc_details)

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

+1-1
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)