88
99from copy import deepcopy
1010from typing import Any , TYPE_CHECKING
11+ from typing_extensions import Self
1112
13+ from azure .core .pipeline import policies
1214from azure .core .rest import HttpRequest , HttpResponse
1315from azure .mgmt .core import ARMPipelineClient
16+ from azure .mgmt .core .policies import ARMAutoResourceProviderRegistrationPolicy
1417
1518from . import models as _models
1619from ._configuration import CostManagementClientConfiguration
1922 AlertsOperations ,
2023 BenefitRecommendationsOperations ,
2124 BenefitUtilizationSummariesOperations ,
25+ BudgetsOperations ,
26+ CostAllocationRulesOperations ,
2227 DimensionsOperations ,
2328 ExportsOperations ,
2429 ForecastOperations ,
30+ GenerateBenefitUtilizationSummariesReportOperations ,
2531 GenerateCostDetailsReportOperations ,
2632 GenerateDetailedCostReportOperationResultsOperations ,
2733 GenerateDetailedCostReportOperationStatusOperations ,
3137 PriceSheetOperations ,
3238 QueryOperations ,
3339 ScheduledActionsOperations ,
40+ SettingsOperations ,
3441 ViewsOperations ,
3542)
3643
3744if TYPE_CHECKING :
38- # pylint: disable=unused-import,ungrouped-imports
3945 from azure .core .credentials import TokenCredential
4046
4147
42- class CostManagementClient : # pylint: disable=client-accepts-api-version-keyword, too-many-instance-attributes
48+ class CostManagementClient : # pylint: disable=too-many-instance-attributes
4349 """CostManagement management client provides access to CostManagement resources for Azure
4450 Enterprise Subscriptions.
4551
4652 :ivar operations: Operations operations
4753 :vartype operations: azure.mgmt.costmanagement.operations.Operations
48- :ivar views: ViewsOperations operations
49- :vartype views: azure.mgmt.costmanagement.operations.ViewsOperations
50- :ivar alerts: AlertsOperations operations
51- :vartype alerts: azure.mgmt.costmanagement.operations.AlertsOperations
52- :ivar forecast: ForecastOperations operations
53- :vartype forecast: azure.mgmt.costmanagement.operations.ForecastOperations
54- :ivar dimensions: DimensionsOperations operations
55- :vartype dimensions: azure.mgmt.costmanagement.operations.DimensionsOperations
56- :ivar query: QueryOperations operations
57- :vartype query: azure.mgmt.costmanagement.operations.QueryOperations
58- :ivar generate_reservation_details_report: GenerateReservationDetailsReportOperations
59- operations
60- :vartype generate_reservation_details_report:
61- azure.mgmt.costmanagement.operations.GenerateReservationDetailsReportOperations
54+ :ivar cost_allocation_rules: CostAllocationRulesOperations operations
55+ :vartype cost_allocation_rules:
56+ azure.mgmt.costmanagement.operations.CostAllocationRulesOperations
57+ :ivar benefit_recommendations: BenefitRecommendationsOperations operations
58+ :vartype benefit_recommendations:
59+ azure.mgmt.costmanagement.operations.BenefitRecommendationsOperations
60+ :ivar benefit_utilization_summaries: BenefitUtilizationSummariesOperations operations
61+ :vartype benefit_utilization_summaries:
62+ azure.mgmt.costmanagement.operations.BenefitUtilizationSummariesOperations
63+ :ivar generate_benefit_utilization_summaries_report:
64+ GenerateBenefitUtilizationSummariesReportOperations operations
65+ :vartype generate_benefit_utilization_summaries_report:
66+ azure.mgmt.costmanagement.operations.GenerateBenefitUtilizationSummariesReportOperations
67+ :ivar budgets: BudgetsOperations operations
68+ :vartype budgets: azure.mgmt.costmanagement.operations.BudgetsOperations
6269 :ivar exports: ExportsOperations operations
6370 :vartype exports: azure.mgmt.costmanagement.operations.ExportsOperations
6471 :ivar generate_cost_details_report: GenerateCostDetailsReportOperations operations
@@ -75,22 +82,32 @@ class CostManagementClient: # pylint: disable=client-accepts-api-version-keywor
7582 GenerateDetailedCostReportOperationStatusOperations operations
7683 :vartype generate_detailed_cost_report_operation_status:
7784 azure.mgmt.costmanagement.operations.GenerateDetailedCostReportOperationStatusOperations
85+ :ivar views: ViewsOperations operations
86+ :vartype views: azure.mgmt.costmanagement.operations.ViewsOperations
87+ :ivar alerts: AlertsOperations operations
88+ :vartype alerts: azure.mgmt.costmanagement.operations.AlertsOperations
89+ :ivar forecast: ForecastOperations operations
90+ :vartype forecast: azure.mgmt.costmanagement.operations.ForecastOperations
91+ :ivar dimensions: DimensionsOperations operations
92+ :vartype dimensions: azure.mgmt.costmanagement.operations.DimensionsOperations
93+ :ivar query: QueryOperations operations
94+ :vartype query: azure.mgmt.costmanagement.operations.QueryOperations
95+ :ivar generate_reservation_details_report: GenerateReservationDetailsReportOperations
96+ operations
97+ :vartype generate_reservation_details_report:
98+ azure.mgmt.costmanagement.operations.GenerateReservationDetailsReportOperations
7899 :ivar price_sheet: PriceSheetOperations operations
79100 :vartype price_sheet: azure.mgmt.costmanagement.operations.PriceSheetOperations
80101 :ivar scheduled_actions: ScheduledActionsOperations operations
81102 :vartype scheduled_actions: azure.mgmt.costmanagement.operations.ScheduledActionsOperations
82- :ivar benefit_recommendations: BenefitRecommendationsOperations operations
83- :vartype benefit_recommendations:
84- azure.mgmt.costmanagement.operations.BenefitRecommendationsOperations
85- :ivar benefit_utilization_summaries: BenefitUtilizationSummariesOperations operations
86- :vartype benefit_utilization_summaries:
87- azure.mgmt.costmanagement.operations.BenefitUtilizationSummariesOperations
103+ :ivar settings: SettingsOperations operations
104+ :vartype settings: azure.mgmt.costmanagement.operations.SettingsOperations
88105 :param credential: Credential needed for the client to connect to Azure. Required.
89106 :type credential: ~azure.core.credentials.TokenCredential
90107 :param base_url: Service URL. Default value is "https://management.azure.com".
91108 :type base_url: str
92- :keyword api_version: Api Version. Default value is "2022 -10-01". Note that overriding this
93- default value may result in unsupported behavior.
109+ :keyword api_version: Api Version. Default value is "2024 -10-01-preview ". Note that overriding
110+ this default value may result in unsupported behavior.
94111 :paramtype api_version: str
95112 :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
96113 Retry-After header is present.
@@ -100,21 +117,44 @@ def __init__(
100117 self , credential : "TokenCredential" , base_url : str = "https://management.azure.com" , ** kwargs : Any
101118 ) -> None :
102119 self ._config = CostManagementClientConfiguration (credential = credential , ** kwargs )
103- self ._client : ARMPipelineClient = ARMPipelineClient (base_url = base_url , config = self ._config , ** kwargs )
120+ _policies = kwargs .pop ("policies" , None )
121+ if _policies is None :
122+ _policies = [
123+ policies .RequestIdPolicy (** kwargs ),
124+ self ._config .headers_policy ,
125+ self ._config .user_agent_policy ,
126+ self ._config .proxy_policy ,
127+ policies .ContentDecodePolicy (** kwargs ),
128+ ARMAutoResourceProviderRegistrationPolicy (),
129+ self ._config .redirect_policy ,
130+ self ._config .retry_policy ,
131+ self ._config .authentication_policy ,
132+ self ._config .custom_hook_policy ,
133+ self ._config .logging_policy ,
134+ policies .DistributedTracingPolicy (** kwargs ),
135+ policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
136+ self ._config .http_logging_policy ,
137+ ]
138+ self ._client : ARMPipelineClient = ARMPipelineClient (base_url = base_url , policies = _policies , ** kwargs )
104139
105140 client_models = {k : v for k , v in _models .__dict__ .items () if isinstance (v , type )}
106141 self ._serialize = Serializer (client_models )
107142 self ._deserialize = Deserializer (client_models )
108143 self ._serialize .client_side_validation = False
109144 self .operations = Operations (self ._client , self ._config , self ._serialize , self ._deserialize )
110- self .views = ViewsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
111- self .alerts = AlertsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
112- self .forecast = ForecastOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
113- self .dimensions = DimensionsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
114- self .query = QueryOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
115- self .generate_reservation_details_report = GenerateReservationDetailsReportOperations (
145+ self .cost_allocation_rules = CostAllocationRulesOperations (
146+ self ._client , self ._config , self ._serialize , self ._deserialize
147+ )
148+ self .benefit_recommendations = BenefitRecommendationsOperations (
149+ self ._client , self ._config , self ._serialize , self ._deserialize
150+ )
151+ self .benefit_utilization_summaries = BenefitUtilizationSummariesOperations (
152+ self ._client , self ._config , self ._serialize , self ._deserialize
153+ )
154+ self .generate_benefit_utilization_summaries_report = GenerateBenefitUtilizationSummariesReportOperations (
116155 self ._client , self ._config , self ._serialize , self ._deserialize
117156 )
157+ self .budgets = BudgetsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
118158 self .exports = ExportsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
119159 self .generate_cost_details_report = GenerateCostDetailsReportOperations (
120160 self ._client , self ._config , self ._serialize , self ._deserialize
@@ -128,18 +168,21 @@ def __init__(
128168 self .generate_detailed_cost_report_operation_status = GenerateDetailedCostReportOperationStatusOperations (
129169 self ._client , self ._config , self ._serialize , self ._deserialize
130170 )
131- self .price_sheet = PriceSheetOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
132- self .scheduled_actions = ScheduledActionsOperations (
133- self ._client , self ._config , self ._serialize , self ._deserialize
134- )
135- self .benefit_recommendations = BenefitRecommendationsOperations (
171+ self .views = ViewsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
172+ self .alerts = AlertsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
173+ self .forecast = ForecastOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
174+ self .dimensions = DimensionsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
175+ self .query = QueryOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
176+ self .generate_reservation_details_report = GenerateReservationDetailsReportOperations (
136177 self ._client , self ._config , self ._serialize , self ._deserialize
137178 )
138- self .benefit_utilization_summaries = BenefitUtilizationSummariesOperations (
179+ self .price_sheet = PriceSheetOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
180+ self .scheduled_actions = ScheduledActionsOperations (
139181 self ._client , self ._config , self ._serialize , self ._deserialize
140182 )
183+ self .settings = SettingsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
141184
142- def _send_request (self , request : HttpRequest , ** kwargs : Any ) -> HttpResponse :
185+ def _send_request (self , request : HttpRequest , * , stream : bool = False , * *kwargs : Any ) -> HttpResponse :
143186 """Runs the network request through the client's chained policies.
144187
145188 >>> from azure.core.rest import HttpRequest
@@ -159,12 +202,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
159202
160203 request_copy = deepcopy (request )
161204 request_copy .url = self ._client .format_url (request_copy .url )
162- return self ._client .send_request (request_copy , ** kwargs )
205+ return self ._client .send_request (request_copy , stream = stream , ** kwargs ) # type: ignore
163206
164207 def close (self ) -> None :
165208 self ._client .close ()
166209
167- def __enter__ (self ) -> "CostManagementClient" :
210+ def __enter__ (self ) -> Self :
168211 self ._client .__enter__ ()
169212 return self
170213
0 commit comments