From 77b9212b976072c093d5ab7110f9f3c42351dd8d Mon Sep 17 00:00:00 2001 From: PythonSdkPipelines Date: Wed, 27 Jul 2022 07:38:11 +0000 Subject: [PATCH 1/4] code and test --- .../CHANGELOG.md | 5 + .../azure-mgmt-datalake-analytics/LICENSE | 21 + .../azure-mgmt-datalake-analytics/MANIFEST.in | 8 + .../azure-mgmt-datalake-analytics/README.md | 30 + .../azure-mgmt-datalake-analytics/_meta.json | 11 + .../azure/__init__.py | 1 + .../azure/mgmt/__init__.py | 1 + .../azure/mgmt/datalake/__init__.py | 1 + .../datalake/analytics/account/__init__.py | 23 + .../analytics/account/_configuration.py | 74 + ...ake_analytics_account_management_client.py | 134 + .../mgmt/datalake/analytics/account/_patch.py | 19 + .../datalake/analytics/account/_vendor.py | 27 + .../datalake/analytics/account/_version.py | 9 + .../analytics/account/aio/__init__.py | 20 + .../analytics/account/aio/_configuration.py | 73 + ...ake_analytics_account_management_client.py | 131 + .../datalake/analytics/account/aio/_patch.py | 19 + .../account/aio/operations/__init__.py | 30 + .../aio/operations/_accounts_operations.py | 838 +++++ .../_compute_policies_operations.py | 426 +++ .../_data_lake_store_accounts_operations.py | 382 +++ .../operations/_firewall_rules_operations.py | 423 +++ .../aio/operations/_locations_operations.py | 106 + .../account/aio/operations/_operations.py | 98 + .../account/aio/operations/_patch.py | 19 + .../_storage_accounts_operations.py | 731 ++++ .../analytics/account/models/__init__.py | 149 + ...alytics_account_management_client_enums.py | 113 + .../analytics/account/models/_models_py3.py | 2946 +++++++++++++++++ .../analytics/account/models/_patch.py | 19 + .../analytics/account/operations/__init__.py | 30 + .../operations/_accounts_operations.py | 1153 +++++++ .../_compute_policies_operations.py | 637 ++++ .../_data_lake_store_accounts_operations.py | 565 ++++ .../operations/_firewall_rules_operations.py | 634 ++++ .../operations/_locations_operations.py | 144 + .../account/operations/_operations.py | 128 + .../analytics/account/operations/_patch.py | 19 + .../_storage_accounts_operations.py | 1082 ++++++ .../mgmt/datalake/analytics/account/py.typed | 1 + .../sdk_packaging.toml | 9 + .../azure-mgmt-datalake-analytics/setup.py | 78 + shared_requirements.txt | 2 + 44 files changed, 11369 insertions(+) create mode 100644 sdk/datalake/azure-mgmt-datalake-analytics/CHANGELOG.md create mode 100644 sdk/datalake/azure-mgmt-datalake-analytics/LICENSE create mode 100644 sdk/datalake/azure-mgmt-datalake-analytics/MANIFEST.in create mode 100644 sdk/datalake/azure-mgmt-datalake-analytics/README.md create mode 100644 sdk/datalake/azure-mgmt-datalake-analytics/_meta.json create mode 100644 sdk/datalake/azure-mgmt-datalake-analytics/azure/__init__.py create mode 100644 sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/__init__.py create mode 100644 sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/__init__.py create mode 100644 sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/__init__.py create mode 100644 sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/_configuration.py create mode 100644 sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/_data_lake_analytics_account_management_client.py create mode 100644 sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/_patch.py create mode 100644 sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/_vendor.py create mode 100644 sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/_version.py create mode 100644 sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/__init__.py create mode 100644 sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/_configuration.py create mode 100644 sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/_data_lake_analytics_account_management_client.py create mode 100644 sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/_patch.py create mode 100644 sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/operations/__init__.py create mode 100644 sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/operations/_accounts_operations.py create mode 100644 sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/operations/_compute_policies_operations.py create mode 100644 sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/operations/_data_lake_store_accounts_operations.py create mode 100644 sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/operations/_firewall_rules_operations.py create mode 100644 sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/operations/_locations_operations.py create mode 100644 sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/operations/_operations.py create mode 100644 sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/operations/_patch.py create mode 100644 sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/operations/_storage_accounts_operations.py create mode 100644 sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/models/__init__.py create mode 100644 sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/models/_data_lake_analytics_account_management_client_enums.py create mode 100644 sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/models/_models_py3.py create mode 100644 sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/models/_patch.py create mode 100644 sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/operations/__init__.py create mode 100644 sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/operations/_accounts_operations.py create mode 100644 sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/operations/_compute_policies_operations.py create mode 100644 sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/operations/_data_lake_store_accounts_operations.py create mode 100644 sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/operations/_firewall_rules_operations.py create mode 100644 sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/operations/_locations_operations.py create mode 100644 sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/operations/_operations.py create mode 100644 sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/operations/_patch.py create mode 100644 sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/operations/_storage_accounts_operations.py create mode 100644 sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/py.typed create mode 100644 sdk/datalake/azure-mgmt-datalake-analytics/sdk_packaging.toml create mode 100644 sdk/datalake/azure-mgmt-datalake-analytics/setup.py diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/CHANGELOG.md b/sdk/datalake/azure-mgmt-datalake-analytics/CHANGELOG.md new file mode 100644 index 000000000000..07917379dcbf --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0b1 (2022-07-27) + +* Initial Release diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/LICENSE b/sdk/datalake/azure-mgmt-datalake-analytics/LICENSE new file mode 100644 index 000000000000..b2f52a2bad4e --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/LICENSE @@ -0,0 +1,21 @@ +Copyright (c) Microsoft Corporation. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/MANIFEST.in b/sdk/datalake/azure-mgmt-datalake-analytics/MANIFEST.in new file mode 100644 index 000000000000..44519abd3225 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/MANIFEST.in @@ -0,0 +1,8 @@ +include _meta.json +recursive-include tests *.py *.json +include *.md +include azure/__init__.py +include azure/mgmt/__init__.py +include azure/mgmt/datalake/__init__.py +include LICENSE +include azure/mgmt/datalake/analytics/py.typed diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/README.md b/sdk/datalake/azure-mgmt-datalake-analytics/README.md new file mode 100644 index 000000000000..a4a9d1a4a258 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/README.md @@ -0,0 +1,30 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure Datalake-analytics Management Client Library. +This package has been tested with Python 3.7+. +For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). + +## _Disclaimer_ + +_Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_ + +# Usage + + +To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) + + + +For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) +Code samples for this package can be found at [Datalake-analytics Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. +Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +# Provide Feedback + +If you encounter any bugs or have suggestions, please file an issue in the +[Issues](https://github.com/Azure/azure-sdk-for-python/issues) +section of the project. + + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-datalake-analytics%2FREADME.png) diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/_meta.json b/sdk/datalake/azure-mgmt-datalake-analytics/_meta.json new file mode 100644 index 000000000000..149dde211d75 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/_meta.json @@ -0,0 +1,11 @@ +{ + "autorest": "3.7.2", + "use": [ + "@autorest/python@5.16.0", + "@autorest/modelerfour@4.19.3" + ], + "commit": "d8bad7cbba37e83cf0c5d2026360d0fd4971b2fe", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/datalake-analytics/resource-manager/readme.md --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.16.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", + "readme": "specification/datalake-analytics/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/azure/__init__.py b/sdk/datalake/azure-mgmt-datalake-analytics/azure/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/__init__.py b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/__init__.py b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/__init__.py b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/__init__.py new file mode 100644 index 000000000000..76660aee26d7 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/__init__.py @@ -0,0 +1,23 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._data_lake_analytics_account_management_client import DataLakeAnalyticsAccountManagementClient +from ._version import VERSION + +__version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk +__all__ = ['DataLakeAnalyticsAccountManagementClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/_configuration.py b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/_configuration.py new file mode 100644 index 000000000000..bfd009f71f57 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/_configuration.py @@ -0,0 +1,74 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class DataLakeAnalyticsAccountManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for DataLakeAnalyticsAccountManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Get subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2019-11-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(DataLakeAnalyticsAccountManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2019-11-01-preview") # type: str + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-datalake-analytics/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/_data_lake_analytics_account_management_client.py b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/_data_lake_analytics_account_management_client.py new file mode 100644 index 000000000000..545a9291b851 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/_data_lake_analytics_account_management_client.py @@ -0,0 +1,134 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer + +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient + +from . import models +from ._configuration import DataLakeAnalyticsAccountManagementClientConfiguration +from .operations import AccountsOperations, ComputePoliciesOperations, DataLakeStoreAccountsOperations, FirewallRulesOperations, LocationsOperations, Operations, StorageAccountsOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + +class DataLakeAnalyticsAccountManagementClient: # pylint: disable=too-many-instance-attributes + """Creates an Azure Data Lake Analytics account management client. + + :ivar accounts: AccountsOperations operations + :vartype accounts: azure.mgmt.datalake.analytics.account.operations.AccountsOperations + :ivar data_lake_store_accounts: DataLakeStoreAccountsOperations operations + :vartype data_lake_store_accounts: + azure.mgmt.datalake.analytics.account.operations.DataLakeStoreAccountsOperations + :ivar storage_accounts: StorageAccountsOperations operations + :vartype storage_accounts: + azure.mgmt.datalake.analytics.account.operations.StorageAccountsOperations + :ivar compute_policies: ComputePoliciesOperations operations + :vartype compute_policies: + azure.mgmt.datalake.analytics.account.operations.ComputePoliciesOperations + :ivar firewall_rules: FirewallRulesOperations operations + :vartype firewall_rules: + azure.mgmt.datalake.analytics.account.operations.FirewallRulesOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.datalake.analytics.account.operations.Operations + :ivar locations: LocationsOperations operations + :vartype locations: azure.mgmt.datalake.analytics.account.operations.LocationsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Get subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2019-11-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = DataLakeAnalyticsAccountManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.accounts = AccountsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.data_lake_store_accounts = DataLakeStoreAccountsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.storage_accounts = StorageAccountsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.compute_policies = ComputePoliciesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.firewall_rules = FirewallRulesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.locations = LocationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> DataLakeAnalyticsAccountManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/_patch.py b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/_vendor.py b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/_version.py b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/__init__.py b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/__init__.py new file mode 100644 index 000000000000..09a62e02708c --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/__init__.py @@ -0,0 +1,20 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._data_lake_analytics_account_management_client import DataLakeAnalyticsAccountManagementClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk +__all__ = ['DataLakeAnalyticsAccountManagementClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/_configuration.py b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/_configuration.py new file mode 100644 index 000000000000..9688ee3647a9 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/_configuration.py @@ -0,0 +1,73 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class DataLakeAnalyticsAccountManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for DataLakeAnalyticsAccountManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Get subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2019-11-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(DataLakeAnalyticsAccountManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2019-11-01-preview") # type: str + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-datalake-analytics/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/_data_lake_analytics_account_management_client.py b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/_data_lake_analytics_account_management_client.py new file mode 100644 index 000000000000..a064f3e9a542 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/_data_lake_analytics_account_management_client.py @@ -0,0 +1,131 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer + +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient + +from .. import models +from ._configuration import DataLakeAnalyticsAccountManagementClientConfiguration +from .operations import AccountsOperations, ComputePoliciesOperations, DataLakeStoreAccountsOperations, FirewallRulesOperations, LocationsOperations, Operations, StorageAccountsOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +class DataLakeAnalyticsAccountManagementClient: # pylint: disable=too-many-instance-attributes + """Creates an Azure Data Lake Analytics account management client. + + :ivar accounts: AccountsOperations operations + :vartype accounts: azure.mgmt.datalake.analytics.account.aio.operations.AccountsOperations + :ivar data_lake_store_accounts: DataLakeStoreAccountsOperations operations + :vartype data_lake_store_accounts: + azure.mgmt.datalake.analytics.account.aio.operations.DataLakeStoreAccountsOperations + :ivar storage_accounts: StorageAccountsOperations operations + :vartype storage_accounts: + azure.mgmt.datalake.analytics.account.aio.operations.StorageAccountsOperations + :ivar compute_policies: ComputePoliciesOperations operations + :vartype compute_policies: + azure.mgmt.datalake.analytics.account.aio.operations.ComputePoliciesOperations + :ivar firewall_rules: FirewallRulesOperations operations + :vartype firewall_rules: + azure.mgmt.datalake.analytics.account.aio.operations.FirewallRulesOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.datalake.analytics.account.aio.operations.Operations + :ivar locations: LocationsOperations operations + :vartype locations: azure.mgmt.datalake.analytics.account.aio.operations.LocationsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Get subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2019-11-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = DataLakeAnalyticsAccountManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.accounts = AccountsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.data_lake_store_accounts = DataLakeStoreAccountsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.storage_accounts = StorageAccountsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.compute_policies = ComputePoliciesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.firewall_rules = FirewallRulesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.locations = LocationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "DataLakeAnalyticsAccountManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/_patch.py b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/operations/__init__.py b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/operations/__init__.py new file mode 100644 index 000000000000..44eab672879e --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/operations/__init__.py @@ -0,0 +1,30 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._accounts_operations import AccountsOperations +from ._data_lake_store_accounts_operations import DataLakeStoreAccountsOperations +from ._storage_accounts_operations import StorageAccountsOperations +from ._compute_policies_operations import ComputePoliciesOperations +from ._firewall_rules_operations import FirewallRulesOperations +from ._operations import Operations +from ._locations_operations import LocationsOperations + +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk +__all__ = [ + 'AccountsOperations', + 'DataLakeStoreAccountsOperations', + 'StorageAccountsOperations', + 'ComputePoliciesOperations', + 'FirewallRulesOperations', + 'Operations', + 'LocationsOperations', +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/operations/_accounts_operations.py b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/operations/_accounts_operations.py new file mode 100644 index 000000000000..324e153fa282 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/operations/_accounts_operations.py @@ -0,0 +1,838 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._accounts_operations import build_check_name_availability_request, build_create_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AccountsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.datalake.analytics.account.aio.DataLakeAnalyticsAccountManagementClient`'s + :attr:`accounts` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace + def list( + self, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + select: Optional[str] = None, + orderby: Optional[str] = None, + count: Optional[bool] = None, + **kwargs: Any + ) -> AsyncIterable[_models.DataLakeAnalyticsAccountListResult]: + """Gets the first page of Data Lake Analytics accounts, if any, within the current subscription. + This includes a link to the next page, if any. + + :param filter: OData filter. Optional. Default value is None. + :type filter: str + :param top: The number of items to return. Optional. Default value is None. + :type top: int + :param skip: The number of items to skip over before returning elements. Optional. Default + value is None. + :type skip: int + :param select: OData Select statement. Limits the properties on each entry to just those + requested, e.g. Categories?$select=CategoryName,Description. Optional. Default value is None. + :type select: str + :param orderby: OrderBy clause. One or more comma-separated expressions with an optional "asc" + (the default) or "desc" depending on the order you'd like the values sorted, e.g. + Categories?$orderby=CategoryName desc. Optional. Default value is None. + :type orderby: str + :param count: The Boolean value of true or false to request a count of the matching resources + included with the resources in the response, e.g. Categories?$count=true. Optional. Default + value is None. + :type count: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DataLakeAnalyticsAccountListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.datalake.analytics.account.models.DataLakeAnalyticsAccountListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DataLakeAnalyticsAccountListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + filter=filter, + top=top, + skip=skip, + select=select, + orderby=orderby, + count=count, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + filter=filter, + top=top, + skip=skip, + select=select, + orderby=orderby, + count=count, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DataLakeAnalyticsAccountListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.DataLakeAnalytics/accounts"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + select: Optional[str] = None, + orderby: Optional[str] = None, + count: Optional[bool] = None, + **kwargs: Any + ) -> AsyncIterable[_models.DataLakeAnalyticsAccountListResult]: + """Gets the first page of Data Lake Analytics accounts, if any, within a specific resource group. + This includes a link to the next page, if any. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param filter: OData filter. Optional. Default value is None. + :type filter: str + :param top: The number of items to return. Optional. Default value is None. + :type top: int + :param skip: The number of items to skip over before returning elements. Optional. Default + value is None. + :type skip: int + :param select: OData Select statement. Limits the properties on each entry to just those + requested, e.g. Categories?$select=CategoryName,Description. Optional. Default value is None. + :type select: str + :param orderby: OrderBy clause. One or more comma-separated expressions with an optional "asc" + (the default) or "desc" depending on the order you'd like the values sorted, e.g. + Categories?$orderby=CategoryName desc. Optional. Default value is None. + :type orderby: str + :param count: The Boolean value of true or false to request a count of the matching resources + included with the resources in the response, e.g. Categories?$count=true. Optional. Default + value is None. + :type count: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DataLakeAnalyticsAccountListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.datalake.analytics.account.models.DataLakeAnalyticsAccountListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DataLakeAnalyticsAccountListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + filter=filter, + top=top, + skip=skip, + select=select, + orderby=orderby, + count=count, + template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + filter=filter, + top=top, + skip=skip, + select=select, + orderby=orderby, + count=count, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DataLakeAnalyticsAccountListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts"} # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + account_name: str, + parameters: _models.CreateDataLakeAnalyticsAccountParameters, + **kwargs: Any + ) -> _models.DataLakeAnalyticsAccount: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.DataLakeAnalyticsAccount] + + _json = self._serialize.body(parameters, 'CreateDataLakeAnalyticsAccountParameters') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DataLakeAnalyticsAccount', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DataLakeAnalyticsAccount', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}"} # type: ignore + + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + account_name: str, + parameters: _models.CreateDataLakeAnalyticsAccountParameters, + **kwargs: Any + ) -> AsyncLROPoller[_models.DataLakeAnalyticsAccount]: + """Creates the specified Data Lake Analytics account. This supplies the user with computation + services for Data Lake Analytics workloads. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :param parameters: Parameters supplied to create a new Data Lake Analytics account. + :type parameters: + ~azure.mgmt.datalake.analytics.account.models.CreateDataLakeAnalyticsAccountParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DataLakeAnalyticsAccount or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.datalake.analytics.account.models.DataLakeAnalyticsAccount] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.DataLakeAnalyticsAccount] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_initial( # type: ignore + resource_group_name=resource_group_name, + account_name=account_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DataLakeAnalyticsAccount', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> _models.DataLakeAnalyticsAccount: + """Gets details of the specified Data Lake Analytics account. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataLakeAnalyticsAccount, or the result of cls(response) + :rtype: ~azure.mgmt.datalake.analytics.account.models.DataLakeAnalyticsAccount + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DataLakeAnalyticsAccount] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataLakeAnalyticsAccount', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}"} # type: ignore + + + async def _update_initial( + self, + resource_group_name: str, + account_name: str, + parameters: Optional[_models.UpdateDataLakeAnalyticsAccountParameters] = None, + **kwargs: Any + ) -> _models.DataLakeAnalyticsAccount: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.DataLakeAnalyticsAccount] + + if parameters is not None: + _json = self._serialize.body(parameters, 'UpdateDataLakeAnalyticsAccountParameters') + else: + _json = None + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DataLakeAnalyticsAccount', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DataLakeAnalyticsAccount', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('DataLakeAnalyticsAccount', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}"} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + account_name: str, + parameters: Optional[_models.UpdateDataLakeAnalyticsAccountParameters] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.DataLakeAnalyticsAccount]: + """Updates the Data Lake Analytics account object specified by the accountName with the contents + of the account object. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :param parameters: Parameters supplied to the update Data Lake Analytics account operation. + Default value is None. + :type parameters: + ~azure.mgmt.datalake.analytics.account.models.UpdateDataLakeAnalyticsAccountParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DataLakeAnalyticsAccount or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.datalake.analytics.account.models.DataLakeAnalyticsAccount] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.DataLakeAnalyticsAccount] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( # type: ignore + resource_group_name=resource_group_name, + account_name=account_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DataLakeAnalyticsAccount', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Begins the delete process for the Data Lake Analytics account object specified by the account + name. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + account_name=account_name, + api_version=api_version, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}"} # type: ignore + + @distributed_trace_async + async def check_name_availability( + self, + location: str, + parameters: _models.CheckNameAvailabilityParameters, + **kwargs: Any + ) -> _models.NameAvailabilityInformation: + """Checks whether the specified account name is available or taken. + + :param location: The resource location without whitespace. + :type location: str + :param parameters: Parameters supplied to check the Data Lake Analytics account name + availability. + :type parameters: ~azure.mgmt.datalake.analytics.account.models.CheckNameAvailabilityParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailabilityInformation, or the result of cls(response) + :rtype: ~azure.mgmt.datalake.analytics.account.models.NameAvailabilityInformation + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.NameAvailabilityInformation] + + _json = self._serialize.body(parameters, 'CheckNameAvailabilityParameters') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + location=location, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NameAvailabilityInformation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.DataLakeAnalytics/locations/{location}/checkNameAvailability"} # type: ignore + diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/operations/_compute_policies_operations.py b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/operations/_compute_policies_operations.py new file mode 100644 index 000000000000..5fd3e3ac4c05 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/operations/_compute_policies_operations.py @@ -0,0 +1,426 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._compute_policies_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_account_request, build_update_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ComputePoliciesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.datalake.analytics.account.aio.DataLakeAnalyticsAccountManagementClient`'s + :attr:`compute_policies` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace + def list_by_account( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> AsyncIterable[_models.ComputePolicyListResult]: + """Lists the Data Lake Analytics compute policies within the specified Data Lake Analytics + account. An account supports, at most, 50 policies. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ComputePolicyListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.datalake.analytics.account.models.ComputePolicyListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ComputePolicyListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_account_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + api_version=api_version, + template_url=self.list_by_account.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_by_account_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ComputePolicyListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/computePolicies"} # type: ignore + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + account_name: str, + compute_policy_name: str, + parameters: _models.CreateOrUpdateComputePolicyParameters, + **kwargs: Any + ) -> _models.ComputePolicy: + """Creates or updates the specified compute policy. During update, the compute policy with the + specified name will be replaced with this new compute policy. An account supports, at most, 50 + policies. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :param compute_policy_name: The name of the compute policy to create or update. + :type compute_policy_name: str + :param parameters: Parameters supplied to create or update the compute policy. The max degree + of parallelism per job property, min priority per job property, or both must be present. + :type parameters: + ~azure.mgmt.datalake.analytics.account.models.CreateOrUpdateComputePolicyParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ComputePolicy, or the result of cls(response) + :rtype: ~azure.mgmt.datalake.analytics.account.models.ComputePolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ComputePolicy] + + _json = self._serialize.body(parameters, 'CreateOrUpdateComputePolicyParameters') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + compute_policy_name=compute_policy_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ComputePolicy', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/computePolicies/{computePolicyName}"} # type: ignore + + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + account_name: str, + compute_policy_name: str, + **kwargs: Any + ) -> _models.ComputePolicy: + """Gets the specified Data Lake Analytics compute policy. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :param compute_policy_name: The name of the compute policy to retrieve. + :type compute_policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ComputePolicy, or the result of cls(response) + :rtype: ~azure.mgmt.datalake.analytics.account.models.ComputePolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ComputePolicy] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + compute_policy_name=compute_policy_name, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ComputePolicy', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/computePolicies/{computePolicyName}"} # type: ignore + + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + account_name: str, + compute_policy_name: str, + parameters: Optional[_models.UpdateComputePolicyParameters] = None, + **kwargs: Any + ) -> _models.ComputePolicy: + """Updates the specified compute policy. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :param compute_policy_name: The name of the compute policy to update. + :type compute_policy_name: str + :param parameters: Parameters supplied to update the compute policy. Default value is None. + :type parameters: ~azure.mgmt.datalake.analytics.account.models.UpdateComputePolicyParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ComputePolicy, or the result of cls(response) + :rtype: ~azure.mgmt.datalake.analytics.account.models.ComputePolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ComputePolicy] + + if parameters is not None: + _json = self._serialize.body(parameters, 'UpdateComputePolicyParameters') + else: + _json = None + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + compute_policy_name=compute_policy_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ComputePolicy', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/computePolicies/{computePolicyName}"} # type: ignore + + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + account_name: str, + compute_policy_name: str, + **kwargs: Any + ) -> None: + """Deletes the specified compute policy from the specified Data Lake Analytics account. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :param compute_policy_name: The name of the compute policy to delete. + :type compute_policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + compute_policy_name=compute_policy_name, + api_version=api_version, + template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/computePolicies/{computePolicyName}"} # type: ignore + diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/operations/_data_lake_store_accounts_operations.py b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/operations/_data_lake_store_accounts_operations.py new file mode 100644 index 000000000000..d379a4fe6569 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/operations/_data_lake_store_accounts_operations.py @@ -0,0 +1,382 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._data_lake_store_accounts_operations import build_add_request, build_delete_request, build_get_request, build_list_by_account_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DataLakeStoreAccountsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.datalake.analytics.account.aio.DataLakeAnalyticsAccountManagementClient`'s + :attr:`data_lake_store_accounts` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace + def list_by_account( + self, + resource_group_name: str, + account_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + select: Optional[str] = None, + orderby: Optional[str] = None, + count: Optional[bool] = None, + **kwargs: Any + ) -> AsyncIterable[_models.DataLakeStoreAccountInformationListResult]: + """Gets the first page of Data Lake Store accounts linked to the specified Data Lake Analytics + account. The response includes a link to the next page, if any. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :param filter: OData filter. Optional. Default value is None. + :type filter: str + :param top: The number of items to return. Optional. Default value is None. + :type top: int + :param skip: The number of items to skip over before returning elements. Optional. Default + value is None. + :type skip: int + :param select: OData Select statement. Limits the properties on each entry to just those + requested, e.g. Categories?$select=CategoryName,Description. Optional. Default value is None. + :type select: str + :param orderby: OrderBy clause. One or more comma-separated expressions with an optional "asc" + (the default) or "desc" depending on the order you'd like the values sorted, e.g. + Categories?$orderby=CategoryName desc. Optional. Default value is None. + :type orderby: str + :param count: The Boolean value of true or false to request a count of the matching resources + included with the resources in the response, e.g. Categories?$count=true. Optional. Default + value is None. + :type count: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DataLakeStoreAccountInformationListResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.datalake.analytics.account.models.DataLakeStoreAccountInformationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DataLakeStoreAccountInformationListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_account_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + api_version=api_version, + filter=filter, + top=top, + skip=skip, + select=select, + orderby=orderby, + count=count, + template_url=self.list_by_account.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_by_account_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + api_version=api_version, + filter=filter, + top=top, + skip=skip, + select=select, + orderby=orderby, + count=count, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DataLakeStoreAccountInformationListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/dataLakeStoreAccounts"} # type: ignore + + @distributed_trace_async + async def add( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + account_name: str, + data_lake_store_account_name: str, + parameters: Optional[_models.AddDataLakeStoreParameters] = None, + **kwargs: Any + ) -> None: + """Updates the specified Data Lake Analytics account to include the additional Data Lake Store + account. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :param data_lake_store_account_name: The name of the Data Lake Store account to add. + :type data_lake_store_account_name: str + :param parameters: The details of the Data Lake Store account. Default value is None. + :type parameters: ~azure.mgmt.datalake.analytics.account.models.AddDataLakeStoreParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] + + if parameters is not None: + _json = self._serialize.body(parameters, 'AddDataLakeStoreParameters') + else: + _json = None + + request = build_add_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + data_lake_store_account_name=data_lake_store_account_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.add.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + add.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/dataLakeStoreAccounts/{dataLakeStoreAccountName}"} # type: ignore + + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + account_name: str, + data_lake_store_account_name: str, + **kwargs: Any + ) -> _models.DataLakeStoreAccountInformation: + """Gets the specified Data Lake Store account details in the specified Data Lake Analytics + account. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :param data_lake_store_account_name: The name of the Data Lake Store account to retrieve. + :type data_lake_store_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataLakeStoreAccountInformation, or the result of cls(response) + :rtype: ~azure.mgmt.datalake.analytics.account.models.DataLakeStoreAccountInformation + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DataLakeStoreAccountInformation] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + data_lake_store_account_name=data_lake_store_account_name, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataLakeStoreAccountInformation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/dataLakeStoreAccounts/{dataLakeStoreAccountName}"} # type: ignore + + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + account_name: str, + data_lake_store_account_name: str, + **kwargs: Any + ) -> None: + """Updates the Data Lake Analytics account specified to remove the specified Data Lake Store + account. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :param data_lake_store_account_name: The name of the Data Lake Store account to remove. + :type data_lake_store_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + data_lake_store_account_name=data_lake_store_account_name, + api_version=api_version, + template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/dataLakeStoreAccounts/{dataLakeStoreAccountName}"} # type: ignore + diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/operations/_firewall_rules_operations.py b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/operations/_firewall_rules_operations.py new file mode 100644 index 000000000000..0568527ab8f4 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/operations/_firewall_rules_operations.py @@ -0,0 +1,423 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._firewall_rules_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_account_request, build_update_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class FirewallRulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.datalake.analytics.account.aio.DataLakeAnalyticsAccountManagementClient`'s + :attr:`firewall_rules` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace + def list_by_account( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> AsyncIterable[_models.FirewallRuleListResult]: + """Lists the Data Lake Analytics firewall rules within the specified Data Lake Analytics account. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FirewallRuleListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.datalake.analytics.account.models.FirewallRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.FirewallRuleListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_account_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + api_version=api_version, + template_url=self.list_by_account.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_by_account_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("FirewallRuleListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/firewallRules"} # type: ignore + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + account_name: str, + firewall_rule_name: str, + parameters: _models.CreateOrUpdateFirewallRuleParameters, + **kwargs: Any + ) -> _models.FirewallRule: + """Creates or updates the specified firewall rule. During update, the firewall rule with the + specified name will be replaced with this new firewall rule. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :param firewall_rule_name: The name of the firewall rule to create or update. + :type firewall_rule_name: str + :param parameters: Parameters supplied to create or update the firewall rule. + :type parameters: + ~azure.mgmt.datalake.analytics.account.models.CreateOrUpdateFirewallRuleParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FirewallRule, or the result of cls(response) + :rtype: ~azure.mgmt.datalake.analytics.account.models.FirewallRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.FirewallRule] + + _json = self._serialize.body(parameters, 'CreateOrUpdateFirewallRuleParameters') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + firewall_rule_name=firewall_rule_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FirewallRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/firewallRules/{firewallRuleName}"} # type: ignore + + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + account_name: str, + firewall_rule_name: str, + **kwargs: Any + ) -> _models.FirewallRule: + """Gets the specified Data Lake Analytics firewall rule. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :param firewall_rule_name: The name of the firewall rule to retrieve. + :type firewall_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FirewallRule, or the result of cls(response) + :rtype: ~azure.mgmt.datalake.analytics.account.models.FirewallRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.FirewallRule] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + firewall_rule_name=firewall_rule_name, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FirewallRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/firewallRules/{firewallRuleName}"} # type: ignore + + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + account_name: str, + firewall_rule_name: str, + parameters: Optional[_models.UpdateFirewallRuleParameters] = None, + **kwargs: Any + ) -> _models.FirewallRule: + """Updates the specified firewall rule. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :param firewall_rule_name: The name of the firewall rule to update. + :type firewall_rule_name: str + :param parameters: Parameters supplied to update the firewall rule. Default value is None. + :type parameters: ~azure.mgmt.datalake.analytics.account.models.UpdateFirewallRuleParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FirewallRule, or the result of cls(response) + :rtype: ~azure.mgmt.datalake.analytics.account.models.FirewallRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.FirewallRule] + + if parameters is not None: + _json = self._serialize.body(parameters, 'UpdateFirewallRuleParameters') + else: + _json = None + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + firewall_rule_name=firewall_rule_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FirewallRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/firewallRules/{firewallRuleName}"} # type: ignore + + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + account_name: str, + firewall_rule_name: str, + **kwargs: Any + ) -> None: + """Deletes the specified firewall rule from the specified Data Lake Analytics account. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :param firewall_rule_name: The name of the firewall rule to delete. + :type firewall_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + firewall_rule_name=firewall_rule_name, + api_version=api_version, + template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/firewallRules/{firewallRuleName}"} # type: ignore + diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/operations/_locations_operations.py b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/operations/_locations_operations.py new file mode 100644 index 000000000000..3ab8f4645977 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/operations/_locations_operations.py @@ -0,0 +1,106 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._locations_operations import build_get_capability_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class LocationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.datalake.analytics.account.aio.DataLakeAnalyticsAccountManagementClient`'s + :attr:`locations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace_async + async def get_capability( + self, + location: str, + **kwargs: Any + ) -> Optional[_models.CapabilityInformation]: + """Gets subscription-level properties and limits for Data Lake Analytics specified by resource + location. + + :param location: The resource location without whitespace. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CapabilityInformation, or the result of cls(response) + :rtype: ~azure.mgmt.datalake.analytics.account.models.CapabilityInformation or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.CapabilityInformation]] + + + request = build_get_capability_request( + subscription_id=self._config.subscription_id, + location=location, + api_version=api_version, + template_url=self.get_capability.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('CapabilityInformation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_capability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.DataLakeAnalytics/locations/{location}/capability"} # type: ignore + diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/operations/_operations.py b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/operations/_operations.py new file mode 100644 index 000000000000..ef83f46b87f2 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/operations/_operations.py @@ -0,0 +1,98 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operations import build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.datalake.analytics.account.aio.DataLakeAnalyticsAccountManagementClient`'s + :attr:`operations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace_async + async def list( + self, + **kwargs: Any + ) -> _models.OperationListResult: + """Lists all of the available Data Lake Analytics REST API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationListResult, or the result of cls(response) + :rtype: ~azure.mgmt.datalake.analytics.account.models.OperationListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('OperationListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = {'url': "/providers/Microsoft.DataLakeAnalytics/operations"} # type: ignore + diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/operations/_patch.py b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/operations/_storage_accounts_operations.py b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/operations/_storage_accounts_operations.py new file mode 100644 index 000000000000..57a319665d5e --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/aio/operations/_storage_accounts_operations.py @@ -0,0 +1,731 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._storage_accounts_operations import build_add_request, build_delete_request, build_get_request, build_get_storage_container_request, build_list_by_account_request, build_list_sas_tokens_request, build_list_storage_containers_request, build_update_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class StorageAccountsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.datalake.analytics.account.aio.DataLakeAnalyticsAccountManagementClient`'s + :attr:`storage_accounts` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace + def list_by_account( + self, + resource_group_name: str, + account_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + select: Optional[str] = None, + orderby: Optional[str] = None, + count: Optional[bool] = None, + **kwargs: Any + ) -> AsyncIterable[_models.StorageAccountInformationListResult]: + """Gets the first page of Azure Storage accounts, if any, linked to the specified Data Lake + Analytics account. The response includes a link to the next page, if any. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :param filter: The OData filter. Optional. Default value is None. + :type filter: str + :param top: The number of items to return. Optional. Default value is None. + :type top: int + :param skip: The number of items to skip over before returning elements. Optional. Default + value is None. + :type skip: int + :param select: OData Select statement. Limits the properties on each entry to just those + requested, e.g. Categories?$select=CategoryName,Description. Optional. Default value is None. + :type select: str + :param orderby: OrderBy clause. One or more comma-separated expressions with an optional "asc" + (the default) or "desc" depending on the order you'd like the values sorted, e.g. + Categories?$orderby=CategoryName desc. Optional. Default value is None. + :type orderby: str + :param count: The Boolean value of true or false to request a count of the matching resources + included with the resources in the response, e.g. Categories?$count=true. Optional. Default + value is None. + :type count: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StorageAccountInformationListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.datalake.analytics.account.models.StorageAccountInformationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.StorageAccountInformationListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_account_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + api_version=api_version, + filter=filter, + top=top, + skip=skip, + select=select, + orderby=orderby, + count=count, + template_url=self.list_by_account.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_by_account_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + api_version=api_version, + filter=filter, + top=top, + skip=skip, + select=select, + orderby=orderby, + count=count, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("StorageAccountInformationListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/storageAccounts"} # type: ignore + + @distributed_trace_async + async def add( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + account_name: str, + storage_account_name: str, + parameters: _models.AddStorageAccountParameters, + **kwargs: Any + ) -> None: + """Updates the specified Data Lake Analytics account to add an Azure Storage account. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :param storage_account_name: The name of the Azure Storage account to add. + :type storage_account_name: str + :param parameters: The parameters containing the access key and optional suffix for the Azure + Storage Account. + :type parameters: ~azure.mgmt.datalake.analytics.account.models.AddStorageAccountParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] + + _json = self._serialize.body(parameters, 'AddStorageAccountParameters') + + request = build_add_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + storage_account_name=storage_account_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.add.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + add.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/storageAccounts/{storageAccountName}"} # type: ignore + + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + account_name: str, + storage_account_name: str, + **kwargs: Any + ) -> _models.StorageAccountInformation: + """Gets the specified Azure Storage account linked to the given Data Lake Analytics account. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :param storage_account_name: The name of the Azure Storage account for which to retrieve the + details. + :type storage_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageAccountInformation, or the result of cls(response) + :rtype: ~azure.mgmt.datalake.analytics.account.models.StorageAccountInformation + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.StorageAccountInformation] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + storage_account_name=storage_account_name, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StorageAccountInformation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/storageAccounts/{storageAccountName}"} # type: ignore + + + @distributed_trace_async + async def update( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + account_name: str, + storage_account_name: str, + parameters: Optional[_models.UpdateStorageAccountParameters] = None, + **kwargs: Any + ) -> None: + """Updates the Data Lake Analytics account to replace Azure Storage blob account details, such as + the access key and/or suffix. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :param storage_account_name: The Azure Storage account to modify. + :type storage_account_name: str + :param parameters: The parameters containing the access key and suffix to update the storage + account with, if any. Passing nothing results in no change. Default value is None. + :type parameters: ~azure.mgmt.datalake.analytics.account.models.UpdateStorageAccountParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] + + if parameters is not None: + _json = self._serialize.body(parameters, 'UpdateStorageAccountParameters') + else: + _json = None + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + storage_account_name=storage_account_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/storageAccounts/{storageAccountName}"} # type: ignore + + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + account_name: str, + storage_account_name: str, + **kwargs: Any + ) -> None: + """Updates the specified Data Lake Analytics account to remove an Azure Storage account. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :param storage_account_name: The name of the Azure Storage account to remove. + :type storage_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + storage_account_name=storage_account_name, + api_version=api_version, + template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/storageAccounts/{storageAccountName}"} # type: ignore + + + @distributed_trace + def list_storage_containers( + self, + resource_group_name: str, + account_name: str, + storage_account_name: str, + **kwargs: Any + ) -> AsyncIterable[_models.StorageContainerListResult]: + """Lists the Azure Storage containers, if any, associated with the specified Data Lake Analytics + and Azure Storage account combination. The response includes a link to the next page of + results, if any. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :param storage_account_name: The name of the Azure storage account from which to list blob + containers. + :type storage_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StorageContainerListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.datalake.analytics.account.models.StorageContainerListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.StorageContainerListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_storage_containers_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + storage_account_name=storage_account_name, + api_version=api_version, + template_url=self.list_storage_containers.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_storage_containers_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + storage_account_name=storage_account_name, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("StorageContainerListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_storage_containers.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/storageAccounts/{storageAccountName}/containers"} # type: ignore + + @distributed_trace_async + async def get_storage_container( + self, + resource_group_name: str, + account_name: str, + storage_account_name: str, + container_name: str, + **kwargs: Any + ) -> _models.StorageContainer: + """Gets the specified Azure Storage container associated with the given Data Lake Analytics and + Azure Storage accounts. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :param storage_account_name: The name of the Azure storage account from which to retrieve the + blob container. + :type storage_account_name: str + :param container_name: The name of the Azure storage container to retrieve. + :type container_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageContainer, or the result of cls(response) + :rtype: ~azure.mgmt.datalake.analytics.account.models.StorageContainer + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.StorageContainer] + + + request = build_get_storage_container_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + storage_account_name=storage_account_name, + container_name=container_name, + api_version=api_version, + template_url=self.get_storage_container.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StorageContainer', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_storage_container.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/storageAccounts/{storageAccountName}/containers/{containerName}"} # type: ignore + + + @distributed_trace + def list_sas_tokens( + self, + resource_group_name: str, + account_name: str, + storage_account_name: str, + container_name: str, + **kwargs: Any + ) -> AsyncIterable[_models.SasTokenInformationListResult]: + """Gets the SAS token associated with the specified Data Lake Analytics and Azure Storage account + and container combination. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :param storage_account_name: The name of the Azure storage account for which the SAS token is + being requested. + :type storage_account_name: str + :param container_name: The name of the Azure storage container for which the SAS token is being + requested. + :type container_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SasTokenInformationListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.datalake.analytics.account.models.SasTokenInformationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SasTokenInformationListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_sas_tokens_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + storage_account_name=storage_account_name, + container_name=container_name, + api_version=api_version, + template_url=self.list_sas_tokens.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_sas_tokens_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + storage_account_name=storage_account_name, + container_name=container_name, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SasTokenInformationListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_sas_tokens.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/storageAccounts/{storageAccountName}/containers/{containerName}/listSasTokens"} # type: ignore diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/models/__init__.py b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/models/__init__.py new file mode 100644 index 000000000000..d355cabdfafd --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/models/__init__.py @@ -0,0 +1,149 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._models_py3 import AddDataLakeStoreParameters +from ._models_py3 import AddDataLakeStoreWithAccountParameters +from ._models_py3 import AddStorageAccountParameters +from ._models_py3 import AddStorageAccountWithAccountParameters +from ._models_py3 import CapabilityInformation +from ._models_py3 import CheckNameAvailabilityParameters +from ._models_py3 import ComputePolicy +from ._models_py3 import ComputePolicyListResult +from ._models_py3 import CreateComputePolicyWithAccountParameters +from ._models_py3 import CreateDataLakeAnalyticsAccountParameters +from ._models_py3 import CreateFirewallRuleWithAccountParameters +from ._models_py3 import CreateOrUpdateComputePolicyParameters +from ._models_py3 import CreateOrUpdateFirewallRuleParameters +from ._models_py3 import DataLakeAnalyticsAccount +from ._models_py3 import DataLakeAnalyticsAccountBasic +from ._models_py3 import DataLakeAnalyticsAccountListResult +from ._models_py3 import DataLakeAnalyticsAccountProperties +from ._models_py3 import DataLakeAnalyticsAccountPropertiesBasic +from ._models_py3 import DataLakeStoreAccountInformation +from ._models_py3 import DataLakeStoreAccountInformationListResult +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorResponse +from ._models_py3 import FirewallRule +from ._models_py3 import FirewallRuleListResult +from ._models_py3 import HiveMetastore +from ._models_py3 import HiveMetastoreListResult +from ._models_py3 import NameAvailabilityInformation +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import OperationMetaLogSpecification +from ._models_py3 import OperationMetaMetricAvailabilitiesSpecification +from ._models_py3 import OperationMetaMetricSpecification +from ._models_py3 import OperationMetaPropertyInfo +from ._models_py3 import OperationMetaServiceSpecification +from ._models_py3 import Resource +from ._models_py3 import SasTokenInformation +from ._models_py3 import SasTokenInformationListResult +from ._models_py3 import StorageAccountInformation +from ._models_py3 import StorageAccountInformationListResult +from ._models_py3 import StorageContainer +from ._models_py3 import StorageContainerListResult +from ._models_py3 import SubResource +from ._models_py3 import UpdateComputePolicyParameters +from ._models_py3 import UpdateComputePolicyWithAccountParameters +from ._models_py3 import UpdateDataLakeAnalyticsAccountParameters +from ._models_py3 import UpdateDataLakeStoreWithAccountParameters +from ._models_py3 import UpdateFirewallRuleParameters +from ._models_py3 import UpdateFirewallRuleWithAccountParameters +from ._models_py3 import UpdateStorageAccountParameters +from ._models_py3 import UpdateStorageAccountWithAccountParameters +from ._models_py3 import VirtualNetworkRule +from ._models_py3 import VirtualNetworkRuleListResult + + +from ._data_lake_analytics_account_management_client_enums import ( + AADObjectType, + DataLakeAnalyticsAccountState, + DataLakeAnalyticsAccountStatus, + DebugDataAccessLevel, + FirewallAllowAzureIpsState, + FirewallState, + NestedResourceProvisioningState, + OperationOrigin, + SubscriptionState, + TierType, + VirtualNetworkRuleState, +) +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk +__all__ = [ + 'AddDataLakeStoreParameters', + 'AddDataLakeStoreWithAccountParameters', + 'AddStorageAccountParameters', + 'AddStorageAccountWithAccountParameters', + 'CapabilityInformation', + 'CheckNameAvailabilityParameters', + 'ComputePolicy', + 'ComputePolicyListResult', + 'CreateComputePolicyWithAccountParameters', + 'CreateDataLakeAnalyticsAccountParameters', + 'CreateFirewallRuleWithAccountParameters', + 'CreateOrUpdateComputePolicyParameters', + 'CreateOrUpdateFirewallRuleParameters', + 'DataLakeAnalyticsAccount', + 'DataLakeAnalyticsAccountBasic', + 'DataLakeAnalyticsAccountListResult', + 'DataLakeAnalyticsAccountProperties', + 'DataLakeAnalyticsAccountPropertiesBasic', + 'DataLakeStoreAccountInformation', + 'DataLakeStoreAccountInformationListResult', + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponse', + 'FirewallRule', + 'FirewallRuleListResult', + 'HiveMetastore', + 'HiveMetastoreListResult', + 'NameAvailabilityInformation', + 'Operation', + 'OperationDisplay', + 'OperationListResult', + 'OperationMetaLogSpecification', + 'OperationMetaMetricAvailabilitiesSpecification', + 'OperationMetaMetricSpecification', + 'OperationMetaPropertyInfo', + 'OperationMetaServiceSpecification', + 'Resource', + 'SasTokenInformation', + 'SasTokenInformationListResult', + 'StorageAccountInformation', + 'StorageAccountInformationListResult', + 'StorageContainer', + 'StorageContainerListResult', + 'SubResource', + 'UpdateComputePolicyParameters', + 'UpdateComputePolicyWithAccountParameters', + 'UpdateDataLakeAnalyticsAccountParameters', + 'UpdateDataLakeStoreWithAccountParameters', + 'UpdateFirewallRuleParameters', + 'UpdateFirewallRuleWithAccountParameters', + 'UpdateStorageAccountParameters', + 'UpdateStorageAccountWithAccountParameters', + 'VirtualNetworkRule', + 'VirtualNetworkRuleListResult', + 'AADObjectType', + 'DataLakeAnalyticsAccountState', + 'DataLakeAnalyticsAccountStatus', + 'DebugDataAccessLevel', + 'FirewallAllowAzureIpsState', + 'FirewallState', + 'NestedResourceProvisioningState', + 'OperationOrigin', + 'SubscriptionState', + 'TierType', + 'VirtualNetworkRuleState', +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/models/_data_lake_analytics_account_management_client_enums.py b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/models/_data_lake_analytics_account_management_client_enums.py new file mode 100644 index 000000000000..4a6db99792c8 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/models/_data_lake_analytics_account_management_client_enums.py @@ -0,0 +1,113 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum +from azure.core import CaseInsensitiveEnumMeta + + +class AADObjectType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of AAD object the object identifier refers to. + """ + + USER = "User" + GROUP = "Group" + SERVICE_PRINCIPAL = "ServicePrincipal" + +class DataLakeAnalyticsAccountState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The state of the Data Lake Analytics account. + """ + + ACTIVE = "Active" + SUSPENDED = "Suspended" + +class DataLakeAnalyticsAccountStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The provisioning status of the Data Lake Analytics account. + """ + + FAILED = "Failed" + CREATING = "Creating" + RUNNING = "Running" + SUCCEEDED = "Succeeded" + PATCHING = "Patching" + SUSPENDING = "Suspending" + RESUMING = "Resuming" + DELETING = "Deleting" + DELETED = "Deleted" + UNDELETING = "Undeleting" + CANCELED = "Canceled" + +class DebugDataAccessLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current state of the DebugDataAccessLevel for this account. + """ + + ALL = "All" + CUSTOMER = "Customer" + NONE = "None" + +class FirewallAllowAzureIpsState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current state of allowing or disallowing IPs originating within Azure through the firewall. + If the firewall is disabled, this is not enforced. + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + +class FirewallState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current state of the IP address firewall for this account. + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + +class NestedResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current state of the NestedResourceProvisioning for this account. + """ + + SUCCEEDED = "Succeeded" + CANCELED = "Canceled" + FAILED = "Failed" + +class OperationOrigin(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The intended executor of the operation. + """ + + USER = "user" + SYSTEM = "system" + USER_SYSTEM = "user,system" + +class SubscriptionState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The subscription state. + """ + + REGISTERED = "Registered" + SUSPENDED = "Suspended" + DELETED = "Deleted" + UNREGISTERED = "Unregistered" + WARNED = "Warned" + +class TierType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The commitment tier for the next month. + """ + + CONSUMPTION = "Consumption" + COMMITMENT100_AU_HOURS = "Commitment_100AUHours" + COMMITMENT500_AU_HOURS = "Commitment_500AUHours" + COMMITMENT1000_AU_HOURS = "Commitment_1000AUHours" + COMMITMENT5000_AU_HOURS = "Commitment_5000AUHours" + COMMITMENT10000_AU_HOURS = "Commitment_10000AUHours" + COMMITMENT50000_AU_HOURS = "Commitment_50000AUHours" + COMMITMENT100000_AU_HOURS = "Commitment_100000AUHours" + COMMITMENT500000_AU_HOURS = "Commitment_500000AUHours" + +class VirtualNetworkRuleState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current state of the VirtualNetworkRule for this account. + """ + + ACTIVE = "Active" + NETWORK_SOURCE_DELETED = "NetworkSourceDeleted" + FAILED = "Failed" diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/models/_models_py3.py b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/models/_models_py3.py new file mode 100644 index 000000000000..5bd058120bb9 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/models/_models_py3.py @@ -0,0 +1,2946 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Dict, List, Optional, TYPE_CHECKING, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models + + +class AddDataLakeStoreParameters(msrest.serialization.Model): + """The parameters used to add a new Data Lake Store account. + + :ivar suffix: The optional suffix for the Data Lake Store account. + :vartype suffix: str + """ + + _attribute_map = { + 'suffix': {'key': 'properties.suffix', 'type': 'str'}, + } + + def __init__( + self, + *, + suffix: Optional[str] = None, + **kwargs + ): + """ + :keyword suffix: The optional suffix for the Data Lake Store account. + :paramtype suffix: str + """ + super(AddDataLakeStoreParameters, self).__init__(**kwargs) + self.suffix = suffix + + +class AddDataLakeStoreWithAccountParameters(msrest.serialization.Model): + """The parameters used to add a new Data Lake Store account while creating a new Data Lake Analytics account. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. The unique name of the Data Lake Store account to add. + :vartype name: str + :ivar suffix: The optional suffix for the Data Lake Store account. + :vartype suffix: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'suffix': {'key': 'properties.suffix', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + suffix: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Required. The unique name of the Data Lake Store account to add. + :paramtype name: str + :keyword suffix: The optional suffix for the Data Lake Store account. + :paramtype suffix: str + """ + super(AddDataLakeStoreWithAccountParameters, self).__init__(**kwargs) + self.name = name + self.suffix = suffix + + +class AddStorageAccountParameters(msrest.serialization.Model): + """The parameters used to add a new Azure Storage account. + + All required parameters must be populated in order to send to Azure. + + :ivar access_key: Required. The access key associated with this Azure Storage account that will + be used to connect to it. + :vartype access_key: str + :ivar suffix: The optional suffix for the storage account. + :vartype suffix: str + """ + + _validation = { + 'access_key': {'required': True}, + } + + _attribute_map = { + 'access_key': {'key': 'properties.accessKey', 'type': 'str'}, + 'suffix': {'key': 'properties.suffix', 'type': 'str'}, + } + + def __init__( + self, + *, + access_key: str, + suffix: Optional[str] = "azuredatalakestore.net", + **kwargs + ): + """ + :keyword access_key: Required. The access key associated with this Azure Storage account that + will be used to connect to it. + :paramtype access_key: str + :keyword suffix: The optional suffix for the storage account. + :paramtype suffix: str + """ + super(AddStorageAccountParameters, self).__init__(**kwargs) + self.access_key = access_key + self.suffix = suffix + + +class AddStorageAccountWithAccountParameters(msrest.serialization.Model): + """The parameters used to add a new Azure Storage account while creating a new Data Lake Analytics account. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. The unique name of the Azure Storage account to add. + :vartype name: str + :ivar access_key: Required. The access key associated with this Azure Storage account that will + be used to connect to it. + :vartype access_key: str + :ivar suffix: The optional suffix for the storage account. + :vartype suffix: str + """ + + _validation = { + 'name': {'required': True}, + 'access_key': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'access_key': {'key': 'properties.accessKey', 'type': 'str'}, + 'suffix': {'key': 'properties.suffix', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + access_key: str, + suffix: Optional[str] = "azuredatalakestore.net", + **kwargs + ): + """ + :keyword name: Required. The unique name of the Azure Storage account to add. + :paramtype name: str + :keyword access_key: Required. The access key associated with this Azure Storage account that + will be used to connect to it. + :paramtype access_key: str + :keyword suffix: The optional suffix for the storage account. + :paramtype suffix: str + """ + super(AddStorageAccountWithAccountParameters, self).__init__(**kwargs) + self.name = name + self.access_key = access_key + self.suffix = suffix + + +class CapabilityInformation(msrest.serialization.Model): + """Subscription-level properties and limits for Data Lake Analytics. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar subscription_id: The subscription credentials that uniquely identifies the subscription. + :vartype subscription_id: str + :ivar state: The subscription state. Known values are: "Registered", "Suspended", "Deleted", + "Unregistered", "Warned". + :vartype state: str or ~azure.mgmt.datalake.analytics.account.models.SubscriptionState + :ivar max_account_count: The maximum supported number of accounts under this subscription. + :vartype max_account_count: int + :ivar account_count: The current number of accounts under this subscription. + :vartype account_count: int + :ivar migration_state: The Boolean value of true or false to indicate the maintenance state. + :vartype migration_state: bool + """ + + _validation = { + 'subscription_id': {'readonly': True}, + 'state': {'readonly': True}, + 'max_account_count': {'readonly': True}, + 'account_count': {'readonly': True}, + 'migration_state': {'readonly': True}, + } + + _attribute_map = { + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'state': {'key': 'state', 'type': 'str'}, + 'max_account_count': {'key': 'maxAccountCount', 'type': 'int'}, + 'account_count': {'key': 'accountCount', 'type': 'int'}, + 'migration_state': {'key': 'migrationState', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(CapabilityInformation, self).__init__(**kwargs) + self.subscription_id = None + self.state = None + self.max_account_count = None + self.account_count = None + self.migration_state = None + + +class CheckNameAvailabilityParameters(msrest.serialization.Model): + """Data Lake Analytics account name availability check parameters. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. The Data Lake Analytics name to check availability for. + :vartype name: str + :ivar type: The resource type. Note: This should not be set by the user, as the constant value + is Microsoft.DataLakeAnalytics/accounts. Has constant value: + "Microsoft.DataLakeAnalytics/accounts". + :vartype type: str + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True, 'constant': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + type = "Microsoft.DataLakeAnalytics/accounts" + + def __init__( + self, + *, + name: str, + **kwargs + ): + """ + :keyword name: Required. The Data Lake Analytics name to check availability for. + :paramtype name: str + """ + super(CheckNameAvailabilityParameters, self).__init__(**kwargs) + self.name = name + + +class SubResource(msrest.serialization.Model): + """The resource model definition for a nested resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The resource name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(SubResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class ComputePolicy(SubResource): + """Data Lake Analytics compute policy information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The resource name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :ivar object_id: The AAD object identifier for the entity to create a policy for. + :vartype object_id: str + :ivar object_type: The type of AAD object the object identifier refers to. Known values are: + "User", "Group", "ServicePrincipal". + :vartype object_type: str or ~azure.mgmt.datalake.analytics.account.models.AADObjectType + :ivar max_degree_of_parallelism_per_job: The maximum degree of parallelism per job this user + can use to submit jobs. + :vartype max_degree_of_parallelism_per_job: int + :ivar min_priority_per_job: The minimum priority per job this user can use to submit jobs. + :vartype min_priority_per_job: int + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'object_id': {'readonly': True}, + 'object_type': {'readonly': True}, + 'max_degree_of_parallelism_per_job': {'readonly': True, 'minimum': 1}, + 'min_priority_per_job': {'readonly': True, 'minimum': 1}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'object_id': {'key': 'properties.objectId', 'type': 'str'}, + 'object_type': {'key': 'properties.objectType', 'type': 'str'}, + 'max_degree_of_parallelism_per_job': {'key': 'properties.maxDegreeOfParallelismPerJob', 'type': 'int'}, + 'min_priority_per_job': {'key': 'properties.minPriorityPerJob', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ComputePolicy, self).__init__(**kwargs) + self.object_id = None + self.object_type = None + self.max_degree_of_parallelism_per_job = None + self.min_priority_per_job = None + + +class ComputePolicyListResult(msrest.serialization.Model): + """The list of compute policies in the account. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The results of the list operation. + :vartype value: list[~azure.mgmt.datalake.analytics.account.models.ComputePolicy] + :ivar next_link: The link (url) to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ComputePolicy]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ComputePolicyListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class CreateComputePolicyWithAccountParameters(msrest.serialization.Model): + """The parameters used to create a new compute policy while creating a new Data Lake Analytics account. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. The unique name of the compute policy to create. + :vartype name: str + :ivar object_id: Required. The AAD object identifier for the entity to create a policy for. + :vartype object_id: str + :ivar object_type: Required. The type of AAD object the object identifier refers to. Known + values are: "User", "Group", "ServicePrincipal". + :vartype object_type: str or ~azure.mgmt.datalake.analytics.account.models.AADObjectType + :ivar max_degree_of_parallelism_per_job: The maximum degree of parallelism per job this user + can use to submit jobs. This property, the min priority per job property, or both must be + passed. + :vartype max_degree_of_parallelism_per_job: int + :ivar min_priority_per_job: The minimum priority per job this user can use to submit jobs. This + property, the max degree of parallelism per job property, or both must be passed. + :vartype min_priority_per_job: int + """ + + _validation = { + 'name': {'required': True}, + 'object_id': {'required': True}, + 'object_type': {'required': True}, + 'max_degree_of_parallelism_per_job': {'minimum': 1}, + 'min_priority_per_job': {'minimum': 1}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'object_id': {'key': 'properties.objectId', 'type': 'str'}, + 'object_type': {'key': 'properties.objectType', 'type': 'str'}, + 'max_degree_of_parallelism_per_job': {'key': 'properties.maxDegreeOfParallelismPerJob', 'type': 'int'}, + 'min_priority_per_job': {'key': 'properties.minPriorityPerJob', 'type': 'int'}, + } + + def __init__( + self, + *, + name: str, + object_id: str, + object_type: Union[str, "_models.AADObjectType"], + max_degree_of_parallelism_per_job: Optional[int] = None, + min_priority_per_job: Optional[int] = None, + **kwargs + ): + """ + :keyword name: Required. The unique name of the compute policy to create. + :paramtype name: str + :keyword object_id: Required. The AAD object identifier for the entity to create a policy for. + :paramtype object_id: str + :keyword object_type: Required. The type of AAD object the object identifier refers to. Known + values are: "User", "Group", "ServicePrincipal". + :paramtype object_type: str or ~azure.mgmt.datalake.analytics.account.models.AADObjectType + :keyword max_degree_of_parallelism_per_job: The maximum degree of parallelism per job this user + can use to submit jobs. This property, the min priority per job property, or both must be + passed. + :paramtype max_degree_of_parallelism_per_job: int + :keyword min_priority_per_job: The minimum priority per job this user can use to submit jobs. + This property, the max degree of parallelism per job property, or both must be passed. + :paramtype min_priority_per_job: int + """ + super(CreateComputePolicyWithAccountParameters, self).__init__(**kwargs) + self.name = name + self.object_id = object_id + self.object_type = object_type + self.max_degree_of_parallelism_per_job = max_degree_of_parallelism_per_job + self.min_priority_per_job = min_priority_per_job + + +class CreateDataLakeAnalyticsAccountParameters(msrest.serialization.Model): + """The parameters to use for creating a Data Lake Analytics account. + + All required parameters must be populated in order to send to Azure. + + :ivar location: Required. The resource location. + :vartype location: str + :ivar tags: A set of tags. The resource tags. + :vartype tags: dict[str, str] + :ivar default_data_lake_store_account: Required. The default Data Lake Store account associated + with this account. + :vartype default_data_lake_store_account: str + :ivar data_lake_store_accounts: Required. The list of Data Lake Store accounts associated with + this account. + :vartype data_lake_store_accounts: + list[~azure.mgmt.datalake.analytics.account.models.AddDataLakeStoreWithAccountParameters] + :ivar storage_accounts: The list of Azure Blob Storage accounts associated with this account. + :vartype storage_accounts: + list[~azure.mgmt.datalake.analytics.account.models.AddStorageAccountWithAccountParameters] + :ivar compute_policies: The list of compute policies associated with this account. + :vartype compute_policies: + list[~azure.mgmt.datalake.analytics.account.models.CreateComputePolicyWithAccountParameters] + :ivar firewall_rules: The list of firewall rules associated with this account. + :vartype firewall_rules: + list[~azure.mgmt.datalake.analytics.account.models.CreateFirewallRuleWithAccountParameters] + :ivar firewall_state: The current state of the IP address firewall for this account. Known + values are: "Enabled", "Disabled". + :vartype firewall_state: str or ~azure.mgmt.datalake.analytics.account.models.FirewallState + :ivar firewall_allow_azure_ips: The current state of allowing or disallowing IPs originating + within Azure through the firewall. If the firewall is disabled, this is not enforced. Known + values are: "Enabled", "Disabled". + :vartype firewall_allow_azure_ips: str or + ~azure.mgmt.datalake.analytics.account.models.FirewallAllowAzureIpsState + :ivar new_tier: The commitment tier for the next month. Known values are: "Consumption", + "Commitment_100AUHours", "Commitment_500AUHours", "Commitment_1000AUHours", + "Commitment_5000AUHours", "Commitment_10000AUHours", "Commitment_50000AUHours", + "Commitment_100000AUHours", "Commitment_500000AUHours". + :vartype new_tier: str or ~azure.mgmt.datalake.analytics.account.models.TierType + :ivar max_job_count: The maximum supported jobs running under the account at the same time. + :vartype max_job_count: int + :ivar max_degree_of_parallelism: The maximum supported degree of parallelism for this account. + :vartype max_degree_of_parallelism: int + :ivar max_degree_of_parallelism_per_job: The maximum supported degree of parallelism per job + for this account. + :vartype max_degree_of_parallelism_per_job: int + :ivar min_priority_per_job: The minimum supported priority per job for this account. + :vartype min_priority_per_job: int + :ivar query_store_retention: The number of days that job metadata is retained. + :vartype query_store_retention: int + """ + + _validation = { + 'location': {'required': True}, + 'default_data_lake_store_account': {'required': True}, + 'data_lake_store_accounts': {'required': True}, + 'max_job_count': {'minimum': 1}, + 'max_degree_of_parallelism': {'minimum': 1}, + 'max_degree_of_parallelism_per_job': {'minimum': 1}, + 'min_priority_per_job': {'minimum': 1}, + 'query_store_retention': {'maximum': 180, 'minimum': 1}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'default_data_lake_store_account': {'key': 'properties.defaultDataLakeStoreAccount', 'type': 'str'}, + 'data_lake_store_accounts': {'key': 'properties.dataLakeStoreAccounts', 'type': '[AddDataLakeStoreWithAccountParameters]'}, + 'storage_accounts': {'key': 'properties.storageAccounts', 'type': '[AddStorageAccountWithAccountParameters]'}, + 'compute_policies': {'key': 'properties.computePolicies', 'type': '[CreateComputePolicyWithAccountParameters]'}, + 'firewall_rules': {'key': 'properties.firewallRules', 'type': '[CreateFirewallRuleWithAccountParameters]'}, + 'firewall_state': {'key': 'properties.firewallState', 'type': 'str'}, + 'firewall_allow_azure_ips': {'key': 'properties.firewallAllowAzureIps', 'type': 'str'}, + 'new_tier': {'key': 'properties.newTier', 'type': 'str'}, + 'max_job_count': {'key': 'properties.maxJobCount', 'type': 'int'}, + 'max_degree_of_parallelism': {'key': 'properties.maxDegreeOfParallelism', 'type': 'int'}, + 'max_degree_of_parallelism_per_job': {'key': 'properties.maxDegreeOfParallelismPerJob', 'type': 'int'}, + 'min_priority_per_job': {'key': 'properties.minPriorityPerJob', 'type': 'int'}, + 'query_store_retention': {'key': 'properties.queryStoreRetention', 'type': 'int'}, + } + + def __init__( + self, + *, + location: str, + default_data_lake_store_account: str, + data_lake_store_accounts: List["_models.AddDataLakeStoreWithAccountParameters"], + tags: Optional[Dict[str, str]] = None, + storage_accounts: Optional[List["_models.AddStorageAccountWithAccountParameters"]] = None, + compute_policies: Optional[List["_models.CreateComputePolicyWithAccountParameters"]] = None, + firewall_rules: Optional[List["_models.CreateFirewallRuleWithAccountParameters"]] = None, + firewall_state: Optional[Union[str, "_models.FirewallState"]] = None, + firewall_allow_azure_ips: Optional[Union[str, "_models.FirewallAllowAzureIpsState"]] = None, + new_tier: Optional[Union[str, "_models.TierType"]] = None, + max_job_count: Optional[int] = 3, + max_degree_of_parallelism: Optional[int] = 30, + max_degree_of_parallelism_per_job: Optional[int] = 32, + min_priority_per_job: Optional[int] = None, + query_store_retention: Optional[int] = 30, + **kwargs + ): + """ + :keyword location: Required. The resource location. + :paramtype location: str + :keyword tags: A set of tags. The resource tags. + :paramtype tags: dict[str, str] + :keyword default_data_lake_store_account: Required. The default Data Lake Store account + associated with this account. + :paramtype default_data_lake_store_account: str + :keyword data_lake_store_accounts: Required. The list of Data Lake Store accounts associated + with this account. + :paramtype data_lake_store_accounts: + list[~azure.mgmt.datalake.analytics.account.models.AddDataLakeStoreWithAccountParameters] + :keyword storage_accounts: The list of Azure Blob Storage accounts associated with this + account. + :paramtype storage_accounts: + list[~azure.mgmt.datalake.analytics.account.models.AddStorageAccountWithAccountParameters] + :keyword compute_policies: The list of compute policies associated with this account. + :paramtype compute_policies: + list[~azure.mgmt.datalake.analytics.account.models.CreateComputePolicyWithAccountParameters] + :keyword firewall_rules: The list of firewall rules associated with this account. + :paramtype firewall_rules: + list[~azure.mgmt.datalake.analytics.account.models.CreateFirewallRuleWithAccountParameters] + :keyword firewall_state: The current state of the IP address firewall for this account. Known + values are: "Enabled", "Disabled". + :paramtype firewall_state: str or ~azure.mgmt.datalake.analytics.account.models.FirewallState + :keyword firewall_allow_azure_ips: The current state of allowing or disallowing IPs originating + within Azure through the firewall. If the firewall is disabled, this is not enforced. Known + values are: "Enabled", "Disabled". + :paramtype firewall_allow_azure_ips: str or + ~azure.mgmt.datalake.analytics.account.models.FirewallAllowAzureIpsState + :keyword new_tier: The commitment tier for the next month. Known values are: "Consumption", + "Commitment_100AUHours", "Commitment_500AUHours", "Commitment_1000AUHours", + "Commitment_5000AUHours", "Commitment_10000AUHours", "Commitment_50000AUHours", + "Commitment_100000AUHours", "Commitment_500000AUHours". + :paramtype new_tier: str or ~azure.mgmt.datalake.analytics.account.models.TierType + :keyword max_job_count: The maximum supported jobs running under the account at the same time. + :paramtype max_job_count: int + :keyword max_degree_of_parallelism: The maximum supported degree of parallelism for this + account. + :paramtype max_degree_of_parallelism: int + :keyword max_degree_of_parallelism_per_job: The maximum supported degree of parallelism per job + for this account. + :paramtype max_degree_of_parallelism_per_job: int + :keyword min_priority_per_job: The minimum supported priority per job for this account. + :paramtype min_priority_per_job: int + :keyword query_store_retention: The number of days that job metadata is retained. + :paramtype query_store_retention: int + """ + super(CreateDataLakeAnalyticsAccountParameters, self).__init__(**kwargs) + self.location = location + self.tags = tags + self.default_data_lake_store_account = default_data_lake_store_account + self.data_lake_store_accounts = data_lake_store_accounts + self.storage_accounts = storage_accounts + self.compute_policies = compute_policies + self.firewall_rules = firewall_rules + self.firewall_state = firewall_state + self.firewall_allow_azure_ips = firewall_allow_azure_ips + self.new_tier = new_tier + self.max_job_count = max_job_count + self.max_degree_of_parallelism = max_degree_of_parallelism + self.max_degree_of_parallelism_per_job = max_degree_of_parallelism_per_job + self.min_priority_per_job = min_priority_per_job + self.query_store_retention = query_store_retention + + +class CreateFirewallRuleWithAccountParameters(msrest.serialization.Model): + """The parameters used to create a new firewall rule while creating a new Data Lake Analytics account. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. The unique name of the firewall rule to create. + :vartype name: str + :ivar start_ip_address: Required. The start IP address for the firewall rule. This can be + either ipv4 or ipv6. Start and End should be in the same protocol. + :vartype start_ip_address: str + :ivar end_ip_address: Required. The end IP address for the firewall rule. This can be either + ipv4 or ipv6. Start and End should be in the same protocol. + :vartype end_ip_address: str + """ + + _validation = { + 'name': {'required': True}, + 'start_ip_address': {'required': True}, + 'end_ip_address': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'start_ip_address': {'key': 'properties.startIpAddress', 'type': 'str'}, + 'end_ip_address': {'key': 'properties.endIpAddress', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + start_ip_address: str, + end_ip_address: str, + **kwargs + ): + """ + :keyword name: Required. The unique name of the firewall rule to create. + :paramtype name: str + :keyword start_ip_address: Required. The start IP address for the firewall rule. This can be + either ipv4 or ipv6. Start and End should be in the same protocol. + :paramtype start_ip_address: str + :keyword end_ip_address: Required. The end IP address for the firewall rule. This can be either + ipv4 or ipv6. Start and End should be in the same protocol. + :paramtype end_ip_address: str + """ + super(CreateFirewallRuleWithAccountParameters, self).__init__(**kwargs) + self.name = name + self.start_ip_address = start_ip_address + self.end_ip_address = end_ip_address + + +class CreateOrUpdateComputePolicyParameters(msrest.serialization.Model): + """The parameters used to create a new compute policy. + + All required parameters must be populated in order to send to Azure. + + :ivar object_id: Required. The AAD object identifier for the entity to create a policy for. + :vartype object_id: str + :ivar object_type: Required. The type of AAD object the object identifier refers to. Known + values are: "User", "Group", "ServicePrincipal". + :vartype object_type: str or ~azure.mgmt.datalake.analytics.account.models.AADObjectType + :ivar max_degree_of_parallelism_per_job: The maximum degree of parallelism per job this user + can use to submit jobs. This property, the min priority per job property, or both must be + passed. + :vartype max_degree_of_parallelism_per_job: int + :ivar min_priority_per_job: The minimum priority per job this user can use to submit jobs. This + property, the max degree of parallelism per job property, or both must be passed. + :vartype min_priority_per_job: int + """ + + _validation = { + 'object_id': {'required': True}, + 'object_type': {'required': True}, + 'max_degree_of_parallelism_per_job': {'minimum': 1}, + 'min_priority_per_job': {'minimum': 1}, + } + + _attribute_map = { + 'object_id': {'key': 'properties.objectId', 'type': 'str'}, + 'object_type': {'key': 'properties.objectType', 'type': 'str'}, + 'max_degree_of_parallelism_per_job': {'key': 'properties.maxDegreeOfParallelismPerJob', 'type': 'int'}, + 'min_priority_per_job': {'key': 'properties.minPriorityPerJob', 'type': 'int'}, + } + + def __init__( + self, + *, + object_id: str, + object_type: Union[str, "_models.AADObjectType"], + max_degree_of_parallelism_per_job: Optional[int] = None, + min_priority_per_job: Optional[int] = None, + **kwargs + ): + """ + :keyword object_id: Required. The AAD object identifier for the entity to create a policy for. + :paramtype object_id: str + :keyword object_type: Required. The type of AAD object the object identifier refers to. Known + values are: "User", "Group", "ServicePrincipal". + :paramtype object_type: str or ~azure.mgmt.datalake.analytics.account.models.AADObjectType + :keyword max_degree_of_parallelism_per_job: The maximum degree of parallelism per job this user + can use to submit jobs. This property, the min priority per job property, or both must be + passed. + :paramtype max_degree_of_parallelism_per_job: int + :keyword min_priority_per_job: The minimum priority per job this user can use to submit jobs. + This property, the max degree of parallelism per job property, or both must be passed. + :paramtype min_priority_per_job: int + """ + super(CreateOrUpdateComputePolicyParameters, self).__init__(**kwargs) + self.object_id = object_id + self.object_type = object_type + self.max_degree_of_parallelism_per_job = max_degree_of_parallelism_per_job + self.min_priority_per_job = min_priority_per_job + + +class CreateOrUpdateFirewallRuleParameters(msrest.serialization.Model): + """The parameters used to create a new firewall rule. + + All required parameters must be populated in order to send to Azure. + + :ivar start_ip_address: Required. The start IP address for the firewall rule. This can be + either ipv4 or ipv6. Start and End should be in the same protocol. + :vartype start_ip_address: str + :ivar end_ip_address: Required. The end IP address for the firewall rule. This can be either + ipv4 or ipv6. Start and End should be in the same protocol. + :vartype end_ip_address: str + """ + + _validation = { + 'start_ip_address': {'required': True}, + 'end_ip_address': {'required': True}, + } + + _attribute_map = { + 'start_ip_address': {'key': 'properties.startIpAddress', 'type': 'str'}, + 'end_ip_address': {'key': 'properties.endIpAddress', 'type': 'str'}, + } + + def __init__( + self, + *, + start_ip_address: str, + end_ip_address: str, + **kwargs + ): + """ + :keyword start_ip_address: Required. The start IP address for the firewall rule. This can be + either ipv4 or ipv6. Start and End should be in the same protocol. + :paramtype start_ip_address: str + :keyword end_ip_address: Required. The end IP address for the firewall rule. This can be either + ipv4 or ipv6. Start and End should be in the same protocol. + :paramtype end_ip_address: str + """ + super(CreateOrUpdateFirewallRuleParameters, self).__init__(**kwargs) + self.start_ip_address = start_ip_address + self.end_ip_address = end_ip_address + + +class Resource(msrest.serialization.Model): + """The resource model definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The resource name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :ivar location: The resource location. + :vartype location: str + :ivar tags: A set of tags. The resource tags. + :vartype tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'tags': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = None + self.tags = None + + +class DataLakeAnalyticsAccount(Resource): + """A Data Lake Analytics account object, containing all information associated with the named Data Lake Analytics account. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The resource name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :ivar location: The resource location. + :vartype location: str + :ivar tags: A set of tags. The resource tags. + :vartype tags: dict[str, str] + :ivar account_id: The unique identifier associated with this Data Lake Analytics account. + :vartype account_id: str + :ivar provisioning_state: The provisioning status of the Data Lake Analytics account. Known + values are: "Failed", "Creating", "Running", "Succeeded", "Patching", "Suspending", "Resuming", + "Deleting", "Deleted", "Undeleting", "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.datalake.analytics.account.models.DataLakeAnalyticsAccountStatus + :ivar state: The state of the Data Lake Analytics account. Known values are: "Active", + "Suspended". + :vartype state: str or + ~azure.mgmt.datalake.analytics.account.models.DataLakeAnalyticsAccountState + :ivar creation_time: The account creation time. + :vartype creation_time: ~datetime.datetime + :ivar last_modified_time: The account last modified time. + :vartype last_modified_time: ~datetime.datetime + :ivar endpoint: The full CName endpoint for this account. + :vartype endpoint: str + :ivar default_data_lake_store_account_type: The type of the default Data Lake Store account + associated with this account. + :vartype default_data_lake_store_account_type: str + :ivar default_data_lake_store_account: The default Data Lake Store account associated with this + account. + :vartype default_data_lake_store_account: str + :ivar data_lake_store_accounts: The list of Data Lake Store accounts associated with this + account. + :vartype data_lake_store_accounts: + list[~azure.mgmt.datalake.analytics.account.models.DataLakeStoreAccountInformation] + :ivar public_data_lake_store_accounts: The list of Data Lake Store accounts associated with + this account. + :vartype public_data_lake_store_accounts: + list[~azure.mgmt.datalake.analytics.account.models.DataLakeStoreAccountInformation] + :ivar storage_accounts: The list of Azure Blob Storage accounts associated with this account. + :vartype storage_accounts: + list[~azure.mgmt.datalake.analytics.account.models.StorageAccountInformation] + :ivar compute_policies: The list of compute policies associated with this account. + :vartype compute_policies: list[~azure.mgmt.datalake.analytics.account.models.ComputePolicy] + :ivar hive_metastores: The list of hiveMetastores associated with this account. + :vartype hive_metastores: list[~azure.mgmt.datalake.analytics.account.models.HiveMetastore] + :ivar virtual_network_rules: The list of virtualNetwork rules associated with this account. + :vartype virtual_network_rules: + list[~azure.mgmt.datalake.analytics.account.models.VirtualNetworkRule] + :ivar firewall_rules: The list of firewall rules associated with this account. + :vartype firewall_rules: list[~azure.mgmt.datalake.analytics.account.models.FirewallRule] + :ivar firewall_state: The current state of the IP address firewall for this account. Known + values are: "Enabled", "Disabled". + :vartype firewall_state: str or ~azure.mgmt.datalake.analytics.account.models.FirewallState + :ivar firewall_allow_azure_ips: The current state of allowing or disallowing IPs originating + within Azure through the firewall. If the firewall is disabled, this is not enforced. Known + values are: "Enabled", "Disabled". + :vartype firewall_allow_azure_ips: str or + ~azure.mgmt.datalake.analytics.account.models.FirewallAllowAzureIpsState + :ivar new_tier: The commitment tier for the next month. Known values are: "Consumption", + "Commitment_100AUHours", "Commitment_500AUHours", "Commitment_1000AUHours", + "Commitment_5000AUHours", "Commitment_10000AUHours", "Commitment_50000AUHours", + "Commitment_100000AUHours", "Commitment_500000AUHours". + :vartype new_tier: str or ~azure.mgmt.datalake.analytics.account.models.TierType + :ivar current_tier: The commitment tier in use for the current month. Known values are: + "Consumption", "Commitment_100AUHours", "Commitment_500AUHours", "Commitment_1000AUHours", + "Commitment_5000AUHours", "Commitment_10000AUHours", "Commitment_50000AUHours", + "Commitment_100000AUHours", "Commitment_500000AUHours". + :vartype current_tier: str or ~azure.mgmt.datalake.analytics.account.models.TierType + :ivar max_job_count: The maximum supported jobs running under the account at the same time. + :vartype max_job_count: int + :ivar max_active_job_count_per_user: The maximum supported active jobs under the account at the + same time. + :vartype max_active_job_count_per_user: int + :ivar max_queued_job_count_per_user: The maximum supported jobs queued under the account at the + same time. + :vartype max_queued_job_count_per_user: int + :ivar max_job_running_time_in_min: The maximum supported active jobs under the account at the + same time. + :vartype max_job_running_time_in_min: int + :ivar system_max_job_count: The system defined maximum supported jobs running under the account + at the same time, which restricts the maximum number of running jobs the user can set for the + account. + :vartype system_max_job_count: int + :ivar max_degree_of_parallelism: The maximum supported degree of parallelism for this account. + :vartype max_degree_of_parallelism: int + :ivar system_max_degree_of_parallelism: The system defined maximum supported degree of + parallelism for this account, which restricts the maximum value of parallelism the user can set + for the account. + :vartype system_max_degree_of_parallelism: int + :ivar max_degree_of_parallelism_per_job: The maximum supported degree of parallelism per job + for this account. + :vartype max_degree_of_parallelism_per_job: int + :ivar min_priority_per_job: The minimum supported priority per job for this account. + :vartype min_priority_per_job: int + :ivar query_store_retention: The number of days that job metadata is retained. + :vartype query_store_retention: int + :ivar debug_data_access_level: The current state of the DebugDataAccessLevel for this account. + Known values are: "All", "Customer", "None". + :vartype debug_data_access_level: str or + ~azure.mgmt.datalake.analytics.account.models.DebugDataAccessLevel + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'tags': {'readonly': True}, + 'account_id': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'state': {'readonly': True}, + 'creation_time': {'readonly': True}, + 'last_modified_time': {'readonly': True}, + 'endpoint': {'readonly': True}, + 'default_data_lake_store_account_type': {'readonly': True}, + 'default_data_lake_store_account': {'readonly': True}, + 'data_lake_store_accounts': {'readonly': True}, + 'storage_accounts': {'readonly': True}, + 'compute_policies': {'readonly': True}, + 'hive_metastores': {'readonly': True}, + 'virtual_network_rules': {'readonly': True}, + 'firewall_rules': {'readonly': True}, + 'current_tier': {'readonly': True}, + 'max_job_count': {'minimum': 1}, + 'max_active_job_count_per_user': {'readonly': True}, + 'max_queued_job_count_per_user': {'readonly': True}, + 'max_job_running_time_in_min': {'readonly': True}, + 'system_max_job_count': {'readonly': True}, + 'max_degree_of_parallelism': {'minimum': 1}, + 'system_max_degree_of_parallelism': {'readonly': True}, + 'max_degree_of_parallelism_per_job': {'minimum': 1}, + 'min_priority_per_job': {'readonly': True, 'minimum': 1}, + 'query_store_retention': {'maximum': 180, 'minimum': 1}, + 'debug_data_access_level': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'account_id': {'key': 'properties.accountId', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'state': {'key': 'properties.state', 'type': 'str'}, + 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, + 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, + 'endpoint': {'key': 'properties.endpoint', 'type': 'str'}, + 'default_data_lake_store_account_type': {'key': 'properties.defaultDataLakeStoreAccountType', 'type': 'str'}, + 'default_data_lake_store_account': {'key': 'properties.defaultDataLakeStoreAccount', 'type': 'str'}, + 'data_lake_store_accounts': {'key': 'properties.dataLakeStoreAccounts', 'type': '[DataLakeStoreAccountInformation]'}, + 'public_data_lake_store_accounts': {'key': 'properties.publicDataLakeStoreAccounts', 'type': '[DataLakeStoreAccountInformation]'}, + 'storage_accounts': {'key': 'properties.storageAccounts', 'type': '[StorageAccountInformation]'}, + 'compute_policies': {'key': 'properties.computePolicies', 'type': '[ComputePolicy]'}, + 'hive_metastores': {'key': 'properties.hiveMetastores', 'type': '[HiveMetastore]'}, + 'virtual_network_rules': {'key': 'properties.virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, + 'firewall_rules': {'key': 'properties.firewallRules', 'type': '[FirewallRule]'}, + 'firewall_state': {'key': 'properties.firewallState', 'type': 'str'}, + 'firewall_allow_azure_ips': {'key': 'properties.firewallAllowAzureIps', 'type': 'str'}, + 'new_tier': {'key': 'properties.newTier', 'type': 'str'}, + 'current_tier': {'key': 'properties.currentTier', 'type': 'str'}, + 'max_job_count': {'key': 'properties.maxJobCount', 'type': 'int'}, + 'max_active_job_count_per_user': {'key': 'properties.maxActiveJobCountPerUser', 'type': 'int'}, + 'max_queued_job_count_per_user': {'key': 'properties.maxQueuedJobCountPerUser', 'type': 'int'}, + 'max_job_running_time_in_min': {'key': 'properties.maxJobRunningTimeInMin', 'type': 'int'}, + 'system_max_job_count': {'key': 'properties.systemMaxJobCount', 'type': 'int'}, + 'max_degree_of_parallelism': {'key': 'properties.maxDegreeOfParallelism', 'type': 'int'}, + 'system_max_degree_of_parallelism': {'key': 'properties.systemMaxDegreeOfParallelism', 'type': 'int'}, + 'max_degree_of_parallelism_per_job': {'key': 'properties.maxDegreeOfParallelismPerJob', 'type': 'int'}, + 'min_priority_per_job': {'key': 'properties.minPriorityPerJob', 'type': 'int'}, + 'query_store_retention': {'key': 'properties.queryStoreRetention', 'type': 'int'}, + 'debug_data_access_level': {'key': 'properties.debugDataAccessLevel', 'type': 'str'}, + } + + def __init__( + self, + *, + public_data_lake_store_accounts: Optional[List["_models.DataLakeStoreAccountInformation"]] = None, + firewall_state: Optional[Union[str, "_models.FirewallState"]] = None, + firewall_allow_azure_ips: Optional[Union[str, "_models.FirewallAllowAzureIpsState"]] = None, + new_tier: Optional[Union[str, "_models.TierType"]] = None, + max_job_count: Optional[int] = 3, + max_degree_of_parallelism: Optional[int] = 30, + max_degree_of_parallelism_per_job: Optional[int] = None, + query_store_retention: Optional[int] = 30, + **kwargs + ): + """ + :keyword public_data_lake_store_accounts: The list of Data Lake Store accounts associated with + this account. + :paramtype public_data_lake_store_accounts: + list[~azure.mgmt.datalake.analytics.account.models.DataLakeStoreAccountInformation] + :keyword firewall_state: The current state of the IP address firewall for this account. Known + values are: "Enabled", "Disabled". + :paramtype firewall_state: str or ~azure.mgmt.datalake.analytics.account.models.FirewallState + :keyword firewall_allow_azure_ips: The current state of allowing or disallowing IPs originating + within Azure through the firewall. If the firewall is disabled, this is not enforced. Known + values are: "Enabled", "Disabled". + :paramtype firewall_allow_azure_ips: str or + ~azure.mgmt.datalake.analytics.account.models.FirewallAllowAzureIpsState + :keyword new_tier: The commitment tier for the next month. Known values are: "Consumption", + "Commitment_100AUHours", "Commitment_500AUHours", "Commitment_1000AUHours", + "Commitment_5000AUHours", "Commitment_10000AUHours", "Commitment_50000AUHours", + "Commitment_100000AUHours", "Commitment_500000AUHours". + :paramtype new_tier: str or ~azure.mgmt.datalake.analytics.account.models.TierType + :keyword max_job_count: The maximum supported jobs running under the account at the same time. + :paramtype max_job_count: int + :keyword max_degree_of_parallelism: The maximum supported degree of parallelism for this + account. + :paramtype max_degree_of_parallelism: int + :keyword max_degree_of_parallelism_per_job: The maximum supported degree of parallelism per job + for this account. + :paramtype max_degree_of_parallelism_per_job: int + :keyword query_store_retention: The number of days that job metadata is retained. + :paramtype query_store_retention: int + """ + super(DataLakeAnalyticsAccount, self).__init__(**kwargs) + self.account_id = None + self.provisioning_state = None + self.state = None + self.creation_time = None + self.last_modified_time = None + self.endpoint = None + self.default_data_lake_store_account_type = None + self.default_data_lake_store_account = None + self.data_lake_store_accounts = None + self.public_data_lake_store_accounts = public_data_lake_store_accounts + self.storage_accounts = None + self.compute_policies = None + self.hive_metastores = None + self.virtual_network_rules = None + self.firewall_rules = None + self.firewall_state = firewall_state + self.firewall_allow_azure_ips = firewall_allow_azure_ips + self.new_tier = new_tier + self.current_tier = None + self.max_job_count = max_job_count + self.max_active_job_count_per_user = None + self.max_queued_job_count_per_user = None + self.max_job_running_time_in_min = None + self.system_max_job_count = None + self.max_degree_of_parallelism = max_degree_of_parallelism + self.system_max_degree_of_parallelism = None + self.max_degree_of_parallelism_per_job = max_degree_of_parallelism_per_job + self.min_priority_per_job = None + self.query_store_retention = query_store_retention + self.debug_data_access_level = None + + +class DataLakeAnalyticsAccountBasic(Resource): + """A Data Lake Analytics account object, containing all information associated with the named Data Lake Analytics account. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The resource name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :ivar location: The resource location. + :vartype location: str + :ivar tags: A set of tags. The resource tags. + :vartype tags: dict[str, str] + :ivar account_id: The unique identifier associated with this Data Lake Analytics account. + :vartype account_id: str + :ivar provisioning_state: The provisioning status of the Data Lake Analytics account. Known + values are: "Failed", "Creating", "Running", "Succeeded", "Patching", "Suspending", "Resuming", + "Deleting", "Deleted", "Undeleting", "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.datalake.analytics.account.models.DataLakeAnalyticsAccountStatus + :ivar state: The state of the Data Lake Analytics account. Known values are: "Active", + "Suspended". + :vartype state: str or + ~azure.mgmt.datalake.analytics.account.models.DataLakeAnalyticsAccountState + :ivar creation_time: The account creation time. + :vartype creation_time: ~datetime.datetime + :ivar last_modified_time: The account last modified time. + :vartype last_modified_time: ~datetime.datetime + :ivar endpoint: The full CName endpoint for this account. + :vartype endpoint: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'tags': {'readonly': True}, + 'account_id': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'state': {'readonly': True}, + 'creation_time': {'readonly': True}, + 'last_modified_time': {'readonly': True}, + 'endpoint': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'account_id': {'key': 'properties.accountId', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'state': {'key': 'properties.state', 'type': 'str'}, + 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, + 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, + 'endpoint': {'key': 'properties.endpoint', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(DataLakeAnalyticsAccountBasic, self).__init__(**kwargs) + self.account_id = None + self.provisioning_state = None + self.state = None + self.creation_time = None + self.last_modified_time = None + self.endpoint = None + + +class DataLakeAnalyticsAccountListResult(msrest.serialization.Model): + """Data Lake Analytics account list information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The results of the list operation. + :vartype value: + list[~azure.mgmt.datalake.analytics.account.models.DataLakeAnalyticsAccountBasic] + :ivar count: The current number of data lake analytics accounts under this subscription. + :vartype count: int + :ivar next_link: The link (url) to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'count': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DataLakeAnalyticsAccountBasic]'}, + 'count': {'key': 'count', 'type': 'int'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(DataLakeAnalyticsAccountListResult, self).__init__(**kwargs) + self.value = None + self.count = None + self.next_link = None + + +class DataLakeAnalyticsAccountPropertiesBasic(msrest.serialization.Model): + """The basic account specific properties that are associated with an underlying Data Lake Analytics account. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar account_id: The unique identifier associated with this Data Lake Analytics account. + :vartype account_id: str + :ivar provisioning_state: The provisioning status of the Data Lake Analytics account. Known + values are: "Failed", "Creating", "Running", "Succeeded", "Patching", "Suspending", "Resuming", + "Deleting", "Deleted", "Undeleting", "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.datalake.analytics.account.models.DataLakeAnalyticsAccountStatus + :ivar state: The state of the Data Lake Analytics account. Known values are: "Active", + "Suspended". + :vartype state: str or + ~azure.mgmt.datalake.analytics.account.models.DataLakeAnalyticsAccountState + :ivar creation_time: The account creation time. + :vartype creation_time: ~datetime.datetime + :ivar last_modified_time: The account last modified time. + :vartype last_modified_time: ~datetime.datetime + :ivar endpoint: The full CName endpoint for this account. + :vartype endpoint: str + """ + + _validation = { + 'account_id': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'state': {'readonly': True}, + 'creation_time': {'readonly': True}, + 'last_modified_time': {'readonly': True}, + 'endpoint': {'readonly': True}, + } + + _attribute_map = { + 'account_id': {'key': 'accountId', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'state': {'key': 'state', 'type': 'str'}, + 'creation_time': {'key': 'creationTime', 'type': 'iso-8601'}, + 'last_modified_time': {'key': 'lastModifiedTime', 'type': 'iso-8601'}, + 'endpoint': {'key': 'endpoint', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(DataLakeAnalyticsAccountPropertiesBasic, self).__init__(**kwargs) + self.account_id = None + self.provisioning_state = None + self.state = None + self.creation_time = None + self.last_modified_time = None + self.endpoint = None + + +class DataLakeAnalyticsAccountProperties(DataLakeAnalyticsAccountPropertiesBasic): + """The account specific properties that are associated with an underlying Data Lake Analytics account. Returned only when retrieving a specific account. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar account_id: The unique identifier associated with this Data Lake Analytics account. + :vartype account_id: str + :ivar provisioning_state: The provisioning status of the Data Lake Analytics account. Known + values are: "Failed", "Creating", "Running", "Succeeded", "Patching", "Suspending", "Resuming", + "Deleting", "Deleted", "Undeleting", "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.datalake.analytics.account.models.DataLakeAnalyticsAccountStatus + :ivar state: The state of the Data Lake Analytics account. Known values are: "Active", + "Suspended". + :vartype state: str or + ~azure.mgmt.datalake.analytics.account.models.DataLakeAnalyticsAccountState + :ivar creation_time: The account creation time. + :vartype creation_time: ~datetime.datetime + :ivar last_modified_time: The account last modified time. + :vartype last_modified_time: ~datetime.datetime + :ivar endpoint: The full CName endpoint for this account. + :vartype endpoint: str + :ivar default_data_lake_store_account_type: The type of the default Data Lake Store account + associated with this account. + :vartype default_data_lake_store_account_type: str + :ivar default_data_lake_store_account: The default Data Lake Store account associated with this + account. + :vartype default_data_lake_store_account: str + :ivar data_lake_store_accounts: The list of Data Lake Store accounts associated with this + account. + :vartype data_lake_store_accounts: + list[~azure.mgmt.datalake.analytics.account.models.DataLakeStoreAccountInformation] + :ivar public_data_lake_store_accounts: The list of Data Lake Store accounts associated with + this account. + :vartype public_data_lake_store_accounts: + list[~azure.mgmt.datalake.analytics.account.models.DataLakeStoreAccountInformation] + :ivar storage_accounts: The list of Azure Blob Storage accounts associated with this account. + :vartype storage_accounts: + list[~azure.mgmt.datalake.analytics.account.models.StorageAccountInformation] + :ivar compute_policies: The list of compute policies associated with this account. + :vartype compute_policies: list[~azure.mgmt.datalake.analytics.account.models.ComputePolicy] + :ivar hive_metastores: The list of hiveMetastores associated with this account. + :vartype hive_metastores: list[~azure.mgmt.datalake.analytics.account.models.HiveMetastore] + :ivar virtual_network_rules: The list of virtualNetwork rules associated with this account. + :vartype virtual_network_rules: + list[~azure.mgmt.datalake.analytics.account.models.VirtualNetworkRule] + :ivar firewall_rules: The list of firewall rules associated with this account. + :vartype firewall_rules: list[~azure.mgmt.datalake.analytics.account.models.FirewallRule] + :ivar firewall_state: The current state of the IP address firewall for this account. Known + values are: "Enabled", "Disabled". + :vartype firewall_state: str or ~azure.mgmt.datalake.analytics.account.models.FirewallState + :ivar firewall_allow_azure_ips: The current state of allowing or disallowing IPs originating + within Azure through the firewall. If the firewall is disabled, this is not enforced. Known + values are: "Enabled", "Disabled". + :vartype firewall_allow_azure_ips: str or + ~azure.mgmt.datalake.analytics.account.models.FirewallAllowAzureIpsState + :ivar new_tier: The commitment tier for the next month. Known values are: "Consumption", + "Commitment_100AUHours", "Commitment_500AUHours", "Commitment_1000AUHours", + "Commitment_5000AUHours", "Commitment_10000AUHours", "Commitment_50000AUHours", + "Commitment_100000AUHours", "Commitment_500000AUHours". + :vartype new_tier: str or ~azure.mgmt.datalake.analytics.account.models.TierType + :ivar current_tier: The commitment tier in use for the current month. Known values are: + "Consumption", "Commitment_100AUHours", "Commitment_500AUHours", "Commitment_1000AUHours", + "Commitment_5000AUHours", "Commitment_10000AUHours", "Commitment_50000AUHours", + "Commitment_100000AUHours", "Commitment_500000AUHours". + :vartype current_tier: str or ~azure.mgmt.datalake.analytics.account.models.TierType + :ivar max_job_count: The maximum supported jobs running under the account at the same time. + :vartype max_job_count: int + :ivar max_active_job_count_per_user: The maximum supported active jobs under the account at the + same time. + :vartype max_active_job_count_per_user: int + :ivar max_queued_job_count_per_user: The maximum supported jobs queued under the account at the + same time. + :vartype max_queued_job_count_per_user: int + :ivar max_job_running_time_in_min: The maximum supported active jobs under the account at the + same time. + :vartype max_job_running_time_in_min: int + :ivar system_max_job_count: The system defined maximum supported jobs running under the account + at the same time, which restricts the maximum number of running jobs the user can set for the + account. + :vartype system_max_job_count: int + :ivar max_degree_of_parallelism: The maximum supported degree of parallelism for this account. + :vartype max_degree_of_parallelism: int + :ivar system_max_degree_of_parallelism: The system defined maximum supported degree of + parallelism for this account, which restricts the maximum value of parallelism the user can set + for the account. + :vartype system_max_degree_of_parallelism: int + :ivar max_degree_of_parallelism_per_job: The maximum supported degree of parallelism per job + for this account. + :vartype max_degree_of_parallelism_per_job: int + :ivar min_priority_per_job: The minimum supported priority per job for this account. + :vartype min_priority_per_job: int + :ivar query_store_retention: The number of days that job metadata is retained. + :vartype query_store_retention: int + :ivar debug_data_access_level: The current state of the DebugDataAccessLevel for this account. + Known values are: "All", "Customer", "None". + :vartype debug_data_access_level: str or + ~azure.mgmt.datalake.analytics.account.models.DebugDataAccessLevel + """ + + _validation = { + 'account_id': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'state': {'readonly': True}, + 'creation_time': {'readonly': True}, + 'last_modified_time': {'readonly': True}, + 'endpoint': {'readonly': True}, + 'default_data_lake_store_account_type': {'readonly': True}, + 'default_data_lake_store_account': {'readonly': True}, + 'data_lake_store_accounts': {'readonly': True}, + 'storage_accounts': {'readonly': True}, + 'compute_policies': {'readonly': True}, + 'hive_metastores': {'readonly': True}, + 'virtual_network_rules': {'readonly': True}, + 'firewall_rules': {'readonly': True}, + 'current_tier': {'readonly': True}, + 'max_job_count': {'minimum': 1}, + 'max_active_job_count_per_user': {'readonly': True}, + 'max_queued_job_count_per_user': {'readonly': True}, + 'max_job_running_time_in_min': {'readonly': True}, + 'system_max_job_count': {'readonly': True}, + 'max_degree_of_parallelism': {'minimum': 1}, + 'system_max_degree_of_parallelism': {'readonly': True}, + 'max_degree_of_parallelism_per_job': {'minimum': 1}, + 'min_priority_per_job': {'readonly': True, 'minimum': 1}, + 'query_store_retention': {'maximum': 180, 'minimum': 1}, + 'debug_data_access_level': {'readonly': True}, + } + + _attribute_map = { + 'account_id': {'key': 'accountId', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'state': {'key': 'state', 'type': 'str'}, + 'creation_time': {'key': 'creationTime', 'type': 'iso-8601'}, + 'last_modified_time': {'key': 'lastModifiedTime', 'type': 'iso-8601'}, + 'endpoint': {'key': 'endpoint', 'type': 'str'}, + 'default_data_lake_store_account_type': {'key': 'defaultDataLakeStoreAccountType', 'type': 'str'}, + 'default_data_lake_store_account': {'key': 'defaultDataLakeStoreAccount', 'type': 'str'}, + 'data_lake_store_accounts': {'key': 'dataLakeStoreAccounts', 'type': '[DataLakeStoreAccountInformation]'}, + 'public_data_lake_store_accounts': {'key': 'publicDataLakeStoreAccounts', 'type': '[DataLakeStoreAccountInformation]'}, + 'storage_accounts': {'key': 'storageAccounts', 'type': '[StorageAccountInformation]'}, + 'compute_policies': {'key': 'computePolicies', 'type': '[ComputePolicy]'}, + 'hive_metastores': {'key': 'hiveMetastores', 'type': '[HiveMetastore]'}, + 'virtual_network_rules': {'key': 'virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, + 'firewall_rules': {'key': 'firewallRules', 'type': '[FirewallRule]'}, + 'firewall_state': {'key': 'firewallState', 'type': 'str'}, + 'firewall_allow_azure_ips': {'key': 'firewallAllowAzureIps', 'type': 'str'}, + 'new_tier': {'key': 'newTier', 'type': 'str'}, + 'current_tier': {'key': 'currentTier', 'type': 'str'}, + 'max_job_count': {'key': 'maxJobCount', 'type': 'int'}, + 'max_active_job_count_per_user': {'key': 'maxActiveJobCountPerUser', 'type': 'int'}, + 'max_queued_job_count_per_user': {'key': 'maxQueuedJobCountPerUser', 'type': 'int'}, + 'max_job_running_time_in_min': {'key': 'maxJobRunningTimeInMin', 'type': 'int'}, + 'system_max_job_count': {'key': 'systemMaxJobCount', 'type': 'int'}, + 'max_degree_of_parallelism': {'key': 'maxDegreeOfParallelism', 'type': 'int'}, + 'system_max_degree_of_parallelism': {'key': 'systemMaxDegreeOfParallelism', 'type': 'int'}, + 'max_degree_of_parallelism_per_job': {'key': 'maxDegreeOfParallelismPerJob', 'type': 'int'}, + 'min_priority_per_job': {'key': 'minPriorityPerJob', 'type': 'int'}, + 'query_store_retention': {'key': 'queryStoreRetention', 'type': 'int'}, + 'debug_data_access_level': {'key': 'debugDataAccessLevel', 'type': 'str'}, + } + + def __init__( + self, + *, + public_data_lake_store_accounts: Optional[List["_models.DataLakeStoreAccountInformation"]] = None, + firewall_state: Optional[Union[str, "_models.FirewallState"]] = None, + firewall_allow_azure_ips: Optional[Union[str, "_models.FirewallAllowAzureIpsState"]] = None, + new_tier: Optional[Union[str, "_models.TierType"]] = None, + max_job_count: Optional[int] = 3, + max_degree_of_parallelism: Optional[int] = 30, + max_degree_of_parallelism_per_job: Optional[int] = None, + query_store_retention: Optional[int] = 30, + **kwargs + ): + """ + :keyword public_data_lake_store_accounts: The list of Data Lake Store accounts associated with + this account. + :paramtype public_data_lake_store_accounts: + list[~azure.mgmt.datalake.analytics.account.models.DataLakeStoreAccountInformation] + :keyword firewall_state: The current state of the IP address firewall for this account. Known + values are: "Enabled", "Disabled". + :paramtype firewall_state: str or ~azure.mgmt.datalake.analytics.account.models.FirewallState + :keyword firewall_allow_azure_ips: The current state of allowing or disallowing IPs originating + within Azure through the firewall. If the firewall is disabled, this is not enforced. Known + values are: "Enabled", "Disabled". + :paramtype firewall_allow_azure_ips: str or + ~azure.mgmt.datalake.analytics.account.models.FirewallAllowAzureIpsState + :keyword new_tier: The commitment tier for the next month. Known values are: "Consumption", + "Commitment_100AUHours", "Commitment_500AUHours", "Commitment_1000AUHours", + "Commitment_5000AUHours", "Commitment_10000AUHours", "Commitment_50000AUHours", + "Commitment_100000AUHours", "Commitment_500000AUHours". + :paramtype new_tier: str or ~azure.mgmt.datalake.analytics.account.models.TierType + :keyword max_job_count: The maximum supported jobs running under the account at the same time. + :paramtype max_job_count: int + :keyword max_degree_of_parallelism: The maximum supported degree of parallelism for this + account. + :paramtype max_degree_of_parallelism: int + :keyword max_degree_of_parallelism_per_job: The maximum supported degree of parallelism per job + for this account. + :paramtype max_degree_of_parallelism_per_job: int + :keyword query_store_retention: The number of days that job metadata is retained. + :paramtype query_store_retention: int + """ + super(DataLakeAnalyticsAccountProperties, self).__init__(**kwargs) + self.default_data_lake_store_account_type = None + self.default_data_lake_store_account = None + self.data_lake_store_accounts = None + self.public_data_lake_store_accounts = public_data_lake_store_accounts + self.storage_accounts = None + self.compute_policies = None + self.hive_metastores = None + self.virtual_network_rules = None + self.firewall_rules = None + self.firewall_state = firewall_state + self.firewall_allow_azure_ips = firewall_allow_azure_ips + self.new_tier = new_tier + self.current_tier = None + self.max_job_count = max_job_count + self.max_active_job_count_per_user = None + self.max_queued_job_count_per_user = None + self.max_job_running_time_in_min = None + self.system_max_job_count = None + self.max_degree_of_parallelism = max_degree_of_parallelism + self.system_max_degree_of_parallelism = None + self.max_degree_of_parallelism_per_job = max_degree_of_parallelism_per_job + self.min_priority_per_job = None + self.query_store_retention = query_store_retention + self.debug_data_access_level = None + + +class DataLakeStoreAccountInformation(SubResource): + """Data Lake Store account information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The resource name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :ivar suffix: The optional suffix for the Data Lake Store account. + :vartype suffix: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'suffix': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'suffix': {'key': 'properties.suffix', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(DataLakeStoreAccountInformation, self).__init__(**kwargs) + self.suffix = None + + +class DataLakeStoreAccountInformationListResult(msrest.serialization.Model): + """Data Lake Store account list information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The results of the list operation. + :vartype value: + list[~azure.mgmt.datalake.analytics.account.models.DataLakeStoreAccountInformation] + :ivar next_link: The link (url) to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DataLakeStoreAccountInformation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(DataLakeStoreAccountInformationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(msrest.serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.datalake.analytics.account.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.datalake.analytics.account.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + :ivar error: The error object. + :vartype error: ~azure.mgmt.datalake.analytics.account.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + *, + error: Optional["_models.ErrorDetail"] = None, + **kwargs + ): + """ + :keyword error: The error object. + :paramtype error: ~azure.mgmt.datalake.analytics.account.models.ErrorDetail + """ + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class FirewallRule(SubResource): + """Data Lake Analytics firewall rule information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The resource name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :ivar start_ip_address: The start IP address for the firewall rule. This can be either ipv4 or + ipv6. Start and End should be in the same protocol. + :vartype start_ip_address: str + :ivar end_ip_address: The end IP address for the firewall rule. This can be either ipv4 or + ipv6. Start and End should be in the same protocol. + :vartype end_ip_address: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'start_ip_address': {'readonly': True}, + 'end_ip_address': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'start_ip_address': {'key': 'properties.startIpAddress', 'type': 'str'}, + 'end_ip_address': {'key': 'properties.endIpAddress', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(FirewallRule, self).__init__(**kwargs) + self.start_ip_address = None + self.end_ip_address = None + + +class FirewallRuleListResult(msrest.serialization.Model): + """Data Lake Analytics firewall rule list information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The results of the list operation. + :vartype value: list[~azure.mgmt.datalake.analytics.account.models.FirewallRule] + :ivar next_link: The link (url) to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[FirewallRule]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(FirewallRuleListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class HiveMetastore(SubResource): + """HiveMetastore. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The resource name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :ivar server_uri: The serverUri for the Hive MetaStore. + :vartype server_uri: str + :ivar database_name: The databaseName for the Hive MetaStore. + :vartype database_name: str + :ivar runtime_version: The runtimeVersion for the Hive MetaStore. + :vartype runtime_version: str + :ivar user_name: The userName for the Hive MetaStore. + :vartype user_name: str + :ivar password: The password for the Hive MetaStore. + :vartype password: str + :ivar nested_resource_provisioning_state: The current state of the NestedResource. Known values + are: "Succeeded", "Canceled", "Failed". + :vartype nested_resource_provisioning_state: str or + ~azure.mgmt.datalake.analytics.account.models.NestedResourceProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'server_uri': {'readonly': True}, + 'database_name': {'readonly': True}, + 'runtime_version': {'readonly': True}, + 'user_name': {'readonly': True}, + 'password': {'readonly': True}, + 'nested_resource_provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'server_uri': {'key': 'properties.serverUri', 'type': 'str'}, + 'database_name': {'key': 'properties.databaseName', 'type': 'str'}, + 'runtime_version': {'key': 'properties.runtimeVersion', 'type': 'str'}, + 'user_name': {'key': 'properties.userName', 'type': 'str'}, + 'password': {'key': 'properties.password', 'type': 'str'}, + 'nested_resource_provisioning_state': {'key': 'properties.nestedResourceProvisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(HiveMetastore, self).__init__(**kwargs) + self.server_uri = None + self.database_name = None + self.runtime_version = None + self.user_name = None + self.password = None + self.nested_resource_provisioning_state = None + + +class HiveMetastoreListResult(msrest.serialization.Model): + """Data Lake Analytics HiveMetastore list information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The results of the list operation. + :vartype value: list[~azure.mgmt.datalake.analytics.account.models.HiveMetastore] + :ivar next_link: The link (url) to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[HiveMetastore]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(HiveMetastoreListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class NameAvailabilityInformation(msrest.serialization.Model): + """Data Lake Analytics account name availability result information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name_available: The Boolean value of true or false to indicate whether the Data Lake + Analytics account name is available or not. + :vartype name_available: bool + :ivar reason: The reason why the Data Lake Analytics account name is not available, if + nameAvailable is false. + :vartype reason: str + :ivar message: The message describing why the Data Lake Analytics account name is not + available, if nameAvailable is false. + :vartype message: str + """ + + _validation = { + 'name_available': {'readonly': True}, + 'reason': {'readonly': True}, + 'message': {'readonly': True}, + } + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(NameAvailabilityInformation, self).__init__(**kwargs) + self.name_available = None + self.reason = None + self.message = None + + +class Operation(msrest.serialization.Model): + """An available operation for Data Lake Analytics. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the operation. + :vartype name: str + :ivar display: The display information for the operation. + :vartype display: ~azure.mgmt.datalake.analytics.account.models.OperationDisplay + :ivar properties: The OperationMetaPropertyInfo for the operation. + :vartype properties: ~azure.mgmt.datalake.analytics.account.models.OperationMetaPropertyInfo + :ivar origin: The intended executor of the operation. Known values are: "user", "system", + "user,system". + :vartype origin: str or ~azure.mgmt.datalake.analytics.account.models.OperationOrigin + """ + + _validation = { + 'name': {'readonly': True}, + 'display': {'readonly': True}, + 'properties': {'readonly': True}, + 'origin': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'properties': {'key': 'properties', 'type': 'OperationMetaPropertyInfo'}, + 'origin': {'key': 'origin', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = None + self.properties = None + self.origin = None + + +class OperationDisplay(msrest.serialization.Model): + """The display information for a particular operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: The resource provider of the operation. + :vartype provider: str + :ivar resource: The resource type of the operation. + :vartype resource: str + :ivar operation: A friendly name of the operation. + :vartype operation: str + :ivar description: A friendly description of the operation. + :vartype description: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None + + +class OperationListResult(msrest.serialization.Model): + """The list of available operations for Data Lake Analytics. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The results of the list operation. + :vartype value: list[~azure.mgmt.datalake.analytics.account.models.Operation] + :ivar next_link: The link (url) to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(OperationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class OperationMetaLogSpecification(msrest.serialization.Model): + """OperationMetaLogSpecification. + + :ivar name: The name for OperationMetaLogSpecification. + :vartype name: str + :ivar display_name: The displayName for OperationMetaLogSpecification. + :vartype display_name: str + :ivar blob_duration: The blobDuration for OperationMetaLogSpecification. + :vartype blob_duration: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + blob_duration: Optional[str] = None, + **kwargs + ): + """ + :keyword name: The name for OperationMetaLogSpecification. + :paramtype name: str + :keyword display_name: The displayName for OperationMetaLogSpecification. + :paramtype display_name: str + :keyword blob_duration: The blobDuration for OperationMetaLogSpecification. + :paramtype blob_duration: str + """ + super(OperationMetaLogSpecification, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.blob_duration = blob_duration + + +class OperationMetaMetricAvailabilitiesSpecification(msrest.serialization.Model): + """OperationMetaMetricAvailabilitiesSpecification. + + :ivar time_grain: The timegrain for OperationMetaMetricAvailabilitiesSpecification. + :vartype time_grain: str + :ivar blob_duration: The blobDuration for OperationMetaMetricAvailabilitiesSpecification. + :vartype blob_duration: str + """ + + _attribute_map = { + 'time_grain': {'key': 'timeGrain', 'type': 'str'}, + 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, + } + + def __init__( + self, + *, + time_grain: Optional[str] = None, + blob_duration: Optional[str] = None, + **kwargs + ): + """ + :keyword time_grain: The timegrain for OperationMetaMetricAvailabilitiesSpecification. + :paramtype time_grain: str + :keyword blob_duration: The blobDuration for OperationMetaMetricAvailabilitiesSpecification. + :paramtype blob_duration: str + """ + super(OperationMetaMetricAvailabilitiesSpecification, self).__init__(**kwargs) + self.time_grain = time_grain + self.blob_duration = blob_duration + + +class OperationMetaMetricSpecification(msrest.serialization.Model): + """OperationMetaMetricSpecification. + + :ivar name: The name for OperationMetaMetricSpecification. + :vartype name: str + :ivar display_description: The displayName for OperationMetaMetricSpecification. + :vartype display_description: str + :ivar display_name: The displayName for OperationMetaMetricSpecification. + :vartype display_name: str + :ivar unit: The unit for OperationMetaMetricSpecification. + :vartype unit: str + :ivar aggregation_type: The aggregationType for OperationMetaMetricSpecification. + :vartype aggregation_type: str + :ivar availabilities: The availabilities for OperationMetaMetricSpecification. + :vartype availabilities: + list[~azure.mgmt.datalake.analytics.account.models.OperationMetaMetricAvailabilitiesSpecification] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, + 'availabilities': {'key': 'availabilities', 'type': '[OperationMetaMetricAvailabilitiesSpecification]'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_description: Optional[str] = None, + display_name: Optional[str] = None, + unit: Optional[str] = None, + aggregation_type: Optional[str] = None, + availabilities: Optional[List["_models.OperationMetaMetricAvailabilitiesSpecification"]] = None, + **kwargs + ): + """ + :keyword name: The name for OperationMetaMetricSpecification. + :paramtype name: str + :keyword display_description: The displayName for OperationMetaMetricSpecification. + :paramtype display_description: str + :keyword display_name: The displayName for OperationMetaMetricSpecification. + :paramtype display_name: str + :keyword unit: The unit for OperationMetaMetricSpecification. + :paramtype unit: str + :keyword aggregation_type: The aggregationType for OperationMetaMetricSpecification. + :paramtype aggregation_type: str + :keyword availabilities: The availabilities for OperationMetaMetricSpecification. + :paramtype availabilities: + list[~azure.mgmt.datalake.analytics.account.models.OperationMetaMetricAvailabilitiesSpecification] + """ + super(OperationMetaMetricSpecification, self).__init__(**kwargs) + self.name = name + self.display_description = display_description + self.display_name = display_name + self.unit = unit + self.aggregation_type = aggregation_type + self.availabilities = availabilities + + +class OperationMetaPropertyInfo(msrest.serialization.Model): + """OperationMetaPropertyInfo. + + :ivar service_specification: The operations OperationMetaServiceSpecification. + :vartype service_specification: + ~azure.mgmt.datalake.analytics.account.models.OperationMetaServiceSpecification + """ + + _attribute_map = { + 'service_specification': {'key': 'serviceSpecification', 'type': 'OperationMetaServiceSpecification'}, + } + + def __init__( + self, + *, + service_specification: Optional["_models.OperationMetaServiceSpecification"] = None, + **kwargs + ): + """ + :keyword service_specification: The operations OperationMetaServiceSpecification. + :paramtype service_specification: + ~azure.mgmt.datalake.analytics.account.models.OperationMetaServiceSpecification + """ + super(OperationMetaPropertyInfo, self).__init__(**kwargs) + self.service_specification = service_specification + + +class OperationMetaServiceSpecification(msrest.serialization.Model): + """OperationMetaServiceSpecification. + + :ivar metric_specifications: The metricSpecifications for OperationMetaServiceSpecification. + :vartype metric_specifications: + list[~azure.mgmt.datalake.analytics.account.models.OperationMetaMetricSpecification] + :ivar log_specifications: The logSpecifications for OperationMetaServiceSpecification. + :vartype log_specifications: + list[~azure.mgmt.datalake.analytics.account.models.OperationMetaLogSpecification] + """ + + _attribute_map = { + 'metric_specifications': {'key': 'metricSpecifications', 'type': '[OperationMetaMetricSpecification]'}, + 'log_specifications': {'key': 'logSpecifications', 'type': '[OperationMetaLogSpecification]'}, + } + + def __init__( + self, + *, + metric_specifications: Optional[List["_models.OperationMetaMetricSpecification"]] = None, + log_specifications: Optional[List["_models.OperationMetaLogSpecification"]] = None, + **kwargs + ): + """ + :keyword metric_specifications: The metricSpecifications for OperationMetaServiceSpecification. + :paramtype metric_specifications: + list[~azure.mgmt.datalake.analytics.account.models.OperationMetaMetricSpecification] + :keyword log_specifications: The logSpecifications for OperationMetaServiceSpecification. + :paramtype log_specifications: + list[~azure.mgmt.datalake.analytics.account.models.OperationMetaLogSpecification] + """ + super(OperationMetaServiceSpecification, self).__init__(**kwargs) + self.metric_specifications = metric_specifications + self.log_specifications = log_specifications + + +class SasTokenInformation(msrest.serialization.Model): + """SAS token information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar access_token: The access token for the associated Azure Storage Container. + :vartype access_token: str + """ + + _validation = { + 'access_token': {'readonly': True}, + } + + _attribute_map = { + 'access_token': {'key': 'accessToken', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(SasTokenInformation, self).__init__(**kwargs) + self.access_token = None + + +class SasTokenInformationListResult(msrest.serialization.Model): + """The SAS response that contains the storage account, container and associated SAS token for connection use. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The results of the list operation. + :vartype value: list[~azure.mgmt.datalake.analytics.account.models.SasTokenInformation] + :ivar next_link: The link (url) to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SasTokenInformation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(SasTokenInformationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class StorageAccountInformation(SubResource): + """Azure Storage account information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The resource name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :ivar suffix: The optional suffix for the storage account. + :vartype suffix: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'suffix': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'suffix': {'key': 'properties.suffix', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(StorageAccountInformation, self).__init__(**kwargs) + self.suffix = None + + +class StorageAccountInformationListResult(msrest.serialization.Model): + """Azure Storage account list information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The results of the list operation. + :vartype value: list[~azure.mgmt.datalake.analytics.account.models.StorageAccountInformation] + :ivar next_link: The link (url) to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[StorageAccountInformation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(StorageAccountInformationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class StorageContainer(SubResource): + """Azure Storage blob container information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The resource name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :ivar last_modified_time: The last modified time of the blob container. + :vartype last_modified_time: ~datetime.datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'last_modified_time': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(StorageContainer, self).__init__(**kwargs) + self.last_modified_time = None + + +class StorageContainerListResult(msrest.serialization.Model): + """The list of blob containers associated with the storage account attached to the Data Lake Analytics account. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The results of the list operation. + :vartype value: list[~azure.mgmt.datalake.analytics.account.models.StorageContainer] + :ivar next_link: The link (url) to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[StorageContainer]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(StorageContainerListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class UpdateComputePolicyParameters(msrest.serialization.Model): + """The parameters used to update a compute policy. + + :ivar object_id: The AAD object identifier for the entity to create a policy for. + :vartype object_id: str + :ivar object_type: The type of AAD object the object identifier refers to. Known values are: + "User", "Group", "ServicePrincipal". + :vartype object_type: str or ~azure.mgmt.datalake.analytics.account.models.AADObjectType + :ivar max_degree_of_parallelism_per_job: The maximum degree of parallelism per job this user + can use to submit jobs. This property, the min priority per job property, or both must be + passed. + :vartype max_degree_of_parallelism_per_job: int + :ivar min_priority_per_job: The minimum priority per job this user can use to submit jobs. This + property, the max degree of parallelism per job property, or both must be passed. + :vartype min_priority_per_job: int + """ + + _validation = { + 'max_degree_of_parallelism_per_job': {'minimum': 1}, + 'min_priority_per_job': {'minimum': 1}, + } + + _attribute_map = { + 'object_id': {'key': 'properties.objectId', 'type': 'str'}, + 'object_type': {'key': 'properties.objectType', 'type': 'str'}, + 'max_degree_of_parallelism_per_job': {'key': 'properties.maxDegreeOfParallelismPerJob', 'type': 'int'}, + 'min_priority_per_job': {'key': 'properties.minPriorityPerJob', 'type': 'int'}, + } + + def __init__( + self, + *, + object_id: Optional[str] = None, + object_type: Optional[Union[str, "_models.AADObjectType"]] = None, + max_degree_of_parallelism_per_job: Optional[int] = None, + min_priority_per_job: Optional[int] = None, + **kwargs + ): + """ + :keyword object_id: The AAD object identifier for the entity to create a policy for. + :paramtype object_id: str + :keyword object_type: The type of AAD object the object identifier refers to. Known values are: + "User", "Group", "ServicePrincipal". + :paramtype object_type: str or ~azure.mgmt.datalake.analytics.account.models.AADObjectType + :keyword max_degree_of_parallelism_per_job: The maximum degree of parallelism per job this user + can use to submit jobs. This property, the min priority per job property, or both must be + passed. + :paramtype max_degree_of_parallelism_per_job: int + :keyword min_priority_per_job: The minimum priority per job this user can use to submit jobs. + This property, the max degree of parallelism per job property, or both must be passed. + :paramtype min_priority_per_job: int + """ + super(UpdateComputePolicyParameters, self).__init__(**kwargs) + self.object_id = object_id + self.object_type = object_type + self.max_degree_of_parallelism_per_job = max_degree_of_parallelism_per_job + self.min_priority_per_job = min_priority_per_job + + +class UpdateComputePolicyWithAccountParameters(msrest.serialization.Model): + """The parameters used to update a compute policy while updating a Data Lake Analytics account. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. The unique name of the compute policy to update. + :vartype name: str + :ivar object_id: The AAD object identifier for the entity to create a policy for. + :vartype object_id: str + :ivar object_type: The type of AAD object the object identifier refers to. Known values are: + "User", "Group", "ServicePrincipal". + :vartype object_type: str or ~azure.mgmt.datalake.analytics.account.models.AADObjectType + :ivar max_degree_of_parallelism_per_job: The maximum degree of parallelism per job this user + can use to submit jobs. This property, the min priority per job property, or both must be + passed. + :vartype max_degree_of_parallelism_per_job: int + :ivar min_priority_per_job: The minimum priority per job this user can use to submit jobs. This + property, the max degree of parallelism per job property, or both must be passed. + :vartype min_priority_per_job: int + """ + + _validation = { + 'name': {'required': True}, + 'max_degree_of_parallelism_per_job': {'minimum': 1}, + 'min_priority_per_job': {'minimum': 1}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'object_id': {'key': 'properties.objectId', 'type': 'str'}, + 'object_type': {'key': 'properties.objectType', 'type': 'str'}, + 'max_degree_of_parallelism_per_job': {'key': 'properties.maxDegreeOfParallelismPerJob', 'type': 'int'}, + 'min_priority_per_job': {'key': 'properties.minPriorityPerJob', 'type': 'int'}, + } + + def __init__( + self, + *, + name: str, + object_id: Optional[str] = None, + object_type: Optional[Union[str, "_models.AADObjectType"]] = None, + max_degree_of_parallelism_per_job: Optional[int] = None, + min_priority_per_job: Optional[int] = None, + **kwargs + ): + """ + :keyword name: Required. The unique name of the compute policy to update. + :paramtype name: str + :keyword object_id: The AAD object identifier for the entity to create a policy for. + :paramtype object_id: str + :keyword object_type: The type of AAD object the object identifier refers to. Known values are: + "User", "Group", "ServicePrincipal". + :paramtype object_type: str or ~azure.mgmt.datalake.analytics.account.models.AADObjectType + :keyword max_degree_of_parallelism_per_job: The maximum degree of parallelism per job this user + can use to submit jobs. This property, the min priority per job property, or both must be + passed. + :paramtype max_degree_of_parallelism_per_job: int + :keyword min_priority_per_job: The minimum priority per job this user can use to submit jobs. + This property, the max degree of parallelism per job property, or both must be passed. + :paramtype min_priority_per_job: int + """ + super(UpdateComputePolicyWithAccountParameters, self).__init__(**kwargs) + self.name = name + self.object_id = object_id + self.object_type = object_type + self.max_degree_of_parallelism_per_job = max_degree_of_parallelism_per_job + self.min_priority_per_job = min_priority_per_job + + +class UpdateDataLakeAnalyticsAccountParameters(msrest.serialization.Model): + """The parameters that can be used to update an existing Data Lake Analytics account. + + :ivar tags: A set of tags. The resource tags. + :vartype tags: dict[str, str] + :ivar data_lake_store_accounts: The list of Data Lake Store accounts associated with this + account. + :vartype data_lake_store_accounts: + list[~azure.mgmt.datalake.analytics.account.models.UpdateDataLakeStoreWithAccountParameters] + :ivar storage_accounts: The list of Azure Blob storage accounts associated with this account. + :vartype storage_accounts: + list[~azure.mgmt.datalake.analytics.account.models.UpdateStorageAccountWithAccountParameters] + :ivar compute_policies: The list of compute policies associated with this account. + :vartype compute_policies: + list[~azure.mgmt.datalake.analytics.account.models.UpdateComputePolicyWithAccountParameters] + :ivar firewall_rules: The list of firewall rules associated with this account. + :vartype firewall_rules: + list[~azure.mgmt.datalake.analytics.account.models.UpdateFirewallRuleWithAccountParameters] + :ivar firewall_state: The current state of the IP address firewall for this account. Disabling + the firewall does not remove existing rules, they will just be ignored until the firewall is + re-enabled. Known values are: "Enabled", "Disabled". + :vartype firewall_state: str or ~azure.mgmt.datalake.analytics.account.models.FirewallState + :ivar firewall_allow_azure_ips: The current state of allowing or disallowing IPs originating + within Azure through the firewall. If the firewall is disabled, this is not enforced. Known + values are: "Enabled", "Disabled". + :vartype firewall_allow_azure_ips: str or + ~azure.mgmt.datalake.analytics.account.models.FirewallAllowAzureIpsState + :ivar new_tier: The commitment tier to use for next month. Known values are: "Consumption", + "Commitment_100AUHours", "Commitment_500AUHours", "Commitment_1000AUHours", + "Commitment_5000AUHours", "Commitment_10000AUHours", "Commitment_50000AUHours", + "Commitment_100000AUHours", "Commitment_500000AUHours". + :vartype new_tier: str or ~azure.mgmt.datalake.analytics.account.models.TierType + :ivar max_job_count: The maximum supported jobs running under the account at the same time. + :vartype max_job_count: int + :ivar max_degree_of_parallelism: The maximum supported degree of parallelism for this account. + :vartype max_degree_of_parallelism: int + :ivar max_degree_of_parallelism_per_job: The maximum supported degree of parallelism per job + for this account. + :vartype max_degree_of_parallelism_per_job: int + :ivar min_priority_per_job: The minimum supported priority per job for this account. + :vartype min_priority_per_job: int + :ivar query_store_retention: The number of days that job metadata is retained. + :vartype query_store_retention: int + """ + + _validation = { + 'max_job_count': {'minimum': 1}, + 'max_degree_of_parallelism': {'minimum': 1}, + 'max_degree_of_parallelism_per_job': {'minimum': 1}, + 'min_priority_per_job': {'minimum': 1}, + 'query_store_retention': {'maximum': 180, 'minimum': 1}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'data_lake_store_accounts': {'key': 'properties.dataLakeStoreAccounts', 'type': '[UpdateDataLakeStoreWithAccountParameters]'}, + 'storage_accounts': {'key': 'properties.storageAccounts', 'type': '[UpdateStorageAccountWithAccountParameters]'}, + 'compute_policies': {'key': 'properties.computePolicies', 'type': '[UpdateComputePolicyWithAccountParameters]'}, + 'firewall_rules': {'key': 'properties.firewallRules', 'type': '[UpdateFirewallRuleWithAccountParameters]'}, + 'firewall_state': {'key': 'properties.firewallState', 'type': 'str'}, + 'firewall_allow_azure_ips': {'key': 'properties.firewallAllowAzureIps', 'type': 'str'}, + 'new_tier': {'key': 'properties.newTier', 'type': 'str'}, + 'max_job_count': {'key': 'properties.maxJobCount', 'type': 'int'}, + 'max_degree_of_parallelism': {'key': 'properties.maxDegreeOfParallelism', 'type': 'int'}, + 'max_degree_of_parallelism_per_job': {'key': 'properties.maxDegreeOfParallelismPerJob', 'type': 'int'}, + 'min_priority_per_job': {'key': 'properties.minPriorityPerJob', 'type': 'int'}, + 'query_store_retention': {'key': 'properties.queryStoreRetention', 'type': 'int'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + data_lake_store_accounts: Optional[List["_models.UpdateDataLakeStoreWithAccountParameters"]] = None, + storage_accounts: Optional[List["_models.UpdateStorageAccountWithAccountParameters"]] = None, + compute_policies: Optional[List["_models.UpdateComputePolicyWithAccountParameters"]] = None, + firewall_rules: Optional[List["_models.UpdateFirewallRuleWithAccountParameters"]] = None, + firewall_state: Optional[Union[str, "_models.FirewallState"]] = None, + firewall_allow_azure_ips: Optional[Union[str, "_models.FirewallAllowAzureIpsState"]] = None, + new_tier: Optional[Union[str, "_models.TierType"]] = None, + max_job_count: Optional[int] = None, + max_degree_of_parallelism: Optional[int] = None, + max_degree_of_parallelism_per_job: Optional[int] = None, + min_priority_per_job: Optional[int] = None, + query_store_retention: Optional[int] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. The resource tags. + :paramtype tags: dict[str, str] + :keyword data_lake_store_accounts: The list of Data Lake Store accounts associated with this + account. + :paramtype data_lake_store_accounts: + list[~azure.mgmt.datalake.analytics.account.models.UpdateDataLakeStoreWithAccountParameters] + :keyword storage_accounts: The list of Azure Blob storage accounts associated with this + account. + :paramtype storage_accounts: + list[~azure.mgmt.datalake.analytics.account.models.UpdateStorageAccountWithAccountParameters] + :keyword compute_policies: The list of compute policies associated with this account. + :paramtype compute_policies: + list[~azure.mgmt.datalake.analytics.account.models.UpdateComputePolicyWithAccountParameters] + :keyword firewall_rules: The list of firewall rules associated with this account. + :paramtype firewall_rules: + list[~azure.mgmt.datalake.analytics.account.models.UpdateFirewallRuleWithAccountParameters] + :keyword firewall_state: The current state of the IP address firewall for this account. + Disabling the firewall does not remove existing rules, they will just be ignored until the + firewall is re-enabled. Known values are: "Enabled", "Disabled". + :paramtype firewall_state: str or ~azure.mgmt.datalake.analytics.account.models.FirewallState + :keyword firewall_allow_azure_ips: The current state of allowing or disallowing IPs originating + within Azure through the firewall. If the firewall is disabled, this is not enforced. Known + values are: "Enabled", "Disabled". + :paramtype firewall_allow_azure_ips: str or + ~azure.mgmt.datalake.analytics.account.models.FirewallAllowAzureIpsState + :keyword new_tier: The commitment tier to use for next month. Known values are: "Consumption", + "Commitment_100AUHours", "Commitment_500AUHours", "Commitment_1000AUHours", + "Commitment_5000AUHours", "Commitment_10000AUHours", "Commitment_50000AUHours", + "Commitment_100000AUHours", "Commitment_500000AUHours". + :paramtype new_tier: str or ~azure.mgmt.datalake.analytics.account.models.TierType + :keyword max_job_count: The maximum supported jobs running under the account at the same time. + :paramtype max_job_count: int + :keyword max_degree_of_parallelism: The maximum supported degree of parallelism for this + account. + :paramtype max_degree_of_parallelism: int + :keyword max_degree_of_parallelism_per_job: The maximum supported degree of parallelism per job + for this account. + :paramtype max_degree_of_parallelism_per_job: int + :keyword min_priority_per_job: The minimum supported priority per job for this account. + :paramtype min_priority_per_job: int + :keyword query_store_retention: The number of days that job metadata is retained. + :paramtype query_store_retention: int + """ + super(UpdateDataLakeAnalyticsAccountParameters, self).__init__(**kwargs) + self.tags = tags + self.data_lake_store_accounts = data_lake_store_accounts + self.storage_accounts = storage_accounts + self.compute_policies = compute_policies + self.firewall_rules = firewall_rules + self.firewall_state = firewall_state + self.firewall_allow_azure_ips = firewall_allow_azure_ips + self.new_tier = new_tier + self.max_job_count = max_job_count + self.max_degree_of_parallelism = max_degree_of_parallelism + self.max_degree_of_parallelism_per_job = max_degree_of_parallelism_per_job + self.min_priority_per_job = min_priority_per_job + self.query_store_retention = query_store_retention + + +class UpdateDataLakeStoreWithAccountParameters(msrest.serialization.Model): + """The parameters used to update a Data Lake Store account while updating a Data Lake Analytics account. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. The unique name of the Data Lake Store account to update. + :vartype name: str + :ivar suffix: The optional suffix for the Data Lake Store account. + :vartype suffix: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'suffix': {'key': 'properties.suffix', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + suffix: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Required. The unique name of the Data Lake Store account to update. + :paramtype name: str + :keyword suffix: The optional suffix for the Data Lake Store account. + :paramtype suffix: str + """ + super(UpdateDataLakeStoreWithAccountParameters, self).__init__(**kwargs) + self.name = name + self.suffix = suffix + + +class UpdateFirewallRuleParameters(msrest.serialization.Model): + """The parameters used to update a firewall rule. + + :ivar start_ip_address: The start IP address for the firewall rule. This can be either ipv4 or + ipv6. Start and End should be in the same protocol. + :vartype start_ip_address: str + :ivar end_ip_address: The end IP address for the firewall rule. This can be either ipv4 or + ipv6. Start and End should be in the same protocol. + :vartype end_ip_address: str + """ + + _attribute_map = { + 'start_ip_address': {'key': 'properties.startIpAddress', 'type': 'str'}, + 'end_ip_address': {'key': 'properties.endIpAddress', 'type': 'str'}, + } + + def __init__( + self, + *, + start_ip_address: Optional[str] = None, + end_ip_address: Optional[str] = None, + **kwargs + ): + """ + :keyword start_ip_address: The start IP address for the firewall rule. This can be either ipv4 + or ipv6. Start and End should be in the same protocol. + :paramtype start_ip_address: str + :keyword end_ip_address: The end IP address for the firewall rule. This can be either ipv4 or + ipv6. Start and End should be in the same protocol. + :paramtype end_ip_address: str + """ + super(UpdateFirewallRuleParameters, self).__init__(**kwargs) + self.start_ip_address = start_ip_address + self.end_ip_address = end_ip_address + + +class UpdateFirewallRuleWithAccountParameters(msrest.serialization.Model): + """The parameters used to update a firewall rule while updating a Data Lake Analytics account. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. The unique name of the firewall rule to update. + :vartype name: str + :ivar start_ip_address: The start IP address for the firewall rule. This can be either ipv4 or + ipv6. Start and End should be in the same protocol. + :vartype start_ip_address: str + :ivar end_ip_address: The end IP address for the firewall rule. This can be either ipv4 or + ipv6. Start and End should be in the same protocol. + :vartype end_ip_address: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'start_ip_address': {'key': 'properties.startIpAddress', 'type': 'str'}, + 'end_ip_address': {'key': 'properties.endIpAddress', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + start_ip_address: Optional[str] = None, + end_ip_address: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Required. The unique name of the firewall rule to update. + :paramtype name: str + :keyword start_ip_address: The start IP address for the firewall rule. This can be either ipv4 + or ipv6. Start and End should be in the same protocol. + :paramtype start_ip_address: str + :keyword end_ip_address: The end IP address for the firewall rule. This can be either ipv4 or + ipv6. Start and End should be in the same protocol. + :paramtype end_ip_address: str + """ + super(UpdateFirewallRuleWithAccountParameters, self).__init__(**kwargs) + self.name = name + self.start_ip_address = start_ip_address + self.end_ip_address = end_ip_address + + +class UpdateStorageAccountParameters(msrest.serialization.Model): + """The parameters used to update an Azure Storage account. + + :ivar access_key: The updated access key associated with this Azure Storage account that will + be used to connect to it. + :vartype access_key: str + :ivar suffix: The optional suffix for the storage account. + :vartype suffix: str + """ + + _attribute_map = { + 'access_key': {'key': 'properties.accessKey', 'type': 'str'}, + 'suffix': {'key': 'properties.suffix', 'type': 'str'}, + } + + def __init__( + self, + *, + access_key: Optional[str] = None, + suffix: Optional[str] = None, + **kwargs + ): + """ + :keyword access_key: The updated access key associated with this Azure Storage account that + will be used to connect to it. + :paramtype access_key: str + :keyword suffix: The optional suffix for the storage account. + :paramtype suffix: str + """ + super(UpdateStorageAccountParameters, self).__init__(**kwargs) + self.access_key = access_key + self.suffix = suffix + + +class UpdateStorageAccountWithAccountParameters(msrest.serialization.Model): + """The parameters used to update an Azure Storage account while updating a Data Lake Analytics account. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. The unique name of the Azure Storage account to update. + :vartype name: str + :ivar access_key: The updated access key associated with this Azure Storage account that will + be used to connect to it. + :vartype access_key: str + :ivar suffix: The optional suffix for the storage account. + :vartype suffix: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'access_key': {'key': 'properties.accessKey', 'type': 'str'}, + 'suffix': {'key': 'properties.suffix', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + access_key: Optional[str] = None, + suffix: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Required. The unique name of the Azure Storage account to update. + :paramtype name: str + :keyword access_key: The updated access key associated with this Azure Storage account that + will be used to connect to it. + :paramtype access_key: str + :keyword suffix: The optional suffix for the storage account. + :paramtype suffix: str + """ + super(UpdateStorageAccountWithAccountParameters, self).__init__(**kwargs) + self.name = name + self.access_key = access_key + self.suffix = suffix + + +class VirtualNetworkRule(SubResource): + """Data Lake Analytics VirtualNetwork Rule information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The resource name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :ivar subnet_id: The resource identifier for the subnet. + :vartype subnet_id: str + :ivar virtual_network_rule_state: The current state of the VirtualNetwork Rule. Known values + are: "Active", "NetworkSourceDeleted", "Failed". + :vartype virtual_network_rule_state: str or + ~azure.mgmt.datalake.analytics.account.models.VirtualNetworkRuleState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'subnet_id': {'readonly': True}, + 'virtual_network_rule_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'subnet_id': {'key': 'properties.subnetId', 'type': 'str'}, + 'virtual_network_rule_state': {'key': 'properties.virtualNetworkRuleState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(VirtualNetworkRule, self).__init__(**kwargs) + self.subnet_id = None + self.virtual_network_rule_state = None + + +class VirtualNetworkRuleListResult(msrest.serialization.Model): + """Data Lake Analytics VirtualNetwork rule list information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The results of the list operation. + :vartype value: list[~azure.mgmt.datalake.analytics.account.models.VirtualNetworkRule] + :ivar next_link: The link (url) to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[VirtualNetworkRule]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(VirtualNetworkRuleListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/models/_patch.py b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/operations/__init__.py b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/operations/__init__.py new file mode 100644 index 000000000000..44eab672879e --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/operations/__init__.py @@ -0,0 +1,30 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._accounts_operations import AccountsOperations +from ._data_lake_store_accounts_operations import DataLakeStoreAccountsOperations +from ._storage_accounts_operations import StorageAccountsOperations +from ._compute_policies_operations import ComputePoliciesOperations +from ._firewall_rules_operations import FirewallRulesOperations +from ._operations import Operations +from ._locations_operations import LocationsOperations + +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk +__all__ = [ + 'AccountsOperations', + 'DataLakeStoreAccountsOperations', + 'StorageAccountsOperations', + 'ComputePoliciesOperations', + 'FirewallRulesOperations', + 'Operations', + 'LocationsOperations', +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/operations/_accounts_operations.py b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/operations/_accounts_operations.py new file mode 100644 index 000000000000..1013be5649b1 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/operations/_accounts_operations.py @@ -0,0 +1,1153 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + select: Optional[str] = None, + orderby: Optional[str] = None, + count: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DataLakeAnalytics/accounts") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + if filter is not None: + _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + _params['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + _params['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=1) + if select is not None: + _params['$select'] = _SERIALIZER.query("select", select, 'str') + if orderby is not None: + _params['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + if count is not None: + _params['$count'] = _SERIALIZER.query("count", count, 'bool') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + select: Optional[str] = None, + orderby: Optional[str] = None, + count: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + if filter is not None: + _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + _params['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + _params['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=1) + if select is not None: + _params['$select'] = _SERIALIZER.query("select", select, 'str') + if orderby is not None: + _params['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + if count is not None: + _params['$count'] = _SERIALIZER.query("count", count, 'bool') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + *, + json: Optional[_models.CreateDataLakeAnalyticsAccountParameters] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + *, + json: Optional[_models.UpdateDataLakeAnalyticsAccountParameters] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_check_name_availability_request( + subscription_id: str, + location: str, + *, + json: Optional[_models.CheckNameAvailabilityParameters] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DataLakeAnalytics/locations/{location}/checkNameAvailability") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, + **kwargs + ) + +class AccountsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.datalake.analytics.account.DataLakeAnalyticsAccountManagementClient`'s + :attr:`accounts` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace + def list( + self, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + select: Optional[str] = None, + orderby: Optional[str] = None, + count: Optional[bool] = None, + **kwargs: Any + ) -> Iterable[_models.DataLakeAnalyticsAccountListResult]: + """Gets the first page of Data Lake Analytics accounts, if any, within the current subscription. + This includes a link to the next page, if any. + + :param filter: OData filter. Optional. Default value is None. + :type filter: str + :param top: The number of items to return. Optional. Default value is None. + :type top: int + :param skip: The number of items to skip over before returning elements. Optional. Default + value is None. + :type skip: int + :param select: OData Select statement. Limits the properties on each entry to just those + requested, e.g. Categories?$select=CategoryName,Description. Optional. Default value is None. + :type select: str + :param orderby: OrderBy clause. One or more comma-separated expressions with an optional "asc" + (the default) or "desc" depending on the order you'd like the values sorted, e.g. + Categories?$orderby=CategoryName desc. Optional. Default value is None. + :type orderby: str + :param count: The Boolean value of true or false to request a count of the matching resources + included with the resources in the response, e.g. Categories?$count=true. Optional. Default + value is None. + :type count: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DataLakeAnalyticsAccountListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.datalake.analytics.account.models.DataLakeAnalyticsAccountListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DataLakeAnalyticsAccountListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + filter=filter, + top=top, + skip=skip, + select=select, + orderby=orderby, + count=count, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + filter=filter, + top=top, + skip=skip, + select=select, + orderby=orderby, + count=count, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DataLakeAnalyticsAccountListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.DataLakeAnalytics/accounts"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + select: Optional[str] = None, + orderby: Optional[str] = None, + count: Optional[bool] = None, + **kwargs: Any + ) -> Iterable[_models.DataLakeAnalyticsAccountListResult]: + """Gets the first page of Data Lake Analytics accounts, if any, within a specific resource group. + This includes a link to the next page, if any. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param filter: OData filter. Optional. Default value is None. + :type filter: str + :param top: The number of items to return. Optional. Default value is None. + :type top: int + :param skip: The number of items to skip over before returning elements. Optional. Default + value is None. + :type skip: int + :param select: OData Select statement. Limits the properties on each entry to just those + requested, e.g. Categories?$select=CategoryName,Description. Optional. Default value is None. + :type select: str + :param orderby: OrderBy clause. One or more comma-separated expressions with an optional "asc" + (the default) or "desc" depending on the order you'd like the values sorted, e.g. + Categories?$orderby=CategoryName desc. Optional. Default value is None. + :type orderby: str + :param count: The Boolean value of true or false to request a count of the matching resources + included with the resources in the response, e.g. Categories?$count=true. Optional. Default + value is None. + :type count: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DataLakeAnalyticsAccountListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.datalake.analytics.account.models.DataLakeAnalyticsAccountListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DataLakeAnalyticsAccountListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + filter=filter, + top=top, + skip=skip, + select=select, + orderby=orderby, + count=count, + template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + filter=filter, + top=top, + skip=skip, + select=select, + orderby=orderby, + count=count, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DataLakeAnalyticsAccountListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts"} # type: ignore + + def _create_initial( + self, + resource_group_name: str, + account_name: str, + parameters: _models.CreateDataLakeAnalyticsAccountParameters, + **kwargs: Any + ) -> _models.DataLakeAnalyticsAccount: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.DataLakeAnalyticsAccount] + + _json = self._serialize.body(parameters, 'CreateDataLakeAnalyticsAccountParameters') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DataLakeAnalyticsAccount', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DataLakeAnalyticsAccount', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}"} # type: ignore + + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + account_name: str, + parameters: _models.CreateDataLakeAnalyticsAccountParameters, + **kwargs: Any + ) -> LROPoller[_models.DataLakeAnalyticsAccount]: + """Creates the specified Data Lake Analytics account. This supplies the user with computation + services for Data Lake Analytics workloads. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :param parameters: Parameters supplied to create a new Data Lake Analytics account. + :type parameters: + ~azure.mgmt.datalake.analytics.account.models.CreateDataLakeAnalyticsAccountParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DataLakeAnalyticsAccount or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.datalake.analytics.account.models.DataLakeAnalyticsAccount] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.DataLakeAnalyticsAccount] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_initial( # type: ignore + resource_group_name=resource_group_name, + account_name=account_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DataLakeAnalyticsAccount', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> _models.DataLakeAnalyticsAccount: + """Gets details of the specified Data Lake Analytics account. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataLakeAnalyticsAccount, or the result of cls(response) + :rtype: ~azure.mgmt.datalake.analytics.account.models.DataLakeAnalyticsAccount + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DataLakeAnalyticsAccount] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataLakeAnalyticsAccount', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}"} # type: ignore + + + def _update_initial( + self, + resource_group_name: str, + account_name: str, + parameters: Optional[_models.UpdateDataLakeAnalyticsAccountParameters] = None, + **kwargs: Any + ) -> _models.DataLakeAnalyticsAccount: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.DataLakeAnalyticsAccount] + + if parameters is not None: + _json = self._serialize.body(parameters, 'UpdateDataLakeAnalyticsAccountParameters') + else: + _json = None + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DataLakeAnalyticsAccount', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DataLakeAnalyticsAccount', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('DataLakeAnalyticsAccount', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}"} # type: ignore + + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + account_name: str, + parameters: Optional[_models.UpdateDataLakeAnalyticsAccountParameters] = None, + **kwargs: Any + ) -> LROPoller[_models.DataLakeAnalyticsAccount]: + """Updates the Data Lake Analytics account object specified by the accountName with the contents + of the account object. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :param parameters: Parameters supplied to the update Data Lake Analytics account operation. + Default value is None. + :type parameters: + ~azure.mgmt.datalake.analytics.account.models.UpdateDataLakeAnalyticsAccountParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DataLakeAnalyticsAccount or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.datalake.analytics.account.models.DataLakeAnalyticsAccount] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.DataLakeAnalyticsAccount] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( # type: ignore + resource_group_name=resource_group_name, + account_name=account_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DataLakeAnalyticsAccount', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Begins the delete process for the Data Lake Analytics account object specified by the account + name. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + account_name=account_name, + api_version=api_version, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}"} # type: ignore + + @distributed_trace + def check_name_availability( + self, + location: str, + parameters: _models.CheckNameAvailabilityParameters, + **kwargs: Any + ) -> _models.NameAvailabilityInformation: + """Checks whether the specified account name is available or taken. + + :param location: The resource location without whitespace. + :type location: str + :param parameters: Parameters supplied to check the Data Lake Analytics account name + availability. + :type parameters: ~azure.mgmt.datalake.analytics.account.models.CheckNameAvailabilityParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailabilityInformation, or the result of cls(response) + :rtype: ~azure.mgmt.datalake.analytics.account.models.NameAvailabilityInformation + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.NameAvailabilityInformation] + + _json = self._serialize.body(parameters, 'CheckNameAvailabilityParameters') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + location=location, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NameAvailabilityInformation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.DataLakeAnalytics/locations/{location}/checkNameAvailability"} # type: ignore + diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/operations/_compute_policies_operations.py b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/operations/_compute_policies_operations.py new file mode 100644 index 000000000000..cb5139ab2f04 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/operations/_compute_policies_operations.py @@ -0,0 +1,637 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_account_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/computePolicies") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + compute_policy_name: str, + *, + json: Optional[_models.CreateOrUpdateComputePolicyParameters] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/computePolicies/{computePolicyName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "computePolicyName": _SERIALIZER.url("compute_policy_name", compute_policy_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + compute_policy_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/computePolicies/{computePolicyName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "computePolicyName": _SERIALIZER.url("compute_policy_name", compute_policy_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + compute_policy_name: str, + *, + json: Optional[_models.UpdateComputePolicyParameters] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/computePolicies/{computePolicyName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "computePolicyName": _SERIALIZER.url("compute_policy_name", compute_policy_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + compute_policy_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/computePolicies/{computePolicyName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "computePolicyName": _SERIALIZER.url("compute_policy_name", compute_policy_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + +class ComputePoliciesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.datalake.analytics.account.DataLakeAnalyticsAccountManagementClient`'s + :attr:`compute_policies` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace + def list_by_account( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable[_models.ComputePolicyListResult]: + """Lists the Data Lake Analytics compute policies within the specified Data Lake Analytics + account. An account supports, at most, 50 policies. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ComputePolicyListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.datalake.analytics.account.models.ComputePolicyListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ComputePolicyListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_account_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + api_version=api_version, + template_url=self.list_by_account.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_by_account_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ComputePolicyListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/computePolicies"} # type: ignore + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + account_name: str, + compute_policy_name: str, + parameters: _models.CreateOrUpdateComputePolicyParameters, + **kwargs: Any + ) -> _models.ComputePolicy: + """Creates or updates the specified compute policy. During update, the compute policy with the + specified name will be replaced with this new compute policy. An account supports, at most, 50 + policies. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :param compute_policy_name: The name of the compute policy to create or update. + :type compute_policy_name: str + :param parameters: Parameters supplied to create or update the compute policy. The max degree + of parallelism per job property, min priority per job property, or both must be present. + :type parameters: + ~azure.mgmt.datalake.analytics.account.models.CreateOrUpdateComputePolicyParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ComputePolicy, or the result of cls(response) + :rtype: ~azure.mgmt.datalake.analytics.account.models.ComputePolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ComputePolicy] + + _json = self._serialize.body(parameters, 'CreateOrUpdateComputePolicyParameters') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + compute_policy_name=compute_policy_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ComputePolicy', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/computePolicies/{computePolicyName}"} # type: ignore + + + @distributed_trace + def get( + self, + resource_group_name: str, + account_name: str, + compute_policy_name: str, + **kwargs: Any + ) -> _models.ComputePolicy: + """Gets the specified Data Lake Analytics compute policy. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :param compute_policy_name: The name of the compute policy to retrieve. + :type compute_policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ComputePolicy, or the result of cls(response) + :rtype: ~azure.mgmt.datalake.analytics.account.models.ComputePolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ComputePolicy] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + compute_policy_name=compute_policy_name, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ComputePolicy', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/computePolicies/{computePolicyName}"} # type: ignore + + + @distributed_trace + def update( + self, + resource_group_name: str, + account_name: str, + compute_policy_name: str, + parameters: Optional[_models.UpdateComputePolicyParameters] = None, + **kwargs: Any + ) -> _models.ComputePolicy: + """Updates the specified compute policy. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :param compute_policy_name: The name of the compute policy to update. + :type compute_policy_name: str + :param parameters: Parameters supplied to update the compute policy. Default value is None. + :type parameters: ~azure.mgmt.datalake.analytics.account.models.UpdateComputePolicyParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ComputePolicy, or the result of cls(response) + :rtype: ~azure.mgmt.datalake.analytics.account.models.ComputePolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ComputePolicy] + + if parameters is not None: + _json = self._serialize.body(parameters, 'UpdateComputePolicyParameters') + else: + _json = None + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + compute_policy_name=compute_policy_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ComputePolicy', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/computePolicies/{computePolicyName}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + account_name: str, + compute_policy_name: str, + **kwargs: Any + ) -> None: + """Deletes the specified compute policy from the specified Data Lake Analytics account. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :param compute_policy_name: The name of the compute policy to delete. + :type compute_policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + compute_policy_name=compute_policy_name, + api_version=api_version, + template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/computePolicies/{computePolicyName}"} # type: ignore + diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/operations/_data_lake_store_accounts_operations.py b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/operations/_data_lake_store_accounts_operations.py new file mode 100644 index 000000000000..8495a622fb37 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/operations/_data_lake_store_accounts_operations.py @@ -0,0 +1,565 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_account_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + select: Optional[str] = None, + orderby: Optional[str] = None, + count: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/dataLakeStoreAccounts") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + if filter is not None: + _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + _params['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + _params['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=1) + if select is not None: + _params['$select'] = _SERIALIZER.query("select", select, 'str') + if orderby is not None: + _params['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + if count is not None: + _params['$count'] = _SERIALIZER.query("count", count, 'bool') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_add_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + data_lake_store_account_name: str, + *, + json: Optional[_models.AddDataLakeStoreParameters] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/dataLakeStoreAccounts/{dataLakeStoreAccountName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "dataLakeStoreAccountName": _SERIALIZER.url("data_lake_store_account_name", data_lake_store_account_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + data_lake_store_account_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/dataLakeStoreAccounts/{dataLakeStoreAccountName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "dataLakeStoreAccountName": _SERIALIZER.url("data_lake_store_account_name", data_lake_store_account_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + data_lake_store_account_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/dataLakeStoreAccounts/{dataLakeStoreAccountName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "dataLakeStoreAccountName": _SERIALIZER.url("data_lake_store_account_name", data_lake_store_account_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + +class DataLakeStoreAccountsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.datalake.analytics.account.DataLakeAnalyticsAccountManagementClient`'s + :attr:`data_lake_store_accounts` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace + def list_by_account( + self, + resource_group_name: str, + account_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + select: Optional[str] = None, + orderby: Optional[str] = None, + count: Optional[bool] = None, + **kwargs: Any + ) -> Iterable[_models.DataLakeStoreAccountInformationListResult]: + """Gets the first page of Data Lake Store accounts linked to the specified Data Lake Analytics + account. The response includes a link to the next page, if any. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :param filter: OData filter. Optional. Default value is None. + :type filter: str + :param top: The number of items to return. Optional. Default value is None. + :type top: int + :param skip: The number of items to skip over before returning elements. Optional. Default + value is None. + :type skip: int + :param select: OData Select statement. Limits the properties on each entry to just those + requested, e.g. Categories?$select=CategoryName,Description. Optional. Default value is None. + :type select: str + :param orderby: OrderBy clause. One or more comma-separated expressions with an optional "asc" + (the default) or "desc" depending on the order you'd like the values sorted, e.g. + Categories?$orderby=CategoryName desc. Optional. Default value is None. + :type orderby: str + :param count: The Boolean value of true or false to request a count of the matching resources + included with the resources in the response, e.g. Categories?$count=true. Optional. Default + value is None. + :type count: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DataLakeStoreAccountInformationListResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.datalake.analytics.account.models.DataLakeStoreAccountInformationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DataLakeStoreAccountInformationListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_account_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + api_version=api_version, + filter=filter, + top=top, + skip=skip, + select=select, + orderby=orderby, + count=count, + template_url=self.list_by_account.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_by_account_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + api_version=api_version, + filter=filter, + top=top, + skip=skip, + select=select, + orderby=orderby, + count=count, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DataLakeStoreAccountInformationListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/dataLakeStoreAccounts"} # type: ignore + + @distributed_trace + def add( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + account_name: str, + data_lake_store_account_name: str, + parameters: Optional[_models.AddDataLakeStoreParameters] = None, + **kwargs: Any + ) -> None: + """Updates the specified Data Lake Analytics account to include the additional Data Lake Store + account. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :param data_lake_store_account_name: The name of the Data Lake Store account to add. + :type data_lake_store_account_name: str + :param parameters: The details of the Data Lake Store account. Default value is None. + :type parameters: ~azure.mgmt.datalake.analytics.account.models.AddDataLakeStoreParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] + + if parameters is not None: + _json = self._serialize.body(parameters, 'AddDataLakeStoreParameters') + else: + _json = None + + request = build_add_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + data_lake_store_account_name=data_lake_store_account_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.add.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + add.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/dataLakeStoreAccounts/{dataLakeStoreAccountName}"} # type: ignore + + + @distributed_trace + def get( + self, + resource_group_name: str, + account_name: str, + data_lake_store_account_name: str, + **kwargs: Any + ) -> _models.DataLakeStoreAccountInformation: + """Gets the specified Data Lake Store account details in the specified Data Lake Analytics + account. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :param data_lake_store_account_name: The name of the Data Lake Store account to retrieve. + :type data_lake_store_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataLakeStoreAccountInformation, or the result of cls(response) + :rtype: ~azure.mgmt.datalake.analytics.account.models.DataLakeStoreAccountInformation + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DataLakeStoreAccountInformation] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + data_lake_store_account_name=data_lake_store_account_name, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataLakeStoreAccountInformation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/dataLakeStoreAccounts/{dataLakeStoreAccountName}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + account_name: str, + data_lake_store_account_name: str, + **kwargs: Any + ) -> None: + """Updates the Data Lake Analytics account specified to remove the specified Data Lake Store + account. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :param data_lake_store_account_name: The name of the Data Lake Store account to remove. + :type data_lake_store_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + data_lake_store_account_name=data_lake_store_account_name, + api_version=api_version, + template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/dataLakeStoreAccounts/{dataLakeStoreAccountName}"} # type: ignore + diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/operations/_firewall_rules_operations.py b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/operations/_firewall_rules_operations.py new file mode 100644 index 000000000000..56e7df16677d --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/operations/_firewall_rules_operations.py @@ -0,0 +1,634 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_account_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/firewallRules") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + firewall_rule_name: str, + *, + json: Optional[_models.CreateOrUpdateFirewallRuleParameters] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/firewallRules/{firewallRuleName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "firewallRuleName": _SERIALIZER.url("firewall_rule_name", firewall_rule_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + firewall_rule_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/firewallRules/{firewallRuleName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "firewallRuleName": _SERIALIZER.url("firewall_rule_name", firewall_rule_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + firewall_rule_name: str, + *, + json: Optional[_models.UpdateFirewallRuleParameters] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/firewallRules/{firewallRuleName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "firewallRuleName": _SERIALIZER.url("firewall_rule_name", firewall_rule_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + firewall_rule_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/firewallRules/{firewallRuleName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "firewallRuleName": _SERIALIZER.url("firewall_rule_name", firewall_rule_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + +class FirewallRulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.datalake.analytics.account.DataLakeAnalyticsAccountManagementClient`'s + :attr:`firewall_rules` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace + def list_by_account( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable[_models.FirewallRuleListResult]: + """Lists the Data Lake Analytics firewall rules within the specified Data Lake Analytics account. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FirewallRuleListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.datalake.analytics.account.models.FirewallRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.FirewallRuleListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_account_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + api_version=api_version, + template_url=self.list_by_account.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_by_account_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("FirewallRuleListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/firewallRules"} # type: ignore + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + account_name: str, + firewall_rule_name: str, + parameters: _models.CreateOrUpdateFirewallRuleParameters, + **kwargs: Any + ) -> _models.FirewallRule: + """Creates or updates the specified firewall rule. During update, the firewall rule with the + specified name will be replaced with this new firewall rule. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :param firewall_rule_name: The name of the firewall rule to create or update. + :type firewall_rule_name: str + :param parameters: Parameters supplied to create or update the firewall rule. + :type parameters: + ~azure.mgmt.datalake.analytics.account.models.CreateOrUpdateFirewallRuleParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FirewallRule, or the result of cls(response) + :rtype: ~azure.mgmt.datalake.analytics.account.models.FirewallRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.FirewallRule] + + _json = self._serialize.body(parameters, 'CreateOrUpdateFirewallRuleParameters') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + firewall_rule_name=firewall_rule_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FirewallRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/firewallRules/{firewallRuleName}"} # type: ignore + + + @distributed_trace + def get( + self, + resource_group_name: str, + account_name: str, + firewall_rule_name: str, + **kwargs: Any + ) -> _models.FirewallRule: + """Gets the specified Data Lake Analytics firewall rule. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :param firewall_rule_name: The name of the firewall rule to retrieve. + :type firewall_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FirewallRule, or the result of cls(response) + :rtype: ~azure.mgmt.datalake.analytics.account.models.FirewallRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.FirewallRule] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + firewall_rule_name=firewall_rule_name, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FirewallRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/firewallRules/{firewallRuleName}"} # type: ignore + + + @distributed_trace + def update( + self, + resource_group_name: str, + account_name: str, + firewall_rule_name: str, + parameters: Optional[_models.UpdateFirewallRuleParameters] = None, + **kwargs: Any + ) -> _models.FirewallRule: + """Updates the specified firewall rule. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :param firewall_rule_name: The name of the firewall rule to update. + :type firewall_rule_name: str + :param parameters: Parameters supplied to update the firewall rule. Default value is None. + :type parameters: ~azure.mgmt.datalake.analytics.account.models.UpdateFirewallRuleParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FirewallRule, or the result of cls(response) + :rtype: ~azure.mgmt.datalake.analytics.account.models.FirewallRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.FirewallRule] + + if parameters is not None: + _json = self._serialize.body(parameters, 'UpdateFirewallRuleParameters') + else: + _json = None + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + firewall_rule_name=firewall_rule_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FirewallRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/firewallRules/{firewallRuleName}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + account_name: str, + firewall_rule_name: str, + **kwargs: Any + ) -> None: + """Deletes the specified firewall rule from the specified Data Lake Analytics account. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :param firewall_rule_name: The name of the firewall rule to delete. + :type firewall_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + firewall_rule_name=firewall_rule_name, + api_version=api_version, + template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/firewallRules/{firewallRuleName}"} # type: ignore + diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/operations/_locations_operations.py b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/operations/_locations_operations.py new file mode 100644 index 000000000000..a0d372bc3f07 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/operations/_locations_operations.py @@ -0,0 +1,144 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_capability_request( + subscription_id: str, + location: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DataLakeAnalytics/locations/{location}/capability") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + +class LocationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.datalake.analytics.account.DataLakeAnalyticsAccountManagementClient`'s + :attr:`locations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace + def get_capability( + self, + location: str, + **kwargs: Any + ) -> Optional[_models.CapabilityInformation]: + """Gets subscription-level properties and limits for Data Lake Analytics specified by resource + location. + + :param location: The resource location without whitespace. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CapabilityInformation, or the result of cls(response) + :rtype: ~azure.mgmt.datalake.analytics.account.models.CapabilityInformation or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.CapabilityInformation]] + + + request = build_get_capability_request( + subscription_id=self._config.subscription_id, + location=location, + api_version=api_version, + template_url=self.get_capability.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('CapabilityInformation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_capability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.DataLakeAnalytics/locations/{location}/capability"} # type: ignore + diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/operations/_operations.py b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/operations/_operations.py new file mode 100644 index 000000000000..c020821b90f4 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/operations/_operations.py @@ -0,0 +1,128 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.DataLakeAnalytics/operations") + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.datalake.analytics.account.DataLakeAnalyticsAccountManagementClient`'s + :attr:`operations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> _models.OperationListResult: + """Lists all of the available Data Lake Analytics REST API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationListResult, or the result of cls(response) + :rtype: ~azure.mgmt.datalake.analytics.account.models.OperationListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('OperationListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = {'url': "/providers/Microsoft.DataLakeAnalytics/operations"} # type: ignore + diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/operations/_patch.py b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/operations/_storage_accounts_operations.py b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/operations/_storage_accounts_operations.py new file mode 100644 index 000000000000..55cedce90d6d --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/operations/_storage_accounts_operations.py @@ -0,0 +1,1082 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_account_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + select: Optional[str] = None, + orderby: Optional[str] = None, + count: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/storageAccounts") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + if filter is not None: + _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + _params['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + _params['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=1) + if select is not None: + _params['$select'] = _SERIALIZER.query("select", select, 'str') + if orderby is not None: + _params['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + if count is not None: + _params['$count'] = _SERIALIZER.query("count", count, 'bool') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_add_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + storage_account_name: str, + *, + json: Optional[_models.AddStorageAccountParameters] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/storageAccounts/{storageAccountName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + storage_account_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/storageAccounts/{storageAccountName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + storage_account_name: str, + *, + json: Optional[_models.UpdateStorageAccountParameters] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/storageAccounts/{storageAccountName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + storage_account_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/storageAccounts/{storageAccountName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_list_storage_containers_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + storage_account_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/storageAccounts/{storageAccountName}/containers") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_get_storage_container_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + storage_account_name: str, + container_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/storageAccounts/{storageAccountName}/containers/{containerName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "containerName": _SERIALIZER.url("container_name", container_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_list_sas_tokens_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + storage_account_name: str, + container_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/storageAccounts/{storageAccountName}/containers/{containerName}/listSasTokens") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "containerName": _SERIALIZER.url("container_name", container_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + +class StorageAccountsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.datalake.analytics.account.DataLakeAnalyticsAccountManagementClient`'s + :attr:`storage_accounts` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace + def list_by_account( + self, + resource_group_name: str, + account_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + select: Optional[str] = None, + orderby: Optional[str] = None, + count: Optional[bool] = None, + **kwargs: Any + ) -> Iterable[_models.StorageAccountInformationListResult]: + """Gets the first page of Azure Storage accounts, if any, linked to the specified Data Lake + Analytics account. The response includes a link to the next page, if any. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :param filter: The OData filter. Optional. Default value is None. + :type filter: str + :param top: The number of items to return. Optional. Default value is None. + :type top: int + :param skip: The number of items to skip over before returning elements. Optional. Default + value is None. + :type skip: int + :param select: OData Select statement. Limits the properties on each entry to just those + requested, e.g. Categories?$select=CategoryName,Description. Optional. Default value is None. + :type select: str + :param orderby: OrderBy clause. One or more comma-separated expressions with an optional "asc" + (the default) or "desc" depending on the order you'd like the values sorted, e.g. + Categories?$orderby=CategoryName desc. Optional. Default value is None. + :type orderby: str + :param count: The Boolean value of true or false to request a count of the matching resources + included with the resources in the response, e.g. Categories?$count=true. Optional. Default + value is None. + :type count: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StorageAccountInformationListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.datalake.analytics.account.models.StorageAccountInformationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.StorageAccountInformationListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_account_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + api_version=api_version, + filter=filter, + top=top, + skip=skip, + select=select, + orderby=orderby, + count=count, + template_url=self.list_by_account.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_by_account_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + api_version=api_version, + filter=filter, + top=top, + skip=skip, + select=select, + orderby=orderby, + count=count, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("StorageAccountInformationListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/storageAccounts"} # type: ignore + + @distributed_trace + def add( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + account_name: str, + storage_account_name: str, + parameters: _models.AddStorageAccountParameters, + **kwargs: Any + ) -> None: + """Updates the specified Data Lake Analytics account to add an Azure Storage account. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :param storage_account_name: The name of the Azure Storage account to add. + :type storage_account_name: str + :param parameters: The parameters containing the access key and optional suffix for the Azure + Storage Account. + :type parameters: ~azure.mgmt.datalake.analytics.account.models.AddStorageAccountParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] + + _json = self._serialize.body(parameters, 'AddStorageAccountParameters') + + request = build_add_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + storage_account_name=storage_account_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.add.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + add.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/storageAccounts/{storageAccountName}"} # type: ignore + + + @distributed_trace + def get( + self, + resource_group_name: str, + account_name: str, + storage_account_name: str, + **kwargs: Any + ) -> _models.StorageAccountInformation: + """Gets the specified Azure Storage account linked to the given Data Lake Analytics account. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :param storage_account_name: The name of the Azure Storage account for which to retrieve the + details. + :type storage_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageAccountInformation, or the result of cls(response) + :rtype: ~azure.mgmt.datalake.analytics.account.models.StorageAccountInformation + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.StorageAccountInformation] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + storage_account_name=storage_account_name, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StorageAccountInformation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/storageAccounts/{storageAccountName}"} # type: ignore + + + @distributed_trace + def update( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + account_name: str, + storage_account_name: str, + parameters: Optional[_models.UpdateStorageAccountParameters] = None, + **kwargs: Any + ) -> None: + """Updates the Data Lake Analytics account to replace Azure Storage blob account details, such as + the access key and/or suffix. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :param storage_account_name: The Azure Storage account to modify. + :type storage_account_name: str + :param parameters: The parameters containing the access key and suffix to update the storage + account with, if any. Passing nothing results in no change. Default value is None. + :type parameters: ~azure.mgmt.datalake.analytics.account.models.UpdateStorageAccountParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] + + if parameters is not None: + _json = self._serialize.body(parameters, 'UpdateStorageAccountParameters') + else: + _json = None + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + storage_account_name=storage_account_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/storageAccounts/{storageAccountName}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + account_name: str, + storage_account_name: str, + **kwargs: Any + ) -> None: + """Updates the specified Data Lake Analytics account to remove an Azure Storage account. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :param storage_account_name: The name of the Azure Storage account to remove. + :type storage_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + storage_account_name=storage_account_name, + api_version=api_version, + template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/storageAccounts/{storageAccountName}"} # type: ignore + + + @distributed_trace + def list_storage_containers( + self, + resource_group_name: str, + account_name: str, + storage_account_name: str, + **kwargs: Any + ) -> Iterable[_models.StorageContainerListResult]: + """Lists the Azure Storage containers, if any, associated with the specified Data Lake Analytics + and Azure Storage account combination. The response includes a link to the next page of + results, if any. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :param storage_account_name: The name of the Azure storage account from which to list blob + containers. + :type storage_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StorageContainerListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.datalake.analytics.account.models.StorageContainerListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.StorageContainerListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_storage_containers_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + storage_account_name=storage_account_name, + api_version=api_version, + template_url=self.list_storage_containers.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_storage_containers_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + storage_account_name=storage_account_name, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("StorageContainerListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_storage_containers.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/storageAccounts/{storageAccountName}/containers"} # type: ignore + + @distributed_trace + def get_storage_container( + self, + resource_group_name: str, + account_name: str, + storage_account_name: str, + container_name: str, + **kwargs: Any + ) -> _models.StorageContainer: + """Gets the specified Azure Storage container associated with the given Data Lake Analytics and + Azure Storage accounts. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :param storage_account_name: The name of the Azure storage account from which to retrieve the + blob container. + :type storage_account_name: str + :param container_name: The name of the Azure storage container to retrieve. + :type container_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageContainer, or the result of cls(response) + :rtype: ~azure.mgmt.datalake.analytics.account.models.StorageContainer + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.StorageContainer] + + + request = build_get_storage_container_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + storage_account_name=storage_account_name, + container_name=container_name, + api_version=api_version, + template_url=self.get_storage_container.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StorageContainer', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_storage_container.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/storageAccounts/{storageAccountName}/containers/{containerName}"} # type: ignore + + + @distributed_trace + def list_sas_tokens( + self, + resource_group_name: str, + account_name: str, + storage_account_name: str, + container_name: str, + **kwargs: Any + ) -> Iterable[_models.SasTokenInformationListResult]: + """Gets the SAS token associated with the specified Data Lake Analytics and Azure Storage account + and container combination. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param account_name: The name of the Data Lake Analytics account. + :type account_name: str + :param storage_account_name: The name of the Azure storage account for which the SAS token is + being requested. + :type storage_account_name: str + :param container_name: The name of the Azure storage container for which the SAS token is being + requested. + :type container_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SasTokenInformationListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.datalake.analytics.account.models.SasTokenInformationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SasTokenInformationListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_sas_tokens_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + storage_account_name=storage_account_name, + container_name=container_name, + api_version=api_version, + template_url=self.list_sas_tokens.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_sas_tokens_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + storage_account_name=storage_account_name, + container_name=container_name, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SasTokenInformationListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_sas_tokens.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/storageAccounts/{storageAccountName}/containers/{containerName}/listSasTokens"} # type: ignore diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/py.typed b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/sdk_packaging.toml b/sdk/datalake/azure-mgmt-datalake-analytics/sdk_packaging.toml new file mode 100644 index 000000000000..c0e6dce39cab --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/sdk_packaging.toml @@ -0,0 +1,9 @@ +[packaging] +package_name = "azure-mgmt-datalake-analytics" +package_nspkg = "azure-mgmt-datalake-nspkg" +package_pprint_name = "Datalake-analytics Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = false +need_azuremgmtcore = true diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/setup.py b/sdk/datalake/azure-mgmt-datalake-analytics/setup.py new file mode 100644 index 000000000000..06aae92e70bd --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/setup.py @@ -0,0 +1,78 @@ +#!/usr/bin/env python + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +import re +import os.path +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-mgmt-datalake-analytics" +PACKAGE_PPRINT_NAME = "Datalake-analytics Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace('-', '/') +# a-b-c => a.b.c +namespace_name = PACKAGE_NAME.replace('-', '.') + +# Version extraction inspired from 'requests' +with open(os.path.join(package_folder_path, 'version.py') + if os.path.exists(os.path.join(package_folder_path, 'version.py')) + else os.path.join(package_folder_path, '_version.py'), 'r') as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', + fd.read(), re.MULTILINE).group(1) + +if not version: + raise RuntimeError('Cannot find version information') + +with open('README.md', encoding='utf-8') as f: + readme = f.read() +with open('CHANGELOG.md', encoding='utf-8') as f: + changelog = f.read() + +setup( + name=PACKAGE_NAME, + version=version, + description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), + long_description=readme + '\n\n' + changelog, + long_description_content_type='text/markdown', + license='MIT License', + author='Microsoft Corporation', + author_email='azpysdkhelp@microsoft.com', + url='https://github.com/Azure/azure-sdk-for-python', + keywords="azure, azure sdk", # update with search keywords relevant to the azure service / product + classifiers=[ + 'Development Status :: 4 - Beta', + 'Programming Language :: Python', + 'Programming Language :: Python :: 3 :: Only', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', + 'License :: OSI Approved :: MIT License', + ], + zip_safe=False, + packages=find_packages(exclude=[ + 'tests', + # Exclude packages that will be covered by PEP420 or nspkg + 'azure', + 'azure.mgmt', + 'azure.mgmt.datalake', + ]), + include_package_data=True, + package_data={ + 'pytyped': ['py.typed'], + }, + install_requires=[ + 'msrest>=0.6.21', + 'azure-common~=1.1', + 'azure-mgmt-core>=1.3.1,<2.0.0', + ], + python_requires=">=3.7" +) diff --git a/shared_requirements.txt b/shared_requirements.txt index 3054a5457266..cdd8413aa95d 100644 --- a/shared_requirements.txt +++ b/shared_requirements.txt @@ -395,3 +395,5 @@ opentelemetry-sdk<2.0.0,>=1.5.0,!=1.10a0 #override azure-mgmt-automation msrest>=0.6.21 #override azure-mgmt-automation azure-mgmt-core>=1.3.1,<2.0.0 #override azure-mgmt-rdbms azure-mgmt-core>=1.3.1,<2.0.0 +#override azure-mgmt-datalake-analytics msrest>=0.6.21 +#override azure-mgmt-datalake-analytics azure-mgmt-core>=1.3.1,<2.0.0 From 30f2745d04ed674ba7d05ce32493245f1fb25b9c Mon Sep 17 00:00:00 2001 From: "Zhenbiao Wei (WICRESOFT NORTH AMERICA LTD)" Date: Thu, 28 Jul 2022 15:23:54 +0800 Subject: [PATCH 2/4] Update tests --- .../dev_requirements.txt | 3 ++ .../tests/conftest.py | 54 +++++++++++++++++++ ...Datalaketest_generate_recommendations.json | 4 ++ .../tests/test_mgmt_datalake.py | 26 +++++++++ 4 files changed, 87 insertions(+) create mode 100644 sdk/datalake/azure-mgmt-datalake-analytics/dev_requirements.txt create mode 100644 sdk/datalake/azure-mgmt-datalake-analytics/tests/conftest.py create mode 100644 sdk/datalake/azure-mgmt-datalake-analytics/tests/recordings/test_mgmt_datalake.pyTestMgmtDatalaketest_generate_recommendations.json create mode 100644 sdk/datalake/azure-mgmt-datalake-analytics/tests/test_mgmt_datalake.py diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/dev_requirements.txt b/sdk/datalake/azure-mgmt-datalake-analytics/dev_requirements.txt new file mode 100644 index 000000000000..00bff4da2800 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/dev_requirements.txt @@ -0,0 +1,3 @@ +-e ../../../tools/azure-sdk-tools +-e ../../../tools/azure-devtools +../../identity/azure-identity \ No newline at end of file diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/tests/conftest.py b/sdk/datalake/azure-mgmt-datalake-analytics/tests/conftest.py new file mode 100644 index 000000000000..28187eb4ba85 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/tests/conftest.py @@ -0,0 +1,54 @@ +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- +import os +import platform +import pytest +import sys + +from dotenv import load_dotenv + +from devtools_testutils import test_proxy, add_general_regex_sanitizer +from devtools_testutils import add_header_regex_sanitizer, add_body_key_sanitizer + +# Ignore async tests for Python < 3.5 +collect_ignore_glob = [] +if sys.version_info < (3, 5) or platform.python_implementation() == "PyPy": + collect_ignore_glob.append("*_async.py") + +load_dotenv() + +@pytest.fixture(scope="session", autouse=True) +def add_sanitizers(test_proxy): + subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") + tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=subscription_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex="SharedAccessKey=(.*?);", value="SharedAccessKey=SharedAccessKey;") + add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") + add_header_regex_sanitizer(key="Cookie", value="cookie;") + add_body_key_sanitizer(json_path="$..access_token", value="access_token") + add_body_key_sanitizer(json_path="$..primaryKey", value="primaryKey") + add_body_key_sanitizer(json_path="$..secondaryKey", value="secondaryKey") diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/tests/recordings/test_mgmt_datalake.pyTestMgmtDatalaketest_generate_recommendations.json b/sdk/datalake/azure-mgmt-datalake-analytics/tests/recordings/test_mgmt_datalake.pyTestMgmtDatalaketest_generate_recommendations.json new file mode 100644 index 000000000000..f721723386d8 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/tests/recordings/test_mgmt_datalake.pyTestMgmtDatalaketest_generate_recommendations.json @@ -0,0 +1,4 @@ +{ + "Entries": [], + "Variables": {} +} diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/tests/test_mgmt_datalake.py b/sdk/datalake/azure-mgmt-datalake-analytics/tests/test_mgmt_datalake.py new file mode 100644 index 000000000000..468644acf002 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/tests/test_mgmt_datalake.py @@ -0,0 +1,26 @@ +import azure.mgmt.datalake.analytics.account + +import unittest + +from devtools_testutils import ( + AzureMgmtRecordedTestCase, ResourceGroupPreparer, recorded_by_proxy +) + + +class TestMgmtDatalake(AzureMgmtRecordedTestCase): + + def setup_method(self, method): + self.client = self.create_mgmt_client( + azure.mgmt.datalake.analytics.account.DataLakeAnalyticsAccountManagementClient + ) + + @recorded_by_proxy + def test_generate_recommendations(self): + + response = self.client.operations.list() + + assert response + + +if __name__ == '__main__': + unittest.main() From 006626a0fb66a1d6e0abe540c5bc555d626f5b5b Mon Sep 17 00:00:00 2001 From: "Zhenbiao Wei (WICRESOFT NORTH AMERICA LTD)" Date: Thu, 28 Jul 2022 16:05:46 +0800 Subject: [PATCH 3/4] Update ci.yml --- sdk/datalake/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/sdk/datalake/ci.yml b/sdk/datalake/ci.yml index 5ad5c729dfd5..38ba8092e32f 100644 --- a/sdk/datalake/ci.yml +++ b/sdk/datalake/ci.yml @@ -27,6 +27,7 @@ extends: template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: ServiceDirectory: datalake + TestProxy: true Artifacts: - name: azure-mgmt-datalake-analytics safeName: azuremgmtdatalakeanalytics From e1b02dbc308696a7f7571f7c78d6fcfe741529f8 Mon Sep 17 00:00:00 2001 From: zhenbiao wei <424401670@qq.com> Date: Fri, 29 Jul 2022 14:41:43 +0800 Subject: [PATCH 4/4] Update test_mgmt_datalake.pyTestMgmtDatalaketest_generate_recommendations.json --- ...Datalaketest_generate_recommendations.json | 718 +++++++++++++++++- 1 file changed, 717 insertions(+), 1 deletion(-) diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/tests/recordings/test_mgmt_datalake.pyTestMgmtDatalaketest_generate_recommendations.json b/sdk/datalake/azure-mgmt-datalake-analytics/tests/recordings/test_mgmt_datalake.pyTestMgmtDatalaketest_generate_recommendations.json index f721723386d8..7f90655a0e86 100644 --- a/sdk/datalake/azure-mgmt-datalake-analytics/tests/recordings/test_mgmt_datalake.pyTestMgmtDatalaketest_generate_recommendations.json +++ b/sdk/datalake/azure-mgmt-datalake-analytics/tests/recordings/test_mgmt_datalake.pyTestMgmtDatalaketest_generate_recommendations.json @@ -1,4 +1,720 @@ { - "Entries": [], + "Entries": [ + { + "RequestUri": "https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000/v2.0/.well-known/openid-configuration", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-identity/1.11.0b3 Python/3.8.10 (Windows-10-10.0.22000-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Allow-Methods": "GET, OPTIONS", + "Access-Control-Allow-Origin": "*", + "Cache-Control": "max-age=86400, private", + "Content-Length": "1753", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 29 Jul 2022 06:33:45 GMT", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Set-Cookie": "[set-cookie;]", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-ests-server": "2.1.13355.6 - EUS ProdSlices", + "X-XSS-Protection": "0" + }, + "ResponseBody": { + "token_endpoint": "https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000/oauth2/v2.0/token", + "token_endpoint_auth_methods_supported": [ + "client_secret_post", + "private_key_jwt", + "client_secret_basic" + ], + "jwks_uri": "https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000/discovery/v2.0/keys", + "response_modes_supported": [ + "query", + "fragment", + "form_post" + ], + "subject_types_supported": [ + "pairwise" + ], + "id_token_signing_alg_values_supported": [ + "RS256" + ], + "response_types_supported": [ + "code", + "id_token", + "code id_token", + "id_token token" + ], + "scopes_supported": [ + "openid", + "profile", + "email", + "offline_access" + ], + "issuer": "https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000/v2.0", + "request_uri_parameter_supported": false, + "userinfo_endpoint": "https://graph.microsoft.com/oidc/userinfo", + "authorization_endpoint": "https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000/oauth2/v2.0/authorize", + "device_authorization_endpoint": "https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000/oauth2/v2.0/devicecode", + "http_logout_supported": true, + "frontchannel_logout_supported": true, + "end_session_endpoint": "https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000/oauth2/v2.0/logout", + "claims_supported": [ + "sub", + "iss", + "cloud_instance_name", + "cloud_instance_host_name", + "cloud_graph_host_name", + "msgraph_host", + "aud", + "exp", + "iat", + "auth_time", + "acr", + "nonce", + "preferred_username", + "name", + "tid", + "ver", + "at_hash", + "c_hash", + "email" + ], + "kerberos_endpoint": "https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000/kerberos", + "tenant_region_scope": "NA", + "cloud_instance_name": "microsoftonline.com", + "cloud_graph_host_name": "graph.windows.net", + "msgraph_host": "graph.microsoft.com", + "rbac_url": "https://pas.windows.net" + } + }, + { + "RequestUri": "https://login.microsoftonline.com/common/discovery/instance?api-version=1.1\u0026authorization_endpoint=https://login.microsoftonline.com/common/oauth2/authorize", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Cookie": "cookie;", + "User-Agent": "azsdk-python-identity/1.11.0b3 Python/3.8.10 (Windows-10-10.0.22000-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Allow-Methods": "GET, OPTIONS", + "Access-Control-Allow-Origin": "*", + "Cache-Control": "max-age=86400, private", + "Content-Length": "945", + "Content-Security-Policy-Report-Only": "script-src \u0027self\u0027 \u0027nonce-kuITJVUaqCN5HqsrgguMNQ\u0027 \u0027unsafe-eval\u0027 \u0027unsafe-inline\u0027; object-src \u0027none\u0027; base-uri \u0027none\u0027; report-uri https://csp.microsoft.com/report/ESTS-UX-All", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 29 Jul 2022 06:33:45 GMT", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Set-Cookie": "[set-cookie;]", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-ests-server": "2.1.13355.6 - KRSLR1 ProdSlices", + "X-XSS-Protection": "0" + }, + "ResponseBody": { + "tenant_discovery_endpoint": "https://login.microsoftonline.com/common/.well-known/openid-configuration", + "api-version": "1.1", + "metadata": [ + { + "preferred_network": "login.microsoftonline.com", + "preferred_cache": "login.windows.net", + "aliases": [ + "login.microsoftonline.com", + "login.windows.net", + "login.microsoft.com", + "sts.windows.net" + ] + }, + { + "preferred_network": "login.partner.microsoftonline.cn", + "preferred_cache": "login.partner.microsoftonline.cn", + "aliases": [ + "login.partner.microsoftonline.cn", + "login.chinacloudapi.cn" + ] + }, + { + "preferred_network": "login.microsoftonline.de", + "preferred_cache": "login.microsoftonline.de", + "aliases": [ + "login.microsoftonline.de" + ] + }, + { + "preferred_network": "login.microsoftonline.us", + "preferred_cache": "login.microsoftonline.us", + "aliases": [ + "login.microsoftonline.us", + "login.usgovcloudapi.net" + ] + }, + { + "preferred_network": "login-us.microsoftonline.com", + "preferred_cache": "login-us.microsoftonline.com", + "aliases": [ + "login-us.microsoftonline.com" + ] + } + ] + } + }, + { + "RequestUri": "https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000/oauth2/v2.0/token", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "client-request-id": "ee19bff2-523f-471c-88f9-9c23b59d4215", + "Connection": "keep-alive", + "Content-Length": "289", + "Content-Type": "application/x-www-form-urlencoded", + "Cookie": "cookie;", + "User-Agent": "azsdk-python-identity/1.11.0b3 Python/3.8.10 (Windows-10-10.0.22000-SP0)", + "x-client-cpu": "x64", + "x-client-current-telemetry": "4|730,0|", + "x-client-last-telemetry": "4|0|||", + "x-client-os": "win32", + "x-client-sku": "MSAL.Python", + "x-client-ver": "1.18.0", + "x-ms-lib-capability": "retry-after, h429" + }, + "RequestBody": "client_id=a2df54d5-ab03-4725-9b80-9a00b3b1967f\u0026grant_type=client_credentials\u0026client_info=1\u0026client_secret=0vj7Q~IsFayrD0V_8oyOfygU-GE3ELOabq95a\u0026claims=%7B%22access_token%22%3A\u002B%7B%22xms_cc%22%3A\u002B%7B%22values%22%3A\u002B%5B%22CP1%22%5D%7D%7D%7D\u0026scope=https%3A%2F%2Fmanagement.azure.com%2F.default", + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-store, no-cache", + "client-request-id": "ee19bff2-523f-471c-88f9-9c23b59d4215", + "Content-Length": "93", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 29 Jul 2022 06:33:46 GMT", + "Expires": "-1", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Pragma": "no-cache", + "Set-Cookie": "[set-cookie;]", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-clitelem": "1,0,0,,", + "x-ms-ests-server": "2.1.13355.6 - NCUS ProdSlices", + "X-XSS-Protection": "0" + }, + "ResponseBody": { + "token_type": "Bearer", + "expires_in": 3599, + "ext_expires_in": 3599, + "access_token": "access_token" + } + }, + { + "RequestUri": "https://management.azure.com/providers/Microsoft.DataLakeAnalytics/operations?api-version=2019-11-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-datalake-analytics/1.0.0b1 Python/3.8.10 (Windows-10-10.0.22000-SP0)" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json", + "Date": "Fri, 29 Jul 2022 06:33:48 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Server": "Microsoft-IIS/10.0", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", + "X-AspNet-Version": "4.0.30319", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "2ea308d7-b0d2-436a-8baf-754ba7c3b770", + "x-ms-ratelimit-remaining-tenant-reads": "11999", + "x-ms-routing-request-id": "SOUTHEASTASIA:20220729T063349Z:2ea308d7-b0d2-436a-8baf-754ba7c3b770", + "X-Powered-By": "ASP.NET" + }, + "ResponseBody": { + "value": [ + { + "name": "Microsoft.DataLakeAnalytics/operations/read", + "display": { + "provider": "Microsoft DataLakeAnalytics", + "resource": "Available Operations", + "operation": "Get Available Operations", + "description": "Get available operations of DataLakeAnalytics." + } + }, + { + "name": "Microsoft.DataLakeAnalytics/register/action", + "display": { + "provider": "Microsoft DataLakeAnalytics", + "resource": "Registration", + "operation": "Register to DataLakeAnalytics", + "description": "Register subscription to DataLakeAnalytics." + } + }, + { + "name": "Microsoft.DataLakeAnalytics/accounts/read", + "display": { + "provider": "Microsoft DataLakeAnalytics", + "resource": "Account", + "operation": "Get DataLakeAnalytics Account", + "description": "Get information about an existing DataLakeAnalytics account." + } + }, + { + "name": "Microsoft.DataLakeAnalytics/accounts/write", + "display": { + "provider": "Microsoft DataLakeAnalytics", + "resource": "Account", + "operation": "Create or Update DataLakeAnalytics Account", + "description": "Create or update a DataLakeAnalytics account." + } + }, + { + "name": "Microsoft.DataLakeAnalytics/accounts/delete", + "display": { + "provider": "Microsoft DataLakeAnalytics", + "resource": "Account", + "operation": "Delete DataLakeAnalytics Account", + "description": "Delete a DataLakeAnalytics account." + } + }, + { + "name": "Microsoft.DataLakeAnalytics/accounts/operationResults/read", + "display": { + "provider": "Microsoft DataLakeAnalytics", + "resource": "Operation Result", + "operation": "Get DataLakeAnalytics Account OperationResult", + "description": "Get result of a DataLakeAnalytics account operation." + } + }, + { + "name": "Microsoft.DataLakeAnalytics/accounts/transferAnalyticsUnits/action", + "display": { + "provider": "Microsoft DataLakeAnalytics", + "resource": "Account", + "operation": "Transfer AnalyticsUnits", + "description": "Transfer SystemMaxAnalyticsUnits among DataLakeAnalytics accounts." + } + }, + { + "name": "Microsoft.DataLakeAnalytics/accounts/firewallRules/read", + "display": { + "provider": "Microsoft DataLakeAnalytics", + "resource": "Firewall Rule", + "operation": "Get Firewall Rule", + "description": "Get information about a firewall rule." + } + }, + { + "name": "Microsoft.DataLakeAnalytics/accounts/firewallRules/write", + "display": { + "provider": "Microsoft DataLakeAnalytics", + "resource": "Firewall Rule", + "operation": "Create or Update Firewall Rule", + "description": "Create or update a firewall rule." + } + }, + { + "name": "Microsoft.DataLakeAnalytics/accounts/firewallRules/delete", + "display": { + "provider": "Microsoft DataLakeAnalytics", + "resource": "Firewall Rule", + "operation": "Delete Firewall Rule", + "description": "Delete a firewall rule." + } + }, + { + "name": "Microsoft.DataLakeAnalytics/accounts/virtualNetworkRules/read", + "display": { + "provider": "Microsoft DataLakeAnalytics", + "resource": "Virtual Network Rule", + "operation": "Get Virtual Network Rule", + "description": "Get information about a virtual network rule." + } + }, + { + "name": "Microsoft.DataLakeAnalytics/accounts/virtualNetworkRules/write", + "display": { + "provider": "Microsoft DataLakeAnalytics", + "resource": "Virtual Network Rule", + "operation": "Create or Update Virtual Network Rule", + "description": "Create or update a virtual network rule." + } + }, + { + "name": "Microsoft.DataLakeAnalytics/accounts/virtualNetworkRules/delete", + "display": { + "provider": "Microsoft DataLakeAnalytics", + "resource": "Virtual Network Rule", + "operation": "Delete Virtual Network Rule", + "description": "Delete a virtual network rule." + } + }, + { + "name": "Microsoft.DataLakeAnalytics/accounts/dataLakeStoreAccounts/read", + "display": { + "provider": "Microsoft DataLakeAnalytics", + "resource": "DataLakeStore Account", + "operation": "Get Linked DataLakeStore Account", + "description": "Get information about a linked DataLakeStore account of a DataLakeAnalytics account." + } + }, + { + "name": "Microsoft.DataLakeAnalytics/accounts/dataLakeStoreAccounts/write", + "display": { + "provider": "Microsoft DataLakeAnalytics", + "resource": "DataLakeStore Account", + "operation": "Create or Update Linked DataLakeStore Account", + "description": "Create or update a linked DataLakeStore account of a DataLakeAnalytics account." + } + }, + { + "name": "Microsoft.DataLakeAnalytics/accounts/dataLakeStoreAccounts/delete", + "display": { + "provider": "Microsoft DataLakeAnalytics", + "resource": "DataLakeStore Account", + "operation": "Unlink DataLakeStore Account", + "description": "Unlink a DataLakeStore account from a DataLakeAnalytics account." + } + }, + { + "name": "Microsoft.DataLakeAnalytics/accounts/dataLakeStoreGen2Accounts/read", + "display": { + "provider": "Microsoft DataLakeAnalytics", + "resource": "DataLakeStoreGen2 Account", + "operation": "Get Linked DataLakeStoreGen2 Account", + "description": "Get information about a linked DataLakeStoreGen2 account of a DataLakeAnalytics account." + } + }, + { + "name": "Microsoft.DataLakeAnalytics/accounts/dataLakeStoreGen2Accounts/write", + "display": { + "provider": "Microsoft DataLakeAnalytics", + "resource": "DataLakeStoreGen2 Account", + "operation": "Create or Update Linked DataLakeStoreGen2 Account", + "description": "Create or update a linked DataLakeStoreGen2 account of a DataLakeAnalytics account." + } + }, + { + "name": "Microsoft.DataLakeAnalytics/accounts/dataLakeStoreGen2Accounts/delete", + "display": { + "provider": "Microsoft DataLakeAnalytics", + "resource": "DataLakeStoreGen2 Account", + "operation": "Unlink DataLakeStoreGen2 Account", + "description": "Unlink a DataLakeStoreGen2 account from a DataLakeAnalytics account." + } + }, + { + "name": "Microsoft.DataLakeAnalytics/accounts/storageAccounts/read", + "display": { + "provider": "Microsoft DataLakeAnalytics", + "resource": "Storage Account", + "operation": "Get Linked Storage Account", + "description": "Get information about a linked Storage account of a DataLakeAnalytics account." + } + }, + { + "name": "Microsoft.DataLakeAnalytics/accounts/storageAccounts/write", + "display": { + "provider": "Microsoft DataLakeAnalytics", + "resource": "Storage Account", + "operation": "Create or Update Linked Storage Account", + "description": "Create or update a linked Storage account of a DataLakeAnalytics account." + } + }, + { + "name": "Microsoft.DataLakeAnalytics/accounts/storageAccounts/delete", + "display": { + "provider": "Microsoft DataLakeAnalytics", + "resource": "Storage Account", + "operation": "Unlink Storage Account", + "description": "Unlink a Storage account from a DataLakeAnalytics account." + } + }, + { + "name": "Microsoft.DataLakeAnalytics/accounts/storageAccounts/Containers/read", + "display": { + "provider": "Microsoft DataLakeAnalytics", + "resource": "Container", + "operation": "Get Storage Container", + "description": "Get containers of a linked Storage account of a DataLakeAnalytics account." + } + }, + { + "name": "Microsoft.DataLakeAnalytics/accounts/storageAccounts/Containers/listSasTokens/action", + "display": { + "provider": "Microsoft DataLakeAnalytics", + "resource": "SAS Token", + "operation": "List SAS Tokens", + "description": "List SAS tokens for storage containers of a linked Storage account of a DataLakeAnalytics account." + } + }, + { + "name": "Microsoft.DataLakeAnalytics/accounts/computePolicies/read", + "display": { + "provider": "Microsoft DataLakeAnalytics", + "resource": "Compute Policy", + "operation": "Get Compute Policy", + "description": "Get information about a compute policy." + } + }, + { + "name": "Microsoft.DataLakeAnalytics/accounts/computePolicies/write", + "display": { + "provider": "Microsoft DataLakeAnalytics", + "resource": "Compute Policy", + "operation": "Create or Update Compute Policy", + "description": "Create or update a compute policy." + } + }, + { + "name": "Microsoft.DataLakeAnalytics/accounts/computePolicies/delete", + "display": { + "provider": "Microsoft DataLakeAnalytics", + "resource": "Compute Policy", + "operation": "Delete Compute Policy", + "description": "Delete a compute policy." + } + }, + { + "name": "Microsoft.DataLakeAnalytics/accounts/TakeOwnership/action", + "display": { + "provider": "Microsoft DataLakeAnalytics", + "resource": "Job Ownership", + "operation": "Take Ownership of DataLakeAnalytics Job", + "description": "Grant permissions to cancel jobs submitted by other users." + } + }, + { + "name": "Microsoft.DataLakeAnalytics/locations/capability/read", + "display": { + "provider": "Microsoft DataLakeAnalytics", + "resource": "Subscription Capability", + "operation": "Get DataLakeAnalytics Subscription Capability", + "description": "Get capability information of a subscription regarding using DataLakeAnalytics." + } + }, + { + "name": "Microsoft.DataLakeAnalytics/locations/usages/read", + "display": { + "provider": "Microsoft DataLakeAnalytics", + "resource": "Subscription Quota Usages", + "operation": "Get DataLakeAnalytics Subscription Quota Usages", + "description": "Get quota usages information of a subscription regarding using DataLakeAnalytics." + } + }, + { + "name": "Microsoft.DataLakeAnalytics/locations/checkNameAvailability/action", + "display": { + "provider": "Microsoft DataLakeAnalytics", + "resource": "Name Availability", + "operation": "Check DataLakeAnalytics Account Name Availability", + "description": "Check availability of a DataLakeAnalytics account name." + } + }, + { + "name": "Microsoft.DataLakeAnalytics/locations/operationResults/read", + "display": { + "provider": "Microsoft DataLakeAnalytics", + "resource": "Operation Result", + "operation": "Get DataLakeAnalytics Account OperationResult", + "description": "Get result of a DataLakeAnalytics account operation." + } + }, + { + "name": "Microsoft.DataLakeAnalytics/accounts/providers/Microsoft.Insights/metricDefinitions/read", + "display": { + "provider": "Microsoft DataLakeAnalytics", + "resource": "Metric Definition", + "operation": "Get DataLakeAnalytics Account metric definitions", + "description": "Get the available metrics for the DataLakeAnalytics account." + }, + "origin": "system", + "properties": { + "serviceSpecification": { + "metricSpecifications": [ + { + "name": "JobEndedSuccess", + "displayName": "Successful Jobs", + "displayDescription": "Count of successful jobs.", + "unit": "Count", + "aggregationType": "Total", + "availabilities": [ + { + "timeGrain": "PT1M", + "blobDuration": "PT1H" + }, + { + "timeGrain": "PT1H", + "blobDuration": "P1D" + } + ] + }, + { + "name": "JobEndedFailure", + "displayName": "Failed Jobs", + "displayDescription": "Count of failed jobs.", + "unit": "Count", + "aggregationType": "Total", + "availabilities": [ + { + "timeGrain": "PT1M", + "blobDuration": "PT1H" + }, + { + "timeGrain": "PT1H", + "blobDuration": "P1D" + } + ] + }, + { + "name": "JobEndedCancelled", + "displayName": "Cancelled Jobs", + "displayDescription": "Count of cancelled jobs.", + "unit": "Count", + "aggregationType": "Total", + "availabilities": [ + { + "timeGrain": "PT1M", + "blobDuration": "PT1H" + }, + { + "timeGrain": "PT1H", + "blobDuration": "P1D" + } + ] + }, + { + "name": "JobAUEndedSuccess", + "displayName": "Successful AU Time", + "displayDescription": "Total AU time for successful jobs.", + "unit": "Seconds", + "aggregationType": "Total", + "availabilities": [ + { + "timeGrain": "PT1M", + "blobDuration": "PT1H" + }, + { + "timeGrain": "PT1H", + "blobDuration": "P1D" + } + ] + }, + { + "name": "JobAUEndedFailure", + "displayName": "Failed AU Time", + "displayDescription": "Total AU time for failed jobs.", + "unit": "Seconds", + "aggregationType": "Total", + "availabilities": [ + { + "timeGrain": "PT1M", + "blobDuration": "PT1H" + }, + { + "timeGrain": "PT1H", + "blobDuration": "P1D" + } + ] + }, + { + "name": "JobAUEndedCancelled", + "displayName": "Cancelled AU Time", + "displayDescription": "Total AU time for cancelled jobs.", + "unit": "Seconds", + "aggregationType": "Total", + "availabilities": [ + { + "timeGrain": "PT1M", + "blobDuration": "PT1H" + }, + { + "timeGrain": "PT1H", + "blobDuration": "P1D" + } + ] + }, + { + "name": "JobStage", + "displayName": "Jobs in Stage", + "displayDescription": "Number of jobs in each stage.", + "unit": "Count", + "aggregationType": "Total", + "availabilities": [ + { + "timeGrain": "PT1M", + "blobDuration": "PT1H" + }, + { + "timeGrain": "PT1H", + "blobDuration": "P1D" + } + ] + } + ] + } + } + }, + { + "name": "Microsoft.DataLakeAnalytics/accounts/providers/Microsoft.Insights/logDefinitions/read", + "display": { + "provider": "Microsoft DataLakeAnalytics", + "resource": "Log Definition", + "operation": "Get DataLakeAnalytics Account log definitions", + "description": "Get the available logs for the DataLakeAnalytics account." + }, + "origin": "system", + "properties": { + "serviceSpecification": { + "logSpecifications": [ + { + "name": "Audit", + "displayName": "Audit Logs", + "blobDuration": "PT1H" + }, + { + "name": "Requests", + "displayName": "Request Logs", + "blobDuration": "PT1H" + } + ] + } + } + }, + { + "name": "Microsoft.DataLakeAnalytics/accounts/providers/Microsoft.Insights/diagnosticSettings/read", + "display": { + "provider": "Microsoft DataLakeAnalytics", + "resource": "Diagnostic Setting", + "operation": "Get DataLakeAnalytics Account diagnostic settings", + "description": "Get the diagnostic settings for the DataLakeAnalytics account." + }, + "origin": "system" + }, + { + "name": "Microsoft.DataLakeAnalytics/accounts/providers/Microsoft.Insights/diagnosticSettings/write", + "display": { + "provider": "Microsoft DataLakeAnalytics", + "resource": "Diagnostic Setting", + "operation": "Create or update DataLakeAnalytics Account diagnostic settings", + "description": "Create or update the diagnostic settings for the DataLakeAnalytics account." + }, + "origin": "system" + } + ] + } + } + ], "Variables": {} }