Skip to content

Commit 284da3e

Browse files
author
SDKAuto
committed
CodeGen from PR 17222 in Azure/azure-rest-api-specs
Merge a61c0597c494bfde9bc2c77f29959a772f39d8bc into 6a7c020
1 parent 9a544e9 commit 284da3e

Some content is hidden

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

42 files changed

+4834
-5792
lines changed
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"autorest": "3.4.5",
2+
"autorest": "3.7.2",
33
"use": [
4-
"@autorest/python@5.8.4",
5-
"@autorest/[email protected].2"
4+
"@autorest/python@5.12.0",
5+
"@autorest/[email protected].3"
66
],
7-
"commit": "74efe54fbc55c91a1d9213afbb2723747acfddf9",
7+
"commit": "0dc1b4a6458b017559c4cab86a98561457936ee6",
88
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
9-
"autorest_command": "autorest specification/cost-management/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.4 --use=@autorest/[email protected].2 --version=3.4.5",
9+
"autorest_command": "autorest specification/cost-management/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/[email protected].3 --version=3.7.2",
1010
"readme": "specification/cost-management/resource-manager/readme.md"
1111
}

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
__version__ = VERSION
1313
__all__ = ['CostManagementClient']
1414

15-
try:
16-
from ._patch import patch_sdk # type: ignore
17-
patch_sdk()
18-
except ImportError:
19-
pass
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()

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

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,16 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
from typing import TYPE_CHECKING
9+
from typing import Any, TYPE_CHECKING
1010

1111
from azure.core.configuration import Configuration
1212
from azure.core.pipeline import policies
13-
from azure.mgmt.core.policies import ARMHttpLoggingPolicy
13+
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
1414

1515
from ._version import VERSION
1616

1717
if TYPE_CHECKING:
1818
# pylint: disable=unused-import,ungrouped-imports
19-
from typing import Any
20-
2119
from azure.core.credentials import TokenCredential
2220

2321

@@ -33,16 +31,15 @@ class CostManagementClientConfiguration(Configuration):
3331

3432
def __init__(
3533
self,
36-
credential, # type: "TokenCredential"
37-
**kwargs # type: Any
38-
):
39-
# type: (...) -> None
34+
credential: "TokenCredential",
35+
**kwargs: Any
36+
) -> None:
37+
super(CostManagementClientConfiguration, self).__init__(**kwargs)
4038
if credential is None:
4139
raise ValueError("Parameter 'credential' must not be None.")
42-
super(CostManagementClientConfiguration, self).__init__(**kwargs)
4340

4441
self.credential = credential
45-
self.api_version = "2019-11-01"
42+
self.api_version = "2021-10-01"
4643
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
4744
kwargs.setdefault('sdk_moniker', 'mgmt-costmanagement/{}'.format(VERSION))
4845
self._configure(**kwargs)
@@ -62,4 +59,4 @@ def _configure(
6259
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
6360
self.authentication_policy = kwargs.get('authentication_policy')
6461
if self.credential and not self.authentication_policy:
65-
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
62+
self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)

sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_cost_management_client.py

Lines changed: 64 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,37 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
from typing import TYPE_CHECKING
9+
from copy import deepcopy
10+
from typing import Any, Optional, TYPE_CHECKING
1011

12+
from azure.core.rest import HttpRequest, HttpResponse
1113
from azure.mgmt.core import ARMPipelineClient
1214
from msrest import Deserializer, Serializer
1315

16+
from . import models
17+
from ._configuration import CostManagementClientConfiguration
18+
from .operations import AlertsOperations, DimensionsOperations, ExportsOperations, ForecastOperations, GenerateDetailedCostReportOperationResultsOperations, GenerateDetailedCostReportOperationStatusOperations, GenerateDetailedCostReportOperations, Operations, QueryOperations, ViewsOperations
19+
1420
if TYPE_CHECKING:
1521
# pylint: disable=unused-import,ungrouped-imports
16-
from typing import Any, Optional
17-
1822
from azure.core.credentials import TokenCredential
19-
from azure.core.pipeline.transport import HttpRequest, HttpResponse
20-
21-
from ._configuration import CostManagementClientConfiguration
22-
from .operations import SettingsOperations
23-
from .operations import ViewsOperations
24-
from .operations import AlertsOperations
25-
from .operations import ForecastOperations
26-
from .operations import DimensionsOperations
27-
from .operations import QueryOperations
28-
from .operations import GenerateReservationDetailsReportOperations
29-
from .operations import Operations
30-
from .operations import ExportsOperations
31-
from . import models
32-
3323

