77# --------------------------------------------------------------------------
88
99from copy import deepcopy
10- from typing import Any , TYPE_CHECKING
10+ from typing import Any , Optional , TYPE_CHECKING , cast
1111from typing_extensions import Self
1212
1313from azure .core .pipeline import policies
1414from azure .core .rest import HttpRequest , HttpResponse
15+ from azure .core .settings import settings
1516from azure .mgmt .core import ARMPipelineClient
1617from azure .mgmt .core .policies import ARMAutoResourceProviderRegistrationPolicy
18+ from azure .mgmt .core .tools import get_arm_endpoints
1719
1820from . import models as _models
1921from ._configuration import BillingManagementClientConfiguration
5254)
5355
5456if TYPE_CHECKING :
55- # pylint: disable=unused-import,ungrouped-imports
5657 from azure .core .credentials import TokenCredential
5758
5859
59- class BillingManagementClient : # pylint: disable=client-accepts-api-version-keyword, too-many-instance-attributes
60+ class BillingManagementClient : # pylint: disable=too-many-instance-attributes
6061 """Billing Client.
6162
6263 :ivar agreements: AgreementsOperations operations
@@ -125,7 +126,7 @@ class BillingManagementClient: # pylint: disable=client-accepts-api-version-key
125126 :type credential: ~azure.core.credentials.TokenCredential
126127 :param subscription_id: The ID that uniquely identifies a billing subscription. Required.
127128 :type subscription_id: str
128- :param base_url: Service URL. Default value is "https://management.azure.com" .
129+ :param base_url: Service URL. Default value is None .
129130 :type base_url: str
130131 :keyword api_version: Api Version. Default value is "2024-04-01". Note that overriding this
131132 default value may result in unsupported behavior.
@@ -135,15 +136,17 @@ class BillingManagementClient: # pylint: disable=client-accepts-api-version-key
135136 """
136137
137138 def __init__ (
138- self ,
139- credential : "TokenCredential" ,
140- subscription_id : str ,
141- base_url : str = "https://management.azure.com" ,
142- ** kwargs : Any
139+ self , credential : "TokenCredential" , subscription_id : str , base_url : Optional [str ] = None , ** kwargs : Any
143140 ) -> None :
141+ _cloud = kwargs .pop ("cloud_setting" , None ) or settings .current .azure_cloud # type: ignore
142+ _endpoints = get_arm_endpoints (_cloud )
143+ if not base_url :
144+ base_url = _endpoints ["resource_manager" ]
145+ credential_scopes = kwargs .pop ("credential_scopes" , _endpoints ["credential_scopes" ])
144146 self ._config = BillingManagementClientConfiguration (
145- credential = credential , subscription_id = subscription_id , ** kwargs
147+ credential = credential , subscription_id = subscription_id , credential_scopes = credential_scopes , ** kwargs
146148 )
149+
147150 _policies = kwargs .pop ("policies" , None )
148151 if _policies is None :
149152 _policies = [
@@ -162,7 +165,7 @@ def __init__(
162165 policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
163166 self ._config .http_logging_policy ,
164167 ]
165- self ._client : ARMPipelineClient = ARMPipelineClient (base_url = base_url , policies = _policies , ** kwargs )
168+ self ._client : ARMPipelineClient = ARMPipelineClient (base_url = cast ( str , base_url ) , policies = _policies , ** kwargs )
166169
167170 client_models = {k : v for k , v in _models .__dict__ .items () if isinstance (v , type )}
168171 self ._serialize = Serializer (client_models )
0 commit comments