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 ElasticSanMgmtClientConfiguration
@@ -59,7 +61,7 @@ class ElasticSanMgmtClient(ElasticSanMgmtClientOperationsMixin): # pylint: disa
5961 :type credential: ~azure.core.credentials.TokenCredential
6062 :param subscription_id: The ID of the target subscription. Required.
6163 :type subscription_id: str
62- :param base_url: Service URL. Default value is "https://management.azure.com" .
64+ :param base_url: Service URL. Default value is None .
6365 :type base_url: str
6466 :keyword api_version: Api Version. Default value is "2024-07-01-preview". Note that overriding
6567 this default value may result in unsupported behavior.
@@ -69,15 +71,17 @@ class ElasticSanMgmtClient(ElasticSanMgmtClientOperationsMixin): # pylint: disa
6971 """
7072
7173 def __init__ (
72- self ,
73- credential : "TokenCredential" ,
74- subscription_id : str ,
75- base_url : str = "https://management.azure.com" ,
76- ** kwargs : Any
74+ self , credential : "TokenCredential" , subscription_id : str , base_url : Optional [str ] = None , ** kwargs : Any
7775 ) -> None :
76+ _cloud = kwargs .pop ("cloud_setting" , None ) or settings .current .azure_cloud # type: ignore
77+ _endpoints = get_arm_endpoints (_cloud )
78+ if not base_url :
79+ base_url = _endpoints ["resource_manager" ]
80+ credential_scopes = kwargs .pop ("credential_scopes" , _endpoints ["credential_scopes" ])
7881 self ._config = ElasticSanMgmtClientConfiguration (
79- credential = credential , subscription_id = subscription_id , ** kwargs
82+ credential = credential , subscription_id = subscription_id , credential_scopes = credential_scopes , ** kwargs
8083 )
84+
8185 _policies = kwargs .pop ("policies" , None )
8286 if _policies is None :
8387 _policies = [
@@ -96,7 +100,7 @@ def __init__(
96100 policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
97101 self ._config .http_logging_policy ,
98102 ]
99- self ._client : ARMPipelineClient = ARMPipelineClient (base_url = base_url , policies = _policies , ** kwargs )
103+ self ._client : ARMPipelineClient = ARMPipelineClient (base_url = cast ( str , base_url ) , policies = _policies , ** kwargs )
100104
101105 client_models = {k : v for k , v in _models .__dict__ .items () if isinstance (v , type )}
102106 self ._serialize = Serializer (client_models )
0 commit comments