6
6
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
7
# --------------------------------------------------------------------------
8
8
9
- from typing import TYPE_CHECKING
9
+ from copy import deepcopy
10
+ from typing import Any , TYPE_CHECKING
10
11
11
- from azure .mgmt .core import ARMPipelineClient
12
12
from msrest import Deserializer , Serializer
13
13
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
20
16
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
17
from . import models
18
+ from ._configuration import CostManagementClientConfiguration
19
+ from .operations import AlertsOperations , DimensionsOperations , ExportsOperations , ForecastOperations , GenerateDetailedCostReportOperationResultsOperations , GenerateDetailedCostReportOperationStatusOperations , GenerateDetailedCostReportOperations , GenerateReservationDetailsReportOperations , Operations , QueryOperations , ViewsOperations
32
20
21
+ if TYPE_CHECKING :
22
+ # pylint: disable=unused-import,ungrouped-imports
23
+ from azure .core .credentials import TokenCredential
33
24
34
- class CostManagementClient ( object ):
25
+ class CostManagementClient : # pylint: disable=too-many-instance-attributes
35
26
"""CostManagementClient.
36
27
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
39
41
:ivar views: ViewsOperations operations
40
42
:vartype views: azure.mgmt.costmanagement.operations.ViewsOperations
41
43
:ivar alerts: AlertsOperations operations
@@ -46,68 +48,96 @@ class CostManagementClient(object):
46
48
:vartype dimensions: azure.mgmt.costmanagement.operations.DimensionsOperations
47
49
:ivar query: QueryOperations operations
48
50
: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
51
55
:ivar operations: Operations operations
52
56
:vartype operations: azure.mgmt.costmanagement.operations.Operations
53
- :ivar exports: ExportsOperations operations
54
- :vartype exports: azure.mgmt.costmanagement.operations.ExportsOperations
55
57
:param credential: Credential needed for the client to connect to Azure.
56
58
: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.
59
66
"""
60
67
61
68
def __init__ (
62
69
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 )
71
75
self ._client = ARMPipelineClient (base_url = base_url , config = self ._config , ** kwargs )
72
76
73
77
client_models = {k : v for k , v in models .__dict__ .items () if isinstance (v , type )}
74
78
self ._serialize = Serializer (client_models )
75
- self ._serialize .client_side_validation = False
76
79
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
+ )
80
93
self .views = ViewsOperations (
81
- self ._client , self ._config , self ._serialize , self ._deserialize )
94
+ self ._client , self ._config , self ._serialize , self ._deserialize
95
+ )
82
96
self .alerts = AlertsOperations (
83
- self ._client , self ._config , self ._serialize , self ._deserialize )
97
+ self ._client , self ._config , self ._serialize , self ._deserialize
98
+ )
84
99
self .forecast = ForecastOperations (
85
- self ._client , self ._config , self ._serialize , self ._deserialize )
100
+ self ._client , self ._config , self ._serialize , self ._deserialize
101
+ )
86
102
self .dimensions = DimensionsOperations (
87
- self ._client , self ._config , self ._serialize , self ._deserialize )
103
+ self ._client , self ._config , self ._serialize , self ._deserialize
104
+ )
88
105
self .query = QueryOperations (
89
- self ._client , self ._config , self ._serialize , self ._deserialize )
106
+ self ._client , self ._config , self ._serialize , self ._deserialize
107
+ )
90
108
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
+ )
92
111
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
+
96
115
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 :
99
121
"""Runs the network request through the client's chained policies.
100
122
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.
104
134
: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
106
136
"""
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 )
111
141
112
142
def close (self ):
113
143
# type: () -> None
0 commit comments