|
| 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 |
| 16 | +from ._configuration import ElasticSanManagementConfiguration |
| 17 | +from ._serialization import Deserializer, Serializer |
| 18 | +from .operations import ElasticSansOperations, Operations, SkusOperations, VolumeGroupsOperations, VolumesOperations |
| 19 | + |
| 20 | +if TYPE_CHECKING: |
| 21 | + # pylint: disable=unused-import,ungrouped-imports |
| 22 | + from azure.core.credentials import TokenCredential |
| 23 | + |
| 24 | + |
| 25 | +class ElasticSanManagement: # pylint: disable=client-accepts-api-version-keyword |
| 26 | + """ElasticSanManagement. |
| 27 | +
|
| 28 | + :ivar operations: Operations operations |
| 29 | + :vartype operations: azure.mgmt.elasticsan.operations.Operations |
| 30 | + :ivar skus: SkusOperations operations |
| 31 | + :vartype skus: azure.mgmt.elasticsan.operations.SkusOperations |
| 32 | + :ivar elastic_sans: ElasticSansOperations operations |
| 33 | + :vartype elastic_sans: azure.mgmt.elasticsan.operations.ElasticSansOperations |
| 34 | + :ivar volume_groups: VolumeGroupsOperations operations |
| 35 | + :vartype volume_groups: azure.mgmt.elasticsan.operations.VolumeGroupsOperations |
| 36 | + :ivar volumes: VolumesOperations operations |
| 37 | + :vartype volumes: azure.mgmt.elasticsan.operations.VolumesOperations |
| 38 | + :param credential: Credential needed for the client to connect to Azure. Required. |
| 39 | + :type credential: ~azure.core.credentials.TokenCredential |
| 40 | + :param subscription_id: The ID of the target subscription. Required. |
| 41 | + :type subscription_id: str |
| 42 | + :param base_url: Service URL. Default value is "https://management.azure.com". |
| 43 | + :type base_url: str |
| 44 | + :keyword api_version: Api Version. Default value is "2021-11-20-preview". Note that overriding |
| 45 | + this default value may result in unsupported behavior. |
| 46 | + :paramtype api_version: str |
| 47 | + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no |
| 48 | + Retry-After header is present. |
| 49 | + """ |
| 50 | + |
| 51 | + def __init__( |
| 52 | + self, |
| 53 | + credential: "TokenCredential", |
| 54 | + subscription_id: str, |
| 55 | + base_url: str = "https://management.azure.com", |
| 56 | + **kwargs: Any |
| 57 | + ) -> None: |
| 58 | + self._config = ElasticSanManagementConfiguration( |
| 59 | + credential=credential, subscription_id=subscription_id, **kwargs |
| 60 | + ) |
| 61 | + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) |
| 62 | + |
| 63 | + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} |
| 64 | + self._serialize = Serializer(client_models) |
| 65 | + self._deserialize = Deserializer(client_models) |
| 66 | + self._serialize.client_side_validation = False |
| 67 | + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) |
| 68 | + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) |
| 69 | + self.elastic_sans = ElasticSansOperations(self._client, self._config, self._serialize, self._deserialize) |
| 70 | + self.volume_groups = VolumeGroupsOperations(self._client, self._config, self._serialize, self._deserialize) |
| 71 | + self.volumes = VolumesOperations(self._client, self._config, self._serialize, self._deserialize) |
| 72 | + |
| 73 | + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: |
| 74 | + """Runs the network request through the client's chained policies. |
| 75 | +
|
| 76 | + >>> from azure.core.rest import HttpRequest |
| 77 | + >>> request = HttpRequest("GET", "https://www.example.org/") |
| 78 | + <HttpRequest [GET], url: 'https://www.example.org/'> |
| 79 | + >>> response = client._send_request(request) |
| 80 | + <HttpResponse: 200 OK> |
| 81 | +
|
| 82 | + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request |
| 83 | +
|
| 84 | + :param request: The network request you want to make. Required. |
| 85 | + :type request: ~azure.core.rest.HttpRequest |
| 86 | + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. |
| 87 | + :return: The response of your network call. Does not do error handling on your response. |
| 88 | + :rtype: ~azure.core.rest.HttpResponse |
| 89 | + """ |
| 90 | + |
| 91 | + request_copy = deepcopy(request) |
| 92 | + request_copy.url = self._client.format_url(request_copy.url) |
| 93 | + return self._client.send_request(request_copy, **kwargs) |
| 94 | + |
| 95 | + def close(self): |
| 96 | + # type: () -> None |
| 97 | + self._client.close() |
| 98 | + |
| 99 | + def __enter__(self): |
| 100 | + # type: () -> ElasticSanManagement |
| 101 | + self._client.__enter__() |
| 102 | + return self |
| 103 | + |
| 104 | + def __exit__(self, *exc_details): |
| 105 | + # type: (Any) -> None |
| 106 | + self._client.__exit__(*exc_details) |
0 commit comments