2
2
# --------------------------------------------------------------------------
3
3
# Copyright (c) Microsoft Corporation. All rights reserved.
4
4
# Licensed under the MIT License. See License.txt in the project root for license information.
5
- # Code generated by Microsoft (R) AutoRest Code Generator.
5
+ # Code generated by Microsoft (R) Python Code Generator.
6
6
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
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
- from . import models as _models
19
20
from ._configuration import StorageActionsMgmtClientConfiguration
20
- from ._serialization import Deserializer , Serializer
21
+ from ._utils . serialization import Deserializer , Serializer
21
22
from .operations import (
22
23
Operations ,
23
24
StorageTaskAssignmentOperations ,
@@ -36,35 +37,42 @@ class StorageActionsMgmtClient:
36
37
:vartype operations: azure.mgmt.storageactions.operations.Operations
37
38
:ivar storage_tasks: StorageTasksOperations operations
38
39
: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
40
:ivar storage_tasks_report: StorageTasksReportOperations operations
43
41
:vartype storage_tasks_report:
44
42
azure.mgmt.storageactions.operations.StorageTasksReportOperations
45
- :param credential: Credential needed for the client to connect to Azure. Required.
43
+ :ivar storage_task_assignment: StorageTaskAssignmentOperations operations
44
+ :vartype storage_task_assignment:
45
+ azure.mgmt.storageactions.operations.StorageTaskAssignmentOperations
46
+ :param credential: Credential used to authenticate requests to the service. Required.
46
47
:type credential: ~azure.core.credentials.TokenCredential
47
48
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
48
49
:type subscription_id: str
49
- :param base_url: Service URL . Default value is "https://management.azure.com" .
50
+ :param base_url: Service host . Default value is None .
50
51
:type base_url: str
51
- :keyword api_version: Api Version . Default value is "2023-01-01". Note that overriding this
52
- default value may result in unsupported behavior.
52
+ :keyword api_version: The API version to use for this operation . Default value is "2023-01-01".
53
+ Note that overriding this default value may result in unsupported behavior.
53
54
:paramtype api_version: str
54
55
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
55
56
Retry-After header is present.
56
57
"""
57
58
58
59
def __init__ (
59
- self ,
60
- credential : "TokenCredential" ,
61
- subscription_id : str ,
62
- base_url : str = "https://management.azure.com" ,
63
- ** kwargs : Any
60
+ self , credential : "TokenCredential" , subscription_id : str , base_url : Optional [str ] = None , ** kwargs : Any
64
61
) -> None :
62
+ _endpoint = "{endpoint}"
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 ,
70
+ subscription_id = subscription_id ,
71
+ base_url = cast (str , base_url ),
72
+ credential_scopes = credential_scopes ,
73
+ ** kwargs
67
74
)
75
+
68
76
_policies = kwargs .pop ("policies" , None )
69
77
if _policies is None :
70
78
_policies = [
@@ -83,28 +91,27 @@ def __init__(
83
91
policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
84
92
self ._config .http_logging_policy ,
85
93
]
86
- self ._client : ARMPipelineClient = ARMPipelineClient (base_url = base_url , policies = _policies , ** kwargs )
94
+ self ._client : ARMPipelineClient = ARMPipelineClient (base_url = cast ( str , _endpoint ) , policies = _policies , ** kwargs )
87
95
88
- client_models = {k : v for k , v in _models .__dict__ .items () if isinstance (v , type )}
89
- self ._serialize = Serializer (client_models )
90
- self ._deserialize = Deserializer (client_models )
96
+ self ._serialize = Serializer ()
97
+ self ._deserialize = Deserializer ()
91
98
self ._serialize .client_side_validation = False
92
99
self .operations = Operations (self ._client , self ._config , self ._serialize , self ._deserialize )
93
100
self .storage_tasks = StorageTasksOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
94
- self .storage_task_assignment = StorageTaskAssignmentOperations (
101
+ self .storage_tasks_report = StorageTasksReportOperations (
95
102
self ._client , self ._config , self ._serialize , self ._deserialize
96
103
)
97
- self .storage_tasks_report = StorageTasksReportOperations (
104
+ self .storage_task_assignment = StorageTaskAssignmentOperations (
98
105
self ._client , self ._config , self ._serialize , self ._deserialize
99
106
)
100
107
101
- def _send_request (self , request : HttpRequest , * , stream : bool = False , ** kwargs : Any ) -> HttpResponse :
108
+ def send_request (self , request : HttpRequest , * , stream : bool = False , ** kwargs : Any ) -> HttpResponse :
102
109
"""Runs the network request through the client's chained policies.
103
110
104
111
>>> from azure.core.rest import HttpRequest
105
112
>>> request = HttpRequest("GET", "https://www.example.org/")
106
113
<HttpRequest [GET], url: 'https://www.example.org/'>
107
- >>> response = client._send_request (request)
114
+ >>> response = client.send_request (request)
108
115
<HttpResponse: 200 OK>
109
116
110
117
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
@@ -117,7 +124,11 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:
117
124
"""
118
125
119
126
request_copy = deepcopy (request )
120
- request_copy .url = self ._client .format_url (request_copy .url )
127
+ path_format_arguments = {
128
+ "endpoint" : self ._serialize .url ("self._config.base_url" , self ._config .base_url , "str" , skip_quote = True ),
129
+ }
130
+
131
+ request_copy .url = self ._client .format_url (request_copy .url , ** path_format_arguments )
121
132
return self ._client .send_request (request_copy , stream = stream , ** kwargs ) # type: ignore
122
133
123
134
def close (self ) -> None :
0 commit comments