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
1518from . import models as _models
1619from ._configuration import HardwareSecurityModulesMgmtClientConfiguration
1720from ._serialization import Deserializer , Serializer
1821from .operations import (
22+ CloudHsmClusterBackupStatusOperations ,
1923 CloudHsmClusterPrivateEndpointConnectionsOperations ,
2024 CloudHsmClusterPrivateLinkResourcesOperations ,
25+ CloudHsmClusterRestoreStatusOperations ,
2126 CloudHsmClustersOperations ,
2227 DedicatedHsmOperations ,
2328 Operations ,
2429 PrivateEndpointConnectionsOperations ,
2530)
2631
2732if TYPE_CHECKING :
28- # pylint: disable=unused-import,ungrouped-imports
2933 from azure .core .credentials import TokenCredential
3034
3135
32- class HardwareSecurityModulesMgmtClient : # pylint: disable=client-accepts-api-version-keyword
36+ class HardwareSecurityModulesMgmtClient : # pylint: disable=too-many-instance-attributes
3337 """The Azure management API provides a RESTful set of web services that interact with Azure HSM
3438 RP.
3539
@@ -47,16 +51,25 @@ class HardwareSecurityModulesMgmtClient: # pylint: disable=client-accepts-api-v
4751 :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations
4852 :vartype private_endpoint_connections:
4953 azure.mgmt.hardwaresecuritymodules.operations.PrivateEndpointConnectionsOperations
50- :ivar operations: Operations operations
51- :vartype operations: azure.mgmt.hardwaresecuritymodules.operations.Operations
54+ :ivar cloud_hsm_cluster_backup_status: CloudHsmClusterBackupStatusOperations operations
55+ :vartype cloud_hsm_cluster_backup_status:
56+ azure.mgmt.hardwaresecuritymodules.operations.CloudHsmClusterBackupStatusOperations
57+ :ivar cloud_hsm_cluster_restore_status: CloudHsmClusterRestoreStatusOperations operations
58+ :vartype cloud_hsm_cluster_restore_status:
59+ azure.mgmt.hardwaresecuritymodules.operations.CloudHsmClusterRestoreStatusOperations
5260 :ivar dedicated_hsm: DedicatedHsmOperations operations
5361 :vartype dedicated_hsm: azure.mgmt.hardwaresecuritymodules.operations.DedicatedHsmOperations
62+ :ivar operations: Operations operations
63+ :vartype operations: azure.mgmt.hardwaresecuritymodules.operations.Operations
5464 :param credential: Credential needed for the client to connect to Azure. Required.
5565 :type credential: ~azure.core.credentials.TokenCredential
5666 :param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
5767 :type subscription_id: str
5868 :param base_url: Service URL. Default value is "https://management.azure.com".
5969 :type base_url: str
70+ :keyword api_version: Api Version. Default value is "2025-03-31". Note that overriding this
71+ default value may result in unsupported behavior.
72+ :paramtype api_version: str
6073 :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
6174 Retry-After header is present.
6275 """
@@ -71,7 +84,25 @@ def __init__(
7184 self ._config = HardwareSecurityModulesMgmtClientConfiguration (
7285 credential = credential , subscription_id = subscription_id , ** kwargs
7386 )
74- self ._client : ARMPipelineClient = ARMPipelineClient (base_url = base_url , config = self ._config , ** kwargs )
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 )
75106
76107 client_models = {k : v for k , v in _models .__dict__ .items () if isinstance (v , type )}
77108 self ._serialize = Serializer (client_models )
@@ -89,10 +120,16 @@ def __init__(
89120 self .private_endpoint_connections = PrivateEndpointConnectionsOperations (
90121 self ._client , self ._config , self ._serialize , self ._deserialize
91122 )
92- self .operations = Operations (self ._client , self ._config , self ._serialize , self ._deserialize )
123+ self .cloud_hsm_cluster_backup_status = CloudHsmClusterBackupStatusOperations (
124+ self ._client , self ._config , self ._serialize , self ._deserialize
125+ )
126+ self .cloud_hsm_cluster_restore_status = CloudHsmClusterRestoreStatusOperations (
127+ self ._client , self ._config , self ._serialize , self ._deserialize
128+ )
93129 self .dedicated_hsm = DedicatedHsmOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
130+ self .operations = Operations (self ._client , self ._config , self ._serialize , self ._deserialize )
94131
95- def _send_request (self , request : HttpRequest , ** kwargs : Any ) -> HttpResponse :
132+ def _send_request (self , request : HttpRequest , * , stream : bool = False , * *kwargs : Any ) -> HttpResponse :
96133 """Runs the network request through the client's chained policies.
97134
98135 >>> from azure.core.rest import HttpRequest
@@ -112,12 +149,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
112149
113150 request_copy = deepcopy (request )
114151 request_copy .url = self ._client .format_url (request_copy .url )
115- return self ._client .send_request (request_copy , ** kwargs )
152+ return self ._client .send_request (request_copy , stream = stream , ** kwargs ) # type: ignore
116153
117154 def close (self ) -> None :
118155 self ._client .close ()
119156
120- def __enter__ (self ) -> "HardwareSecurityModulesMgmtClient" :
157+ def __enter__ (self ) -> Self :
121158 self ._client .__enter__ ()
122159 return self
123160
0 commit comments