8
8
9
9
from copy import deepcopy
10
10
from typing import Any , TYPE_CHECKING
11
+ from typing_extensions import Self
11
12
13
+ from azure .core .pipeline import policies
12
14
from azure .core .rest import HttpRequest , HttpResponse
13
15
from azure .mgmt .core import ARMPipelineClient
16
+ from azure .mgmt .core .policies import ARMAutoResourceProviderRegistrationPolicy
14
17
15
18
from . import models as _models
16
19
from ._configuration import HardwareSecurityModulesMgmtClientConfiguration
17
20
from ._serialization import Deserializer , Serializer
18
21
from .operations import (
22
+ CloudHsmClusterBackupStatusOperations ,
19
23
CloudHsmClusterPrivateEndpointConnectionsOperations ,
20
24
CloudHsmClusterPrivateLinkResourcesOperations ,
25
+ CloudHsmClusterRestoreStatusOperations ,
21
26
CloudHsmClustersOperations ,
22
27
DedicatedHsmOperations ,
23
28
Operations ,
29
34
from azure .core .credentials import TokenCredential
30
35
31
36
32
- class HardwareSecurityModulesMgmtClient : # pylint: disable=client-accepts-api-version-keyword
37
+ class HardwareSecurityModulesMgmtClient : # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
33
38
"""The Azure management API provides a RESTful set of web services that interact with Azure HSM
34
39
RP.
35
40
@@ -47,16 +52,25 @@ class HardwareSecurityModulesMgmtClient: # pylint: disable=client-accepts-api-v
47
52
:ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations
48
53
:vartype private_endpoint_connections:
49
54
azure.mgmt.hardwaresecuritymodules.operations.PrivateEndpointConnectionsOperations
50
- :ivar operations: Operations operations
51
- :vartype operations: azure.mgmt.hardwaresecuritymodules.operations.Operations
55
+ :ivar cloud_hsm_cluster_backup_status: CloudHsmClusterBackupStatusOperations operations
56
+ :vartype cloud_hsm_cluster_backup_status:
57
+ azure.mgmt.hardwaresecuritymodules.operations.CloudHsmClusterBackupStatusOperations
58
+ :ivar cloud_hsm_cluster_restore_status: CloudHsmClusterRestoreStatusOperations operations
59
+ :vartype cloud_hsm_cluster_restore_status:
60
+ azure.mgmt.hardwaresecuritymodules.operations.CloudHsmClusterRestoreStatusOperations
52
61
:ivar dedicated_hsm: DedicatedHsmOperations operations
53
62
:vartype dedicated_hsm: azure.mgmt.hardwaresecuritymodules.operations.DedicatedHsmOperations
63
+ :ivar operations: Operations operations
64
+ :vartype operations: azure.mgmt.hardwaresecuritymodules.operations.Operations
54
65
:param credential: Credential needed for the client to connect to Azure. Required.
55
66
:type credential: ~azure.core.credentials.TokenCredential
56
67
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
57
68
:type subscription_id: str
58
69
:param base_url: Service URL. Default value is "https://management.azure.com".
59
70
:type base_url: str
71
+ :keyword api_version: Api Version. Default value is "2024-06-30". Note that overriding this
72
+ default value may result in unsupported behavior.
73
+ :paramtype api_version: str
60
74
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
61
75
Retry-After header is present.
62
76
"""
@@ -71,7 +85,25 @@ def __init__(
71
85
self ._config = HardwareSecurityModulesMgmtClientConfiguration (
72
86
credential = credential , subscription_id = subscription_id , ** kwargs
73
87
)
74
- self ._client : ARMPipelineClient = ARMPipelineClient (base_url = base_url , config = self ._config , ** kwargs )
88
+ _policies = kwargs .pop ("policies" , None )
89
+ if _policies is None :
90
+ _policies = [
91
+ policies .RequestIdPolicy (** kwargs ),
92
+ self ._config .headers_policy ,
93
+ self ._config .user_agent_policy ,
94
+ self ._config .proxy_policy ,
95
+ policies .ContentDecodePolicy (** kwargs ),
96
+ ARMAutoResourceProviderRegistrationPolicy (),
97
+ self ._config .redirect_policy ,
98
+ self ._config .retry_policy ,
99
+ self ._config .authentication_policy ,
100
+ self ._config .custom_hook_policy ,
101
+ self ._config .logging_policy ,
102
+ policies .DistributedTracingPolicy (** kwargs ),
103
+ policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
104
+ self ._config .http_logging_policy ,
105
+ ]
106
+ self ._client : ARMPipelineClient = ARMPipelineClient (base_url = base_url , policies = _policies , ** kwargs )
75
107
76
108
client_models = {k : v for k , v in _models .__dict__ .items () if isinstance (v , type )}
77
109
self ._serialize = Serializer (client_models )
@@ -89,10 +121,16 @@ def __init__(
89
121
self .private_endpoint_connections = PrivateEndpointConnectionsOperations (
90
122
self ._client , self ._config , self ._serialize , self ._deserialize
91
123
)
92
- self .operations = Operations (self ._client , self ._config , self ._serialize , self ._deserialize )
124
+ self .cloud_hsm_cluster_backup_status = CloudHsmClusterBackupStatusOperations (
125
+ self ._client , self ._config , self ._serialize , self ._deserialize
126
+ )
127
+ self .cloud_hsm_cluster_restore_status = CloudHsmClusterRestoreStatusOperations (
128
+ self ._client , self ._config , self ._serialize , self ._deserialize
129
+ )
93
130
self .dedicated_hsm = DedicatedHsmOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
131
+ self .operations = Operations (self ._client , self ._config , self ._serialize , self ._deserialize )
94
132
95
- def _send_request (self , request : HttpRequest , ** kwargs : Any ) -> HttpResponse :
133
+ def _send_request (self , request : HttpRequest , * , stream : bool = False , * *kwargs : Any ) -> HttpResponse :
96
134
"""Runs the network request through the client's chained policies.
97
135
98
136
>>> from azure.core.rest import HttpRequest
@@ -112,12 +150,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
112
150
113
151
request_copy = deepcopy (request )
114
152
request_copy .url = self ._client .format_url (request_copy .url )
115
- return self ._client .send_request (request_copy , ** kwargs )
153
+ return self ._client .send_request (request_copy , stream = stream , ** kwargs ) # type: ignore
116
154
117
155
def close (self ) -> None :
118
156
self ._client .close ()
119
157
120
- def __enter__ (self ) -> "HardwareSecurityModulesMgmtClient" :
158
+ def __enter__ (self ) -> Self :
121
159
self ._client .__enter__ ()
122
160
return self
123
161
0 commit comments