7
7
# --------------------------------------------------------------------------
8
8
9
9
from copy import deepcopy
10
- from typing import Any , TYPE_CHECKING
10
+ from typing import Any , Optional , TYPE_CHECKING , cast
11
11
from typing_extensions import Self
12
12
13
13
from azure .core .pipeline import policies
14
14
from azure .core .rest import HttpRequest , HttpResponse
15
+ from azure .core .settings import settings
15
16
from azure .mgmt .core import ARMPipelineClient
16
17
from azure .mgmt .core .policies import ARMAutoResourceProviderRegistrationPolicy
18
+ from azure .mgmt .core .tools import get_arm_endpoints
17
19
18
20
from . import models as _models
19
21
from ._configuration import NginxManagementClientConfiguration
20
- from ._serialization import Deserializer , Serializer
22
+ from ._utils . serialization import Deserializer , Serializer
21
23
from .operations import (
22
24
ApiKeysOperations ,
23
25
CertificatesOperations ,
@@ -47,7 +49,7 @@ class NginxManagementClient:
47
49
:type credential: ~azure.core.credentials.TokenCredential
48
50
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
49
51
: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 .
51
53
:type base_url: str
52
54
:keyword api_version: Api Version. Default value is "2024-11-01-preview". Note that overriding
53
55
this default value may result in unsupported behavior.
@@ -57,15 +59,17 @@ class NginxManagementClient:
57
59
"""
58
60
59
61
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
65
63
) -> 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" ])
66
69
self ._config = NginxManagementClientConfiguration (
67
- credential = credential , subscription_id = subscription_id , ** kwargs
70
+ credential = credential , subscription_id = subscription_id , credential_scopes = credential_scopes , ** kwargs
68
71
)
72
+
69
73
_policies = kwargs .pop ("policies" , None )
70
74
if _policies is None :
71
75
_policies = [
@@ -84,7 +88,7 @@ def __init__(
84
88
policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
85
89
self ._config .http_logging_policy ,
86
90
]
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 )
88
92
89
93
client_models = {k : v for k , v in _models .__dict__ .items () if isinstance (v , type )}
90
94
self ._serialize = Serializer (client_models )
0 commit comments