88
99from copy import deepcopy
1010from typing import Any , TYPE_CHECKING
11+ from typing_extensions import Self
1112
13+ from azure .core .pipeline import policies
1214from azure .core .rest import HttpRequest , HttpResponse
1315from azure .mgmt .core import ARMPipelineClient
16+ from azure .mgmt .core .policies import ARMAutoResourceProviderRegistrationPolicy
1417
15- from . import models
18+ from . import models as _models
1619from ._configuration import MicrosoftStorageSyncConfiguration
1720from ._serialization import Deserializer , Serializer
1821from .operations import (
3033)
3134
3235if TYPE_CHECKING :
33- # pylint: disable=unused-import,ungrouped-imports
3436 from azure .core .credentials import TokenCredential
3537
3638
37- class MicrosoftStorageSync (
38- MicrosoftStorageSyncOperationsMixin
39- ): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
40- """Microsoft Storage Sync Service API.
39+ class MicrosoftStorageSync (MicrosoftStorageSyncOperationsMixin ): # pylint: disable=too-many-instance-attributes
40+ """Microsoft Storage Sync Service API. This belongs to Microsoft.StorageSync Resource Provider.
4141
4242 :ivar operations: Operations operations
4343 :vartype operations: azure.mgmt.storagesync.operations.Operations
@@ -63,11 +63,11 @@ class MicrosoftStorageSync(
6363 :vartype operation_status: azure.mgmt.storagesync.operations.OperationStatusOperations
6464 :param credential: Credential needed for the client to connect to Azure. Required.
6565 :type credential: ~azure.core.credentials.TokenCredential
66- :param subscription_id: The ID of the target subscription. Required.
66+ :param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
6767 :type subscription_id: str
6868 :param base_url: Service URL. Default value is "https://management.azure.com".
6969 :type base_url: str
70- :keyword api_version: Api Version. Default value is "2022-06 -01". Note that overriding this
70+ :keyword api_version: Api Version. Default value is "2022-09 -01". Note that overriding this
7171 default value may result in unsupported behavior.
7272 :paramtype api_version: str
7373 :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
@@ -84,9 +84,27 @@ def __init__(
8484 self ._config = MicrosoftStorageSyncConfiguration (
8585 credential = credential , subscription_id = subscription_id , ** kwargs
8686 )
87- self ._client = ARMPipelineClient (base_url = base_url , config = self ._config , ** kwargs )
88-
89- client_models = {k : v for k , v in models .__dict__ .items () if isinstance (v , type )}
87+ _policies = kwargs .pop ("policies" , None )
88+ if _policies is None :
89+ _policies = [
90+ policies .RequestIdPolicy (** kwargs ),
91+ self ._config .headers_policy ,
92+ self ._config .user_agent_policy ,
93+ self ._config .proxy_policy ,
94+ policies .ContentDecodePolicy (** kwargs ),
95+ ARMAutoResourceProviderRegistrationPolicy (),
96+ self ._config .redirect_policy ,
97+ self ._config .retry_policy ,
98+ self ._config .authentication_policy ,
99+ self ._config .custom_hook_policy ,
100+ self ._config .logging_policy ,
101+ policies .DistributedTracingPolicy (** kwargs ),
102+ policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
103+ self ._config .http_logging_policy ,
104+ ]
105+ self ._client : ARMPipelineClient = ARMPipelineClient (base_url = base_url , policies = _policies , ** kwargs )
106+
107+ client_models = {k : v for k , v in _models .__dict__ .items () if isinstance (v , type )}
90108 self ._serialize = Serializer (client_models )
91109 self ._deserialize = Deserializer (client_models )
92110 self ._serialize .client_side_validation = False
@@ -113,7 +131,7 @@ def __init__(
113131 self ._client , self ._config , self ._serialize , self ._deserialize
114132 )
115133
116- def _send_request (self , request : HttpRequest , ** kwargs : Any ) -> HttpResponse :
134+ def _send_request (self , request : HttpRequest , * , stream : bool = False , * *kwargs : Any ) -> HttpResponse :
117135 """Runs the network request through the client's chained policies.
118136
119137 >>> from azure.core.rest import HttpRequest
@@ -133,17 +151,14 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
133151
134152 request_copy = deepcopy (request )
135153 request_copy .url = self ._client .format_url (request_copy .url )
136- return self ._client .send_request (request_copy , ** kwargs )
154+ return self ._client .send_request (request_copy , stream = stream , ** kwargs ) # type: ignore
137155
138- def close (self ):
139- # type: () -> None
156+ def close (self ) -> None :
140157 self ._client .close ()
141158
142- def __enter__ (self ):
143- # type: () -> MicrosoftStorageSync
159+ def __enter__ (self ) -> Self :
144160 self ._client .__enter__ ()
145161 return self
146162
147- def __exit__ (self , * exc_details ):
148- # type: (Any) -> None
163+ def __exit__ (self , * exc_details : Any ) -> None :
149164 self ._client .__exit__ (* exc_details )
0 commit comments