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
- from ._configuration import StorageActionsMgmtClientConfiguration
20
- from ._serialization import Deserializer , Serializer
21
- from .operations import (
22
- Operations ,
23
- StorageTaskAssignmentOperations ,
24
- StorageTasksOperations ,
25
- StorageTasksReportOperations ,
26
- )
20
+ from ._configuration import StorageActionsClientConfiguration
21
+ from ._utils .serialization import Deserializer , Serializer
22
+ from .operations import Operations , StorageTasksOperationGroupOperations , StorageTasksOperations
27
23
28
24
if TYPE_CHECKING :
29
25
from azure .core .credentials import TokenCredential
30
26
31
27
32
- class StorageActionsMgmtClient :
28
+ class StorageActionsClient :
33
29
"""The Azure Storage Actions Management API.
34
30
35
31
:ivar operations: Operations operations
36
32
:vartype operations: azure.mgmt.storageactions.operations.Operations
37
33
:ivar storage_tasks: StorageTasksOperations operations
38
34
: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
- :ivar storage_tasks_report: StorageTasksReportOperations operations
43
- :vartype storage_tasks_report:
44
- azure.mgmt.storageactions.operations.StorageTasksReportOperations
45
- :param credential: Credential needed for the client to connect to Azure. Required.
35
+ :ivar storage_tasks_operation_group: StorageTasksOperationGroupOperations operations
36
+ :vartype storage_tasks_operation_group:
37
+ azure.mgmt.storageactions.operations.StorageTasksOperationGroupOperations
38
+ :param credential: Credential used to authenticate requests to the service. Required.
46
39
:type credential: ~azure.core.credentials.TokenCredential
47
40
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
48
41
:type subscription_id: str
49
- :param base_url: Service URL . Default value is "https://management.azure.com" .
42
+ :param base_url: Service host . Default value is None .
50
43
: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.
44
+ :keyword api_version: The API version to use for this operation . Default value is "2023-01-01".
45
+ Note that overriding this default value may result in unsupported behavior.
53
46
:paramtype api_version: str
54
47
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
55
48
Retry-After header is present.
56
49
"""
57
50
58
51
def __init__ (
59
- self ,
60
- credential : "TokenCredential" ,
61
- subscription_id : str ,
62
- base_url : str = "https://management.azure.com" ,
63
- ** kwargs : Any
52
+ self , credential : "TokenCredential" , subscription_id : str , base_url : Optional [str ] = None , ** kwargs : Any
64
53
) -> None :
65
- self ._config = StorageActionsMgmtClientConfiguration (
66
- credential = credential , subscription_id = subscription_id , ** kwargs
54
+ _endpoint = "{endpoint}"
55
+ _cloud = kwargs .pop ("cloud_setting" , None ) or settings .current .azure_cloud # type: ignore
56
+ _endpoints = get_arm_endpoints (_cloud )
57
+ if not base_url :
58
+ base_url = _endpoints ["resource_manager" ]
59
+ credential_scopes = kwargs .pop ("credential_scopes" , _endpoints ["credential_scopes" ])
60
+ self ._config = StorageActionsClientConfiguration (
61
+ credential = credential ,
62
+ subscription_id = subscription_id ,
63
+ base_url = cast (str , base_url ),
64
+ credential_scopes = credential_scopes ,
65
+ ** kwargs
67
66
)
67
+
68
68
_policies = kwargs .pop ("policies" , None )
69
69
if _policies is None :
70
70
_policies = [
@@ -83,28 +83,24 @@ def __init__(
83
83
policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
84
84
self ._config .http_logging_policy ,
85
85
]
86
- self ._client : ARMPipelineClient = ARMPipelineClient (base_url = base_url , policies = _policies , ** kwargs )
86
+ self ._client : ARMPipelineClient = ARMPipelineClient (base_url = cast ( str , _endpoint ) , policies = _policies , ** kwargs )
87
87
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 )
88
+ self ._serialize = Serializer ()
89
+ self ._deserialize = Deserializer ()
91
90
self ._serialize .client_side_validation = False
92
91
self .operations = Operations (self ._client , self ._config , self ._serialize , self ._deserialize )
93
92
self .storage_tasks = StorageTasksOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
94
- self .storage_task_assignment = StorageTaskAssignmentOperations (
95
- self ._client , self ._config , self ._serialize , self ._deserialize
96
- )
97
- self .storage_tasks_report = StorageTasksReportOperations (
93
+ self .storage_tasks_operation_group = StorageTasksOperationGroupOperations (
98
94
self ._client , self ._config , self ._serialize , self ._deserialize
99
95
)
100
96
101
- def _send_request (self , request : HttpRequest , * , stream : bool = False , ** kwargs : Any ) -> HttpResponse :
97
+ def send_request (self , request : HttpRequest , * , stream : bool = False , ** kwargs : Any ) -> HttpResponse :
102
98
"""Runs the network request through the client's chained policies.
103
99
104
100
>>> from azure.core.rest import HttpRequest
105
101
>>> request = HttpRequest("GET", "https://www.example.org/")
106
102
<HttpRequest [GET], url: 'https://www.example.org/'>
107
- >>> response = client._send_request (request)
103
+ >>> response = client.send_request (request)
108
104
<HttpResponse: 200 OK>
109
105
110
106
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
@@ -117,7 +113,11 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:
117
113
"""
118
114
119
115
request_copy = deepcopy (request )
120
- request_copy .url = self ._client .format_url (request_copy .url )
116
+ path_format_arguments = {
117
+ "endpoint" : self ._serialize .url ("self._config.base_url" , self ._config .base_url , "str" , skip_quote = True ),
118
+ }
119
+
120
+ request_copy .url = self ._client .format_url (request_copy .url , ** path_format_arguments )
121
121
return self ._client .send_request (request_copy , stream = stream , ** kwargs ) # type: ignore
122
122
123
123
def close (self ) -> None :
0 commit comments