Skip to content

Commit 88deafd

Browse files
author
SDKAuto
committed
CodeGen from PR 19450 in Azure/azure-rest-api-specs
Merge 5655c13262da23f02a1d9ad0dcd9114b0ffa9909 into a7de71ef99f5ea2aefe38bbd3c55db09c64547e8
1 parent 8b2cfb0 commit 88deafd

Some content is hidden

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

45 files changed

+6749
-6166
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.16.0",
5+
"@autorest/[email protected].3"
66
],
7-
"commit": "74efe54fbc55c91a1d9213afbb2723747acfddf9",
7+
"commit": "a90e04153316390fae0d45125f47c28c46358c11",
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 --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.16.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: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@
1010
from ._version import VERSION
1111

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

1514
try:
16-
from ._patch import patch_sdk # type: ignore
17-
patch_sdk()
15+
from ._patch import __all__ as _patch_all
16+
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
1817
except ImportError:
19-
pass
18+
_patch_all = []
19+
from ._patch import patch_sdk as _patch_sdk
20+
__all__ = ['CostManagementClient']
21+
__all__.extend([p for p in _patch_all if p not in __all__])
22+
23+
_patch_sdk()

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

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,43 +6,45 @@
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

24-
class CostManagementClientConfiguration(Configuration):
22+
class CostManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
2523
"""Configuration for CostManagementClient.
2624
2725
Note that all parameters used to create this instance are saved as instance
2826
attributes.
2927
3028
:param credential: Credential needed for the client to connect to Azure.
3129
:type credential: ~azure.core.credentials.TokenCredential
30+
:keyword api_version: Api Version. Default value is "2021-10-01". Note that overriding this
31+
default value may result in unsupported behavior.
32+
:paramtype api_version: str
3233
"""
3334

3435
def __init__(
3536
self,
36-
credential, # type: "TokenCredential"
37-
**kwargs # type: Any
38-
):
39-
# type: (...) -> None
37+
credential: "TokenCredential",
38+
**kwargs: Any
39+
) -> None:
40+
super(CostManagementClientConfiguration, self).__init__(**kwargs)
41+
api_version = kwargs.pop('api_version', "2021-10-01") # type: str
42+
4043
if credential is None:
4144
raise ValueError("Parameter 'credential' must not be None.")
42-
super(CostManagementClientConfiguration, self).__init__(**kwargs)
4345

4446
self.credential = credential
45-
self.api_version = "2019-11-01"
47+
self.api_version = api_version
4648
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
4749
kwargs.setdefault('sdk_moniker', 'mgmt-costmanagement/{}'.format(VERSION))
4850
self._configure(**kwargs)
@@ -62,4 +64,4 @@ def _configure(
6264
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
6365
self.authentication_policy = kwargs.get('authentication_policy')
6466
if self.credential and not self.authentication_policy:
65-
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
67+
self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)

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

Lines changed: 88 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,38 @@
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, TYPE_CHECKING
1011

11-
from azure.mgmt.core import ARMPipelineClient
1212
from msrest import Deserializer, Serializer
1313

14-
if TYPE_CHECKING:
15-
# pylint: disable=unused-import,ungrouped-imports
16-
from typing import Any, Optional
17-
18-
from azure.core.credentials import TokenCredential
19-
from azure.core.pipeline.transport import HttpRequest, HttpResponse
14+
from azure.core.rest import HttpRequest, HttpResponse
15+
from azure.mgmt.core import ARMPipelineClient
2016

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
3117
from . import models
18+
from ._configuration import CostManagementClientConfiguration
19+
from .operations import AlertsOperations, DimensionsOperations, ExportsOperations, ForecastOperations, GenerateDetailedCostReportOperationResultsOperations, GenerateDetailedCostReportOperationStatusOperations, GenerateDetailedCostReportOperations, GenerateReservationDetailsReportOperations, Operations, QueryOperations, ViewsOperations
3220

21+
if TYPE_CHECKING:
22+
# pylint: disable=unused-import,ungrouped-imports
23+
from azure.core.credentials import TokenCredential
3324

