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
1920from ._configuration import StorageActionsMgmtClientConfiguration
20- from ._serialization import Deserializer , Serializer
21+ from ._utils . serialization import Deserializer , Serializer
2122from .operations import (
2223 Operations ,
2324 StorageTaskAssignmentOperations ,
@@ -36,35 +37,42 @@ class StorageActionsMgmtClient:
3637 :vartype operations: azure.mgmt.storageactions.operations.Operations
3738 :ivar storage_tasks: StorageTasksOperations operations
3839 :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
4240 :ivar storage_tasks_report: StorageTasksReportOperations operations
4341 :vartype storage_tasks_report:
4442 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.
4647 :type credential: ~azure.core.credentials.TokenCredential
4748 :param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
4849 :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 .
5051 :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.
5354 :paramtype api_version: str
5455 :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
5556 Retry-After header is present.
5657 """
5758
5859 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
6461 ) -> 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" ])
6568 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
6774 )
75+
6876 _policies = kwargs .pop ("policies" , None )
6977 if _policies is None :
7078 _policies = [
@@ -83,28 +91,27 @@ def __init__(
8391 policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
8492 self ._config .http_logging_policy ,
8593 ]
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 )
8795
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 ()
9198 self ._serialize .client_side_validation = False
9299 self .operations = Operations (self ._client , self ._config , self ._serialize , self ._deserialize )
93100 self .storage_tasks = StorageTasksOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
94- self .storage_task_assignment = StorageTaskAssignmentOperations (
101+ self .storage_tasks_report = StorageTasksReportOperations (
95102 self ._client , self ._config , self ._serialize , self ._deserialize
96103 )
97- self .storage_tasks_report = StorageTasksReportOperations (
104+ self .storage_task_assignment = StorageTaskAssignmentOperations (
98105 self ._client , self ._config , self ._serialize , self ._deserialize
99106 )
100107
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 :
102109 """Runs the network request through the client's chained policies.
103110
104111 >>> from azure.core.rest import HttpRequest
105112 >>> request = HttpRequest("GET", "https://www.example.org/")
106113 <HttpRequest [GET], url: 'https://www.example.org/'>
107- >>> response = client._send_request (request)
114+ >>> response = client.send_request (request)
108115 <HttpResponse: 200 OK>
109116
110117 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:
117124 """
118125
119126 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 )
121132 return self ._client .send_request (request_copy , stream = stream , ** kwargs ) # type: ignore
122133
123134 def close (self ) -> None :
0 commit comments