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 ElasticSanMgmtClientConfiguration
@@ -39,27 +41,27 @@ class ElasticSanMgmtClient(ElasticSanMgmtClientOperationsMixin): # pylint: disa
39
41
40
42
:ivar operations: Operations operations
41
43
:vartype operations: azure.mgmt.elasticsan.operations.Operations
42
- :ivar skus: SkusOperations operations
43
- :vartype skus: azure.mgmt.elasticsan.operations.SkusOperations
44
44
:ivar elastic_sans: ElasticSansOperations operations
45
45
:vartype elastic_sans: azure.mgmt.elasticsan.operations.ElasticSansOperations
46
- :ivar volume_groups: VolumeGroupsOperations operations
47
- :vartype volume_groups: azure.mgmt.elasticsan.operations.VolumeGroupsOperations
48
- :ivar volumes: VolumesOperations operations
49
- :vartype volumes: azure.mgmt.elasticsan.operations.VolumesOperations
46
+ :ivar skus: SkusOperations operations
47
+ :vartype skus: azure.mgmt.elasticsan.operations.SkusOperations
50
48
:ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations
51
49
:vartype private_endpoint_connections:
52
50
azure.mgmt.elasticsan.operations.PrivateEndpointConnectionsOperations
53
51
:ivar private_link_resources: PrivateLinkResourcesOperations operations
54
52
:vartype private_link_resources:
55
53
azure.mgmt.elasticsan.operations.PrivateLinkResourcesOperations
54
+ :ivar volume_groups: VolumeGroupsOperations operations
55
+ :vartype volume_groups: azure.mgmt.elasticsan.operations.VolumeGroupsOperations
56
+ :ivar volumes: VolumesOperations operations
57
+ :vartype volumes: azure.mgmt.elasticsan.operations.VolumesOperations
56
58
:ivar volume_snapshots: VolumeSnapshotsOperations operations
57
59
:vartype volume_snapshots: azure.mgmt.elasticsan.operations.VolumeSnapshotsOperations
58
60
:param credential: Credential needed for the client to connect to Azure. Required.
59
61
:type credential: ~azure.core.credentials.TokenCredential
60
62
:param subscription_id: The ID of the target subscription. Required.
61
63
: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 .
63
65
:type base_url: str
64
66
:keyword api_version: Api Version. Default value is "2024-07-01-preview". Note that overriding
65
67
this default value may result in unsupported behavior.
@@ -69,15 +71,17 @@ class ElasticSanMgmtClient(ElasticSanMgmtClientOperationsMixin): # pylint: disa
69
71
"""
70
72
71
73
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
77
75
) -> 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" ])
78
81
self ._config = ElasticSanMgmtClientConfiguration (
79
- credential = credential , subscription_id = subscription_id , ** kwargs
82
+ credential = credential , subscription_id = subscription_id , credential_scopes = credential_scopes , ** kwargs
80
83
)
84
+
81
85
_policies = kwargs .pop ("policies" , None )
82
86
if _policies is None :
83
87
_policies = [
@@ -96,23 +100,23 @@ def __init__(
96
100
policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
97
101
self ._config .http_logging_policy ,
98
102
]
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 )
100
104
101
105
client_models = {k : v for k , v in _models .__dict__ .items () if isinstance (v , type )}
102
106
self ._serialize = Serializer (client_models )
103
107
self ._deserialize = Deserializer (client_models )
104
108
self ._serialize .client_side_validation = False
105
109
self .operations = Operations (self ._client , self ._config , self ._serialize , self ._deserialize )
106
- self .skus = SkusOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
107
110
self .elastic_sans = ElasticSansOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
108
- self .volume_groups = VolumeGroupsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
109
- self .volumes = VolumesOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
111
+ self .skus = SkusOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
110
112
self .private_endpoint_connections = PrivateEndpointConnectionsOperations (
111
113
self ._client , self ._config , self ._serialize , self ._deserialize
112
114
)
113
115
self .private_link_resources = PrivateLinkResourcesOperations (
114
116
self ._client , self ._config , self ._serialize , self ._deserialize
115
117
)
118
+ self .volume_groups = VolumeGroupsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
119
+ self .volumes = VolumesOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
116
120
self .volume_snapshots = VolumeSnapshotsOperations (
117
121
self ._client , self ._config , self ._serialize , self ._deserialize
118
122
)
0 commit comments