22# --------------------------------------------------------------------------
33# Copyright (c) Microsoft Corporation. All rights reserved.
44# 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.
66# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77# --------------------------------------------------------------------------
88
99from copy import deepcopy
10- from typing import Any , TYPE_CHECKING
10+ from typing import Any , Optional , TYPE_CHECKING , cast
1111from typing_extensions import Self
1212
1313from azure .core .pipeline import policies
1414from azure .core .rest import HttpRequest , HttpResponse
15+ from azure .core .settings import settings
1516from azure .mgmt .core import ARMPipelineClient
1617from azure .mgmt .core .policies import ARMAutoResourceProviderRegistrationPolicy
18+ from azure .mgmt .core .tools import get_arm_endpoints
1719
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
2723
2824if TYPE_CHECKING :
2925 from azure .core .credentials import TokenCredential
3026
3127
32- class StorageActionsMgmtClient :
28+ class StorageActionsClient :
3329 """The Azure Storage Actions Management API.
3430
3531 :ivar operations: Operations operations
3632 :vartype operations: azure.mgmt.storageactions.operations.Operations
3733 :ivar storage_tasks: StorageTasksOperations operations
3834 :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.
4639 :type credential: ~azure.core.credentials.TokenCredential
4740 :param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
4841 :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 .
5043 :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.
5346 :paramtype api_version: str
5447 :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
5548 Retry-After header is present.
5649 """
5750
5851 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
6453 ) -> 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
6766 )
67+
6868 _policies = kwargs .pop ("policies" , None )
6969 if _policies is None :
7070 _policies = [
@@ -83,28 +83,24 @@ def __init__(
8383 policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
8484 self ._config .http_logging_policy ,
8585 ]
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 )
8787
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 ()
9190 self ._serialize .client_side_validation = False
9291 self .operations = Operations (self ._client , self ._config , self ._serialize , self ._deserialize )
9392 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 (
9894 self ._client , self ._config , self ._serialize , self ._deserialize
9995 )
10096
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 :
10298 """Runs the network request through the client's chained policies.
10399
104100 >>> from azure.core.rest import HttpRequest
105101 >>> request = HttpRequest("GET", "https://www.example.org/")
106102 <HttpRequest [GET], url: 'https://www.example.org/'>
107- >>> response = client._send_request (request)
103+ >>> response = client.send_request (request)
108104 <HttpResponse: 200 OK>
109105
110106 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:
117113 """
118114
119115 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 )
121121 return self ._client .send_request (request_copy , stream = stream , ** kwargs ) # type: ignore
122122
123123 def close (self ) -> None :
0 commit comments