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 ContainerAppsAPIClientConfiguration
20- from ._serialization import Deserializer , Serializer
22+ from ._utils . serialization import Deserializer , Serializer
2123from .operations import (
2224 AvailableWorkloadProfilesOperations ,
2325 BillingMetersOperations ,
@@ -133,7 +135,7 @@ class ContainerAppsAPIClient(ContainerAppsAPIClientOperationsMixin): # pylint:
133135 :type credential: ~azure.core.credentials.TokenCredential
134136 :param subscription_id: The ID of the target subscription. Required.
135137 :type subscription_id: str
136- :param base_url: Service URL. Default value is "https://management.azure.com" .
138+ :param base_url: Service URL. Default value is None .
137139 :type base_url: str
138140 :keyword api_version: Api Version. Default value is "2025-01-01". Note that overriding this
139141 default value may result in unsupported behavior.
@@ -143,15 +145,17 @@ class ContainerAppsAPIClient(ContainerAppsAPIClientOperationsMixin): # pylint:
143145 """
144146
145147 def __init__ (
146- self ,
147- credential : "TokenCredential" ,
148- subscription_id : str ,
149- base_url : str = "https://management.azure.com" ,
150- ** kwargs : Any
148+ self , credential : "TokenCredential" , subscription_id : str , base_url : Optional [str ] = None , ** kwargs : Any
151149 ) -> None :
150+ _cloud = kwargs .pop ("cloud_setting" , None ) or settings .current .azure_cloud # type: ignore
151+ _endpoints = get_arm_endpoints (_cloud )
152+ if not base_url :
153+ base_url = _endpoints ["resource_manager" ]
154+ credential_scopes = kwargs .pop ("credential_scopes" , _endpoints ["credential_scopes" ])
152155 self ._config = ContainerAppsAPIClientConfiguration (
153- credential = credential , subscription_id = subscription_id , ** kwargs
156+ credential = credential , subscription_id = subscription_id , credential_scopes = credential_scopes , ** kwargs
154157 )
158+
155159 _policies = kwargs .pop ("policies" , None )
156160 if _policies is None :
157161 _policies = [
@@ -170,7 +174,7 @@ def __init__(
170174 policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
171175 self ._config .http_logging_policy ,
172176 ]
173- self ._client : ARMPipelineClient = ARMPipelineClient (base_url = base_url , policies = _policies , ** kwargs )
177+ self ._client : ARMPipelineClient = ARMPipelineClient (base_url = cast ( str , base_url ) , policies = _policies , ** kwargs )
174178
175179 client_models = {k : v for k , v in _models .__dict__ .items () if isinstance (v , type )}
176180 self ._serialize = Serializer (client_models )
0 commit comments