34-
class CostManagementClient(object):
24+
class CostManagementClient:
3525
"""CostManagementClient.
3626
37-
:ivar settings: SettingsOperations operations
38-
:vartype settings: azure.mgmt.costmanagement.operations.SettingsOperations
27+
:ivar exports: ExportsOperations operations
28+
:vartype exports: azure.mgmt.costmanagement.operations.ExportsOperations
29+
:ivar generate_detailed_cost_report: GenerateDetailedCostReportOperations operations
30+
:vartype generate_detailed_cost_report:
31+
azure.mgmt.costmanagement.operations.GenerateDetailedCostReportOperations
32+
:ivar generate_detailed_cost_report_operation_results:
33+
GenerateDetailedCostReportOperationResultsOperations operations
34+
:vartype generate_detailed_cost_report_operation_results:
35+
azure.mgmt.costmanagement.operations.GenerateDetailedCostReportOperationResultsOperations
36+
:ivar generate_detailed_cost_report_operation_status:
37+
GenerateDetailedCostReportOperationStatusOperations operations
38+
:vartype generate_detailed_cost_report_operation_status:
39+
azure.mgmt.costmanagement.operations.GenerateDetailedCostReportOperationStatusOperations
3940
:ivar views: ViewsOperations operations
4041
:vartype views: azure.mgmt.costmanagement.operations.ViewsOperations
4142
:ivar alerts: AlertsOperations operations
@@ -46,68 +47,66 @@ class CostManagementClient(object):
4647
:vartype dimensions: azure.mgmt.costmanagement.operations.DimensionsOperations
4748
:ivar query: QueryOperations operations
4849
:vartype query: azure.mgmt.costmanagement.operations.QueryOperations
49-
:ivar generate_reservation_details_report: GenerateReservationDetailsReportOperations operations
50-
:vartype generate_reservation_details_report: azure.mgmt.costmanagement.operations.GenerateReservationDetailsReportOperations
5150
:ivar operations: Operations operations
5251
:vartype operations: azure.mgmt.costmanagement.operations.Operations
53-
:ivar exports: ExportsOperations operations
54-
:vartype exports: azure.mgmt.costmanagement.operations.ExportsOperations
5552
:param credential: Credential needed for the client to connect to Azure.
5653
:type credential: ~azure.core.credentials.TokenCredential
57-
:param str base_url: Service URL
58-
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
54+
:param base_url: Service URL. Default value is 'https://management.azure.com'.
55+
:type base_url: str
56+
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
57+
Retry-After header is present.
5958
"""
6059

6160
def __init__(
6261
self,
63-
credential, # type: "TokenCredential"
64-
base_url=None, # type: Optional[str]
65-
**kwargs # type: Any
66-
):
67-
# type: (...) -> None
68-
if not base_url:
69-
base_url = 'https://management.azure.com'
70-
self._config = CostManagementClientConfiguration(credential, **kwargs)
62+
credential: "TokenCredential",
63+
base_url: str = "https://management.azure.com",
64+
**kwargs: Any
65+
) -> None:
66+
self._config = CostManagementClientConfiguration(credential=credential, **kwargs)
7167
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
7268

7369
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
7470
self._serialize = Serializer(client_models)
75-
self._serialize.client_side_validation = False
7671
self._deserialize = Deserializer(client_models)
77-
78-
self.settings = SettingsOperations(
79-
self._client, self._config, self._serialize, self._deserialize)
80-
self.views = ViewsOperations(
81-
self._client, self._config, self._serialize, self._deserialize)
82-
self.alerts = AlertsOperations(
83-
self._client, self._config, self._serialize, self._deserialize)
84-
self.forecast = ForecastOperations(
85-
self._client, self._config, self._serialize, self._deserialize)
86-
self.dimensions = DimensionsOperations(
87-
self._client, self._config, self._serialize, self._deserialize)
88-
self.query = QueryOperations(
89-
self._client, self._config, self._serialize, self._deserialize)
90-
self.generate_reservation_details_report = GenerateReservationDetailsReportOperations(
91-
self._client, self._config, self._serialize, self._deserialize)
92-
self.operations = Operations(
93-
self._client, self._config, self._serialize, self._deserialize)
94-
self.exports = ExportsOperations(
95-
self._client, self._config, self._serialize, self._deserialize)
96-
97-
def _send_request(self, http_request, **kwargs):
98-
# type: (HttpRequest, Any) -> HttpResponse
72+
self._serialize.client_side_validation = False
73+
self.exports = ExportsOperations(self._client, self._config, self._serialize, self._deserialize)
74+
self.generate_detailed_cost_report = GenerateDetailedCostReportOperations(self._client, self._config, self._serialize, self._deserialize)
75+
self.generate_detailed_cost_report_operation_results = GenerateDetailedCostReportOperationResultsOperations(self._client, self._config, self._serialize, self._deserialize)
76+
self.generate_detailed_cost_report_operation_status = GenerateDetailedCostReportOperationStatusOperations(self._client, self._config, self._serialize, self._deserialize)
77+
self.views = ViewsOperations(self._client, self._config, self._serialize, self._deserialize)
78+
self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize)
79+
self.forecast = ForecastOperations(self._client, self._config, self._serialize, self._deserialize)
80+
self.dimensions = DimensionsOperations(self._client, self._config, self._serialize, self._deserialize)
81+
self.query = QueryOperations(self._client, self._config, self._serialize, self._deserialize)
82+
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
83+
84+
85+
def _send_request(
86+
self,
87+
request, # type: HttpRequest
88+
**kwargs: Any
89+
) -> HttpResponse:
9990
"""Runs the network request through the client's chained policies.
10091
101-
:param http_request: The network request you want to make. Required.
102-
:type http_request: ~azure.core.pipeline.transport.HttpRequest
103-
:keyword bool stream: Whether the response payload will be streamed. Defaults to True.
92+
>>> from azure.core.rest import HttpRequest
93+
>>> request = HttpRequest("GET", "https://www.example.org/")
94+
<HttpRequest [GET], url: 'https://www.example.org/'>
95+
>>> response = client._send_request(request)
96+
<HttpResponse: 200 OK>
97+
98+
For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart
99+
100+
:param request: The network request you want to make. Required.
101+
:type request: ~azure.core.rest.HttpRequest
102+
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
104103
:return: The response of your network call. Does not do error handling on your response.
105-
:rtype: ~azure.core.pipeline.transport.HttpResponse
104+
:rtype: ~azure.core.rest.HttpResponse
106105
"""
107-
http_request.url = self._client.format_url(http_request.url)
108-
stream = kwargs.pop("stream", True)
109-
pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs)
110-
return pipeline_response.http_response
106+
107+
request_copy = deepcopy(request)
108+
request_copy.url = self._client.format_url(request_copy.url)
109+
return self._client.send_request(request_copy, **kwargs)
111110

