From c1dbd8d6cbf5d0edf0db5215bd6808c40020f9ea Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 13 Nov 2020 01:20:54 +0000 Subject: [PATCH] CodeGen from PR 11639 in Azure/azure-rest-api-specs add openapi-subtype (#11639) --- src/adp/HISTORY.rst | 8 + src/adp/README.md | 58 ++ src/adp/azext_adp/__init__.py | 50 + src/adp/azext_adp/action.py | 17 + src/adp/azext_adp/azext_metadata.json | 4 + src/adp/azext_adp/custom.py | 17 + src/adp/azext_adp/generated/__init__.py | 12 + .../azext_adp/generated/_client_factory.py | 24 + src/adp/azext_adp/generated/_help.py | 170 ++++ src/adp/azext_adp/generated/_params.py | 92 ++ src/adp/azext_adp/generated/_validators.py | 9 + src/adp/azext_adp/generated/action.py | 36 + src/adp/azext_adp/generated/commands.py | 40 + src/adp/azext_adp/generated/custom.py | 118 +++ src/adp/azext_adp/manual/__init__.py | 12 + src/adp/azext_adp/tests/__init__.py | 114 +++ src/adp/azext_adp/tests/latest/__init__.py | 12 + .../tests/latest/test_adp_scenario.py | 187 ++++ src/adp/azext_adp/vendored_sdks/__init__.py | 12 + .../azext_adp/vendored_sdks/adp/__init__.py | 16 + .../adp/_adp_management_client.py | 79 ++ .../vendored_sdks/adp/_configuration.py | 70 ++ .../vendored_sdks/adp/aio/__init__.py | 10 + .../adp/aio/_adp_management_client.py | 73 ++ .../vendored_sdks/adp/aio/_configuration.py | 66 ++ .../adp/aio/operations/__init__.py | 17 + .../adp/aio/operations/_account_operations.py | 623 +++++++++++++ .../aio/operations/_data_pool_operations.py | 582 ++++++++++++ .../aio/operations/_operation_operations.py | 105 +++ .../vendored_sdks/adp/models/__init__.py | 86 ++ .../models/_adp_management_client_enums.py | 47 + .../vendored_sdks/adp/models/_models.py | 784 ++++++++++++++++ .../vendored_sdks/adp/models/_models_py3.py | 856 ++++++++++++++++++ .../vendored_sdks/adp/operations/__init__.py | 17 + .../adp/operations/_account_operations.py | 636 +++++++++++++ .../adp/operations/_data_pool_operations.py | 594 ++++++++++++ .../adp/operations/_operation_operations.py | 110 +++ src/adp/azext_adp/vendored_sdks/adp/py.typed | 1 + src/adp/report.md | 177 ++++ src/adp/setup.cfg | 1 + src/adp/setup.py | 58 ++ 41 files changed, 6000 insertions(+) create mode 100644 src/adp/HISTORY.rst create mode 100644 src/adp/README.md create mode 100644 src/adp/azext_adp/__init__.py create mode 100644 src/adp/azext_adp/action.py create mode 100644 src/adp/azext_adp/azext_metadata.json create mode 100644 src/adp/azext_adp/custom.py create mode 100644 src/adp/azext_adp/generated/__init__.py create mode 100644 src/adp/azext_adp/generated/_client_factory.py create mode 100644 src/adp/azext_adp/generated/_help.py create mode 100644 src/adp/azext_adp/generated/_params.py create mode 100644 src/adp/azext_adp/generated/_validators.py create mode 100644 src/adp/azext_adp/generated/action.py create mode 100644 src/adp/azext_adp/generated/commands.py create mode 100644 src/adp/azext_adp/generated/custom.py create mode 100644 src/adp/azext_adp/manual/__init__.py create mode 100644 src/adp/azext_adp/tests/__init__.py create mode 100644 src/adp/azext_adp/tests/latest/__init__.py create mode 100644 src/adp/azext_adp/tests/latest/test_adp_scenario.py create mode 100644 src/adp/azext_adp/vendored_sdks/__init__.py create mode 100644 src/adp/azext_adp/vendored_sdks/adp/__init__.py create mode 100644 src/adp/azext_adp/vendored_sdks/adp/_adp_management_client.py create mode 100644 src/adp/azext_adp/vendored_sdks/adp/_configuration.py create mode 100644 src/adp/azext_adp/vendored_sdks/adp/aio/__init__.py create mode 100644 src/adp/azext_adp/vendored_sdks/adp/aio/_adp_management_client.py create mode 100644 src/adp/azext_adp/vendored_sdks/adp/aio/_configuration.py create mode 100644 src/adp/azext_adp/vendored_sdks/adp/aio/operations/__init__.py create mode 100644 src/adp/azext_adp/vendored_sdks/adp/aio/operations/_account_operations.py create mode 100644 src/adp/azext_adp/vendored_sdks/adp/aio/operations/_data_pool_operations.py create mode 100644 src/adp/azext_adp/vendored_sdks/adp/aio/operations/_operation_operations.py create mode 100644 src/adp/azext_adp/vendored_sdks/adp/models/__init__.py create mode 100644 src/adp/azext_adp/vendored_sdks/adp/models/_adp_management_client_enums.py create mode 100644 src/adp/azext_adp/vendored_sdks/adp/models/_models.py create mode 100644 src/adp/azext_adp/vendored_sdks/adp/models/_models_py3.py create mode 100644 src/adp/azext_adp/vendored_sdks/adp/operations/__init__.py create mode 100644 src/adp/azext_adp/vendored_sdks/adp/operations/_account_operations.py create mode 100644 src/adp/azext_adp/vendored_sdks/adp/operations/_data_pool_operations.py create mode 100644 src/adp/azext_adp/vendored_sdks/adp/operations/_operation_operations.py create mode 100644 src/adp/azext_adp/vendored_sdks/adp/py.typed create mode 100644 src/adp/report.md create mode 100644 src/adp/setup.cfg create mode 100644 src/adp/setup.py diff --git a/src/adp/HISTORY.rst b/src/adp/HISTORY.rst new file mode 100644 index 00000000000..1c139576ba0 --- /dev/null +++ b/src/adp/HISTORY.rst @@ -0,0 +1,8 @@ +.. :changelog: + +Release History +=============== + +0.1.0 +++++++ +* Initial release. diff --git a/src/adp/README.md b/src/adp/README.md new file mode 100644 index 00000000000..ccbcec7d69a --- /dev/null +++ b/src/adp/README.md @@ -0,0 +1,58 @@ +# Azure CLI adp Extension # +This is the extension for adp + +### How to use ### +Install this extension using the below CLI command +``` +az extension add --name adp +``` + +### Included Features ### +#### adp account #### +##### Create ##### +``` +az adp account create --name "sampleacct" --location "Global" --resource-group "adpClient" + +az adp account wait --created --name "{myAccount}" --resource-group "{rg}" +``` +##### Show ##### +``` +az adp account show --name "sampleacct" --resource-group "adpClient" +``` +##### List ##### +``` +az adp account list --resource-group "adpClient" +``` +##### Update ##### +``` +az adp account update --name "sampleacct" --resource-group "adpClient" +``` +##### Delete ##### +``` +az adp account delete --name "sampleacct" --resource-group "adpClient" +``` +#### adp data-pool #### +##### Create ##### +``` +az adp data-pool create --account-name "sampleacct" --name "sampledp" --locations name="westus" \ + --resource-group "adpClient" + +az adp data-pool wait --created --name "{myDataPool}" --resource-group "{rg}" +``` +##### Show ##### +``` +az adp data-pool show --account-name "sampleacct" --name "sampledp" --resource-group "adpClient" +``` +##### List ##### +``` +az adp data-pool list --account-name "sampleacct" --resource-group "adpClient" +``` +##### Update ##### +``` +az adp data-pool update --account-name "sampleacct" --name "sampledp" --locations name="westus" \ + --resource-group "adpClient" +``` +##### Delete ##### +``` +az adp data-pool delete --account-name "sampleacct" --name "sampledp" --resource-group "adpClient" +``` \ No newline at end of file diff --git a/src/adp/azext_adp/__init__.py b/src/adp/azext_adp/__init__.py new file mode 100644 index 00000000000..0bbfe16ee69 --- /dev/null +++ b/src/adp/azext_adp/__init__.py @@ -0,0 +1,50 @@ +# -------------------------------------------------------------------------- +# 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.cli.core import AzCommandsLoader +from azext_adp.generated._help import helps # pylint: disable=unused-import +try: + from azext_adp.manual._help import helps # pylint: disable=reimported +except ImportError: + pass + + +class AdpManagementClientCommandsLoader(AzCommandsLoader): + + def __init__(self, cli_ctx=None): + from azure.cli.core.commands import CliCommandType + from azext_adp.generated._client_factory import cf_adp_cl + adp_custom = CliCommandType( + operations_tmpl='azext_adp.custom#{}', + client_factory=cf_adp_cl) + parent = super(AdpManagementClientCommandsLoader, self) + parent.__init__(cli_ctx=cli_ctx, custom_command_type=adp_custom) + + def load_command_table(self, args): + from azext_adp.generated.commands import load_command_table + load_command_table(self, args) + try: + from azext_adp.manual.commands import load_command_table as load_command_table_manual + load_command_table_manual(self, args) + except ImportError: + pass + return self.command_table + + def load_arguments(self, command): + from azext_adp.generated._params import load_arguments + load_arguments(self, command) + try: + from azext_adp.manual._params import load_arguments as load_arguments_manual + load_arguments_manual(self, command) + except ImportError: + pass + + +COMMAND_LOADER_CLS = AdpManagementClientCommandsLoader diff --git a/src/adp/azext_adp/action.py b/src/adp/azext_adp/action.py new file mode 100644 index 00000000000..d95d53bf711 --- /dev/null +++ b/src/adp/azext_adp/action.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- +# pylint: disable=wildcard-import +# pylint: disable=unused-wildcard-import + +from .generated.action import * # noqa: F403 +try: + from .manual.action import * # noqa: F403 +except ImportError: + pass diff --git a/src/adp/azext_adp/azext_metadata.json b/src/adp/azext_adp/azext_metadata.json new file mode 100644 index 00000000000..4f48fa652a5 --- /dev/null +++ b/src/adp/azext_adp/azext_metadata.json @@ -0,0 +1,4 @@ +{ + "azext.isExperimental": true, + "azext.minCliCoreVersion": "2.11.0" +} \ No newline at end of file diff --git a/src/adp/azext_adp/custom.py b/src/adp/azext_adp/custom.py new file mode 100644 index 00000000000..dbe9d5f9742 --- /dev/null +++ b/src/adp/azext_adp/custom.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- +# pylint: disable=wildcard-import +# pylint: disable=unused-wildcard-import + +from .generated.custom import * # noqa: F403 +try: + from .manual.custom import * # noqa: F403 +except ImportError: + pass diff --git a/src/adp/azext_adp/generated/__init__.py b/src/adp/azext_adp/generated/__init__.py new file mode 100644 index 00000000000..c9cfdc73e77 --- /dev/null +++ b/src/adp/azext_adp/generated/__init__.py @@ -0,0 +1,12 @@ +# 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. +# -------------------------------------------------------------------------- + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/adp/azext_adp/generated/_client_factory.py b/src/adp/azext_adp/generated/_client_factory.py new file mode 100644 index 00000000000..1d2cf810de2 --- /dev/null +++ b/src/adp/azext_adp/generated/_client_factory.py @@ -0,0 +1,24 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + + +def cf_adp_cl(cli_ctx, *_): + from azure.cli.core.commands.client_factory import get_mgmt_service_client + from ..vendored_sdks.adp import AdpManagementClient + return get_mgmt_service_client(cli_ctx, + AdpManagementClient) + + +def cf_account(cli_ctx, *_): + return cf_adp_cl(cli_ctx).account + + +def cf_data_pool(cli_ctx, *_): + return cf_adp_cl(cli_ctx).data_pool diff --git a/src/adp/azext_adp/generated/_help.py b/src/adp/azext_adp/generated/_help.py new file mode 100644 index 00000000000..cdf105b6ba9 --- /dev/null +++ b/src/adp/azext_adp/generated/_help.py @@ -0,0 +1,170 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- +# pylint: disable=too-many-lines + +from knack.help_files import helps + + +helps['adp account'] = """ + type: group + short-summary: adp account +""" + +helps['adp account list'] = """ + type: command + short-summary: "List all ADP accounts available under the resource group And List all ADP accounts available under \ +the subscription." + examples: + - name: List accounts by resource group + text: |- + az adp account list --resource-group "adpClient" + - name: List accounts + text: |- + az adp account list +""" + +helps['adp account show'] = """ + type: command + short-summary: "Gets the properties of an ADP account." + examples: + - name: Get account + text: |- + az adp account show --name "sampleacct" --resource-group "adpClient" +""" + +helps['adp account create'] = """ + type: command + short-summary: "Create an ADP account." + examples: + - name: Put account + text: |- + az adp account create --name "sampleacct" --location "Global" --resource-group "adpClient" +""" + +helps['adp account update'] = """ + type: command + short-summary: "Updates the properties of an existing ADP account." + examples: + - name: Patch account + text: |- + az adp account update --name "sampleacct" --resource-group "adpClient" +""" + +helps['adp account delete'] = """ + type: command + short-summary: "Deletes an ADP account." + examples: + - name: Delete account + text: |- + az adp account delete --name "sampleacct" --resource-group "adpClient" +""" + +helps['adp account wait'] = """ + type: command + short-summary: Place the CLI in a waiting state until a condition of the adp account is met. + examples: + - name: Pause executing next line of CLI script until the adp account is successfully created. + text: |- + az adp account wait --name "sampleacct" --resource-group "adpClient" --created + - name: Pause executing next line of CLI script until the adp account is successfully updated. + text: |- + az adp account wait --name "sampleacct" --resource-group "adpClient" --updated + - name: Pause executing next line of CLI script until the adp account is successfully deleted. + text: |- + az adp account wait --name "sampleacct" --resource-group "adpClient" --deleted +""" + +helps['adp data-pool'] = """ + type: group + short-summary: adp data-pool +""" + +helps['adp data-pool list'] = """ + type: command + short-summary: "Lists the data pools under the ADP account." + examples: + - name: List Data Pools + text: |- + az adp data-pool list --account-name "sampleacct" --resource-group "adpClient" +""" + +helps['adp data-pool show'] = """ + type: command + short-summary: "Gets the properties of a Data Pool." + examples: + - name: Get Data Pool + text: |- + az adp data-pool show --account-name "sampleacct" --name "sampledp" --resource-group "adpClient" +""" + +helps['adp data-pool create'] = """ + type: command + short-summary: "Create a Data Pool." + parameters: + - name: --locations + short-summary: "Gets or sets the collection of locations where Data Pool resources should be created." + long-summary: | + Usage: --locations name=XX + + name: Required. The location name + + Multiple actions can be specified by using more than one --locations argument. + examples: + - name: Put Data Pool + text: |- + az adp data-pool create --account-name "sampleacct" --name "sampledp" --locations name="westus" \ +--resource-group "adpClient" +""" + +helps['adp data-pool update'] = """ + type: command + short-summary: "Updates the properties of an existing Data Pool." + parameters: + - name: --locations + short-summary: "Gets or sets the collection of locations where Data Pool resources should be created." + long-summary: | + Usage: --locations name=XX + + name: Required. The location name + + Multiple actions can be specified by using more than one --locations argument. + examples: + - name: Patch Data Pool + text: |- + az adp data-pool update --account-name "sampleacct" --name "sampledp" --locations name="westus" \ +--resource-group "adpClient" +""" + +helps['adp data-pool delete'] = """ + type: command + short-summary: "Deletes a Data Pool." + examples: + - name: Delete Data Pool + text: |- + az adp data-pool delete --account-name "sampleacct" --name "sampledp" --resource-group "adpClient" +""" + +helps['adp data-pool wait'] = """ + type: command + short-summary: Place the CLI in a waiting state until a condition of the adp data-pool is met. + examples: + - name: Pause executing next line of CLI script until the adp data-pool is successfully created. + text: |- + az adp data-pool wait --account-name "sampleacct" --name "sampledp" --resource-group "adpClient" \ +--created + - name: Pause executing next line of CLI script until the adp data-pool is successfully updated. + text: |- + az adp data-pool wait --account-name "sampleacct" --name "sampledp" --resource-group "adpClient" \ +--updated + - name: Pause executing next line of CLI script until the adp data-pool is successfully deleted. + text: |- + az adp data-pool wait --account-name "sampleacct" --name "sampledp" --resource-group "adpClient" \ +--deleted +""" diff --git a/src/adp/azext_adp/generated/_params.py b/src/adp/azext_adp/generated/_params.py new file mode 100644 index 00000000000..be83084386d --- /dev/null +++ b/src/adp/azext_adp/generated/_params.py @@ -0,0 +1,92 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- +# pylint: disable=too-many-lines +# pylint: disable=too-many-statements + +from azure.cli.core.commands.parameters import ( + tags_type, + resource_group_name_type, + get_location_type +) +from azure.cli.core.commands.validators import get_default_location_from_resource_group +from azext_adp.action import AddLocations + + +def load_arguments(self, _): + + with self.argument_context('adp account list') as c: + c.argument('resource_group_name', resource_group_name_type) + + with self.argument_context('adp account show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('account_name', options_list=['--name', '-n', '--account-name'], type=str, help='The name of the ' + 'ADP account.', id_part='name') + + with self.argument_context('adp account create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('account_name', options_list=['--name', '-n', '--account-name'], type=str, help='The name of the ' + 'ADP account.') + c.argument('tags', tags_type) + c.argument('location', arg_type=get_location_type(self.cli_ctx), + validator=get_default_location_from_resource_group) + + with self.argument_context('adp account update') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('account_name', options_list=['--name', '-n', '--account-name'], type=str, help='The name of the ' + 'ADP account.', id_part='name') + c.argument('tags', tags_type) + + with self.argument_context('adp account delete') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('account_name', options_list=['--name', '-n', '--account-name'], type=str, help='The name of the ' + 'ADP account.', id_part='name') + + with self.argument_context('adp account wait') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('account_name', options_list=['--name', '-n', '--account-name'], type=str, help='The name of the ' + 'ADP account.', id_part='name') + + with self.argument_context('adp data-pool list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('account_name', type=str, help='The name of the ADP account.') + + with self.argument_context('adp data-pool show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('account_name', type=str, help='The name of the ADP account.', id_part='name') + c.argument('data_pool_name', options_list=['--name', '-n', '--data-pool-name'], type=str, help='The name of ' + 'the Data Pool.', id_part='child_name_1') + + with self.argument_context('adp data-pool create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('account_name', type=str, help='The name of the ADP account.') + c.argument('data_pool_name', options_list=['--name', '-n', '--data-pool-name'], type=str, help='The name of ' + 'the Data Pool.') + c.argument('locations', action=AddLocations, nargs='*', help='Gets or sets the collection of locations where ' + 'Data Pool resources should be created.') + + with self.argument_context('adp data-pool update') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('account_name', type=str, help='The name of the ADP account.', id_part='name') + c.argument('data_pool_name', options_list=['--name', '-n', '--data-pool-name'], type=str, help='The name of ' + 'the Data Pool.', id_part='child_name_1') + c.argument('locations', action=AddLocations, nargs='*', help='Gets or sets the collection of locations where ' + 'Data Pool resources should be created.') + + with self.argument_context('adp data-pool delete') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('account_name', type=str, help='The name of the ADP account.', id_part='name') + c.argument('data_pool_name', options_list=['--name', '-n', '--data-pool-name'], type=str, help='The name of ' + 'the Data Pool.', id_part='child_name_1') + + with self.argument_context('adp data-pool wait') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('account_name', type=str, help='The name of the ADP account.', id_part='name') + c.argument('data_pool_name', options_list=['--name', '-n', '--data-pool-name'], type=str, help='The name of ' + 'the Data Pool.', id_part='child_name_1') diff --git a/src/adp/azext_adp/generated/_validators.py b/src/adp/azext_adp/generated/_validators.py new file mode 100644 index 00000000000..b33a44c1ebf --- /dev/null +++ b/src/adp/azext_adp/generated/_validators.py @@ -0,0 +1,9 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- diff --git a/src/adp/azext_adp/generated/action.py b/src/adp/azext_adp/generated/action.py new file mode 100644 index 00000000000..7293585ff5c --- /dev/null +++ b/src/adp/azext_adp/generated/action.py @@ -0,0 +1,36 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- +# pylint: disable=protected-access + +import argparse +from collections import defaultdict +from knack.util import CLIError + + +class AddLocations(argparse._AppendAction): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + super(AddLocations, self).__call__(parser, namespace, action, option_string) + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'name': + d['name'] = v[0] + return d diff --git a/src/adp/azext_adp/generated/commands.py b/src/adp/azext_adp/generated/commands.py new file mode 100644 index 00000000000..d9e5b1c771c --- /dev/null +++ b/src/adp/azext_adp/generated/commands.py @@ -0,0 +1,40 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- +# pylint: disable=too-many-statements +# pylint: disable=too-many-locals + +from azure.cli.core.commands import CliCommandType + + +def load_command_table(self, _): + + from azext_adp.generated._client_factory import cf_account + adp_account = CliCommandType( + operations_tmpl='azext_adp.vendored_sdks.adp.operations._account_operations#AccountOperations.{}', + client_factory=cf_account) + with self.command_group('adp account', adp_account, client_factory=cf_account, is_experimental=True) as g: + g.custom_command('list', 'adp_account_list') + g.custom_show_command('show', 'adp_account_show') + g.custom_command('create', 'adp_account_create', supports_no_wait=True) + g.custom_command('update', 'adp_account_update', supports_no_wait=True) + g.custom_command('delete', 'adp_account_delete', supports_no_wait=True, confirmation=True) + g.custom_wait_command('wait', 'adp_account_show') + + from azext_adp.generated._client_factory import cf_data_pool + adp_data_pool = CliCommandType( + operations_tmpl='azext_adp.vendored_sdks.adp.operations._data_pool_operations#DataPoolOperations.{}', + client_factory=cf_data_pool) + with self.command_group('adp data-pool', adp_data_pool, client_factory=cf_data_pool, is_experimental=True) as g: + g.custom_command('list', 'adp_data_pool_list') + g.custom_show_command('show', 'adp_data_pool_show') + g.custom_command('create', 'adp_data_pool_create', supports_no_wait=True) + g.custom_command('update', 'adp_data_pool_update', supports_no_wait=True) + g.custom_command('delete', 'adp_data_pool_delete', supports_no_wait=True, confirmation=True) + g.custom_wait_command('wait', 'adp_data_pool_show') diff --git a/src/adp/azext_adp/generated/custom.py b/src/adp/azext_adp/generated/custom.py new file mode 100644 index 00000000000..8b18e797a4d --- /dev/null +++ b/src/adp/azext_adp/generated/custom.py @@ -0,0 +1,118 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- +# pylint: disable=too-many-lines + +from azure.cli.core.util import sdk_no_wait + + +def adp_account_list(client, + resource_group_name=None): + if resource_group_name: + return client.list_by_resource_group(resource_group_name=resource_group_name) + return client.list() + + +def adp_account_show(client, + resource_group_name, + account_name): + return client.get(resource_group_name=resource_group_name, + account_name=account_name) + + +def adp_account_create(client, + resource_group_name, + account_name, + tags=None, + location=None, + no_wait=False): + return sdk_no_wait(no_wait, + client.begin_create_or_update, + resource_group_name=resource_group_name, + account_name=account_name, + tags=tags, + location=location) + + +def adp_account_update(client, + resource_group_name, + account_name, + tags=None, + no_wait=False): + return sdk_no_wait(no_wait, + client.begin_update, + resource_group_name=resource_group_name, + account_name=account_name, + tags=tags) + + +def adp_account_delete(client, + resource_group_name, + account_name, + no_wait=False): + return sdk_no_wait(no_wait, + client.begin_delete, + resource_group_name=resource_group_name, + account_name=account_name) + + +def adp_data_pool_list(client, + resource_group_name, + account_name): + return client.list(resource_group_name=resource_group_name, + account_name=account_name) + + +def adp_data_pool_show(client, + resource_group_name, + account_name, + data_pool_name): + return client.get(resource_group_name=resource_group_name, + account_name=account_name, + data_pool_name=data_pool_name) + + +def adp_data_pool_create(client, + resource_group_name, + account_name, + data_pool_name, + locations=None, + no_wait=False): + return sdk_no_wait(no_wait, + client.begin_create_or_update, + resource_group_name=resource_group_name, + account_name=account_name, + data_pool_name=data_pool_name, + locations=locations) + + +def adp_data_pool_update(client, + resource_group_name, + account_name, + data_pool_name, + locations=None, + no_wait=False): + return sdk_no_wait(no_wait, + client.begin_update, + resource_group_name=resource_group_name, + account_name=account_name, + data_pool_name=data_pool_name, + locations=locations) + + +def adp_data_pool_delete(client, + resource_group_name, + account_name, + data_pool_name, + no_wait=False): + return sdk_no_wait(no_wait, + client.begin_delete, + resource_group_name=resource_group_name, + account_name=account_name, + data_pool_name=data_pool_name) diff --git a/src/adp/azext_adp/manual/__init__.py b/src/adp/azext_adp/manual/__init__.py new file mode 100644 index 00000000000..c9cfdc73e77 --- /dev/null +++ b/src/adp/azext_adp/manual/__init__.py @@ -0,0 +1,12 @@ +# 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. +# -------------------------------------------------------------------------- + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/adp/azext_adp/tests/__init__.py b/src/adp/azext_adp/tests/__init__.py new file mode 100644 index 00000000000..50e0627daff --- /dev/null +++ b/src/adp/azext_adp/tests/__init__.py @@ -0,0 +1,114 @@ +# 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. +# -------------------------------------------------------------------------- +import inspect +import logging +import os +import sys +import traceback +import datetime as dt + +from azure.core.exceptions import AzureError +from azure.cli.testsdk.exceptions import CliTestError, CliExecutionError, JMESPathCheckAssertionError + + +logger = logging.getLogger('azure.cli.testsdk') +logger.addHandler(logging.StreamHandler()) +__path__ = __import__('pkgutil').extend_path(__path__, __name__) +exceptions = [] +test_map = dict() +SUCCESSED = "successed" +FAILED = "failed" + + +def try_manual(func): + def import_manual_function(origin_func): + from importlib import import_module + decorated_path = inspect.getfile(origin_func) + module_path = __path__[0] + if not decorated_path.startswith(module_path): + raise Exception("Decorator can only be used in submodules!") + manual_path = os.path.join( + decorated_path[module_path.rfind(os.path.sep) + 1:]) + manual_file_path, manual_file_name = os.path.split(manual_path) + module_name, _ = os.path.splitext(manual_file_name) + manual_module = "..manual." + \ + ".".join(manual_file_path.split(os.path.sep) + [module_name, ]) + return getattr(import_module(manual_module, package=__name__), origin_func.__name__) + + def get_func_to_call(): + func_to_call = func + try: + func_to_call = import_manual_function(func) + func_to_call = import_manual_function(func) + logger.info("Found manual override for %s(...)", func.__name__) + except (ImportError, AttributeError): + pass + return func_to_call + + def wrapper(*args, **kwargs): + func_to_call = get_func_to_call() + logger.info("running %s()...", func.__name__) + try: + test_map[func.__name__] = dict() + test_map[func.__name__]["result"] = SUCCESSED + test_map[func.__name__]["error_message"] = "" + test_map[func.__name__]["error_stack"] = "" + test_map[func.__name__]["error_normalized"] = "" + test_map[func.__name__]["start_dt"] = dt.datetime.utcnow() + ret = func_to_call(*args, **kwargs) + except (AssertionError, AzureError, CliTestError, CliExecutionError, SystemExit, + JMESPathCheckAssertionError) as e: + test_map[func.__name__]["end_dt"] = dt.datetime.utcnow() + test_map[func.__name__]["result"] = FAILED + test_map[func.__name__]["error_message"] = str(e).replace("\r\n", " ").replace("\n", " ")[:500] + test_map[func.__name__]["error_stack"] = traceback.format_exc().replace( + "\r\n", " ").replace("\n", " ")[:500] + logger.info("--------------------------------------") + logger.info("step exception: %s", e) + logger.error("--------------------------------------") + logger.error("step exception in %s: %s", func.__name__, e) + logger.info(traceback.format_exc()) + exceptions.append((func.__name__, sys.exc_info())) + else: + test_map[func.__name__]["end_dt"] = dt.datetime.utcnow() + return ret + + if inspect.isclass(func): + return get_func_to_call() + return wrapper + + +def calc_coverage(filename): + filename = filename.split(".")[0] + coverage_name = filename + "_coverage.md" + with open(coverage_name, "w") as f: + f.write("|Scenario|Result|ErrorMessage|ErrorStack|ErrorNormalized|StartDt|EndDt|\n") + total = len(test_map) + covered = 0 + for k, v in test_map.items(): + if not k.startswith("step_"): + total -= 1 + continue + if v["result"] == SUCCESSED: + covered += 1 + f.write("|{step_name}|{result}|{error_message}|{error_stack}|{error_normalized}|{start_dt}|" + "{end_dt}|\n".format(step_name=k, **v)) + f.write("Coverage: {}/{}\n".format(covered, total)) + print("Create coverage\n", file=sys.stderr) + + +def raise_if(): + if exceptions: + if len(exceptions) <= 1: + raise exceptions[0][1][1] + message = "{}\nFollowed with exceptions in other steps:\n".format(str(exceptions[0][1][1])) + message += "\n".join(["{}: {}".format(h[0], h[1][1]) for h in exceptions[1:]]) + raise exceptions[0][1][0](message).with_traceback(exceptions[0][1][2]) diff --git a/src/adp/azext_adp/tests/latest/__init__.py b/src/adp/azext_adp/tests/latest/__init__.py new file mode 100644 index 00000000000..c9cfdc73e77 --- /dev/null +++ b/src/adp/azext_adp/tests/latest/__init__.py @@ -0,0 +1,12 @@ +# 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. +# -------------------------------------------------------------------------- + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/adp/azext_adp/tests/latest/test_adp_scenario.py b/src/adp/azext_adp/tests/latest/test_adp_scenario.py new file mode 100644 index 00000000000..e6c2a5d435e --- /dev/null +++ b/src/adp/azext_adp/tests/latest/test_adp_scenario.py @@ -0,0 +1,187 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +import os +from azure.cli.testsdk import ScenarioTest +from .. import try_manual, raise_if, calc_coverage +from azure.cli.testsdk import ResourceGroupPreparer + + +TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..')) + + +# Env setup +@try_manual +def setup(test, rg): + pass + + +# EXAMPLE: /Accounts/put/Put account +@try_manual +def step__accounts_put_put_account(test, rg): + test.cmd('az adp account create ' + '--name "{myAccount}" ' + '--location "Global" ' + '--resource-group "{rg}"', + checks=[ + test.check("location", "Global", case_sensitive=False), + ]) + test.cmd('az adp account wait --created ' + '--name "{myAccount}" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: /Accounts/get/Get account +@try_manual +def step__accounts_get_get_account(test, rg): + test.cmd('az adp account show ' + '--name "{myAccount}" ' + '--resource-group "{rg}"', + checks=[ + test.check("location", "Global", case_sensitive=False), + ]) + + +# EXAMPLE: /Accounts/get/List accounts +@try_manual +def step__accounts_get_list_accounts(test, rg): + test.cmd('az adp account list ' + '-g ""', + checks=[ + test.check('length(@)', 1), + ]) + + +# EXAMPLE: /Accounts/get/List accounts by resource group +@try_manual +def step__accounts_get_list_accounts_by_resource_group(test, rg): + test.cmd('az adp account list ' + '--resource-group "{rg}"', + checks=[ + test.check('length(@)', 1), + ]) + + +# EXAMPLE: /Accounts/patch/Patch account +@try_manual +def step__accounts_patch_patch_account(test, rg): + test.cmd('az adp account update ' + '--name "{myAccount}" ' + '--resource-group "{rg}"', + checks=[ + test.check("location", "Global", case_sensitive=False), + ]) + + +# EXAMPLE: /DataPools/put/Put Data Pool +@try_manual +def step__datapools_put_put_data_pool(test, rg): + test.cmd('az adp data-pool create ' + '--account-name "{myAccount}" ' + '--name "{myDataPool}" ' + '--locations name="westus" ' + '--resource-group "{rg}"', + checks=[]) + test.cmd('az adp data-pool wait --created ' + '--name "{myDataPool}" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: /DataPools/get/Get Data Pool +@try_manual +def step__datapools_get_get_data_pool(test, rg): + test.cmd('az adp data-pool show ' + '--account-name "{myAccount}" ' + '--name "{myDataPool}" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: /DataPools/get/List Data Pools +@try_manual +def step__datapools_get_list_data_pools(test, rg): + test.cmd('az adp data-pool list ' + '--account-name "{myAccount}" ' + '--resource-group "{rg}"', + checks=[ + test.check('length(@)', 1), + ]) + + +# EXAMPLE: /DataPools/patch/Patch Data Pool +@try_manual +def step__datapools_patch_patch_data_pool(test, rg): + test.cmd('az adp data-pool update ' + '--account-name "{myAccount}" ' + '--name "{myDataPool}" ' + '--locations name="westus" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: /DataPools/delete/Delete Data Pool +@try_manual +def step__datapools_delete_delete_data_pool(test, rg): + test.cmd('az adp data-pool delete -y ' + '--account-name "{myAccount}" ' + '--name "{myDataPool}" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: /Accounts/delete/Delete account +@try_manual +def step__accounts_delete_delete_account(test, rg): + test.cmd('az adp account delete -y ' + '--name "{myAccount}" ' + '--resource-group "{rg}"', + checks=[]) + + +# Env cleanup +@try_manual +def cleanup(test, rg): + pass + + +# Testcase +@try_manual +def call_scenario(test, rg): + setup(test, rg) + step__accounts_put_put_account(test, rg) + step__accounts_get_get_account(test, rg) + step__accounts_get_list_accounts(test, rg) + step__accounts_get_list_accounts_by_resource_group(test, rg) + step__accounts_patch_patch_account(test, rg) + step__datapools_put_put_data_pool(test, rg) + step__datapools_get_get_data_pool(test, rg) + step__datapools_get_list_data_pools(test, rg) + step__datapools_patch_patch_data_pool(test, rg) + step__datapools_delete_delete_data_pool(test, rg) + step__accounts_delete_delete_account(test, rg) + cleanup(test, rg) + + +@try_manual +class AdpManagementClientScenarioTest(ScenarioTest): + + @ResourceGroupPreparer(name_prefix='clitestadp_adpClient'[:7], key='rg', parameter_name='rg') + def test_adp(self, rg): + + self.kwargs.update({ + 'myAccount': 'sampleacct', + 'myDataPool': 'sampledp', + }) + + call_scenario(self, rg) + calc_coverage(__file__) + raise_if() diff --git a/src/adp/azext_adp/vendored_sdks/__init__.py b/src/adp/azext_adp/vendored_sdks/__init__.py new file mode 100644 index 00000000000..c9cfdc73e77 --- /dev/null +++ b/src/adp/azext_adp/vendored_sdks/__init__.py @@ -0,0 +1,12 @@ +# 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. +# -------------------------------------------------------------------------- + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/adp/azext_adp/vendored_sdks/adp/__init__.py b/src/adp/azext_adp/vendored_sdks/adp/__init__.py new file mode 100644 index 00000000000..06d58878140 --- /dev/null +++ b/src/adp/azext_adp/vendored_sdks/adp/__init__.py @@ -0,0 +1,16 @@ +# 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 ._adp_management_client import AdpManagementClient +__all__ = ['AdpManagementClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/src/adp/azext_adp/vendored_sdks/adp/_adp_management_client.py b/src/adp/azext_adp/vendored_sdks/adp/_adp_management_client.py new file mode 100644 index 00000000000..15efc378888 --- /dev/null +++ b/src/adp/azext_adp/vendored_sdks/adp/_adp_management_client.py @@ -0,0 +1,79 @@ +# 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 TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + +from ._configuration import AdpManagementClientConfiguration +from .operations import OperationOperations +from .operations import AccountOperations +from .operations import DataPoolOperations +from . import models + + +class AdpManagementClient(object): + """Microsoft Autonomous Development Platform. + + :ivar operation: OperationOperations operations + :vartype operation: azure.mgmt.adp.v2020_07_01_preview.operations.OperationOperations + :ivar account: AccountOperations operations + :vartype account: azure.mgmt.adp.v2020_07_01_preview.operations.AccountOperations + :ivar data_pool: DataPoolOperations operations + :vartype data_pool: azure.mgmt.adp.v2020_07_01_preview.operations.DataPoolOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = AdpManagementClientConfiguration(credential, 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.operation = OperationOperations( + self._client, self._config, self._serialize, self._deserialize) + self.account = AccountOperations( + self._client, self._config, self._serialize, self._deserialize) + self.data_pool = DataPoolOperations( + self._client, self._config, self._serialize, self._deserialize) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> AdpManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/src/adp/azext_adp/vendored_sdks/adp/_configuration.py b/src/adp/azext_adp/vendored_sdks/adp/_configuration.py new file mode 100644 index 00000000000..6899cf029a2 --- /dev/null +++ b/src/adp/azext_adp/vendored_sdks/adp/_configuration.py @@ -0,0 +1,70 @@ +# 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 TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + +VERSION = "unknown" + +class AdpManagementClientConfiguration(Configuration): + """Configuration for AdpManagementClient. + + 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: The ID of the target subscription. + :type subscription_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + 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.") + super(AdpManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2020-07-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'adpmanagementclient/{}'.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 = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/adp/azext_adp/vendored_sdks/adp/aio/__init__.py b/src/adp/azext_adp/vendored_sdks/adp/aio/__init__.py new file mode 100644 index 00000000000..11d600c33dd --- /dev/null +++ b/src/adp/azext_adp/vendored_sdks/adp/aio/__init__.py @@ -0,0 +1,10 @@ +# 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 ._adp_management_client import AdpManagementClient +__all__ = ['AdpManagementClient'] diff --git a/src/adp/azext_adp/vendored_sdks/adp/aio/_adp_management_client.py b/src/adp/azext_adp/vendored_sdks/adp/aio/_adp_management_client.py new file mode 100644 index 00000000000..4d6ad917694 --- /dev/null +++ b/src/adp/azext_adp/vendored_sdks/adp/aio/_adp_management_client.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, Optional, TYPE_CHECKING + +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import AdpManagementClientConfiguration +from .operations import OperationOperations +from .operations import AccountOperations +from .operations import DataPoolOperations +from .. import models + + +class AdpManagementClient(object): + """Microsoft Autonomous Development Platform. + + :ivar operation: OperationOperations operations + :vartype operation: azure.mgmt.adp.v2020_07_01_preview.aio.operations.OperationOperations + :ivar account: AccountOperations operations + :vartype account: azure.mgmt.adp.v2020_07_01_preview.aio.operations.AccountOperations + :ivar data_pool: DataPoolOperations operations + :vartype data_pool: azure.mgmt.adp.v2020_07_01_preview.aio.operations.DataPoolOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param str base_url: Service URL + :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: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = AdpManagementClientConfiguration(credential, 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.operation = OperationOperations( + self._client, self._config, self._serialize, self._deserialize) + self.account = AccountOperations( + self._client, self._config, self._serialize, self._deserialize) + self.data_pool = DataPoolOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "AdpManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/src/adp/azext_adp/vendored_sdks/adp/aio/_configuration.py b/src/adp/azext_adp/vendored_sdks/adp/aio/_configuration.py new file mode 100644 index 00000000000..47cc6c46638 --- /dev/null +++ b/src/adp/azext_adp/vendored_sdks/adp/aio/_configuration.py @@ -0,0 +1,66 @@ +# 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 + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +VERSION = "unknown" + +class AdpManagementClientConfiguration(Configuration): + """Configuration for AdpManagementClient. + + 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: The ID of the target subscription. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + 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.") + super(AdpManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2020-07-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'adpmanagementclient/{}'.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 = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/adp/azext_adp/vendored_sdks/adp/aio/operations/__init__.py b/src/adp/azext_adp/vendored_sdks/adp/aio/operations/__init__.py new file mode 100644 index 00000000000..779fc024a98 --- /dev/null +++ b/src/adp/azext_adp/vendored_sdks/adp/aio/operations/__init__.py @@ -0,0 +1,17 @@ +# 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 ._operation_operations import OperationOperations +from ._account_operations import AccountOperations +from ._data_pool_operations import DataPoolOperations + +__all__ = [ + 'OperationOperations', + 'AccountOperations', + 'DataPoolOperations', +] diff --git a/src/adp/azext_adp/vendored_sdks/adp/aio/operations/_account_operations.py b/src/adp/azext_adp/vendored_sdks/adp/aio/operations/_account_operations.py new file mode 100644 index 00000000000..5d18fe1b2b7 --- /dev/null +++ b/src/adp/azext_adp/vendored_sdks/adp/aio/operations/_account_operations.py @@ -0,0 +1,623 @@ +# 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, Generic, Optional, TypeVar, Union +import warnings + +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, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AccountOperations: + """AccountOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.adp.v2020_07_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs + ) -> AsyncIterable["models.AccountList"]: + """List all ADP accounts available under the subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AccountList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.adp.v2020_07_01_preview.models.AccountList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AccountList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('AccountList', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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.AutonomousDevelopmentPlatform/accounts'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["models.AccountList"]: + """List all ADP accounts available under the resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AccountList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.adp.v2020_07_01_preview.models.AccountList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AccountList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('AccountList', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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.AutonomousDevelopmentPlatform/accounts'} # type: ignore + + async def get( + self, + resource_group_name: str, + account_name: str, + **kwargs + ) -> "models.Account": + """Gets the properties of an ADP account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the ADP account. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Account, or the result of cls(response) + :rtype: ~azure.mgmt.adp.v2020_07_01_preview.models.Account + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Account"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Account', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AutonomousDevelopmentPlatform/accounts/{accountName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + account_name: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ) -> "models.Account": + cls = kwargs.pop('cls', None) # type: ClsType["models.Account"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + parameters = models.AccountPatch(tags=tags) + api_version = "2020-07-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if parameters is not None: + body_content = self._serialize.body(parameters, 'AccountPatch') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Account', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Account', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AutonomousDevelopmentPlatform/accounts/{accountName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + account_name: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ) -> AsyncLROPoller["models.Account"]: + """Updates the properties of an existing ADP account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the ADP account. + :type account_name: str + :param tags: Resource tags. + :type tags: dict[str, 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: True for ARMPolling, False for no polling, or a + polling object for 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 Account or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.adp.v2020_07_01_preview.models.Account] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Account"] + 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( + resource_group_name=resource_group_name, + account_name=account_name, + tags=tags, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Account', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AutonomousDevelopmentPlatform/accounts/{accountName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + account_name: str, + tags: Optional[Dict[str, str]] = None, + location: Optional[str] = None, + **kwargs + ) -> "models.Account": + cls = kwargs.pop('cls', None) # type: ClsType["models.Account"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + parameters = models.Account(tags=tags, location=location) + api_version = "2020-07-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if parameters is not None: + body_content = self._serialize.body(parameters, 'Account') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Account', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Account', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AutonomousDevelopmentPlatform/accounts/{accountName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + tags: Optional[Dict[str, str]] = None, + location: Optional[str] = None, + **kwargs + ) -> AsyncLROPoller["models.Account"]: + """Creates or updates an ADP account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the ADP account. + :type account_name: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param location: The geo-location where the resource lives. + :type location: 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: True for ARMPolling, False for no polling, or a + polling object for 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 Account or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.adp.v2020_07_01_preview.models.Account] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Account"] + 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_or_update_initial( + resource_group_name=resource_group_name, + account_name=account_name, + tags=tags, + location=location, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Account', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AutonomousDevelopmentPlatform/accounts/{accountName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + account_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AutonomousDevelopmentPlatform/accounts/{accountName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + account_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes an ADP account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the ADP 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: True for ARMPolling, False for no polling, or a + polling object for 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + 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( + resource_group_name=resource_group_name, + account_name=account_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AutonomousDevelopmentPlatform/accounts/{accountName}'} # type: ignore diff --git a/src/adp/azext_adp/vendored_sdks/adp/aio/operations/_data_pool_operations.py b/src/adp/azext_adp/vendored_sdks/adp/aio/operations/_data_pool_operations.py new file mode 100644 index 00000000000..0d10f08aaa8 --- /dev/null +++ b/src/adp/azext_adp/vendored_sdks/adp/aio/operations/_data_pool_operations.py @@ -0,0 +1,582 @@ +# 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, Generic, List, Optional, TypeVar, Union +import warnings + +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, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DataPoolOperations: + """DataPoolOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.adp.v2020_07_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name: str, + account_name: str, + **kwargs + ) -> AsyncIterable["models.DataPoolList"]: + """Lists the data pools under the ADP account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the ADP 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 DataPoolList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.adp.v2020_07_01_preview.models.DataPoolList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DataPoolList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DataPoolList', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AutonomousDevelopmentPlatform/accounts/{accountName}/dataPools'} # type: ignore + + async def get( + self, + resource_group_name: str, + account_name: str, + data_pool_name: str, + **kwargs + ) -> "models.DataPool": + """Gets the properties of a Data Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the ADP account. + :type account_name: str + :param data_pool_name: The name of the Data Pool. + :type data_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataPool, or the result of cls(response) + :rtype: ~azure.mgmt.adp.v2020_07_01_preview.models.DataPool + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DataPool"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'dataPoolName': self._serialize.url("data_pool_name", data_pool_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AutonomousDevelopmentPlatform/accounts/{accountName}/dataPools/{dataPoolName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + account_name: str, + data_pool_name: str, + locations: Optional[List["models.DataPoolLocation"]] = None, + **kwargs + ) -> "models.DataPool": + cls = kwargs.pop('cls', None) # type: ClsType["models.DataPool"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + parameters = models.DataPoolPatch(locations=locations) + api_version = "2020-07-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'dataPoolName': self._serialize.url("data_pool_name", data_pool_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if parameters is not None: + body_content = self._serialize.body(parameters, 'DataPoolPatch') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DataPool', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DataPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AutonomousDevelopmentPlatform/accounts/{accountName}/dataPools/{dataPoolName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + account_name: str, + data_pool_name: str, + locations: Optional[List["models.DataPoolLocation"]] = None, + **kwargs + ) -> AsyncLROPoller["models.DataPool"]: + """Updates the properties of an existing Data Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the ADP account. + :type account_name: str + :param data_pool_name: The name of the Data Pool. + :type data_pool_name: str + :param locations: Gets or sets the collection of locations where Data Pool resources should be + created. + :type locations: list[~azure.mgmt.adp.v2020_07_01_preview.models.DataPoolLocation] + :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: True for ARMPolling, False for no polling, or a + polling object for 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 DataPool or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.adp.v2020_07_01_preview.models.DataPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.DataPool"] + 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( + resource_group_name=resource_group_name, + account_name=account_name, + data_pool_name=data_pool_name, + locations=locations, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DataPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'dataPoolName': self._serialize.url("data_pool_name", data_pool_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AutonomousDevelopmentPlatform/accounts/{accountName}/dataPools/{dataPoolName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + account_name: str, + data_pool_name: str, + locations: Optional[List["models.DataPoolLocation"]] = None, + **kwargs + ) -> "models.DataPool": + cls = kwargs.pop('cls', None) # type: ClsType["models.DataPool"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + parameters = models.DataPool(locations=locations) + api_version = "2020-07-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'dataPoolName': self._serialize.url("data_pool_name", data_pool_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if parameters is not None: + body_content = self._serialize.body(parameters, 'DataPool') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DataPool', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DataPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AutonomousDevelopmentPlatform/accounts/{accountName}/dataPools/{dataPoolName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + data_pool_name: str, + locations: Optional[List["models.DataPoolLocation"]] = None, + **kwargs + ) -> AsyncLROPoller["models.DataPool"]: + """Creates or updates a Data Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the ADP account. + :type account_name: str + :param data_pool_name: The name of the Data Pool. + :type data_pool_name: str + :param locations: Gets or sets the collection of locations where Data Pool resources should be + created. + :type locations: list[~azure.mgmt.adp.v2020_07_01_preview.models.DataPoolLocation] + :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: True for ARMPolling, False for no polling, or a + polling object for 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 DataPool or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.adp.v2020_07_01_preview.models.DataPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.DataPool"] + 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_or_update_initial( + resource_group_name=resource_group_name, + account_name=account_name, + data_pool_name=data_pool_name, + locations=locations, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DataPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'dataPoolName': self._serialize.url("data_pool_name", data_pool_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AutonomousDevelopmentPlatform/accounts/{accountName}/dataPools/{dataPoolName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + account_name: str, + data_pool_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'dataPoolName': self._serialize.url("data_pool_name", data_pool_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AutonomousDevelopmentPlatform/accounts/{accountName}/dataPools/{dataPoolName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + account_name: str, + data_pool_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes a Data Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the ADP account. + :type account_name: str + :param data_pool_name: The name of the Data Pool. + :type data_pool_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: True for ARMPolling, False for no polling, or a + polling object for 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + 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( + resource_group_name=resource_group_name, + account_name=account_name, + data_pool_name=data_pool_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'dataPoolName': self._serialize.url("data_pool_name", data_pool_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AutonomousDevelopmentPlatform/accounts/{accountName}/dataPools/{dataPoolName}'} # type: ignore diff --git a/src/adp/azext_adp/vendored_sdks/adp/aio/operations/_operation_operations.py b/src/adp/azext_adp/vendored_sdks/adp/aio/operations/_operation_operations.py new file mode 100644 index 00000000000..8fea7ea0caa --- /dev/null +++ b/src/adp/azext_adp/vendored_sdks/adp/aio/operations/_operation_operations.py @@ -0,0 +1,105 @@ +# 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, Generic, Optional, TypeVar +import warnings + +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, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class OperationOperations: + """OperationOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.adp.v2020_07_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs + ) -> AsyncIterable["models.OperationListResult"]: + """Lists all of the available Autonomous Development Platform provider operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.adp.v2020_07_01_preview.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.AutonomousDevelopmentPlatform/operations'} # type: ignore diff --git a/src/adp/azext_adp/vendored_sdks/adp/models/__init__.py b/src/adp/azext_adp/vendored_sdks/adp/models/__init__.py new file mode 100644 index 00000000000..09019f52c7a --- /dev/null +++ b/src/adp/azext_adp/vendored_sdks/adp/models/__init__.py @@ -0,0 +1,86 @@ +# 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. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import Account + from ._models_py3 import AccountList + from ._models_py3 import AccountPatch + from ._models_py3 import DataPool + from ._models_py3 import DataPoolBaseProperties + from ._models_py3 import DataPoolList + from ._models_py3 import DataPoolLocation + from ._models_py3 import DataPoolPatch + from ._models_py3 import DataPoolProperties + from ._models_py3 import ErrorDefinition + from ._models_py3 import ErrorResponse + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationListResult + from ._models_py3 import OperationLogSpecification + from ._models_py3 import OperationMetricAvailability + from ._models_py3 import OperationMetricSpecification + from ._models_py3 import OperationServiceSpecification + from ._models_py3 import Resource + from ._models_py3 import SystemData + from ._models_py3 import Tags + from ._models_py3 import TrackedResource +except (SyntaxError, ImportError): + from ._models import Account # type: ignore + from ._models import AccountList # type: ignore + from ._models import AccountPatch # type: ignore + from ._models import DataPool # type: ignore + from ._models import DataPoolBaseProperties # type: ignore + from ._models import DataPoolList # type: ignore + from ._models import DataPoolLocation # type: ignore + from ._models import DataPoolPatch # type: ignore + from ._models import DataPoolProperties # type: ignore + from ._models import ErrorDefinition # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import Operation # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationListResult # type: ignore + from ._models import OperationLogSpecification # type: ignore + from ._models import OperationMetricAvailability # type: ignore + from ._models import OperationMetricSpecification # type: ignore + from ._models import OperationServiceSpecification # type: ignore + from ._models import Resource # type: ignore + from ._models import SystemData # type: ignore + from ._models import Tags # type: ignore + from ._models import TrackedResource # type: ignore + +from ._adp_management_client_enums import ( + CreatedByType, + ProvisioningState, +) + +__all__ = [ + 'Account', + 'AccountList', + 'AccountPatch', + 'DataPool', + 'DataPoolBaseProperties', + 'DataPoolList', + 'DataPoolLocation', + 'DataPoolPatch', + 'DataPoolProperties', + 'ErrorDefinition', + 'ErrorResponse', + 'Operation', + 'OperationDisplay', + 'OperationListResult', + 'OperationLogSpecification', + 'OperationMetricAvailability', + 'OperationMetricSpecification', + 'OperationServiceSpecification', + 'Resource', + 'SystemData', + 'Tags', + 'TrackedResource', + 'CreatedByType', + 'ProvisioningState', +] diff --git a/src/adp/azext_adp/vendored_sdks/adp/models/_adp_management_client_enums.py b/src/adp/azext_adp/vendored_sdks/adp/models/_adp_management_client_enums.py new file mode 100644 index 00000000000..f625d603ada --- /dev/null +++ b/src/adp/azext_adp/vendored_sdks/adp/models/_adp_management_client_enums.py @@ -0,0 +1,47 @@ +# 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, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Gets the status of the account at the time the operation was called. + """ + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + ACCEPTED = "Accepted" + PROVISIONING = "Provisioning" + DELETING = "Deleting" diff --git a/src/adp/azext_adp/vendored_sdks/adp/models/_models.py b/src/adp/azext_adp/vendored_sdks/adp/models/_models.py new file mode 100644 index 00000000000..bff614b66ec --- /dev/null +++ b/src/adp/azext_adp/vendored_sdks/adp/models/_models.py @@ -0,0 +1,784 @@ +# 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 azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class Resource(msrest.serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :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(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. + + 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 id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.location = kwargs['location'] + + +class Account(TrackedResource): + """An ADP account. + + 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 id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.adp.v2020_07_01_preview.models.SystemData + :ivar account_id: The account's data-plane ID. + :vartype account_id: str + :ivar provisioning_state: Gets the status of the account at the time the operation was called. + Possible values include: "Succeeded", "Failed", "Canceled", "Accepted", "Provisioning", + "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.adp.v2020_07_01_preview.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'system_data': {'readonly': True}, + 'account_id': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'account_id': {'key': 'properties.accountId', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Account, self).__init__(**kwargs) + self.system_data = None + self.account_id = None + self.provisioning_state = None + + +class AccountList(msrest.serialization.Model): + """The list operation response, that contains the data pools and their properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of accounts and their properties. + :vartype value: list[~azure.mgmt.adp.v2020_07_01_preview.models.Account] + :param next_link: URL to get the next set of operation list results if there are any. + :type next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Account]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AccountList, self).__init__(**kwargs) + self.value = None + self.next_link = kwargs.get('next_link', None) + + +class Tags(msrest.serialization.Model): + """Resource tags. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(Tags, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + + +class AccountPatch(Tags): + """An ADP account. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :ivar account_id: The account's data-plane ID. + :vartype account_id: str + :ivar provisioning_state: Gets the status of the account at the time the operation was called. + Possible values include: "Succeeded", "Failed", "Canceled", "Accepted", "Provisioning", + "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.adp.v2020_07_01_preview.models.ProvisioningState + """ + + _validation = { + 'account_id': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'account_id': {'key': 'properties.accountId', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AccountPatch, self).__init__(**kwargs) + self.account_id = None + self.provisioning_state = None + + +class DataPool(Resource): + """An ADP Data Pool. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar data_pool_id: The Data Pool's data-plane ID. + :vartype data_pool_id: str + :ivar provisioning_state: Gets the status of the data pool at the time the operation was + called. Possible values include: "Succeeded", "Failed", "Canceled", "Accepted", "Provisioning", + "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.adp.v2020_07_01_preview.models.ProvisioningState + :param locations: Gets or sets the collection of locations where Data Pool resources should be + created. + :type locations: list[~azure.mgmt.adp.v2020_07_01_preview.models.DataPoolLocation] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'data_pool_id': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'locations': {'min_items': 1}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'data_pool_id': {'key': 'properties.dataPoolId', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'locations': {'key': 'properties.locations', 'type': '[DataPoolLocation]'}, + } + + def __init__( + self, + **kwargs + ): + super(DataPool, self).__init__(**kwargs) + self.data_pool_id = None + self.provisioning_state = None + self.locations = kwargs.get('locations', None) + + +class DataPoolBaseProperties(msrest.serialization.Model): + """Data Pool properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar data_pool_id: The Data Pool's data-plane ID. + :vartype data_pool_id: str + :ivar provisioning_state: Gets the status of the data pool at the time the operation was + called. Possible values include: "Succeeded", "Failed", "Canceled", "Accepted", "Provisioning", + "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.adp.v2020_07_01_preview.models.ProvisioningState + :param locations: Gets or sets the collection of locations where Data Pool resources should be + created. + :type locations: list[~azure.mgmt.adp.v2020_07_01_preview.models.DataPoolLocation] + """ + + _validation = { + 'data_pool_id': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'locations': {'min_items': 1}, + } + + _attribute_map = { + 'data_pool_id': {'key': 'dataPoolId', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'locations': {'key': 'locations', 'type': '[DataPoolLocation]'}, + } + + def __init__( + self, + **kwargs + ): + super(DataPoolBaseProperties, self).__init__(**kwargs) + self.data_pool_id = None + self.provisioning_state = None + self.locations = kwargs.get('locations', None) + + +class DataPoolList(msrest.serialization.Model): + """The list operation response, that contains the data pools and their properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of data pools and their properties. + :vartype value: list[~azure.mgmt.adp.v2020_07_01_preview.models.DataPool] + :param next_link: URL to get the next set of operation list results if there are any. + :type next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DataPool]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DataPoolList, self).__init__(**kwargs) + self.value = None + self.next_link = kwargs.get('next_link', None) + + +class DataPoolLocation(msrest.serialization.Model): + """Location of a Data Pool. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The location name. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DataPoolLocation, self).__init__(**kwargs) + self.name = kwargs['name'] + + +class DataPoolPatch(Resource): + """An ADP Data Pool. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar data_pool_id: The Data Pool's data-plane ID. + :vartype data_pool_id: str + :ivar provisioning_state: Gets the status of the data pool at the time the operation was + called. Possible values include: "Succeeded", "Failed", "Canceled", "Accepted", "Provisioning", + "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.adp.v2020_07_01_preview.models.ProvisioningState + :param locations: Gets or sets the collection of locations where Data Pool resources should be + created. + :type locations: list[~azure.mgmt.adp.v2020_07_01_preview.models.DataPoolLocation] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'data_pool_id': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'locations': {'min_items': 1}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'data_pool_id': {'key': 'properties.dataPoolId', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'locations': {'key': 'properties.locations', 'type': '[DataPoolLocation]'}, + } + + def __init__( + self, + **kwargs + ): + super(DataPoolPatch, self).__init__(**kwargs) + self.data_pool_id = None + self.provisioning_state = None + self.locations = kwargs.get('locations', None) + + +class DataPoolProperties(DataPoolBaseProperties): + """Data Pool properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar data_pool_id: The Data Pool's data-plane ID. + :vartype data_pool_id: str + :ivar provisioning_state: Gets the status of the data pool at the time the operation was + called. Possible values include: "Succeeded", "Failed", "Canceled", "Accepted", "Provisioning", + "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.adp.v2020_07_01_preview.models.ProvisioningState + :param locations: Gets or sets the collection of locations where Data Pool resources should be + created. + :type locations: list[~azure.mgmt.adp.v2020_07_01_preview.models.DataPoolLocation] + """ + + _validation = { + 'data_pool_id': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'locations': {'min_items': 1}, + } + + _attribute_map = { + 'data_pool_id': {'key': 'dataPoolId', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'locations': {'key': 'locations', 'type': '[DataPoolLocation]'}, + } + + def __init__( + self, + **kwargs + ): + super(DataPoolProperties, self).__init__(**kwargs) + + +class ErrorDefinition(msrest.serialization.Model): + """Error definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Service specific error code which serves as the substatus for the HTTP error code. + :vartype code: str + :ivar message: Description of the error. + :vartype message: str + :ivar details: Internal error details. + :vartype details: list[~azure.mgmt.adp.v2020_07_01_preview.models.ErrorDefinition] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'details': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDefinition]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDefinition, self).__init__(**kwargs) + self.code = None + self.message = None + self.details = None + + +class ErrorResponse(msrest.serialization.Model): + """Error response. + + :param error: The error details. + :type error: ~azure.mgmt.adp.v2020_07_01_preview.models.ErrorDefinition + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDefinition'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class Operation(msrest.serialization.Model): + """Operation detail payload. + + :param name: Name of the operation. + :type name: str + :param is_data_action: Indicates whether the operation is a data action. + :type is_data_action: bool + :param display: Display of the operation. + :type display: ~azure.mgmt.adp.v2020_07_01_preview.models.OperationDisplay + :param origin: Origin of the operation. + :type origin: str + :param service_specification: Details about a service operation. + :type service_specification: + ~azure.mgmt.adp.v2020_07_01_preview.models.OperationServiceSpecification + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'OperationServiceSpecification'}, + } + + def __init__( + self, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.is_data_action = kwargs.get('is_data_action', None) + self.display = kwargs.get('display', None) + self.origin = kwargs.get('origin', None) + self.service_specification = kwargs.get('service_specification', None) + + +class OperationDisplay(msrest.serialization.Model): + """Operation display payload. + + :param provider: Resource provider of the operation. + :type provider: str + :param resource: Resource of the operation. + :type resource: str + :param operation: Localized friendly name for the operation. + :type operation: str + :param description: Localized friendly description for the operation. + :type description: str + """ + + _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 = kwargs.get('provider', None) + self.resource = kwargs.get('resource', None) + self.operation = kwargs.get('operation', None) + self.description = kwargs.get('description', None) + + +class OperationListResult(msrest.serialization.Model): + """Available operations of the service. + + :param value: List of operations supported by the Resource Provider. + :type value: list[~azure.mgmt.adp.v2020_07_01_preview.models.Operation] + :param next_link: URL to get the next set of operation list results if there are any. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class OperationLogSpecification(msrest.serialization.Model): + """Details about an operation related to logs. + + :param name: The name of the log category. + :type name: str + :param display_name: Localized display name. + :type display_name: str + :param blob_duration: Blobs created in the customer storage account, per hour. + :type 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, + **kwargs + ): + super(OperationLogSpecification, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display_name = kwargs.get('display_name', None) + self.blob_duration = kwargs.get('blob_duration', None) + + +class OperationMetricAvailability(msrest.serialization.Model): + """Defines how often data for a metric becomes available. + + :param time_grain: The granularity for the metric. + :type time_grain: str + :param blob_duration: Blob created in the customer storage account, per hour. + :type blob_duration: str + """ + + _attribute_map = { + 'time_grain': {'key': 'timeGrain', 'type': 'str'}, + 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationMetricAvailability, self).__init__(**kwargs) + self.time_grain = kwargs.get('time_grain', None) + self.blob_duration = kwargs.get('blob_duration', None) + + +class OperationMetricSpecification(msrest.serialization.Model): + """Details about an operation related to metrics. + + :param name: The name of the metric. + :type name: str + :param display_name: Localized display name of the metric. + :type display_name: str + :param display_description: The description of the metric. + :type display_description: str + :param unit: The unit that the metric is measured in. + :type unit: str + :param aggregation_type: The type of metric aggregation. + :type aggregation_type: str + :param enable_regional_mdm_account: Whether or not the service is using regional MDM accounts. + :type enable_regional_mdm_account: str + :param source_mdm_account: The name of the MDM account. + :type source_mdm_account: str + :param source_mdm_namespace: The name of the MDM namespace. + :type source_mdm_namespace: str + :param availabilities: Defines how often data for metrics becomes available. + :type availabilities: + list[~azure.mgmt.adp.v2020_07_01_preview.models.OperationMetricAvailability] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, + 'enable_regional_mdm_account': {'key': 'enableRegionalMdmAccount', 'type': 'str'}, + 'source_mdm_account': {'key': 'sourceMdmAccount', 'type': 'str'}, + 'source_mdm_namespace': {'key': 'sourceMdmNamespace', 'type': 'str'}, + 'availabilities': {'key': 'availabilities', 'type': '[OperationMetricAvailability]'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationMetricSpecification, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display_name = kwargs.get('display_name', None) + self.display_description = kwargs.get('display_description', None) + self.unit = kwargs.get('unit', None) + self.aggregation_type = kwargs.get('aggregation_type', None) + self.enable_regional_mdm_account = kwargs.get('enable_regional_mdm_account', None) + self.source_mdm_account = kwargs.get('source_mdm_account', None) + self.source_mdm_namespace = kwargs.get('source_mdm_namespace', None) + self.availabilities = kwargs.get('availabilities', None) + + +class OperationServiceSpecification(msrest.serialization.Model): + """Details about a service operation. + + :param log_specifications: Details about operations related to logs. + :type log_specifications: + list[~azure.mgmt.adp.v2020_07_01_preview.models.OperationLogSpecification] + :param metric_specifications: Details about operations related to metrics. + :type metric_specifications: + list[~azure.mgmt.adp.v2020_07_01_preview.models.OperationMetricSpecification] + """ + + _attribute_map = { + 'log_specifications': {'key': 'logSpecifications', 'type': '[OperationLogSpecification]'}, + 'metric_specifications': {'key': 'metricSpecifications', 'type': '[OperationMetricSpecification]'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationServiceSpecification, self).__init__(**kwargs) + self.log_specifications = kwargs.get('log_specifications', None) + self.metric_specifications = kwargs.get('metric_specifications', None) + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~azure.mgmt.adp.v2020_07_01_preview.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or ~azure.mgmt.adp.v2020_07_01_preview.models.CreatedByType + :param last_modified_at: The type of identity that last modified the resource. + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = kwargs.get('created_by', None) + self.created_by_type = kwargs.get('created_by_type', None) + self.created_at = kwargs.get('created_at', None) + self.last_modified_by = kwargs.get('last_modified_by', None) + self.last_modified_by_type = kwargs.get('last_modified_by_type', None) + self.last_modified_at = kwargs.get('last_modified_at', None) diff --git a/src/adp/azext_adp/vendored_sdks/adp/models/_models_py3.py b/src/adp/azext_adp/vendored_sdks/adp/models/_models_py3.py new file mode 100644 index 00000000000..7ba0061d76b --- /dev/null +++ b/src/adp/azext_adp/vendored_sdks/adp/models/_models_py3.py @@ -0,0 +1,856 @@ +# 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. +# -------------------------------------------------------------------------- + +import datetime +from typing import Dict, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._adp_management_client_enums import * + + +class Resource(msrest.serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :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(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. + + 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 id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.tags = tags + self.location = location + + +class Account(TrackedResource): + """An ADP account. + + 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 id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.adp.v2020_07_01_preview.models.SystemData + :ivar account_id: The account's data-plane ID. + :vartype account_id: str + :ivar provisioning_state: Gets the status of the account at the time the operation was called. + Possible values include: "Succeeded", "Failed", "Canceled", "Accepted", "Provisioning", + "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.adp.v2020_07_01_preview.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'system_data': {'readonly': True}, + 'account_id': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'account_id': {'key': 'properties.accountId', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(Account, self).__init__(tags=tags, location=location, **kwargs) + self.system_data = None + self.account_id = None + self.provisioning_state = None + + +class AccountList(msrest.serialization.Model): + """The list operation response, that contains the data pools and their properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of accounts and their properties. + :vartype value: list[~azure.mgmt.adp.v2020_07_01_preview.models.Account] + :param next_link: URL to get the next set of operation list results if there are any. + :type next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Account]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + **kwargs + ): + super(AccountList, self).__init__(**kwargs) + self.value = None + self.next_link = next_link + + +class Tags(msrest.serialization.Model): + """Resource tags. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(Tags, self).__init__(**kwargs) + self.tags = tags + + +class AccountPatch(Tags): + """An ADP account. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :ivar account_id: The account's data-plane ID. + :vartype account_id: str + :ivar provisioning_state: Gets the status of the account at the time the operation was called. + Possible values include: "Succeeded", "Failed", "Canceled", "Accepted", "Provisioning", + "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.adp.v2020_07_01_preview.models.ProvisioningState + """ + + _validation = { + 'account_id': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'account_id': {'key': 'properties.accountId', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(AccountPatch, self).__init__(tags=tags, **kwargs) + self.account_id = None + self.provisioning_state = None + + +class DataPool(Resource): + """An ADP Data Pool. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar data_pool_id: The Data Pool's data-plane ID. + :vartype data_pool_id: str + :ivar provisioning_state: Gets the status of the data pool at the time the operation was + called. Possible values include: "Succeeded", "Failed", "Canceled", "Accepted", "Provisioning", + "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.adp.v2020_07_01_preview.models.ProvisioningState + :param locations: Gets or sets the collection of locations where Data Pool resources should be + created. + :type locations: list[~azure.mgmt.adp.v2020_07_01_preview.models.DataPoolLocation] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'data_pool_id': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'locations': {'min_items': 1}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'data_pool_id': {'key': 'properties.dataPoolId', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'locations': {'key': 'properties.locations', 'type': '[DataPoolLocation]'}, + } + + def __init__( + self, + *, + locations: Optional[List["DataPoolLocation"]] = None, + **kwargs + ): + super(DataPool, self).__init__(**kwargs) + self.data_pool_id = None + self.provisioning_state = None + self.locations = locations + + +class DataPoolBaseProperties(msrest.serialization.Model): + """Data Pool properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar data_pool_id: The Data Pool's data-plane ID. + :vartype data_pool_id: str + :ivar provisioning_state: Gets the status of the data pool at the time the operation was + called. Possible values include: "Succeeded", "Failed", "Canceled", "Accepted", "Provisioning", + "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.adp.v2020_07_01_preview.models.ProvisioningState + :param locations: Gets or sets the collection of locations where Data Pool resources should be + created. + :type locations: list[~azure.mgmt.adp.v2020_07_01_preview.models.DataPoolLocation] + """ + + _validation = { + 'data_pool_id': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'locations': {'min_items': 1}, + } + + _attribute_map = { + 'data_pool_id': {'key': 'dataPoolId', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'locations': {'key': 'locations', 'type': '[DataPoolLocation]'}, + } + + def __init__( + self, + *, + locations: Optional[List["DataPoolLocation"]] = None, + **kwargs + ): + super(DataPoolBaseProperties, self).__init__(**kwargs) + self.data_pool_id = None + self.provisioning_state = None + self.locations = locations + + +class DataPoolList(msrest.serialization.Model): + """The list operation response, that contains the data pools and their properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of data pools and their properties. + :vartype value: list[~azure.mgmt.adp.v2020_07_01_preview.models.DataPool] + :param next_link: URL to get the next set of operation list results if there are any. + :type next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DataPool]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + **kwargs + ): + super(DataPoolList, self).__init__(**kwargs) + self.value = None + self.next_link = next_link + + +class DataPoolLocation(msrest.serialization.Model): + """Location of a Data Pool. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The location name. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + **kwargs + ): + super(DataPoolLocation, self).__init__(**kwargs) + self.name = name + + +class DataPoolPatch(Resource): + """An ADP Data Pool. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar data_pool_id: The Data Pool's data-plane ID. + :vartype data_pool_id: str + :ivar provisioning_state: Gets the status of the data pool at the time the operation was + called. Possible values include: "Succeeded", "Failed", "Canceled", "Accepted", "Provisioning", + "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.adp.v2020_07_01_preview.models.ProvisioningState + :param locations: Gets or sets the collection of locations where Data Pool resources should be + created. + :type locations: list[~azure.mgmt.adp.v2020_07_01_preview.models.DataPoolLocation] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'data_pool_id': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'locations': {'min_items': 1}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'data_pool_id': {'key': 'properties.dataPoolId', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'locations': {'key': 'properties.locations', 'type': '[DataPoolLocation]'}, + } + + def __init__( + self, + *, + locations: Optional[List["DataPoolLocation"]] = None, + **kwargs + ): + super(DataPoolPatch, self).__init__(**kwargs) + self.data_pool_id = None + self.provisioning_state = None + self.locations = locations + + +class DataPoolProperties(DataPoolBaseProperties): + """Data Pool properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar data_pool_id: The Data Pool's data-plane ID. + :vartype data_pool_id: str + :ivar provisioning_state: Gets the status of the data pool at the time the operation was + called. Possible values include: "Succeeded", "Failed", "Canceled", "Accepted", "Provisioning", + "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.adp.v2020_07_01_preview.models.ProvisioningState + :param locations: Gets or sets the collection of locations where Data Pool resources should be + created. + :type locations: list[~azure.mgmt.adp.v2020_07_01_preview.models.DataPoolLocation] + """ + + _validation = { + 'data_pool_id': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'locations': {'min_items': 1}, + } + + _attribute_map = { + 'data_pool_id': {'key': 'dataPoolId', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'locations': {'key': 'locations', 'type': '[DataPoolLocation]'}, + } + + def __init__( + self, + *, + locations: Optional[List["DataPoolLocation"]] = None, + **kwargs + ): + super(DataPoolProperties, self).__init__(locations=locations, **kwargs) + + +class ErrorDefinition(msrest.serialization.Model): + """Error definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Service specific error code which serves as the substatus for the HTTP error code. + :vartype code: str + :ivar message: Description of the error. + :vartype message: str + :ivar details: Internal error details. + :vartype details: list[~azure.mgmt.adp.v2020_07_01_preview.models.ErrorDefinition] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'details': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDefinition]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDefinition, self).__init__(**kwargs) + self.code = None + self.message = None + self.details = None + + +class ErrorResponse(msrest.serialization.Model): + """Error response. + + :param error: The error details. + :type error: ~azure.mgmt.adp.v2020_07_01_preview.models.ErrorDefinition + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDefinition'}, + } + + def __init__( + self, + *, + error: Optional["ErrorDefinition"] = None, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class Operation(msrest.serialization.Model): + """Operation detail payload. + + :param name: Name of the operation. + :type name: str + :param is_data_action: Indicates whether the operation is a data action. + :type is_data_action: bool + :param display: Display of the operation. + :type display: ~azure.mgmt.adp.v2020_07_01_preview.models.OperationDisplay + :param origin: Origin of the operation. + :type origin: str + :param service_specification: Details about a service operation. + :type service_specification: + ~azure.mgmt.adp.v2020_07_01_preview.models.OperationServiceSpecification + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'OperationServiceSpecification'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + is_data_action: Optional[bool] = None, + display: Optional["OperationDisplay"] = None, + origin: Optional[str] = None, + service_specification: Optional["OperationServiceSpecification"] = None, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = name + self.is_data_action = is_data_action + self.display = display + self.origin = origin + self.service_specification = service_specification + + +class OperationDisplay(msrest.serialization.Model): + """Operation display payload. + + :param provider: Resource provider of the operation. + :type provider: str + :param resource: Resource of the operation. + :type resource: str + :param operation: Localized friendly name for the operation. + :type operation: str + :param description: Localized friendly description for the operation. + :type description: str + """ + + _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, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class OperationListResult(msrest.serialization.Model): + """Available operations of the service. + + :param value: List of operations supported by the Resource Provider. + :type value: list[~azure.mgmt.adp.v2020_07_01_preview.models.Operation] + :param next_link: URL to get the next set of operation list results if there are any. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Operation"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class OperationLogSpecification(msrest.serialization.Model): + """Details about an operation related to logs. + + :param name: The name of the log category. + :type name: str + :param display_name: Localized display name. + :type display_name: str + :param blob_duration: Blobs created in the customer storage account, per hour. + :type 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 + ): + super(OperationLogSpecification, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.blob_duration = blob_duration + + +class OperationMetricAvailability(msrest.serialization.Model): + """Defines how often data for a metric becomes available. + + :param time_grain: The granularity for the metric. + :type time_grain: str + :param blob_duration: Blob created in the customer storage account, per hour. + :type 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 + ): + super(OperationMetricAvailability, self).__init__(**kwargs) + self.time_grain = time_grain + self.blob_duration = blob_duration + + +class OperationMetricSpecification(msrest.serialization.Model): + """Details about an operation related to metrics. + + :param name: The name of the metric. + :type name: str + :param display_name: Localized display name of the metric. + :type display_name: str + :param display_description: The description of the metric. + :type display_description: str + :param unit: The unit that the metric is measured in. + :type unit: str + :param aggregation_type: The type of metric aggregation. + :type aggregation_type: str + :param enable_regional_mdm_account: Whether or not the service is using regional MDM accounts. + :type enable_regional_mdm_account: str + :param source_mdm_account: The name of the MDM account. + :type source_mdm_account: str + :param source_mdm_namespace: The name of the MDM namespace. + :type source_mdm_namespace: str + :param availabilities: Defines how often data for metrics becomes available. + :type availabilities: + list[~azure.mgmt.adp.v2020_07_01_preview.models.OperationMetricAvailability] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, + 'enable_regional_mdm_account': {'key': 'enableRegionalMdmAccount', 'type': 'str'}, + 'source_mdm_account': {'key': 'sourceMdmAccount', 'type': 'str'}, + 'source_mdm_namespace': {'key': 'sourceMdmNamespace', 'type': 'str'}, + 'availabilities': {'key': 'availabilities', 'type': '[OperationMetricAvailability]'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + display_description: Optional[str] = None, + unit: Optional[str] = None, + aggregation_type: Optional[str] = None, + enable_regional_mdm_account: Optional[str] = None, + source_mdm_account: Optional[str] = None, + source_mdm_namespace: Optional[str] = None, + availabilities: Optional[List["OperationMetricAvailability"]] = None, + **kwargs + ): + super(OperationMetricSpecification, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.display_description = display_description + self.unit = unit + self.aggregation_type = aggregation_type + self.enable_regional_mdm_account = enable_regional_mdm_account + self.source_mdm_account = source_mdm_account + self.source_mdm_namespace = source_mdm_namespace + self.availabilities = availabilities + + +class OperationServiceSpecification(msrest.serialization.Model): + """Details about a service operation. + + :param log_specifications: Details about operations related to logs. + :type log_specifications: + list[~azure.mgmt.adp.v2020_07_01_preview.models.OperationLogSpecification] + :param metric_specifications: Details about operations related to metrics. + :type metric_specifications: + list[~azure.mgmt.adp.v2020_07_01_preview.models.OperationMetricSpecification] + """ + + _attribute_map = { + 'log_specifications': {'key': 'logSpecifications', 'type': '[OperationLogSpecification]'}, + 'metric_specifications': {'key': 'metricSpecifications', 'type': '[OperationMetricSpecification]'}, + } + + def __init__( + self, + *, + log_specifications: Optional[List["OperationLogSpecification"]] = None, + metric_specifications: Optional[List["OperationMetricSpecification"]] = None, + **kwargs + ): + super(OperationServiceSpecification, self).__init__(**kwargs) + self.log_specifications = log_specifications + self.metric_specifications = metric_specifications + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~azure.mgmt.adp.v2020_07_01_preview.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or ~azure.mgmt.adp.v2020_07_01_preview.models.CreatedByType + :param last_modified_at: The type of identity that last modified the resource. + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at diff --git a/src/adp/azext_adp/vendored_sdks/adp/operations/__init__.py b/src/adp/azext_adp/vendored_sdks/adp/operations/__init__.py new file mode 100644 index 00000000000..779fc024a98 --- /dev/null +++ b/src/adp/azext_adp/vendored_sdks/adp/operations/__init__.py @@ -0,0 +1,17 @@ +# 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 ._operation_operations import OperationOperations +from ._account_operations import AccountOperations +from ._data_pool_operations import DataPoolOperations + +__all__ = [ + 'OperationOperations', + 'AccountOperations', + 'DataPoolOperations', +] diff --git a/src/adp/azext_adp/vendored_sdks/adp/operations/_account_operations.py b/src/adp/azext_adp/vendored_sdks/adp/operations/_account_operations.py new file mode 100644 index 00000000000..77a2eabea02 --- /dev/null +++ b/src/adp/azext_adp/vendored_sdks/adp/operations/_account_operations.py @@ -0,0 +1,636 @@ +# 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 TYPE_CHECKING +import warnings + +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 HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class AccountOperations(object): + """AccountOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.adp.v2020_07_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.AccountList"] + """List all ADP accounts available under the subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AccountList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.adp.v2020_07_01_preview.models.AccountList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AccountList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('AccountList', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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.AutonomousDevelopmentPlatform/accounts'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.AccountList"] + """List all ADP accounts available under the resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AccountList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.adp.v2020_07_01_preview.models.AccountList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AccountList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('AccountList', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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.AutonomousDevelopmentPlatform/accounts'} # type: ignore + + def get( + self, + resource_group_name, # type: str + account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Account" + """Gets the properties of an ADP account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the ADP account. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Account, or the result of cls(response) + :rtype: ~azure.mgmt.adp.v2020_07_01_preview.models.Account + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Account"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Account', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AutonomousDevelopmentPlatform/accounts/{accountName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + account_name, # type: str + tags=None, # type: Optional[Dict[str, str]] + **kwargs # type: Any + ): + # type: (...) -> "models.Account" + cls = kwargs.pop('cls', None) # type: ClsType["models.Account"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + parameters = models.AccountPatch(tags=tags) + api_version = "2020-07-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if parameters is not None: + body_content = self._serialize.body(parameters, 'AccountPatch') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Account', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Account', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AutonomousDevelopmentPlatform/accounts/{accountName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + account_name, # type: str + tags=None, # type: Optional[Dict[str, str]] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.Account"] + """Updates the properties of an existing ADP account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the ADP account. + :type account_name: str + :param tags: Resource tags. + :type tags: dict[str, 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: True for ARMPolling, False for no polling, or a + polling object for 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 Account or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.adp.v2020_07_01_preview.models.Account] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Account"] + 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( + resource_group_name=resource_group_name, + account_name=account_name, + tags=tags, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Account', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AutonomousDevelopmentPlatform/accounts/{accountName}'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + account_name, # type: str + tags=None, # type: Optional[Dict[str, str]] + location=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.Account" + cls = kwargs.pop('cls', None) # type: ClsType["models.Account"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + parameters = models.Account(tags=tags, location=location) + api_version = "2020-07-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if parameters is not None: + body_content = self._serialize.body(parameters, 'Account') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Account', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Account', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AutonomousDevelopmentPlatform/accounts/{accountName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + account_name, # type: str + tags=None, # type: Optional[Dict[str, str]] + location=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.Account"] + """Creates or updates an ADP account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the ADP account. + :type account_name: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param location: The geo-location where the resource lives. + :type location: 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: True for ARMPolling, False for no polling, or a + polling object for 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 Account or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.adp.v2020_07_01_preview.models.Account] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Account"] + 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_or_update_initial( + resource_group_name=resource_group_name, + account_name=account_name, + tags=tags, + location=location, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Account', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AutonomousDevelopmentPlatform/accounts/{accountName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AutonomousDevelopmentPlatform/accounts/{accountName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes an ADP account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the ADP 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: True for ARMPolling, False for no polling, or a + polling object for 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + 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( + resource_group_name=resource_group_name, + account_name=account_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AutonomousDevelopmentPlatform/accounts/{accountName}'} # type: ignore diff --git a/src/adp/azext_adp/vendored_sdks/adp/operations/_data_pool_operations.py b/src/adp/azext_adp/vendored_sdks/adp/operations/_data_pool_operations.py new file mode 100644 index 00000000000..5832bb7eed0 --- /dev/null +++ b/src/adp/azext_adp/vendored_sdks/adp/operations/_data_pool_operations.py @@ -0,0 +1,594 @@ +# 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 TYPE_CHECKING +import warnings + +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 HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, List, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class DataPoolOperations(object): + """DataPoolOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.adp.v2020_07_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name, # type: str + account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DataPoolList"] + """Lists the data pools under the ADP account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the ADP 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 DataPoolList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.adp.v2020_07_01_preview.models.DataPoolList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DataPoolList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DataPoolList', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AutonomousDevelopmentPlatform/accounts/{accountName}/dataPools'} # type: ignore + + def get( + self, + resource_group_name, # type: str + account_name, # type: str + data_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DataPool" + """Gets the properties of a Data Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the ADP account. + :type account_name: str + :param data_pool_name: The name of the Data Pool. + :type data_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataPool, or the result of cls(response) + :rtype: ~azure.mgmt.adp.v2020_07_01_preview.models.DataPool + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DataPool"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'dataPoolName': self._serialize.url("data_pool_name", data_pool_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AutonomousDevelopmentPlatform/accounts/{accountName}/dataPools/{dataPoolName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + account_name, # type: str + data_pool_name, # type: str + locations=None, # type: Optional[List["models.DataPoolLocation"]] + **kwargs # type: Any + ): + # type: (...) -> "models.DataPool" + cls = kwargs.pop('cls', None) # type: ClsType["models.DataPool"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + parameters = models.DataPoolPatch(locations=locations) + api_version = "2020-07-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'dataPoolName': self._serialize.url("data_pool_name", data_pool_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if parameters is not None: + body_content = self._serialize.body(parameters, 'DataPoolPatch') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DataPool', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DataPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AutonomousDevelopmentPlatform/accounts/{accountName}/dataPools/{dataPoolName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + account_name, # type: str + data_pool_name, # type: str + locations=None, # type: Optional[List["models.DataPoolLocation"]] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.DataPool"] + """Updates the properties of an existing Data Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the ADP account. + :type account_name: str + :param data_pool_name: The name of the Data Pool. + :type data_pool_name: str + :param locations: Gets or sets the collection of locations where Data Pool resources should be + created. + :type locations: list[~azure.mgmt.adp.v2020_07_01_preview.models.DataPoolLocation] + :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: True for ARMPolling, False for no polling, or a + polling object for 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 DataPool or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.adp.v2020_07_01_preview.models.DataPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.DataPool"] + 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( + resource_group_name=resource_group_name, + account_name=account_name, + data_pool_name=data_pool_name, + locations=locations, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DataPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'dataPoolName': self._serialize.url("data_pool_name", data_pool_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AutonomousDevelopmentPlatform/accounts/{accountName}/dataPools/{dataPoolName}'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + account_name, # type: str + data_pool_name, # type: str + locations=None, # type: Optional[List["models.DataPoolLocation"]] + **kwargs # type: Any + ): + # type: (...) -> "models.DataPool" + cls = kwargs.pop('cls', None) # type: ClsType["models.DataPool"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + parameters = models.DataPool(locations=locations) + api_version = "2020-07-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'dataPoolName': self._serialize.url("data_pool_name", data_pool_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if parameters is not None: + body_content = self._serialize.body(parameters, 'DataPool') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DataPool', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DataPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AutonomousDevelopmentPlatform/accounts/{accountName}/dataPools/{dataPoolName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + account_name, # type: str + data_pool_name, # type: str + locations=None, # type: Optional[List["models.DataPoolLocation"]] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.DataPool"] + """Creates or updates a Data Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the ADP account. + :type account_name: str + :param data_pool_name: The name of the Data Pool. + :type data_pool_name: str + :param locations: Gets or sets the collection of locations where Data Pool resources should be + created. + :type locations: list[~azure.mgmt.adp.v2020_07_01_preview.models.DataPoolLocation] + :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: True for ARMPolling, False for no polling, or a + polling object for 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 DataPool or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.adp.v2020_07_01_preview.models.DataPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.DataPool"] + 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_or_update_initial( + resource_group_name=resource_group_name, + account_name=account_name, + data_pool_name=data_pool_name, + locations=locations, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DataPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'dataPoolName': self._serialize.url("data_pool_name", data_pool_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AutonomousDevelopmentPlatform/accounts/{accountName}/dataPools/{dataPoolName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + account_name, # type: str + data_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'dataPoolName': self._serialize.url("data_pool_name", data_pool_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AutonomousDevelopmentPlatform/accounts/{accountName}/dataPools/{dataPoolName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + account_name, # type: str + data_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a Data Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the ADP account. + :type account_name: str + :param data_pool_name: The name of the Data Pool. + :type data_pool_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: True for ARMPolling, False for no polling, or a + polling object for 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + 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( + resource_group_name=resource_group_name, + account_name=account_name, + data_pool_name=data_pool_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + 'dataPoolName': self._serialize.url("data_pool_name", data_pool_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AutonomousDevelopmentPlatform/accounts/{accountName}/dataPools/{dataPoolName}'} # type: ignore diff --git a/src/adp/azext_adp/vendored_sdks/adp/operations/_operation_operations.py b/src/adp/azext_adp/vendored_sdks/adp/operations/_operation_operations.py new file mode 100644 index 00000000000..08f92b65af5 --- /dev/null +++ b/src/adp/azext_adp/vendored_sdks/adp/operations/_operation_operations.py @@ -0,0 +1,110 @@ +# 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 TYPE_CHECKING +import warnings + +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 HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class OperationOperations(object): + """OperationOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.adp.v2020_07_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.OperationListResult"] + """Lists all of the available Autonomous Development Platform provider operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.adp.v2020_07_01_preview.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.AutonomousDevelopmentPlatform/operations'} # type: ignore diff --git a/src/adp/azext_adp/vendored_sdks/adp/py.typed b/src/adp/azext_adp/vendored_sdks/adp/py.typed new file mode 100644 index 00000000000..e5aff4f83af --- /dev/null +++ b/src/adp/azext_adp/vendored_sdks/adp/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/src/adp/report.md b/src/adp/report.md new file mode 100644 index 00000000000..c1719869f17 --- /dev/null +++ b/src/adp/report.md @@ -0,0 +1,177 @@ +# Azure CLI Module Creation Report + +## EXTENSION +|CLI Extension|Command Groups| +|---------|------------| +|az adp|[groups](#CommandGroups) + +## GROUPS +### Command groups in `az adp` extension +|CLI Command Group|Group Swagger name|Commands| +|---------|------------|--------| +|az adp account|Accounts|[commands](#CommandsInAccounts)| +|az adp data-pool|DataPools|[commands](#CommandsInDataPools)| + +## COMMANDS +### Commands in `az adp account` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az adp account list](#AccountsListByResourceGroup)|ListByResourceGroup|[Parameters](#ParametersAccountsListByResourceGroup)|[Example](#ExamplesAccountsListByResourceGroup)| +|[az adp account list](#AccountsList)|List|[Parameters](#ParametersAccountsList)|[Example](#ExamplesAccountsList)| +|[az adp account show](#AccountsGet)|Get|[Parameters](#ParametersAccountsGet)|[Example](#ExamplesAccountsGet)| +|[az adp account create](#AccountsCreateOrUpdate#Create)|CreateOrUpdate#Create|[Parameters](#ParametersAccountsCreateOrUpdate#Create)|[Example](#ExamplesAccountsCreateOrUpdate#Create)| +|[az adp account update](#AccountsUpdate)|Update|[Parameters](#ParametersAccountsUpdate)|[Example](#ExamplesAccountsUpdate)| +|[az adp account delete](#AccountsDelete)|Delete|[Parameters](#ParametersAccountsDelete)|[Example](#ExamplesAccountsDelete)| + +### Commands in `az adp data-pool` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az adp data-pool list](#DataPoolsList)|List|[Parameters](#ParametersDataPoolsList)|[Example](#ExamplesDataPoolsList)| +|[az adp data-pool show](#DataPoolsGet)|Get|[Parameters](#ParametersDataPoolsGet)|[Example](#ExamplesDataPoolsGet)| +|[az adp data-pool create](#DataPoolsCreateOrUpdate#Create)|CreateOrUpdate#Create|[Parameters](#ParametersDataPoolsCreateOrUpdate#Create)|[Example](#ExamplesDataPoolsCreateOrUpdate#Create)| +|[az adp data-pool update](#DataPoolsUpdate)|Update|[Parameters](#ParametersDataPoolsUpdate)|[Example](#ExamplesDataPoolsUpdate)| +|[az adp data-pool delete](#DataPoolsDelete)|Delete|[Parameters](#ParametersDataPoolsDelete)|[Example](#ExamplesDataPoolsDelete)| + + +## COMMAND DETAILS + +### group `az adp account` +#### Command `az adp account list` + +##### Example +``` +az adp account list --resource-group "adpClient" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| + +#### Command `az adp account list` + +##### Example +``` +az adp account list +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +#### Command `az adp account show` + +##### Example +``` +az adp account show --name "sampleacct" --resource-group "adpClient" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--account-name**|string|The name of the ADP account.|account_name|accountName| + +#### Command `az adp account create` + +##### Example +``` +az adp account create --name "sampleacct" --location "Global" --resource-group "adpClient" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--account-name**|string|The name of the ADP account.|account_name|accountName| +|**--tags**|dictionary|Resource tags.|tags|tags| +|**--location**|string|The geo-location where the resource lives|location|location| + +#### Command `az adp account update` + +##### Example +``` +az adp account update --name "sampleacct" --resource-group "adpClient" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--account-name**|string|The name of the ADP account.|account_name|accountName| +|**--tags**|dictionary|Resource tags.|tags|tags| + +#### Command `az adp account delete` + +##### Example +``` +az adp account delete --name "sampleacct" --resource-group "adpClient" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--account-name**|string|The name of the ADP account.|account_name|accountName| + +### group `az adp data-pool` +#### Command `az adp data-pool list` + +##### Example +``` +az adp data-pool list --account-name "sampleacct" --resource-group "adpClient" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--account-name**|string|The name of the ADP account.|account_name|accountName| + +#### Command `az adp data-pool show` + +##### Example +``` +az adp data-pool show --account-name "sampleacct" --name "sampledp" --resource-group "adpClient" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--account-name**|string|The name of the ADP account.|account_name|accountName| +|**--data-pool-name**|string|The name of the Data Pool.|data_pool_name|dataPoolName| + +#### Command `az adp data-pool create` + +##### Example +``` +az adp data-pool create --account-name "sampleacct" --name "sampledp" --locations name="westus" --resource-group \ +"adpClient" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--account-name**|string|The name of the ADP account.|account_name|accountName| +|**--data-pool-name**|string|The name of the Data Pool.|data_pool_name|dataPoolName| +|**--locations**|array|Gets or sets the collection of locations where Data Pool resources should be created.|locations|locations| + +#### Command `az adp data-pool update` + +##### Example +``` +az adp data-pool update --account-name "sampleacct" --name "sampledp" --locations name="westus" --resource-group \ +"adpClient" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--account-name**|string|The name of the ADP account.|account_name|accountName| +|**--data-pool-name**|string|The name of the Data Pool.|data_pool_name|dataPoolName| +|**--locations**|array|Gets or sets the collection of locations where Data Pool resources should be created.|locations|locations| + +#### Command `az adp data-pool delete` + +##### Example +``` +az adp data-pool delete --account-name "sampleacct" --name "sampledp" --resource-group "adpClient" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--account-name**|string|The name of the ADP account.|account_name|accountName| +|**--data-pool-name**|string|The name of the Data Pool.|data_pool_name|dataPoolName| diff --git a/src/adp/setup.cfg b/src/adp/setup.cfg new file mode 100644 index 00000000000..2fdd96e5d39 --- /dev/null +++ b/src/adp/setup.cfg @@ -0,0 +1 @@ +#setup.cfg \ No newline at end of file diff --git a/src/adp/setup.py b/src/adp/setup.py new file mode 100644 index 00000000000..87e009e866b --- /dev/null +++ b/src/adp/setup.py @@ -0,0 +1,58 @@ +#!/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. +# -------------------------------------------------------------------------------------------- + + +from codecs import open +from setuptools import setup, find_packages + +# HISTORY.rst entry. +VERSION = '0.1.0' +try: + from azext_adp.manual.version import VERSION +except ImportError: + pass + +# The full list of classifiers is available at +# https://pypi.python.org/pypi?%3Aaction=list_classifiers +CLASSIFIERS = [ + 'Development Status :: 4 - Beta', + 'Intended Audience :: Developers', + 'Intended Audience :: System Administrators', + 'Programming Language :: Python', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'License :: OSI Approved :: MIT License', +] + +DEPENDENCIES = [] + +try: + from azext_adp.manual.dependency import DEPENDENCIES +except ImportError: + pass + +with open('README.md', 'r', encoding='utf-8') as f: + README = f.read() +with open('HISTORY.rst', 'r', encoding='utf-8') as f: + HISTORY = f.read() + +setup( + name='adp', + version=VERSION, + description='Microsoft Azure Command-Line Tools AdpManagementClient Extension', + author='Microsoft Corporation', + author_email='azpycli@microsoft.com', + url='https://github.com/Azure/azure-cli-extensions/tree/master/src/adp', + long_description=README + '\n\n' + HISTORY, + license='MIT', + classifiers=CLASSIFIERS, + packages=find_packages(), + install_requires=DEPENDENCIES, + package_data={'azext_adp': ['azext_metadata.json']}, +)