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 StorageActionsMgmtClientConfiguration
20
- from ._serialization import Deserializer , Serializer
22
+ from ._utils . serialization import Deserializer , Serializer
21
23
from .operations import (
22
24
Operations ,
23
25
StorageTaskAssignmentOperations ,
@@ -36,17 +38,17 @@ class StorageActionsMgmtClient:
36
38
:vartype operations: azure.mgmt.storageactions.operations.Operations
37
39
:ivar storage_tasks: StorageTasksOperations operations
38
40
:vartype storage_tasks: azure.mgmt.storageactions.operations.StorageTasksOperations
39
- :ivar storage_task_assignment: StorageTaskAssignmentOperations operations
40
- :vartype storage_task_assignment:
41
- azure.mgmt.storageactions.operations.StorageTaskAssignmentOperations
42
41
:ivar storage_tasks_report: StorageTasksReportOperations operations
43
42
:vartype storage_tasks_report:
44
43
azure.mgmt.storageactions.operations.StorageTasksReportOperations
44
+ :ivar storage_task_assignment: StorageTaskAssignmentOperations operations
45
+ :vartype storage_task_assignment:
46
+ azure.mgmt.storageactions.operations.StorageTaskAssignmentOperations
45
47
:param credential: Credential needed for the client to connect to Azure. Required.
46
48
:type credential: ~azure.core.credentials.TokenCredential
47
49
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
48
50
:type subscription_id: str
49
- :param base_url: Service URL. Default value is "https://management.azure.com" .
51
+ :param base_url: Service URL. Default value is None .
50
52
:type base_url: str
51
53
:keyword api_version: Api Version. Default value is "2023-01-01". Note that overriding this
52
54
default value may result in unsupported behavior.
@@ -56,15 +58,17 @@ class StorageActionsMgmtClient:
56
58
"""
57
59
58
60
def __init__ (
59
- self ,
60
- credential : "TokenCredential" ,
61
- subscription_id : str ,
62
- base_url : str = "https://management.azure.com" ,
63
- ** kwargs : Any
61
+ self , credential : "TokenCredential" , subscription_id : str , base_url : Optional [str ] = None , ** kwargs : Any
64
62
) -> None :
63
+ _cloud = kwargs .pop ("cloud_setting" , None ) or settings .current .azure_cloud # type: ignore
64
+ _endpoints = get_arm_endpoints (_cloud )
65
+ if not base_url :
66
+ base_url = _endpoints ["resource_manager" ]
67
+ credential_scopes = kwargs .pop ("credential_scopes" , _endpoints ["credential_scopes" ])
65
68
self ._config = StorageActionsMgmtClientConfiguration (
66
- credential = credential , subscription_id = subscription_id , ** kwargs
69
+ credential = credential , subscription_id = subscription_id , credential_scopes = credential_scopes , ** kwargs
67
70
)
71
+
68
72
_policies = kwargs .pop ("policies" , None )
69
73
if _policies is None :
70
74
_policies = [
@@ -83,18 +87,18 @@ def __init__(
83
87
policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
84
88
self ._config .http_logging_policy ,
85
89
]
86
- self ._client : ARMPipelineClient = ARMPipelineClient (base_url = base_url , policies = _policies , ** kwargs )
90
+ self ._client : ARMPipelineClient = ARMPipelineClient (base_url = cast ( str , base_url ) , policies = _policies , ** kwargs )
87
91
88
92
client_models = {k : v for k , v in _models .__dict__ .items () if isinstance (v , type )}
89
93
self ._serialize = Serializer (client_models )
90
94
self ._deserialize = Deserializer (client_models )
91
95
self ._serialize .client_side_validation = False
92
96
self .operations = Operations (self ._client , self ._config , self ._serialize , self ._deserialize )
93
97
self .storage_tasks = StorageTasksOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
94
- self .storage_task_assignment = StorageTaskAssignmentOperations (
98
+ self .storage_tasks_report = StorageTasksReportOperations (
95
99
self ._client , self ._config , self ._serialize , self ._deserialize
96
100
)
97
- self .storage_tasks_report = StorageTasksReportOperations (
101
+ self .storage_task_assignment = StorageTaskAssignmentOperations (
98
102
self ._client , self ._config , self ._serialize , self ._deserialize
99
103
)
100
104
0 commit comments