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
1113from azure .mgmt .core import ARMPipelineClient
1214from msrest import Deserializer , Serializer
1315
16+ from . import models
17+ from ._configuration import BillingManagementClientConfiguration
18+ from .operations import AddressOperations , AgreementsOperations , AvailableBalancesOperations , BillingAccountsOperations , BillingPeriodsOperations , BillingPermissionsOperations , BillingProfilesOperations , BillingPropertyOperations , BillingRoleAssignmentsOperations , BillingRoleDefinitionsOperations , BillingSubscriptionsOperations , CustomersOperations , EnrollmentAccountsOperations , InstructionsOperations , InvoiceSectionsOperations , InvoicesOperations , Operations , PoliciesOperations , ProductsOperations , ReservationsOperations , TransactionsOperations
19+
1420if 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 BillingManagementClientConfiguration
22- from .operations import BillingAccountsOperations
23- from .operations import AddressOperations
24- from .operations import AvailableBalancesOperations
25- from .operations import InstructionsOperations
26- from .operations import BillingProfilesOperations
27- from .operations import CustomersOperations
28- from .operations import InvoiceSectionsOperations
29- from .operations import BillingPermissionsOperations
30- from .operations import BillingSubscriptionsOperations
31- from .operations import ProductsOperations
32- from .operations import InvoicesOperations
33- from .operations import TransactionsOperations
34- from .operations import PoliciesOperations
35- from .operations import BillingPropertyOperations
36- from .operations import Operations
37- from .operations import BillingRoleDefinitionsOperations
38- from .operations import BillingRoleAssignmentsOperations
39- from .operations import AgreementsOperations
40- from .operations import ReservationsOperations
41- from .operations import EnrollmentAccountsOperations
42- from .operations import BillingPeriodsOperations
43- from . import models
44-
4523
46- class BillingManagementClient ( object ) :
24+ class BillingManagementClient :
4725 """Billing client provides access to billing resources for Azure subscriptions.
4826
4927 :ivar billing_accounts: BillingAccountsOperations operations
@@ -77,9 +55,11 @@ class BillingManagementClient(object):
7755 :ivar operations: Operations operations
7856 :vartype operations: azure.mgmt.billing.operations.Operations
7957 :ivar billing_role_definitions: BillingRoleDefinitionsOperations operations
80- :vartype billing_role_definitions: azure.mgmt.billing.operations.BillingRoleDefinitionsOperations
58+ :vartype billing_role_definitions:
59+ azure.mgmt.billing.operations.BillingRoleDefinitionsOperations
8160 :ivar billing_role_assignments: BillingRoleAssignmentsOperations operations
82- :vartype billing_role_assignments: azure.mgmt.billing.operations.BillingRoleAssignmentsOperations
61+ :vartype billing_role_assignments:
62+ azure.mgmt.billing.operations.BillingRoleAssignmentsOperations
8363 :ivar agreements: AgreementsOperations operations
8464 :vartype agreements: azure.mgmt.billing.operations.AgreementsOperations
8565 :ivar reservations: ReservationsOperations operations
@@ -92,88 +72,74 @@ class BillingManagementClient(object):
9272 :type credential: ~azure.core.credentials.TokenCredential
9373 :param subscription_id: The ID that uniquely identifies an Azure subscription.
9474 :type subscription_id: str
95- :param str base_url: Service URL
96- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
75+ :param base_url: Service URL. Default value is 'https://management.azure.com'.
76+ :type base_url: str
77+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
78+ Retry-After header is present.
9779 """
9880
9981 def __init__ (
10082 self ,
101- credential , # type: "TokenCredential"
102- subscription_id , # type: str
103- base_url = None , # type: Optional[str]
104- ** kwargs # type: Any
105- ):
106- # type: (...) -> None
107- if not base_url :
108- base_url = 'https://management.azure.com'
109- self ._config = BillingManagementClientConfiguration (credential , subscription_id , ** kwargs )
83+ credential : "TokenCredential" ,
84+ subscription_id : str ,
85+ base_url : str = "https://management.azure.com" ,
86+ ** kwargs : Any
87+ ) -> None :
88+ self ._config = BillingManagementClientConfiguration (credential = credential , subscription_id = subscription_id , ** kwargs )
11089 self ._client = ARMPipelineClient (base_url = base_url , config = self ._config , ** kwargs )
11190
11291 client_models = {k : v for k , v in models .__dict__ .items () if isinstance (v , type )}
11392 self ._serialize = Serializer (client_models )
114- self ._serialize .client_side_validation = False
11593 self ._deserialize = Deserializer (client_models )
116-
117- self .billing_accounts = BillingAccountsOperations (
118- self ._client , self ._config , self ._serialize , self ._deserialize )
119- self .address = AddressOperations (
120- self ._client , self ._config , self ._serialize , self ._deserialize )
121- self .available_balances = AvailableBalancesOperations (
122- self ._client , self ._config , self ._serialize , self ._deserialize )
123- self .instructions = InstructionsOperations (
124- self ._client , self ._config , self ._serialize , self ._deserialize )
125- self .billing_profiles = BillingProfilesOperations (
126- self ._client , self ._config , self ._serialize , self ._deserialize )
127- self .customers = CustomersOperations (
128- self ._client , self ._config , self ._serialize , self ._deserialize )
129- self .invoice_sections = InvoiceSectionsOperations (
130- self ._client , self ._config , self ._serialize , self ._deserialize )
131- self .billing_permissions = BillingPermissionsOperations (
132- self ._client , self ._config , self ._serialize , self ._deserialize )
133- self .billing_subscriptions = BillingSubscriptionsOperations (
134- self ._client , self ._config , self ._serialize , self ._deserialize )
135- self .products = ProductsOperations (
136- self ._client , self ._config , self ._serialize , self ._deserialize )
137- self .invoices = InvoicesOperations (
138- self ._client , self ._config , self ._serialize , self ._deserialize )
139- self .transactions = TransactionsOperations (
140- self ._client , self ._config , self ._serialize , self ._deserialize )
141- self .policies = PoliciesOperations (
142- self ._client , self ._config , self ._serialize , self ._deserialize )
143- self .billing_property = BillingPropertyOperations (
144- self ._client , self ._config , self ._serialize , self ._deserialize )
145- self .operations = Operations (
146- self ._client , self ._config , self ._serialize , self ._deserialize )
147- self .billing_role_definitions = BillingRoleDefinitionsOperations (
148- self ._client , self ._config , self ._serialize , self ._deserialize )
149- self .billing_role_assignments = BillingRoleAssignmentsOperations (
150- self ._client , self ._config , self ._serialize , self ._deserialize )
151- self .agreements = AgreementsOperations (
152- self ._client , self ._config , self ._serialize , self ._deserialize )
153- self .reservations = ReservationsOperations (
154- self ._client , self ._config , self ._serialize , self ._deserialize )
155- self .enrollment_accounts = EnrollmentAccountsOperations (
156- self ._client , self ._config , self ._serialize , self ._deserialize )
157- self .billing_periods = BillingPeriodsOperations (
158- self ._client , self ._config , self ._serialize , self ._deserialize )
159-
160- def _send_request (self , http_request , ** kwargs ):
161- # type: (HttpRequest, Any) -> HttpResponse
94+ self ._serialize .client_side_validation = False
95+ self .billing_accounts = BillingAccountsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
96+ self .address = AddressOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
97+ self .available_balances = AvailableBalancesOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
98+ self .instructions = InstructionsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
99+ self .billing_profiles = BillingProfilesOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
100+ self .customers = CustomersOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
101+ self .invoice_sections = InvoiceSectionsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
102+ self .billing_permissions = BillingPermissionsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
103+ self .billing_subscriptions = BillingSubscriptionsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
104+ self .products = ProductsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
105+ self .invoices = InvoicesOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
106+ self .transactions = TransactionsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
107+ self .policies = PoliciesOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
108+ self .billing_property = BillingPropertyOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
109+ self .operations = Operations (self ._client , self ._config , self ._serialize , self ._deserialize )
110+ self .billing_role_definitions = BillingRoleDefinitionsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
111+ self .billing_role_assignments = BillingRoleAssignmentsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
112+ self .agreements = AgreementsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
113+ self .reservations = ReservationsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
114+ self .enrollment_accounts = EnrollmentAccountsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
115+ self .billing_periods = BillingPeriodsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
116+
117+
118+ def _send_request (
119+ self ,
120+ request , # type: HttpRequest
121+ ** kwargs : Any
122+ ) -> HttpResponse :
162123 """Runs the network request through the client's chained policies.
163124
164- :param http_request: The network request you want to make. Required.
165- :type http_request: ~azure.core.pipeline.transport.HttpRequest
166- :keyword bool stream: Whether the response payload will be streamed. Defaults to True.
125+ >>> from azure.core.rest import HttpRequest
126+ >>> request = HttpRequest("GET", "https://www.example.org/")
127+ <HttpRequest [GET], url: 'https://www.example.org/'>
128+ >>> response = client._send_request(request)
129+ <HttpResponse: 200 OK>
130+
131+ For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart
132+
133+ :param request: The network request you want to make. Required.
134+ :type request: ~azure.core.rest.HttpRequest
135+ :keyword bool stream: Whether the response payload will be streamed. Defaults to False.
167136 :return: The response of your network call. Does not do error handling on your response.
168- :rtype: ~azure.core.pipeline.transport .HttpResponse
137+ :rtype: ~azure.core.rest .HttpResponse
169138 """
170- path_format_arguments = {
171- 'subscriptionId' : self ._serialize .url ("self._config.subscription_id" , self ._config .subscription_id , 'str' ),
172- }
173- http_request .url = self ._client .format_url (http_request .url , ** path_format_arguments )
174- stream = kwargs .pop ("stream" , True )
175- pipeline_response = self ._client ._pipeline .run (http_request , stream = stream , ** kwargs )
176- return pipeline_response .http_response
139+
140+ request_copy = deepcopy (request )
141+ request_copy .url = self ._client .format_url (request_copy .url )
142+ return self ._client .send_request (request_copy , ** kwargs )
177143
178144 def close (self ):
179145 # type: () -> None
0 commit comments