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 NginxManagementClientConfiguration
20- from ._serialization import Deserializer , Serializer
22+ from ._utils . serialization import Deserializer , Serializer
2123from .operations import (
2224 ApiKeysOperations ,
2325 CertificatesOperations ,
@@ -47,7 +49,7 @@ class NginxManagementClient:
4749 :type credential: ~azure.core.credentials.TokenCredential
4850 :param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
4951 :type subscription_id: str
50- :param base_url: Service URL. Default value is "https://management.azure.com" .
52+ :param base_url: Service URL. Default value is None .
5153 :type base_url: str
5254 :keyword api_version: Api Version. Default value is "2024-11-01-preview". Note that overriding
5355 this default value may result in unsupported behavior.
@@ -57,15 +59,17 @@ class NginxManagementClient:
5759 """
5860
5961 def __init__ (
60- self ,
61- credential : "TokenCredential" ,
62- subscription_id : str ,
63- base_url : str = "https://management.azure.com" ,
64- ** kwargs : Any
62+ self , credential : "TokenCredential" , subscription_id : str , base_url : Optional [str ] = None , ** kwargs : Any
6563 ) -> None :
64+ _cloud = kwargs .pop ("cloud_setting" , None ) or settings .current .azure_cloud # type: ignore
65+ _endpoints = get_arm_endpoints (_cloud )
66+ if not base_url :
67+ base_url = _endpoints ["resource_manager" ]
68+ credential_scopes = kwargs .pop ("credential_scopes" , _endpoints ["credential_scopes" ])
6669 self ._config = NginxManagementClientConfiguration (
67- credential = credential , subscription_id = subscription_id , ** kwargs
70+ credential = credential , subscription_id = subscription_id , credential_scopes = credential_scopes , ** kwargs
6871 )
72+
6973 _policies = kwargs .pop ("policies" , None )
7074 if _policies is None :
7175 _policies = [
@@ -84,7 +88,7 @@ def __init__(
8488 policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
8589 self ._config .http_logging_policy ,
8690 ]
87- self ._client : ARMPipelineClient = ARMPipelineClient (base_url = base_url , policies = _policies , ** kwargs )
91+ self ._client : ARMPipelineClient = ARMPipelineClient (base_url = cast ( str , base_url ) , policies = _policies , ** kwargs )
8892
8993 client_models = {k : v for k , v in _models .__dict__ .items () if isinstance (v , type )}
9094 self ._serialize = Serializer (client_models )
0 commit comments