34-
class CostManagementClient(object):
25+
class CostManagementClient: # pylint: disable=too-many-instance-attributes
3526
"""CostManagementClient.
3627
37-
:ivar settings: SettingsOperations operations
38-
:vartype settings: azure.mgmt.costmanagement.operations.SettingsOperations
28+
:ivar exports: ExportsOperations operations
29+
:vartype exports: azure.mgmt.costmanagement.operations.ExportsOperations
30+
:ivar generate_detailed_cost_report: GenerateDetailedCostReportOperations operations
31+
:vartype generate_detailed_cost_report:
32+
azure.mgmt.costmanagement.operations.GenerateDetailedCostReportOperations
33+
:ivar generate_detailed_cost_report_operation_results:
34+
GenerateDetailedCostReportOperationResultsOperations operations
35+
:vartype generate_detailed_cost_report_operation_results:
36+
azure.mgmt.costmanagement.operations.GenerateDetailedCostReportOperationResultsOperations
37+
:ivar generate_detailed_cost_report_operation_status:
38+
GenerateDetailedCostReportOperationStatusOperations operations
39+
:vartype generate_detailed_cost_report_operation_status:
40+
azure.mgmt.costmanagement.operations.GenerateDetailedCostReportOperationStatusOperations
3941
:ivar views: ViewsOperations operations
4042
:vartype views: azure.mgmt.costmanagement.operations.ViewsOperations
4143
:ivar alerts: AlertsOperations operations
@@ -46,68 +48,96 @@ class CostManagementClient(object):
4648
:vartype dimensions: azure.mgmt.costmanagement.operations.DimensionsOperations
4749
:ivar query: QueryOperations operations
4850
: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
51+
:ivar generate_reservation_details_report: GenerateReservationDetailsReportOperations
52+
operations
53+
:vartype generate_reservation_details_report:
54+
azure.mgmt.costmanagement.operations.GenerateReservationDetailsReportOperations
5155
:ivar operations: Operations operations
5256
:vartype operations: azure.mgmt.costmanagement.operations.Operations
53-
:ivar exports: ExportsOperations operations
54-
:vartype exports: azure.mgmt.costmanagement.operations.ExportsOperations
5557
:param credential: Credential needed for the client to connect to Azure.
5658
: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.
59+
:param base_url: Service URL. Default value is "https://management.azure.com".
60+
:type base_url: str
61+
:keyword api_version: Api Version. Default value is "2021-10-01". Note that overriding this
62+
default value may result in unsupported behavior.
63+
:paramtype api_version: str
64+
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
65+
Retry-After header is present.
5966
"""
6067

6168
def __init__(
6269
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)
70+
credential: "TokenCredential",
71+
base_url: str = "https://management.azure.com",
72+
**kwargs: Any
73+
) -> None:
74+
self._config = CostManagementClientConfiguration(credential=credential, **kwargs)
7175
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
7276

7377
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
7478
self._serialize = Serializer(client_models)
75-
self._serialize.client_side_validation = False
7679
self._deserialize = Deserializer(client_models)
77-
78-
self.settings = SettingsOperations(
79-
self._client, self._config, self._serialize, self._deserialize)
80+
self._serialize.client_side_validation = False
81+
self.exports = ExportsOperations(
82+
self._client, self._config, self._serialize, self._deserialize
83+
)
84+
self.generate_detailed_cost_report = GenerateDetailedCostReportOperations(
85+
self._client, self._config, self._serialize, self._deserialize
86+
)
87+
self.generate_detailed_cost_report_operation_results = GenerateDetailedCostReportOperationResultsOperations(
88+
self._client, self._config, self._serialize, self._deserialize
89+
)
90+
self.generate_detailed_cost_report_operation_status = GenerateDetailedCostReportOperationStatusOperations(
91+
self._client, self._config, self._serialize, self._deserialize
92+
)
8093
self.views = ViewsOperations(
81-
self._client, self._config, self._serialize, self._deserialize)
94+
self._client, self._config, self._serialize, self._deserialize
95+
)
8296
self.alerts = AlertsOperations(
83-
self._client, self._config, self._serialize, self._deserialize)
97+
self._client, self._config, self._serialize, self._deserialize
98+
)
8499
self.forecast = ForecastOperations(
85-
self._client, self._config, self._serialize, self._deserialize)
100+
self._client, self._config, self._serialize, self._deserialize
101+
)
86102
self.dimensions = DimensionsOperations(
87-
self._client, self._config, self._serialize, self._deserialize)
103+
self._client, self._config, self._serialize, self._deserialize
104+
)
88105
self.query = QueryOperations(
89-
self._client, self._config, self._serialize, self._deserialize)
106+
self._client, self._config, self._serialize, self._deserialize
107+
)
90108
self.generate_reservation_details_report = GenerateReservationDetailsReportOperations(
91-
self._client, self._config, self._serialize, self._deserialize)
109+
self._client, self._config, self._serialize, self._deserialize
110+
)
92111
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)
112+
self._client, self._config, self._serialize, self._deserialize
113+
)
114+
96115

97-
def _send_request(self, http_request, **kwargs):
98-
# type: (HttpRequest, Any) -> HttpResponse
116+
def _send_request(
117+
self,
118+
request: HttpRequest,
119+
**kwargs: Any
120+
) -> HttpResponse:
99121
"""Runs the network request through the client's chained policies.
100122
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.
123+
>>> from azure.core.rest import HttpRequest
124+
>>> request = HttpRequest("GET", "https://www.example.org/")
125+
<HttpRequest [GET], url: 'https://www.example.org/'>
126+
>>> response = client._send_request(request)
127+
<HttpResponse: 200 OK>
128+
129+
For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart
130+
131+
:param request: The network request you want to make. Required.
132+
:type request: ~azure.core.rest.HttpRequest
133+
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
104134
:return: The response of your network call. Does not do error handling on your response.
105-
:rtype: ~azure.core.pipeline.transport.HttpResponse
135+
:rtype: ~azure.core.rest.HttpResponse
106136
"""
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
137+
138+
request_copy = deepcopy(request)
139+
request_copy.url = self._client.format_url(request_copy.url)
140+
return self._client.send_request(request_copy, **kwargs)
111141

112142
def close(self):
113143
# type: () -> None

0 commit comments

Comments
 (0)