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 AVSClientConfiguration
20
- from ._serialization import Deserializer , Serializer
22
+ from ._utils . serialization import Deserializer , Serializer
21
23
from .operations import (
22
24
AddonsOperations ,
23
25
AuthorizationsOperations ,
26
28
DatastoresOperations ,
27
29
GlobalReachConnectionsOperations ,
28
30
HcxEnterpriseSitesOperations ,
31
+ HostsOperations ,
29
32
IscsiPathsOperations ,
30
33
LocationsOperations ,
31
34
Operations ,
32
35
PlacementPoliciesOperations ,
33
36
PrivateCloudsOperations ,
37
+ ProvisionedNetworksOperations ,
38
+ PureStoragePoliciesOperations ,
34
39
ScriptCmdletsOperations ,
35
40
ScriptExecutionsOperations ,
36
41
ScriptPackagesOperations ,
42
+ SkusOperations ,
37
43
VirtualMachinesOperations ,
38
44
WorkloadNetworksOperations ,
39
45
)
40
46
41
47
if TYPE_CHECKING :
42
- # pylint: disable=unused-import,ungrouped-imports
43
48
from azure .core .credentials import TokenCredential
44
49
45
50
46
- class AVSClient : # pylint: disable=client-accepts-api-version-keyword, too-many-instance-attributes
51
+ class AVSClient : # pylint: disable=too-many-instance-attributes
47
52
"""Azure VMware Solution API.
48
53
49
54
:ivar operations: Operations operations
@@ -52,6 +57,8 @@ class AVSClient: # pylint: disable=client-accepts-api-version-keyword,too-many-
52
57
:vartype locations: azure.mgmt.avs.operations.LocationsOperations
53
58
:ivar private_clouds: PrivateCloudsOperations operations
54
59
:vartype private_clouds: azure.mgmt.avs.operations.PrivateCloudsOperations
60
+ :ivar skus: SkusOperations operations
61
+ :vartype skus: azure.mgmt.avs.operations.SkusOperations
55
62
:ivar addons: AddonsOperations operations
56
63
:vartype addons: azure.mgmt.avs.operations.AddonsOperations
57
64
:ivar authorizations: AuthorizationsOperations operations
@@ -62,6 +69,8 @@ class AVSClient: # pylint: disable=client-accepts-api-version-keyword,too-many-
62
69
:vartype clusters: azure.mgmt.avs.operations.ClustersOperations
63
70
:ivar datastores: DatastoresOperations operations
64
71
:vartype datastores: azure.mgmt.avs.operations.DatastoresOperations
72
+ :ivar hosts: HostsOperations operations
73
+ :vartype hosts: azure.mgmt.avs.operations.HostsOperations
65
74
:ivar placement_policies: PlacementPoliciesOperations operations
66
75
:vartype placement_policies: azure.mgmt.avs.operations.PlacementPoliciesOperations
67
76
:ivar virtual_machines: VirtualMachinesOperations operations
@@ -72,6 +81,10 @@ class AVSClient: # pylint: disable=client-accepts-api-version-keyword,too-many-
72
81
:vartype hcx_enterprise_sites: azure.mgmt.avs.operations.HcxEnterpriseSitesOperations
73
82
:ivar iscsi_paths: IscsiPathsOperations operations
74
83
:vartype iscsi_paths: azure.mgmt.avs.operations.IscsiPathsOperations
84
+ :ivar provisioned_networks: ProvisionedNetworksOperations operations
85
+ :vartype provisioned_networks: azure.mgmt.avs.operations.ProvisionedNetworksOperations
86
+ :ivar pure_storage_policies: PureStoragePoliciesOperations operations
87
+ :vartype pure_storage_policies: azure.mgmt.avs.operations.PureStoragePoliciesOperations
75
88
:ivar script_executions: ScriptExecutionsOperations operations
76
89
:vartype script_executions: azure.mgmt.avs.operations.ScriptExecutionsOperations
77
90
:ivar script_packages: ScriptPackagesOperations operations
@@ -84,23 +97,27 @@ class AVSClient: # pylint: disable=client-accepts-api-version-keyword,too-many-
84
97
:type credential: ~azure.core.credentials.TokenCredential
85
98
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
86
99
:type subscription_id: str
87
- :param base_url: Service URL. Default value is "https://management.azure.com" .
100
+ :param base_url: Service URL. Default value is None .
88
101
:type base_url: str
89
- :keyword api_version: Api Version. Default value is "2023 -09-01". Note that overriding this
102
+ :keyword api_version: Api Version. Default value is "2024 -09-01". Note that overriding this
90
103
default value may result in unsupported behavior.
91
104
:paramtype api_version: str
92
105
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
93
106
Retry-After header is present.
94
107
"""
95
108
96
109
def __init__ (
97
- self ,
98
- credential : "TokenCredential" ,
99
- subscription_id : str ,
100
- base_url : str = "https://management.azure.com" ,
101
- ** kwargs : Any
110
+ self , credential : "TokenCredential" , subscription_id : str , base_url : Optional [str ] = None , ** kwargs : Any
102
111
) -> None :
103
- self ._config = AVSClientConfiguration (credential = credential , subscription_id = subscription_id , ** kwargs )
112
+ _cloud = kwargs .pop ("cloud_setting" , None ) or settings .current .azure_cloud # type: ignore
113
+ _endpoints = get_arm_endpoints (_cloud )
114
+ if not base_url :
115
+ base_url = _endpoints ["resource_manager" ]
116
+ credential_scopes = kwargs .pop ("credential_scopes" , _endpoints ["credential_scopes" ])
117
+ self ._config = AVSClientConfiguration (
118
+ credential = credential , subscription_id = subscription_id , credential_scopes = credential_scopes , ** kwargs
119
+ )
120
+
104
121
_policies = kwargs .pop ("policies" , None )
105
122
if _policies is None :
106
123
_policies = [
@@ -119,7 +136,7 @@ def __init__(
119
136
policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
120
137
self ._config .http_logging_policy ,
121
138
]
122
- self ._client : ARMPipelineClient = ARMPipelineClient (base_url = base_url , policies = _policies , ** kwargs )
139
+ self ._client : ARMPipelineClient = ARMPipelineClient (base_url = cast ( str , base_url ) , policies = _policies , ** kwargs )
123
140
124
141
client_models = {k : v for k , v in _models .__dict__ .items () if isinstance (v , type )}
125
142
self ._serialize = Serializer (client_models )
@@ -128,11 +145,13 @@ def __init__(
128
145
self .operations = Operations (self ._client , self ._config , self ._serialize , self ._deserialize )
129
146
self .locations = LocationsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
130
147
self .private_clouds = PrivateCloudsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
148
+ self .skus = SkusOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
131
149
self .addons = AddonsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
132
150
self .authorizations = AuthorizationsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
133
151
self .cloud_links = CloudLinksOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
134
152
self .clusters = ClustersOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
135
153
self .datastores = DatastoresOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
154
+ self .hosts = HostsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
136
155
self .placement_policies = PlacementPoliciesOperations (
137
156
self ._client , self ._config , self ._serialize , self ._deserialize
138
157
)
@@ -146,6 +165,12 @@ def __init__(
146
165
self ._client , self ._config , self ._serialize , self ._deserialize
147
166
)
148
167
self .iscsi_paths = IscsiPathsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
168
+ self .provisioned_networks = ProvisionedNetworksOperations (
169
+ self ._client , self ._config , self ._serialize , self ._deserialize
170
+ )
171
+ self .pure_storage_policies = PureStoragePoliciesOperations (
172
+ self ._client , self ._config , self ._serialize , self ._deserialize
173
+ )
149
174
self .script_executions = ScriptExecutionsOperations (
150
175
self ._client , self ._config , self ._serialize , self ._deserialize
151
176
)
0 commit comments