|
| 1 | +# coding=utf-8 |
| 2 | +# -------------------------------------------------------------------------- |
| 3 | +# Copyright (c) Microsoft Corporation. All rights reserved. |
| 4 | +# Licensed under the MIT License. See License.txt in the project root for license information. |
| 5 | +# Code generated by Microsoft (R) AutoRest Code Generator. |
| 6 | +# Changes may cause incorrect behavior and will be lost if the code is regenerated. |
| 7 | +# -------------------------------------------------------------------------- |
| 8 | + |
| 9 | +from copy import deepcopy |
| 10 | +from typing import Any, TYPE_CHECKING |
| 11 | + |
| 12 | +from azure.core.rest import HttpRequest, HttpResponse |
| 13 | +from azure.mgmt.core import ARMPipelineClient |
| 14 | + |
| 15 | +from . import models as _models |
| 16 | +from ._configuration import HardwareSecurityModulesMgmtClientConfiguration |
| 17 | +from ._serialization import Deserializer, Serializer |
| 18 | +from .operations import ( |
| 19 | + CloudHsmClusterPrivateEndpointConnectionsOperations, |
| 20 | + CloudHsmClusterPrivateLinkResourcesOperations, |
| 21 | + CloudHsmClustersOperations, |
| 22 | + DedicatedHsmOperations, |
| 23 | + Operations, |
| 24 | + PrivateEndpointConnectionsOperations, |
| 25 | +) |
| 26 | + |
| 27 | +if TYPE_CHECKING: |
| 28 | + # pylint: disable=unused-import,ungrouped-imports |
| 29 | + from azure.core.credentials import TokenCredential |
| 30 | + |
| 31 | + |
| 32 | +class HardwareSecurityModulesMgmtClient: # pylint: disable=client-accepts-api-version-keyword |
| 33 | + """The Azure management API provides a RESTful set of web services that interact with Azure HSM |
| 34 | + RP. |
| 35 | +
|
| 36 | + :ivar cloud_hsm_clusters: CloudHsmClustersOperations operations |
| 37 | + :vartype cloud_hsm_clusters: |
| 38 | + azure.mgmt.hardwaresecuritymodules.operations.CloudHsmClustersOperations |
| 39 | + :ivar cloud_hsm_cluster_private_link_resources: CloudHsmClusterPrivateLinkResourcesOperations |
| 40 | + operations |
| 41 | + :vartype cloud_hsm_cluster_private_link_resources: |
| 42 | + azure.mgmt.hardwaresecuritymodules.operations.CloudHsmClusterPrivateLinkResourcesOperations |
| 43 | + :ivar cloud_hsm_cluster_private_endpoint_connections: |
| 44 | + CloudHsmClusterPrivateEndpointConnectionsOperations operations |
| 45 | + :vartype cloud_hsm_cluster_private_endpoint_connections: |
| 46 | + azure.mgmt.hardwaresecuritymodules.operations.CloudHsmClusterPrivateEndpointConnectionsOperations |
| 47 | + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations |
| 48 | + :vartype private_endpoint_connections: |
| 49 | + azure.mgmt.hardwaresecuritymodules.operations.PrivateEndpointConnectionsOperations |
| 50 | + :ivar operations: Operations operations |
| 51 | + :vartype operations: azure.mgmt.hardwaresecuritymodules.operations.Operations |
| 52 | + :ivar dedicated_hsm: DedicatedHsmOperations operations |
| 53 | + :vartype dedicated_hsm: azure.mgmt.hardwaresecuritymodules.operations.DedicatedHsmOperations |
| 54 | + :param credential: Credential needed for the client to connect to Azure. Required. |
| 55 | + :type credential: ~azure.core.credentials.TokenCredential |
| 56 | + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. |
| 57 | + :type subscription_id: str |
| 58 | + :param base_url: Service URL. Default value is "https://management.azure.com". |
| 59 | + :type base_url: str |
| 60 | + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no |
| 61 | + Retry-After header is present. |
| 62 | + """ |
| 63 | + |
| 64 | + def __init__( |
| 65 | + self, |
| 66 | + credential: "TokenCredential", |
| 67 | + subscription_id: str, |
| 68 | + base_url: str = "https://management.azure.com", |
| 69 | + **kwargs: Any |
| 70 | + ) -> None: |
| 71 | + self._config = HardwareSecurityModulesMgmtClientConfiguration( |
| 72 | + credential=credential, subscription_id=subscription_id, **kwargs |
| 73 | + ) |
| 74 | + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) |
| 75 | + |
| 76 | + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} |
| 77 | + self._serialize = Serializer(client_models) |
| 78 | + self._deserialize = Deserializer(client_models) |
| 79 | + self._serialize.client_side_validation = False |
| 80 | + self.cloud_hsm_clusters = CloudHsmClustersOperations( |
| 81 | + self._client, self._config, self._serialize, self._deserialize |
| 82 | + ) |
| 83 | + self.cloud_hsm_cluster_private_link_resources = CloudHsmClusterPrivateLinkResourcesOperations( |
| 84 | + self._client, self._config, self._serialize, self._deserialize |
| 85 | + ) |
| 86 | + self.cloud_hsm_cluster_private_endpoint_connections = CloudHsmClusterPrivateEndpointConnectionsOperations( |
| 87 | + self._client, self._config, self._serialize, self._deserialize |
| 88 | + ) |
| 89 | + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( |
| 90 | + self._client, self._config, self._serialize, self._deserialize |
| 91 | + ) |
| 92 | + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) |
| 93 | + self.dedicated_hsm = DedicatedHsmOperations(self._client, self._config, self._serialize, self._deserialize) |
| 94 | + |
| 95 | + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: |
| 96 | + """Runs the network request through the client's chained policies. |
| 97 | +
|
| 98 | + >>> from azure.core.rest import HttpRequest |
| 99 | + >>> request = HttpRequest("GET", "https://www.example.org/") |
| 100 | + <HttpRequest [GET], url: 'https://www.example.org/'> |
| 101 | + >>> response = client._send_request(request) |
| 102 | + <HttpResponse: 200 OK> |
| 103 | +
|
| 104 | + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request |
| 105 | +
|
| 106 | + :param request: The network request you want to make. Required. |
| 107 | + :type request: ~azure.core.rest.HttpRequest |
| 108 | + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. |
| 109 | + :return: The response of your network call. Does not do error handling on your response. |
| 110 | + :rtype: ~azure.core.rest.HttpResponse |
| 111 | + """ |
| 112 | + |
| 113 | + request_copy = deepcopy(request) |
| 114 | + request_copy.url = self._client.format_url(request_copy.url) |
| 115 | + return self._client.send_request(request_copy, **kwargs) |
| 116 | + |
| 117 | + def close(self) -> None: |
| 118 | + self._client.close() |
| 119 | + |
| 120 | + def __enter__(self) -> "HardwareSecurityModulesMgmtClient": |
| 121 | + self._client.__enter__() |
| 122 | + return self |
| 123 | + |
| 124 | + def __exit__(self, *exc_details: Any) -> None: |
| 125 | + self._client.__exit__(*exc_details) |
0 commit comments