|
| 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 msrest import Deserializer, Serializer |
| 13 | + |
| 14 | +from azure.core.rest import HttpRequest, HttpResponse |
| 15 | +from azure.mgmt.core import ARMPipelineClient |
| 16 | + |
| 17 | +from . import models |
| 18 | +from ._configuration import DataLakeAnalyticsAccountManagementClientConfiguration |
| 19 | +from .operations import AccountsOperations, ComputePoliciesOperations, DataLakeStoreAccountsOperations, FirewallRulesOperations, LocationsOperations, Operations, StorageAccountsOperations |
| 20 | + |
| 21 | +if TYPE_CHECKING: |
| 22 | + # pylint: disable=unused-import,ungrouped-imports |
| 23 | + from azure.core.credentials import TokenCredential |
| 24 | + |
| 25 | +class DataLakeAnalyticsAccountManagementClient: # pylint: disable=too-many-instance-attributes |
| 26 | + """Creates an Azure Data Lake Analytics account management client. |
| 27 | +
|
| 28 | + :ivar accounts: AccountsOperations operations |
| 29 | + :vartype accounts: azure.mgmt.datalake.analytics.account.operations.AccountsOperations |
| 30 | + :ivar data_lake_store_accounts: DataLakeStoreAccountsOperations operations |
| 31 | + :vartype data_lake_store_accounts: |
| 32 | + azure.mgmt.datalake.analytics.account.operations.DataLakeStoreAccountsOperations |
| 33 | + :ivar storage_accounts: StorageAccountsOperations operations |
| 34 | + :vartype storage_accounts: |
| 35 | + azure.mgmt.datalake.analytics.account.operations.StorageAccountsOperations |
| 36 | + :ivar compute_policies: ComputePoliciesOperations operations |
| 37 | + :vartype compute_policies: |
| 38 | + azure.mgmt.datalake.analytics.account.operations.ComputePoliciesOperations |
| 39 | + :ivar firewall_rules: FirewallRulesOperations operations |
| 40 | + :vartype firewall_rules: |
| 41 | + azure.mgmt.datalake.analytics.account.operations.FirewallRulesOperations |
| 42 | + :ivar operations: Operations operations |
| 43 | + :vartype operations: azure.mgmt.datalake.analytics.account.operations.Operations |
| 44 | + :ivar locations: LocationsOperations operations |
| 45 | + :vartype locations: azure.mgmt.datalake.analytics.account.operations.LocationsOperations |
| 46 | + :param credential: Credential needed for the client to connect to Azure. |
| 47 | + :type credential: ~azure.core.credentials.TokenCredential |
| 48 | + :param subscription_id: Get subscription credentials which uniquely identify Microsoft Azure |
| 49 | + subscription. The subscription ID forms part of the URI for every service call. |
| 50 | + :type subscription_id: str |
| 51 | + :param base_url: Service URL. Default value is "https://management.azure.com". |
| 52 | + :type base_url: str |
| 53 | + :keyword api_version: Api Version. Default value is "2019-11-01-preview". Note that overriding |
| 54 | + this default value may result in unsupported behavior. |
| 55 | + :paramtype api_version: str |
| 56 | + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no |
| 57 | + Retry-After header is present. |
| 58 | + """ |
| 59 | + |
| 60 | + def __init__( |
| 61 | + self, |
| 62 | + credential: "TokenCredential", |
| 63 | + subscription_id: str, |
| 64 | + base_url: str = "https://management.azure.com", |
| 65 | + **kwargs: Any |
| 66 | + ) -> None: |
| 67 | + self._config = DataLakeAnalyticsAccountManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) |
| 68 | + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) |
| 69 | + |
| 70 | + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} |
| 71 | + self._serialize = Serializer(client_models) |
| 72 | + self._deserialize = Deserializer(client_models) |
| 73 | + self._serialize.client_side_validation = False |
| 74 | + self.accounts = AccountsOperations( |
| 75 | + self._client, self._config, self._serialize, self._deserialize |
| 76 | + ) |
| 77 | + self.data_lake_store_accounts = DataLakeStoreAccountsOperations( |
| 78 | + self._client, self._config, self._serialize, self._deserialize |
| 79 | + ) |
| 80 | + self.storage_accounts = StorageAccountsOperations( |
| 81 | + self._client, self._config, self._serialize, self._deserialize |
| 82 | + ) |
| 83 | + self.compute_policies = ComputePoliciesOperations( |
| 84 | + self._client, self._config, self._serialize, self._deserialize |
| 85 | + ) |
| 86 | + self.firewall_rules = FirewallRulesOperations( |
| 87 | + self._client, self._config, self._serialize, self._deserialize |
| 88 | + ) |
| 89 | + self.operations = Operations( |
| 90 | + self._client, self._config, self._serialize, self._deserialize |
| 91 | + ) |
| 92 | + self.locations = LocationsOperations( |
| 93 | + self._client, self._config, self._serialize, self._deserialize |
| 94 | + ) |
| 95 | + |
| 96 | + |
| 97 | + def _send_request( |
| 98 | + self, |
| 99 | + request: HttpRequest, |
| 100 | + **kwargs: Any |
| 101 | + ) -> HttpResponse: |
| 102 | + """Runs the network request through the client's chained policies. |
| 103 | +
|
| 104 | + >>> from azure.core.rest import HttpRequest |
| 105 | + >>> request = HttpRequest("GET", "https://www.example.org/") |
| 106 | + <HttpRequest [GET], url: 'https://www.example.org/'> |
| 107 | + >>> response = client._send_request(request) |
| 108 | + <HttpResponse: 200 OK> |
| 109 | +
|
| 110 | + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart |
| 111 | +
|
| 112 | + :param request: The network request you want to make. Required. |
| 113 | + :type request: ~azure.core.rest.HttpRequest |
| 114 | + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. |
| 115 | + :return: The response of your network call. Does not do error handling on your response. |
| 116 | + :rtype: ~azure.core.rest.HttpResponse |
| 117 | + """ |
| 118 | + |
| 119 | + request_copy = deepcopy(request) |
| 120 | + request_copy.url = self._client.format_url(request_copy.url) |
| 121 | + return self._client.send_request(request_copy, **kwargs) |
| 122 | + |
| 123 | + def close(self): |
| 124 | + # type: () -> None |
| 125 | + self._client.close() |
| 126 | + |
| 127 | + def __enter__(self): |
| 128 | + # type: () -> DataLakeAnalyticsAccountManagementClient |
| 129 | + self._client.__enter__() |
| 130 | + return self |
| 131 | + |
| 132 | + def __exit__(self, *exc_details): |
| 133 | + # type: (Any) -> None |
| 134 | + self._client.__exit__(*exc_details) |
0 commit comments