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 QumuloMgmtClientConfiguration
20
22
from ._serialization import Deserializer , Serializer
21
23
from .operations import FileSystemsOperations , Operations
22
24
23
25
if TYPE_CHECKING :
24
- # pylint: disable=unused-import,ungrouped-imports
25
26
from azure .core .credentials import TokenCredential
26
27
27
28
28
- class QumuloMgmtClient : # pylint: disable=client-accepts-api-version-keyword
29
+ class QumuloMgmtClient :
29
30
"""QumuloMgmtClient.
30
31
31
32
:ivar operations: Operations operations
@@ -36,7 +37,7 @@ class QumuloMgmtClient: # pylint: disable=client-accepts-api-version-keyword
36
37
:type credential: ~azure.core.credentials.TokenCredential
37
38
:param subscription_id: The ID of the target subscription. Required.
38
39
:type subscription_id: str
39
- :param base_url: Service URL. Default value is "https://management.azure.com" .
40
+ :param base_url: Service URL. Default value is None .
40
41
:type base_url: str
41
42
:keyword api_version: Api Version. Default value is "2024-06-19". Note that overriding this
42
43
default value may result in unsupported behavior.
@@ -46,13 +47,17 @@ class QumuloMgmtClient: # pylint: disable=client-accepts-api-version-keyword
46
47
"""
47
48
48
49
def __init__ (
49
- self ,
50
- credential : "TokenCredential" ,
51
- subscription_id : str ,
52
- base_url : str = "https://management.azure.com" ,
53
- ** kwargs : Any
50
+ self , credential : "TokenCredential" , subscription_id : str , base_url : Optional [str ] = None , ** kwargs : Any
54
51
) -> None :
55
- self ._config = QumuloMgmtClientConfiguration (credential = credential , subscription_id = subscription_id , ** kwargs )
52
+ _cloud = kwargs .pop ("cloud_setting" , None ) or settings .current .azure_cloud # type: ignore
53
+ _endpoints = get_arm_endpoints (_cloud )
54
+ if not base_url :
55
+ base_url = _endpoints ["resource_manager" ]
56
+ credential_scopes = kwargs .pop ("credential_scopes" , _endpoints ["credential_scopes" ])
57
+ self ._config = QumuloMgmtClientConfiguration (
58
+ credential = credential , subscription_id = subscription_id , credential_scopes = credential_scopes , ** kwargs
59
+ )
60
+
56
61
_policies = kwargs .pop ("policies" , None )
57
62
if _policies is None :
58
63
_policies = [
@@ -71,7 +76,7 @@ def __init__(
71
76
policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
72
77
self ._config .http_logging_policy ,
73
78
]
74
- self ._client : ARMPipelineClient = ARMPipelineClient (base_url = base_url , policies = _policies , ** kwargs )
79
+ self ._client : ARMPipelineClient = ARMPipelineClient (base_url = cast ( str , base_url ) , policies = _policies , ** kwargs )
75
80
76
81
client_models = {k : v for k , v in _models .__dict__ .items () if isinstance (v , type )}
77
82
self ._serialize = Serializer (client_models )
0 commit comments