112111
def close(self):
113112
# type: () -> None

sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_metadata.json

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
{
2-
"chosen_version": "2019-11-01",
3-
"total_api_version_list": ["2019-11-01"],
2+
"chosen_version": "2021-10-01",
3+
"total_api_version_list": ["2021-10-01"],
44
"client": {
55
"name": "CostManagementClient",
66
"filename": "_cost_management_client",
77
"description": "CostManagementClient.",
8-
"base_url": "\u0027https://management.azure.com\u0027",
9-
"custom_base_url": null,
8+
"host_value": "\"https://management.azure.com\"",
9+
"parameterized_host_template": null,
1010
"azure_arm": true,
1111
"has_lro_operations": true,
1212
"client_side_validation": false,
13-
"sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"CostManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}",
14-
"async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"CostManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}"
13+
"sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"CostManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}",
14+
"async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"CostManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}"
1515
},
1616
"global_parameters": {
1717
"sync": {
@@ -42,7 +42,7 @@
4242
"required": false
4343
},
4444
"base_url": {
45-
"signature": "base_url=None, # type: Optional[str]",
45+
"signature": "base_url=\"https://management.azure.com\", # type: str",
4646
"description": "Service URL",
4747
"docstring_type": "str",
4848
"required": false
@@ -62,7 +62,7 @@
6262
"required": false
6363
},
6464
"base_url": {
65-
"signature": "base_url: Optional[str] = None,",
65+
"signature": "base_url: str = \"https://management.azure.com\",",
6666
"description": "Service URL",
6767
"docstring_type": "str",
6868
"required": false
@@ -79,21 +79,21 @@
7979
"config": {
8080
"credential": true,
8181
"credential_scopes": ["https://management.azure.com/.default"],
82-
"credential_default_policy_type": "BearerTokenCredentialPolicy",
83-
"credential_default_policy_type_has_async_version": true,
84-
"credential_key_header_name": null,
85-
"sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
86-
"async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
82+
"credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)",
83+
"credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)",
84+
"sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
85+
"async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
8786
},
8887
"operation_groups": {
89-
"settings": "SettingsOperations",
88+
"exports": "ExportsOperations",
89+
"generate_detailed_cost_report": "GenerateDetailedCostReportOperations",
90+
"generate_detailed_cost_report_operation_results": "GenerateDetailedCostReportOperationResultsOperations",
91+
"generate_detailed_cost_report_operation_status": "GenerateDetailedCostReportOperationStatusOperations",
9092
"views": "ViewsOperations",
9193
"alerts": "AlertsOperations",
9294
"forecast": "ForecastOperations",
9395
"dimensions": "DimensionsOperations",
9496
"query": "QueryOperations",
95-
"generate_reservation_details_report": "GenerateReservationDetailsReportOperations",
96-
"operations": "Operations",
97-
"exports": "ExportsOperations"
97+
"operations": "Operations"
9898
}
9999
}

0 commit comments

Comments
 (0)