From c6c311b74d40956b596bcd7b53f0609efaff3570 Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Mon, 30 Mar 2020 02:24:52 +0000 Subject: [PATCH] Generated from 5bfed6d17d34ae6063022eb977370737f2aeefac add trenton configuration to readme of customproviders --- src/customproviders/HISTORY.rst | 8 + src/customproviders/README.rst | 5 + .../azext_customproviders/__init__.py | 31 + .../azext_customproviders/action.py | 12 + .../azext_customproviders/azext_metadata.json | 4 + .../azext_customproviders/commands.py | 12 + .../azext_customproviders/custom.py | 12 + .../generated/_client_factory.py | 18 + .../azext_customproviders/generated/_help.py | 122 ++++ .../generated/_params.py | 68 ++ .../generated/_validators.py | 18 + .../azext_customproviders/generated/action.py | 71 ++ .../generated/commands.py | 34 + .../azext_customproviders/generated/custom.py | 74 ++ .../tests/latest/__init__.py | 4 + .../tests/latest/preparers.py | 111 +++ .../latest/test_customproviders_scenario.py | 83 +++ .../vendored_sdks/__init__.py | 12 + .../vendored_sdks/customproviders/__init__.py | 10 + .../customproviders/_configuration.py | 60 ++ .../customproviders/_customproviders.py | 72 ++ .../customproviders/aio/__init__.py | 10 + .../aio/_configuration_async.py | 58 ++ .../aio/_customproviders_async.py | 68 ++ .../aio/operations_async/__init__.py | 17 + .../_association_operations_async.py | 359 ++++++++++ ...stom_resource_provider_operations_async.py | 500 ++++++++++++++ .../_operation_operations_async.py | 98 +++ .../customproviders/models/__init__.py | 70 ++ .../models/_customproviders_enums.py | 22 + .../customproviders/models/_models.py | 599 ++++++++++++++++ .../customproviders/models/_models_py3.py | 651 ++++++++++++++++++ .../customproviders/operations/__init__.py | 17 + .../operations/_association_operations.py | 365 ++++++++++ .../_custom_resource_provider_operations.py | 508 ++++++++++++++ .../operations/_operation_operations.py | 99 +++ src/customproviders/report.md | 88 +++ src/customproviders/setup.cfg | 2 + src/customproviders/setup.py | 60 ++ 39 files changed, 4432 insertions(+) create mode 100644 src/customproviders/HISTORY.rst create mode 100644 src/customproviders/README.rst create mode 100644 src/customproviders/azext_customproviders/__init__.py create mode 100644 src/customproviders/azext_customproviders/action.py create mode 100644 src/customproviders/azext_customproviders/azext_metadata.json create mode 100644 src/customproviders/azext_customproviders/commands.py create mode 100644 src/customproviders/azext_customproviders/custom.py create mode 100644 src/customproviders/azext_customproviders/generated/_client_factory.py create mode 100644 src/customproviders/azext_customproviders/generated/_help.py create mode 100644 src/customproviders/azext_customproviders/generated/_params.py create mode 100644 src/customproviders/azext_customproviders/generated/_validators.py create mode 100644 src/customproviders/azext_customproviders/generated/action.py create mode 100644 src/customproviders/azext_customproviders/generated/commands.py create mode 100644 src/customproviders/azext_customproviders/generated/custom.py create mode 100644 src/customproviders/azext_customproviders/tests/latest/__init__.py create mode 100644 src/customproviders/azext_customproviders/tests/latest/preparers.py create mode 100644 src/customproviders/azext_customproviders/tests/latest/test_customproviders_scenario.py create mode 100644 src/customproviders/azext_customproviders/vendored_sdks/__init__.py create mode 100644 src/customproviders/azext_customproviders/vendored_sdks/customproviders/__init__.py create mode 100644 src/customproviders/azext_customproviders/vendored_sdks/customproviders/_configuration.py create mode 100644 src/customproviders/azext_customproviders/vendored_sdks/customproviders/_customproviders.py create mode 100644 src/customproviders/azext_customproviders/vendored_sdks/customproviders/aio/__init__.py create mode 100644 src/customproviders/azext_customproviders/vendored_sdks/customproviders/aio/_configuration_async.py create mode 100644 src/customproviders/azext_customproviders/vendored_sdks/customproviders/aio/_customproviders_async.py create mode 100644 src/customproviders/azext_customproviders/vendored_sdks/customproviders/aio/operations_async/__init__.py create mode 100644 src/customproviders/azext_customproviders/vendored_sdks/customproviders/aio/operations_async/_association_operations_async.py create mode 100644 src/customproviders/azext_customproviders/vendored_sdks/customproviders/aio/operations_async/_custom_resource_provider_operations_async.py create mode 100644 src/customproviders/azext_customproviders/vendored_sdks/customproviders/aio/operations_async/_operation_operations_async.py create mode 100644 src/customproviders/azext_customproviders/vendored_sdks/customproviders/models/__init__.py create mode 100644 src/customproviders/azext_customproviders/vendored_sdks/customproviders/models/_customproviders_enums.py create mode 100644 src/customproviders/azext_customproviders/vendored_sdks/customproviders/models/_models.py create mode 100644 src/customproviders/azext_customproviders/vendored_sdks/customproviders/models/_models_py3.py create mode 100644 src/customproviders/azext_customproviders/vendored_sdks/customproviders/operations/__init__.py create mode 100644 src/customproviders/azext_customproviders/vendored_sdks/customproviders/operations/_association_operations.py create mode 100644 src/customproviders/azext_customproviders/vendored_sdks/customproviders/operations/_custom_resource_provider_operations.py create mode 100644 src/customproviders/azext_customproviders/vendored_sdks/customproviders/operations/_operation_operations.py create mode 100644 src/customproviders/report.md create mode 100644 src/customproviders/setup.cfg create mode 100644 src/customproviders/setup.py diff --git a/src/customproviders/HISTORY.rst b/src/customproviders/HISTORY.rst new file mode 100644 index 00000000000..27f152061e8 --- /dev/null +++ b/src/customproviders/HISTORY.rst @@ -0,0 +1,8 @@ +.. :changelog: + +Release History +=============== + +0.1.0 +++++++ +* Initial release. diff --git a/src/customproviders/README.rst b/src/customproviders/README.rst new file mode 100644 index 00000000000..c993828b1e5 --- /dev/null +++ b/src/customproviders/README.rst @@ -0,0 +1,5 @@ +Microsoft Azure CLI 'customproviders' Extension +========================================== + +This package is for the 'customproviders' extension. +i.e. 'az customproviders' diff --git a/src/customproviders/azext_customproviders/__init__.py b/src/customproviders/azext_customproviders/__init__.py new file mode 100644 index 00000000000..a7c015e5268 --- /dev/null +++ b/src/customproviders/azext_customproviders/__init__.py @@ -0,0 +1,31 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +from azure.cli.core import AzCommandsLoader +from .generated._help import helps + + +class CustomprovidersCommandsLoader(AzCommandsLoader): + + def __init__(self, cli_ctx=None): + from azure.cli.core.commands import CliCommandType + from .generated._client_factory import cf_customproviders + customproviders_custom = CliCommandType( + operations_tmpl='azext_customproviders.custom#{}', + client_factory=cf_customproviders) + super(CustomprovidersCommandsLoader, self).__init__(cli_ctx=cli_ctx, + custom_command_type=customproviders_custom) + + def load_command_table(self, args): + from .generated.commands import load_command_table + load_command_table(self, args) + return self.command_table + + def load_arguments(self, command): + from .generated._params import load_arguments + load_arguments(self, command) + + +COMMAND_LOADER_CLS = CustomprovidersCommandsLoader diff --git a/src/customproviders/azext_customproviders/action.py b/src/customproviders/azext_customproviders/action.py new file mode 100644 index 00000000000..2cb3583de76 --- /dev/null +++ b/src/customproviders/azext_customproviders/action.py @@ -0,0 +1,12 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# 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/customproviders/azext_customproviders/azext_metadata.json b/src/customproviders/azext_customproviders/azext_metadata.json new file mode 100644 index 00000000000..fc707c41f3b --- /dev/null +++ b/src/customproviders/azext_customproviders/azext_metadata.json @@ -0,0 +1,4 @@ +{ + "azext.isPreview": true, + "azext.minCliCoreVersion": "2.0.67" +} \ No newline at end of file diff --git a/src/customproviders/azext_customproviders/commands.py b/src/customproviders/azext_customproviders/commands.py new file mode 100644 index 00000000000..73c5cb52b0f --- /dev/null +++ b/src/customproviders/azext_customproviders/commands.py @@ -0,0 +1,12 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: disable=wildcard-import +# pylint: disable=unused-wildcard-import + +from .generated.commands import * # noqa: F403 +try: + from .manual.commands import * # noqa: F403 +except ImportError: + pass diff --git a/src/customproviders/azext_customproviders/custom.py b/src/customproviders/azext_customproviders/custom.py new file mode 100644 index 00000000000..41ab47d5063 --- /dev/null +++ b/src/customproviders/azext_customproviders/custom.py @@ -0,0 +1,12 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# 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/customproviders/azext_customproviders/generated/_client_factory.py b/src/customproviders/azext_customproviders/generated/_client_factory.py new file mode 100644 index 00000000000..dd043fd45ca --- /dev/null +++ b/src/customproviders/azext_customproviders/generated/_client_factory.py @@ -0,0 +1,18 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + + +def cf_customproviders(cli_ctx, *_): + from azure.cli.core.commands.client_factory import get_mgmt_service_client + from ..vendored_sdks.customproviders import Customproviders + return get_mgmt_service_client(cli_ctx, Customproviders) + + +def cf_custom_resource_provider(cli_ctx, *_): + return cf_customproviders(cli_ctx).custom_resource_provider + + +def cf_association(cli_ctx, *_): + return cf_customproviders(cli_ctx).association diff --git a/src/customproviders/azext_customproviders/generated/_help.py b/src/customproviders/azext_customproviders/generated/_help.py new file mode 100644 index 00000000000..a365b4d4ff1 --- /dev/null +++ b/src/customproviders/azext_customproviders/generated/_help.py @@ -0,0 +1,122 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: disable=line-too-long +# pylint: disable=too-many-lines + +from knack.help_files import helps + + +helps['customproviders custom-resource-provider'] = """ + type: group + short-summary: customproviders custom-resource-provider +""" + +helps['customproviders custom-resource-provider list'] = """ + type: command + short-summary: Gets all the custom resource providers within a subscription. + examples: + - name: List all custom resource providers on the resourceGroup + text: |- + az customproviders custom-resource-provider list --resource-group "testRG" +""" + +helps['customproviders custom-resource-provider show'] = """ + type: command + short-summary: Gets the custom resource provider manifest. + examples: + - name: Get a custom resource provider + text: |- + az customproviders custom-resource-provider show --resource-group "testRG" + --resource-provider-name "newrp" +""" + +helps['customproviders custom-resource-provider create'] = """ + type: command + short-summary: Creates or updates the custom resource provider. + examples: + - name: Create or update the custom resource provider + text: |- + az customproviders custom-resource-provider create --resource-group "testRG" --location + "eastus" --properties-actions + name=TestAction endpoint=https://mytestendpoint/ routing-type=Proxy + --properties-resource-types + name=TestResource endpoint=https://mytestendpoint2/ routing-type=Proxy,Cache + --resource-provider-name "newrp" +""" + +helps['customproviders custom-resource-provider update'] = """ + type: command + short-summary: Updates an existing custom resource provider. The only value that can be updated via PATCH currently is the tags. + examples: + - name: Update a custom resource provider + text: |- + az customproviders custom-resource-provider update --resource-group "testRG" + --resource-provider-name "newrp" +""" + +helps['customproviders custom-resource-provider delete'] = """ + type: command + short-summary: Deletes the custom resource provider. + examples: + - name: Delete a custom resource provider + text: |- + az customproviders custom-resource-provider delete --resource-group "testRG" + --resource-provider-name "newrp" +""" + +helps['customproviders association'] = """ + type: group + short-summary: customproviders association +""" + +helps['customproviders association list'] = """ + type: command + short-summary: Gets all association for the given scope. + examples: + - name: Get all associations + text: |- + az customproviders association list --scope "scope" +""" + +helps['customproviders association show'] = """ + type: command + short-summary: Get an association. + examples: + - name: Get an association + text: |- + az customproviders association show --association-name "associationName" --scope "scope" +""" + +helps['customproviders association create'] = """ + type: command + short-summary: Create or update an association. + examples: + - name: Create or update an association + text: |- + az customproviders association create --properties-target-resource-id "/subscriptions/0000 + 0000-0000-0000-0000-000000000000/resourceGroups/appRG/providers/Microsoft.Solutions/applic + ations/applicationName" --association-name "associationName" --scope "scope" +""" + +helps['customproviders association update'] = """ + type: command + short-summary: Create or update an association. + examples: + - name: Create or update an association + text: |- + az customproviders association create --properties-target-resource-id "/subscriptions/0000 + 0000-0000-0000-0000-000000000000/resourceGroups/appRG/providers/Microsoft.Solutions/applic + ations/applicationName" --association-name "associationName" --scope "scope" +""" + +helps['customproviders association delete'] = """ + type: command + short-summary: Delete an association. + examples: + - name: Delete an association + text: |- + az customproviders association delete --association-name "associationName" --scope + "scope" +""" diff --git a/src/customproviders/azext_customproviders/generated/_params.py b/src/customproviders/azext_customproviders/generated/_params.py new file mode 100644 index 00000000000..284a16d3f66 --- /dev/null +++ b/src/customproviders/azext_customproviders/generated/_params.py @@ -0,0 +1,68 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: disable=line-too-long +# pylint: disable=too-many-lines +# pylint: disable=too-many-statements + +from knack.arguments import CLIArgumentType +from azure.cli.core.commands.parameters import ( + tags_type, + resource_group_name_type, + get_location_type +) +from azext_customproviders.action import ( + AddActions, + AddResourceTypes, + AddValidations +) + + +def load_arguments(self, _): + + with self.argument_context('customproviders custom-resource-provider list') as c: + c.argument('resource_group_name', resource_group_name_type, help='The name of the resource group.') + + with self.argument_context('customproviders custom-resource-provider show') as c: + c.argument('resource_group_name', resource_group_name_type, help='The name of the resource group.') + c.argument('resource_provider_name', help='The name of the resource provider.') + + with self.argument_context('customproviders custom-resource-provider create') as c: + c.argument('resource_group_name', resource_group_name_type, help='The name of the resource group.') + c.argument('resource_provider_name', help='The name of the resource provider.') + c.argument('location', arg_type=get_location_type(self.cli_ctx), help='Resource location') + c.argument('tags', tags_type, help='Resource tags') + c.argument('properties_actions', action=AddActions, nargs='+', help='A list of actions that the custom resource provider implements.') + c.argument('properties_resource_types', action=AddResourceTypes, nargs='+', help='A list of resource types that the custom resource provider implements.') + c.argument('properties_validations', action=AddValidations, nargs='+', help='A list of validations to run on the custom resource provider\'s requests.') + + with self.argument_context('customproviders custom-resource-provider update') as c: + c.argument('resource_group_name', resource_group_name_type, help='The name of the resource group.') + c.argument('resource_provider_name', help='The name of the resource provider.') + c.argument('tags', tags_type, help='Resource tags') + + with self.argument_context('customproviders custom-resource-provider delete') as c: + c.argument('resource_group_name', resource_group_name_type, help='The name of the resource group.') + c.argument('resource_provider_name', help='The name of the resource provider.') + + with self.argument_context('customproviders association list') as c: + c.argument('scope', help='The scope of the association. The scope can be any valid REST resource instance. For example, use \'/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Microsoft.Compute/virtualMachines/{vm-name}\' for a virtual machine resource.') + + with self.argument_context('customproviders association show') as c: + c.argument('scope', help='The scope of the association. The scope can be any valid REST resource instance. For example, use \'/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Microsoft.Compute/virtualMachines/{vm-name}\' for a virtual machine resource.') + c.argument('association_name', help='The name of the association.') + + with self.argument_context('customproviders association create') as c: + c.argument('scope', help='The scope of the association. The scope can be any valid REST resource instance. For example, use \'/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Microsoft.Compute/virtualMachines/{vm-name}\' for a virtual machine resource.') + c.argument('association_name', help='The name of the association.') + c.argument('properties_target_resource_id', help='The REST resource instance of the target resource for this association.') + + with self.argument_context('customproviders association update') as c: + c.argument('scope', help='The scope of the association. The scope can be any valid REST resource instance. For example, use \'/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Microsoft.Compute/virtualMachines/{vm-name}\' for a virtual machine resource.') + c.argument('association_name', help='The name of the association.') + c.argument('properties_target_resource_id', help='The REST resource instance of the target resource for this association.') + + with self.argument_context('customproviders association delete') as c: + c.argument('scope', help='The scope of the association. The scope can be any valid REST resource instance. For example, use \'/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Microsoft.Compute/virtualMachines/{vm-name}\' for a virtual machine resource.') + c.argument('association_name', help='The name of the association.') diff --git a/src/customproviders/azext_customproviders/generated/_validators.py b/src/customproviders/azext_customproviders/generated/_validators.py new file mode 100644 index 00000000000..25e260a7bb4 --- /dev/null +++ b/src/customproviders/azext_customproviders/generated/_validators.py @@ -0,0 +1,18 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + + +def example_name_or_id_validator(cmd, namespace): + from azure.cli.core.commands.client_factory import get_subscription_id + from msrestazure.tools import is_valid_resource_id, resource_id + if namespace.storage_account: + if not is_valid_resource_id(namespace.RESOURCE): + namespace.storage_account = resource_id( + subscription=get_subscription_id(cmd.cli_ctx), + resource_group=namespace.resource_group_name, + namespace='Microsoft.Storage', + type='storageAccounts', + name=namespace.storage_account + ) diff --git a/src/customproviders/azext_customproviders/generated/action.py b/src/customproviders/azext_customproviders/generated/action.py new file mode 100644 index 00000000000..1f0737a10dc --- /dev/null +++ b/src/customproviders/azext_customproviders/generated/action.py @@ -0,0 +1,71 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: disable=protected-access + +import argparse +from knack.util import CLIError + + +class AddActions(argparse._AppendAction): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + super(AddActions, self).__call__(parser, namespace, action, option_string) + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = dict(x.split('=', 1) for x in values) + 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 + elif kl == 'endpoint': + d['endpoint'] = v + return d + + +class AddResourceTypes(argparse._AppendAction): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + super(AddResourceTypes, self).__call__(parser, namespace, action, option_string) + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = dict(x.split('=', 1) for x in values) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'routing_type': + d['routing_type'] = v + elif kl == 'name': + d['name'] = v + elif kl == 'endpoint': + d['endpoint'] = v + return d + + +class AddValidations(argparse._AppendAction): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + super(AddValidations, self).__call__(parser, namespace, action, option_string) + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = dict(x.split('=', 1) for x in values) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'specification': + d['specification'] = v + return d diff --git a/src/customproviders/azext_customproviders/generated/commands.py b/src/customproviders/azext_customproviders/generated/commands.py new file mode 100644 index 00000000000..c7993e53292 --- /dev/null +++ b/src/customproviders/azext_customproviders/generated/commands.py @@ -0,0 +1,34 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: disable=line-too-long + +from azure.cli.core.commands import CliCommandType + + +def load_command_table(self, _): + + from azext_customproviders.generated._client_factory import cf_custom_resource_provider + customproviders_custom_resource_provider = CliCommandType( + operations_tmpl='azext_customproviders.vendored_sdks.customproviders.operations._custom_resource_provider_operations#CustomResourceProviderOperations.{}', + client_factory=cf_custom_resource_provider) + with self.command_group('customproviders custom-resource-provider', customproviders_custom_resource_provider, client_factory=cf_custom_resource_provider) as g: + g.custom_command('list', 'customproviders_custom_resource_provider_list') + g.custom_show_command('show', 'customproviders_custom_resource_provider_show') + g.custom_command('create', 'customproviders_custom_resource_provider_create', supports_no_wait=True) + g.custom_command('update', 'customproviders_custom_resource_provider_update') + g.custom_command('delete', 'customproviders_custom_resource_provider_delete', supports_no_wait=True) + g.wait_command('wait') + + from azext_customproviders.generated._client_factory import cf_association + customproviders_association = CliCommandType( + operations_tmpl='azext_customproviders.vendored_sdks.customproviders.operations._association_operations#AssociationOperations.{}', + client_factory=cf_association) + with self.command_group('customproviders association', customproviders_association, client_factory=cf_association) as g: + g.custom_command('list', 'customproviders_association_list') + g.custom_show_command('show', 'customproviders_association_show') + g.custom_command('create', 'customproviders_association_create', supports_no_wait=True) + g.generic_update_command('update', supports_no_wait=True) + g.custom_command('delete', 'customproviders_association_delete', supports_no_wait=True) + g.wait_command('wait') diff --git a/src/customproviders/azext_customproviders/generated/custom.py b/src/customproviders/azext_customproviders/generated/custom.py new file mode 100644 index 00000000000..8402dee2fde --- /dev/null +++ b/src/customproviders/azext_customproviders/generated/custom.py @@ -0,0 +1,74 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: disable=line-too-long +# pylint: disable=too-many-lines + + +def customproviders_custom_resource_provider_list(cmd, client, + resource_group_name=None): + if resource_group_name is not None: + return client.list_by_resource_group(resource_group_name=resource_group_name) + return client.list_by_subscription() + + +def customproviders_custom_resource_provider_show(cmd, client, + resource_group_name, + resource_provider_name): + return client.get(resource_group_name=resource_group_name, resource_provider_name=resource_provider_name) + + +def customproviders_custom_resource_provider_create(cmd, client, + resource_group_name, + resource_provider_name, + location, + tags=None, + properties_actions=None, + properties_resource_types=None, + properties_validations=None): + return client.begin_create_or_update(resource_group_name=resource_group_name, resource_provider_name=resource_provider_name, location=location, tags=tags, actions=properties_actions, resource_types=properties_resource_types, validations=properties_validations) + + +def customproviders_custom_resource_provider_update(cmd, client, + resource_group_name, + resource_provider_name, + tags=None): + return client.update(resource_group_name=resource_group_name, resource_provider_name=resource_provider_name, tags=tags) + + +def customproviders_custom_resource_provider_delete(cmd, client, + resource_group_name, + resource_provider_name): + return client.begin_delete(resource_group_name=resource_group_name, resource_provider_name=resource_provider_name) + + +def customproviders_association_list(cmd, client, + scope): + return client.list_all(scope=scope) + + +def customproviders_association_show(cmd, client, + scope, + association_name): + return client.get(scope=scope, association_name=association_name) + + +def customproviders_association_create(cmd, client, + scope, + association_name, + properties_target_resource_id=None): + return client.begin_create_or_update(scope=scope, association_name=association_name, target_resource_id=properties_target_resource_id) + + +def customproviders_association_update(cmd, client, + scope, + association_name, + properties_target_resource_id=None): + return client.begin_create_or_update(scope=scope, association_name=association_name, target_resource_id=properties_target_resource_id) + + +def customproviders_association_delete(cmd, client, + scope, + association_name): + return client.begin_delete(scope=scope, association_name=association_name) diff --git a/src/customproviders/azext_customproviders/tests/latest/__init__.py b/src/customproviders/azext_customproviders/tests/latest/__init__.py new file mode 100644 index 00000000000..944e5654667 --- /dev/null +++ b/src/customproviders/azext_customproviders/tests/latest/__init__.py @@ -0,0 +1,4 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- diff --git a/src/customproviders/azext_customproviders/tests/latest/preparers.py b/src/customproviders/azext_customproviders/tests/latest/preparers.py new file mode 100644 index 00000000000..48c7b77dcaf --- /dev/null +++ b/src/customproviders/azext_customproviders/tests/latest/preparers.py @@ -0,0 +1,111 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +import os +from datetime import datetime +from azure.cli.testsdk.preparers import NoTrafficRecordingPreparer +from azure_devtools.scenario_tests import SingleValueReplacer +from azure.cli.testsdk.exceptions import CliTestError +from azure.cli.testsdk.reverse_dependency import get_dummy_cli + + +KEY_RESOURCE_GROUP = 'rg' +KEY_VIRTUAL_NETWORK = 'vnet' +KEY_VNET_SUBNET = 'subnet' + + +class VirtualNetworkPreparer(NoTrafficRecordingPreparer, SingleValueReplacer): + def __init__(self, name_prefix='clitest.vn', + parameter_name='virtual_network', + resource_group_name=None, + resource_group_key=KEY_RESOURCE_GROUP, + dev_setting_name='AZURE_CLI_TEST_DEV_VIRTUAL_NETWORK_NAME', + random_name_length=24, key=KEY_VIRTUAL_NETWORK): + if ' ' in name_prefix: + raise CliTestError( + 'Error: Space character in name prefix \'%s\'' % name_prefix) + super(VirtualNetworkPreparer, self).__init__( + name_prefix, random_name_length) + self.cli_ctx = get_dummy_cli() + self.parameter_name = parameter_name + self.key = key + self.resource_group_name = resource_group_name + self.resource_group_key = resource_group_key + self.dev_setting_name = os.environ.get(dev_setting_name, None) + + def create_resource(self, name, **kwargs): + if self.dev_setting_name: + return {self.parameter_name: self.dev_setting_name, } + + if not self.resource_group_name: + self.resource_group_name = self.test_class_instance.kwargs.get( + self.resource_group_key) + if not self.resource_group_name: + raise CliTestError("Error: No resource group configured!") + + tags = {'product': 'azurecli', 'cause': 'automation', + 'date': datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%SZ')} + if 'ENV_JOB_NAME' in os.environ: + tags['job'] = os.environ['ENV_JOB_NAME'] + tags = ' '.join(['{}={}'.format(key, value) + for key, value in tags.items()]) + template = 'az network vnet create --resource-group {} --name {} --tag ' + tags + self.live_only_execute(self.cli_ctx, template.format( + self.resource_group_name, name)) + + self.test_class_instance.kwargs[self.key] = name + return {self.parameter_name: name} + + def remove_resource(self, name, **kwargs): + # delete vnet if test is being recorded and if the vnet is not a dev rg + if not self.dev_setting_name: + self.live_only_execute( + self.cli_ctx, 'az network vnet delete --name {} --resource-group {}'.format(name, self.resource_group_name)) + + +class VnetSubnetPreparer(NoTrafficRecordingPreparer, SingleValueReplacer): + def __init__(self, name_prefix='clitest.vn', + parameter_name='subnet', + resource_group_name=None, + resource_group_key=KEY_RESOURCE_GROUP, + vnet_name=None, + vnet_key=KEY_VIRTUAL_NETWORK, + address_prefixes="11.0.0.0/24", + dev_setting_name='AZURE_CLI_TEST_DEV_VNET_SUBNET_NAME', + random_name_length=24, key=KEY_VNET_SUBNET): + if ' ' in name_prefix: + raise CliTestError( + 'Error: Space character in name prefix \'%s\'' % name_prefix) + super(VnetSubnetPreparer, self).__init__( + name_prefix, random_name_length) + self.cli_ctx = get_dummy_cli() + self.parameter_name = parameter_name + self.key = key + self.resource_group_name = resource_group_name + self.resource_group_key = resource_group_key + self.vnet_name = vnet_name + self.vnet_key = vnet_key + self.address_prefixes = address_prefixes + self.dev_setting_name = os.environ.get(dev_setting_name, None) + + def create_resource(self, name, **kwargs): + if self.dev_setting_name: + return {self.parameter_name: self.dev_setting_name, } + + if not self.resource_group_name: + self.resource_group_name = self.test_class_instance.kwargs.get( + self.resource_group_key) + if not self.resource_group_name: + raise CliTestError("Error: No resource group configured!") + if not self.vnet_name: + self.vnet_name = self.test_class_instance.kwargs.get(self.vnet_key) + if not self.vnet_name: + raise CliTestError("Error: No vnet configured!") + + self.test_class_instance.kwargs[self.key] = 'default' + return {self.parameter_name: name} + + def remove_resource(self, name, **kwargs): + pass diff --git a/src/customproviders/azext_customproviders/tests/latest/test_customproviders_scenario.py b/src/customproviders/azext_customproviders/tests/latest/test_customproviders_scenario.py new file mode 100644 index 00000000000..6cefe1af09e --- /dev/null +++ b/src/customproviders/azext_customproviders/tests/latest/test_customproviders_scenario.py @@ -0,0 +1,83 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +import os +import unittest + +from azure_devtools.scenario_tests import AllowLargeResponse +from azure.cli.testsdk import ScenarioTest +from azure.cli.testsdk import ResourceGroupPreparer + + +TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..')) + + +class CustomprovidersScenarioTest(ScenarioTest): + + def current_subscription(self): + subs = self.cmd('az account show').get_output_in_json() + return subs['id'] + + @ResourceGroupPreparer(name_prefix='cli_test_customproviders_appRG'[:9], key='rg') + @ResourceGroupPreparer(name_prefix='cli_test_customproviders_testRG'[:9], key='rg_2') + def test_customproviders(self, resource_group): + + self.kwargs.update({ + 'subscription_id': self.current_subscription() + }) + + self.kwargs.update({ + 'associationName': self.create_random_name(prefix='cli_test_associations'[:9], length=24), + }) + + self.cmd('az customproviders association create ' + '--properties-target-resource-id "/subscriptions/{subscription_id}/resourceGroups/{rg}/providers/Microsoft.Solutions/applications/applicationName" ' + '--association-name "{associationName}" ' + '--scope "scope"', + checks=[]) + + self.cmd('az customproviders custom-resource-provider create ' + '--resource-group "{rg_2}" ' + '--location "eastus" ' + '--properties-actions name=TestAction endpoint=https://mytestendpoint/ routing-type=Proxy ' + '--properties-resource-types name=TestResource endpoint=https://mytestendpoint2/ routing-type=Proxy,Cache ' + '--resource-provider-name "newrp"', + checks=[]) + + self.cmd('az customproviders custom-resource-provider show ' + '--resource-group "{rg_2}" ' + '--resource-provider-name "newrp"', + checks=[]) + + self.cmd('az customproviders association show ' + '--association-name "{associationName}" ' + '--scope "scope"', + checks=[]) + + self.cmd('az customproviders custom-resource-provider list ' + '--resource-group "{rg_2}"', + checks=[]) + + self.cmd('az customproviders custom-resource-provider list', + checks=[]) + + self.cmd('az customproviders association list ' + '--scope "scope"', + checks=[]) + + self.cmd('az customproviders custom-resource-provider update ' + '--resource-group "{rg_2}" ' + '--resource-provider-name "newrp"', + checks=[]) + + self.cmd('az customproviders custom-resource-provider delete ' + '--resource-group "{rg_2}" ' + '--resource-provider-name "newrp"', + checks=[]) + + self.cmd('az customproviders association delete ' + '--association-name "{associationName}" ' + '--scope "scope"', + checks=[]) diff --git a/src/customproviders/azext_customproviders/vendored_sdks/__init__.py b/src/customproviders/azext_customproviders/vendored_sdks/__init__.py new file mode 100644 index 00000000000..8d86d5a6be1 --- /dev/null +++ b/src/customproviders/azext_customproviders/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__) \ No newline at end of file diff --git a/src/customproviders/azext_customproviders/vendored_sdks/customproviders/__init__.py b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/__init__.py new file mode 100644 index 00000000000..158a0fe1249 --- /dev/null +++ b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/__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 ._customproviders import Customproviders +__all__ = ['Customproviders'] diff --git a/src/customproviders/azext_customproviders/vendored_sdks/customproviders/_configuration.py b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/_configuration.py new file mode 100644 index 00000000000..1c0e0a88b5c --- /dev/null +++ b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/_configuration.py @@ -0,0 +1,60 @@ +# 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 + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +VERSION = "unknown" + +class CustomprovidersConfiguration(Configuration): + """Configuration for Customproviders + 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 Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :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(CustomprovidersConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2018-09-01-preview" + self._configure(**kwargs) + self.user_agent_policy.add_user_agent('azsdk-python-customproviders/{}'.format(VERSION)) + + 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.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, **kwargs) diff --git a/src/customproviders/azext_customproviders/vendored_sdks/customproviders/_customproviders.py b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/_customproviders.py new file mode 100644 index 00000000000..6c7fb4f953e --- /dev/null +++ b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/_customproviders.py @@ -0,0 +1,72 @@ +# 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 + +from azure.core import PipelineClient +from msrest import Deserializer, Serializer + +from ._configuration import CustomprovidersConfiguration +from .operations import OperationOperations +from .operations import CustomResourceProviderOperations +from .operations import AssociationOperations +from . import models + + +class Customproviders(object): + """Allows extension of ARM control plane with custom resource providers. + + :ivar operation: OperationOperations operations + :vartype operation: customproviders.operations.OperationOperations + :ivar custom_resource_provider: CustomResourceProviderOperations operations + :vartype custom_resource_provider: customproviders.operations.CustomResourceProviderOperations + :ivar association: AssociationOperations operations + :vartype association: customproviders.operations.AssociationOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: azure.core.credentials.TokenCredential + :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :type subscription_id: str + :param str base_url: Service URL + """ + + 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 = CustomprovidersConfiguration(credential, subscription_id, **kwargs) + self._client = PipelineClient(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.custom_resource_provider = CustomResourceProviderOperations( + self._client, self._config, self._serialize, self._deserialize) + self.association = AssociationOperations( + self._client, self._config, self._serialize, self._deserialize) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> Customproviders + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/src/customproviders/azext_customproviders/vendored_sdks/customproviders/aio/__init__.py b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/aio/__init__.py new file mode 100644 index 00000000000..be0b6ba433d --- /dev/null +++ b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/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 ._customproviders_async import Customproviders +__all__ = ['Customproviders'] diff --git a/src/customproviders/azext_customproviders/vendored_sdks/customproviders/aio/_configuration_async.py b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/aio/_configuration_async.py new file mode 100644 index 00000000000..6aae72ec812 --- /dev/null +++ b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/aio/_configuration_async.py @@ -0,0 +1,58 @@ +# 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 + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +VERSION = "unknown" + +class CustomprovidersConfiguration(Configuration): + """Configuration for Customproviders + 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 Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :type subscription_id: str + """ + + def __init__( + self, + credential: "TokenCredential", + 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(CustomprovidersConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2018-09-01-preview" + self._configure(**kwargs) + self.user_agent_policy.add_user_agent('azsdk-python-customproviders/{}'.format(VERSION)) + + 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.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, **kwargs) diff --git a/src/customproviders/azext_customproviders/vendored_sdks/customproviders/aio/_customproviders_async.py b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/aio/_customproviders_async.py new file mode 100644 index 00000000000..2aad711891e --- /dev/null +++ b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/aio/_customproviders_async.py @@ -0,0 +1,68 @@ +# 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 + +from azure.core import AsyncPipelineClient +from msrest import Deserializer, Serializer + +from ._configuration_async import CustomprovidersConfiguration +from .operations_async import OperationOperations +from .operations_async import CustomResourceProviderOperations +from .operations_async import AssociationOperations +from .. import models + + +class Customproviders(object): + """Allows extension of ARM control plane with custom resource providers. + + :ivar operation: OperationOperations operations + :vartype operation: customproviders.aio.operations_async.OperationOperations + :ivar custom_resource_provider: CustomResourceProviderOperations operations + :vartype custom_resource_provider: customproviders.aio.operations_async.CustomResourceProviderOperations + :ivar association: AssociationOperations operations + :vartype association: customproviders.aio.operations_async.AssociationOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: azure.core.credentials.TokenCredential + :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = CustomprovidersConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncPipelineClient(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.custom_resource_provider = CustomResourceProviderOperations( + self._client, self._config, self._serialize, self._deserialize) + self.association = AssociationOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "Customproviders": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/src/customproviders/azext_customproviders/vendored_sdks/customproviders/aio/operations_async/__init__.py b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/aio/operations_async/__init__.py new file mode 100644 index 00000000000..e0b026e0c51 --- /dev/null +++ b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/aio/operations_async/__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_async import OperationOperations +from ._custom_resource_provider_operations_async import CustomResourceProviderOperations +from ._association_operations_async import AssociationOperations + +__all__ = [ + 'OperationOperations', + 'CustomResourceProviderOperations', + 'AssociationOperations', +] diff --git a/src/customproviders/azext_customproviders/vendored_sdks/customproviders/aio/operations_async/_association_operations_async.py b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/aio/operations_async/_association_operations_async.py new file mode 100644 index 00000000000..1d61ec933a7 --- /dev/null +++ b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/aio/operations_async/_association_operations_async.py @@ -0,0 +1,359 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncNoPolling, AsyncPollingMethod, async_poller +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 AssociationOperations: + """AssociationOperations async operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~customproviders.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 + + async def _create_or_update_initial( + self, + scope: str, + association_name: str, + target_resource_id: Optional[str] = None, + **kwargs + ) -> "models.Association": + cls: ClsType["models.Association"] = kwargs.pop('cls', None ) + error_map = kwargs.pop('error_map', {}) + + association = models.Association(target_resource_id=target_resource_id) + api_version = "2018-09-01-preview" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'associationName': self._serialize.url("association_name", association_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters: Dict[str, Any] = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters: Dict[str, Any] = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json' + + # Construct body + body_content = self._serialize.body(association, 'Association') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + 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) + raise models.ErrorResponseException.from_response(response, self._deserialize) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Association', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Association', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/{scope}/providers/Microsoft.CustomProviders/associations/{associationName}'} + + async def create_or_update( + self, + scope: str, + association_name: str, + target_resource_id: Optional[str] = None, + **kwargs + ) -> "models.Association": + """Create or update an association. + + :param scope: The scope of the association. The scope can be any valid REST resource instance. + For example, use '/subscriptions/{subscription-id}/resourceGroups/{resource-group- + name}/providers/Microsoft.Compute/virtualMachines/{vm-name}' for a virtual machine resource. + :type scope: str + :param association_name: The name of the association. + :type association_name: str + :param target_resource_id: The REST resource instance of the target resource for this + association. + :type target_resource_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns Association + :rtype: ~azure.core.polling.LROPoller[~customproviders.models.Association] + + :raises ~customproviders.models.ErrorResponseException: + """ + polling: Union[bool, AsyncPollingMethod] = kwargs.pop('polling', True) + cls: ClsType["models.Association"] = kwargs.pop('cls', None ) + raw_result = await self._create_or_update_initial( + scope=scope, + association_name=association_name, + target_resource_id=target_resource_id, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Association', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + create_or_update.metadata = {'url': '/{scope}/providers/Microsoft.CustomProviders/associations/{associationName}'} + + async def _delete_initial( + self, + scope: str, + association_name: str, + **kwargs + ) -> None: + cls: ClsType[None] = kwargs.pop('cls', None ) + error_map = kwargs.pop('error_map', {}) + api_version = "2018-09-01-preview" + + # Construct URL + url = self._delete_initial.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'associationName': self._serialize.url("association_name", association_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters: Dict[str, Any] = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters: Dict[str, Any] = {} + + # Construct and send request + 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) + raise models.ErrorResponseException.from_response(response, self._deserialize) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/{scope}/providers/Microsoft.CustomProviders/associations/{associationName}'} + + async def delete( + self, + scope: str, + association_name: str, + **kwargs + ) -> None: + """Delete an association. + + :param scope: The scope of the association. The scope can be any valid REST resource instance. + For example, use '/subscriptions/{subscription-id}/resourceGroups/{resource-group- + name}/providers/Microsoft.Compute/virtualMachines/{vm-name}' for a virtual machine resource. + :type scope: str + :param association_name: The name of the association. + :type association_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + + :raises ~customproviders.models.ErrorResponseException: + """ + polling: Union[bool, AsyncPollingMethod] = kwargs.pop('polling', True) + cls: ClsType[None] = kwargs.pop('cls', None ) + raw_result = await self._delete_initial( + scope=scope, + association_name=association_name, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/{scope}/providers/Microsoft.CustomProviders/associations/{associationName}'} + + async def get( + self, + scope: str, + association_name: str, + **kwargs + ) -> "models.Association": + """Get an association. + + :param scope: The scope of the association. The scope can be any valid REST resource instance. + For example, use '/subscriptions/{subscription-id}/resourceGroups/{resource-group- + name}/providers/Microsoft.Compute/virtualMachines/{vm-name}' for a virtual machine resource. + :type scope: str + :param association_name: The name of the association. + :type association_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Association or the result of cls(response) + :rtype: ~customproviders.models.Association + :raises: ~customproviders.models.ErrorResponseException: + """ + cls: ClsType["models.Association"] = kwargs.pop('cls', None ) + error_map = kwargs.pop('error_map', {}) + api_version = "2018-09-01-preview" + + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'associationName': self._serialize.url("association_name", association_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters: Dict[str, Any] = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters: Dict[str, Any] = {} + header_parameters['Accept'] = 'application/json' + + # Construct and send request + 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) + raise models.ErrorResponseException.from_response(response, self._deserialize) + + deserialized = self._deserialize('Association', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/{scope}/providers/Microsoft.CustomProviders/associations/{associationName}'} + + def list_all( + self, + scope: str, + **kwargs + ) -> "models.AssociationsList": + """Gets all association for the given scope. + + :param scope: The scope of the association. The scope can be any valid REST resource instance. + For example, use '/subscriptions/{subscription-id}/resourceGroups/{resource-group- + name}/providers/Microsoft.Compute/virtualMachines/{vm-name}' for a virtual machine resource. + :type scope: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AssociationsList or the result of cls(response) + :rtype: ~customproviders.models.AssociationsList + :raises: ~customproviders.models.ErrorResponseException: + """ + cls: ClsType["models.AssociationsList"] = kwargs.pop('cls', None ) + error_map = kwargs.pop('error_map', {}) + api_version = "2018-09-01-preview" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_all.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # Construct parameters + query_parameters: Dict[str, Any] = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters: Dict[str, Any] = {} + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('AssociationsList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise models.ErrorResponseException.from_response(response, self._deserialize) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_all.metadata = {'url': '/{scope}/providers/Microsoft.CustomProviders/associations'} diff --git a/src/customproviders/azext_customproviders/vendored_sdks/customproviders/aio/operations_async/_custom_resource_provider_operations_async.py b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/aio/operations_async/_custom_resource_provider_operations_async.py new file mode 100644 index 00000000000..d9d4495ada5 --- /dev/null +++ b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/aio/operations_async/_custom_resource_provider_operations_async.py @@ -0,0 +1,500 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncNoPolling, AsyncPollingMethod, async_poller +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 CustomResourceProviderOperations: + """CustomResourceProviderOperations async operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~customproviders.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 + + async def _create_or_update_initial( + self, + resource_group_name: str, + resource_provider_name: str, + location: str, + tags: Optional[Dict[str, str]] = None, + actions: Optional[List["CustomRPActionRouteDefinition"]] = None, + resource_types: Optional[List["CustomRPResourceTypeRouteDefinition"]] = None, + validations: Optional[List["CustomRPValidations"]] = None, + **kwargs + ) -> "models.CustomRPManifest": + cls: ClsType["models.CustomRPManifest"] = kwargs.pop('cls', None ) + error_map = kwargs.pop('error_map', {}) + + resource_provider = models.CustomRPManifest(location=location, tags=tags, actions=actions, resource_types=resource_types, validations=validations) + api_version = "2018-09-01-preview" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceProviderName': self._serialize.url("resource_provider_name", resource_provider_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters: Dict[str, Any] = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters: Dict[str, Any] = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json' + + # Construct body + body_content = self._serialize.body(resource_provider, 'CustomRPManifest') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + 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) + raise models.ErrorResponseException.from_response(response, self._deserialize) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('CustomRPManifest', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('CustomRPManifest', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomProviders/resourceProviders/{resourceProviderName}'} + + async def create_or_update( + self, + resource_group_name: str, + resource_provider_name: str, + location: str, + tags: Optional[Dict[str, str]] = None, + actions: Optional[List["CustomRPActionRouteDefinition"]] = None, + resource_types: Optional[List["CustomRPResourceTypeRouteDefinition"]] = None, + validations: Optional[List["CustomRPValidations"]] = None, + **kwargs + ) -> "models.CustomRPManifest": + """Creates or updates the custom resource provider. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param resource_provider_name: The name of the resource provider. + :type resource_provider_name: str + :param location: Resource location. + :type location: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param actions: A list of actions that the custom resource provider implements. + :type actions: list[~customproviders.models.CustomRPActionRouteDefinition] + :param resource_types: A list of resource types that the custom resource provider implements. + :type resource_types: list[~customproviders.models.CustomRPResourceTypeRouteDefinition] + :param validations: A list of validations to run on the custom resource provider's requests. + :type validations: list[~customproviders.models.CustomRPValidations] + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns CustomRPManifest + :rtype: ~azure.core.polling.LROPoller[~customproviders.models.CustomRPManifest] + + :raises ~customproviders.models.ErrorResponseException: + """ + polling: Union[bool, AsyncPollingMethod] = kwargs.pop('polling', True) + cls: ClsType["models.CustomRPManifest"] = kwargs.pop('cls', None ) + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + resource_provider_name=resource_provider_name, + location=location, + tags=tags, + actions=actions, + resource_types=resource_types, + validations=validations, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('CustomRPManifest', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomProviders/resourceProviders/{resourceProviderName}'} + + async def _delete_initial( + self, + resource_group_name: str, + resource_provider_name: str, + **kwargs + ) -> None: + cls: ClsType[None] = kwargs.pop('cls', None ) + error_map = kwargs.pop('error_map', {}) + api_version = "2018-09-01-preview" + + # Construct URL + url = self._delete_initial.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceProviderName': self._serialize.url("resource_provider_name", resource_provider_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters: Dict[str, Any] = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters: Dict[str, Any] = {} + + # Construct and send request + 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) + raise models.ErrorResponseException.from_response(response, self._deserialize) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomProviders/resourceProviders/{resourceProviderName}'} + + async def delete( + self, + resource_group_name: str, + resource_provider_name: str, + **kwargs + ) -> None: + """Deletes the custom resource provider. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param resource_provider_name: The name of the resource provider. + :type resource_provider_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + + :raises ~customproviders.models.ErrorResponseException: + """ + polling: Union[bool, AsyncPollingMethod] = kwargs.pop('polling', True) + cls: ClsType[None] = kwargs.pop('cls', None ) + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + resource_provider_name=resource_provider_name, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomProviders/resourceProviders/{resourceProviderName}'} + + async def get( + self, + resource_group_name: str, + resource_provider_name: str, + **kwargs + ) -> "models.CustomRPManifest": + """Gets the custom resource provider manifest. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param resource_provider_name: The name of the resource provider. + :type resource_provider_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomRPManifest or the result of cls(response) + :rtype: ~customproviders.models.CustomRPManifest + :raises: ~customproviders.models.ErrorResponseException: + """ + cls: ClsType["models.CustomRPManifest"] = kwargs.pop('cls', None ) + error_map = kwargs.pop('error_map', {}) + api_version = "2018-09-01-preview" + + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceProviderName': self._serialize.url("resource_provider_name", resource_provider_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters: Dict[str, Any] = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters: Dict[str, Any] = {} + header_parameters['Accept'] = 'application/json' + + # Construct and send request + 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) + raise models.ErrorResponseException.from_response(response, self._deserialize) + + deserialized = self._deserialize('CustomRPManifest', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomProviders/resourceProviders/{resourceProviderName}'} + + async def update( + self, + resource_group_name: str, + resource_provider_name: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ) -> "models.CustomRPManifest": + """Updates an existing custom resource provider. The only value that can be updated via PATCH currently is the tags. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param resource_provider_name: The name of the resource provider. + :type resource_provider_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 + :return: CustomRPManifest or the result of cls(response) + :rtype: ~customproviders.models.CustomRPManifest + :raises: ~customproviders.models.ErrorResponseException: + """ + cls: ClsType["models.CustomRPManifest"] = kwargs.pop('cls', None ) + error_map = kwargs.pop('error_map', {}) + + patchable_resource = models.ResourceProvidersUpdate(tags=tags) + api_version = "2018-09-01-preview" + + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceProviderName': self._serialize.url("resource_provider_name", resource_provider_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters: Dict[str, Any] = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters: Dict[str, Any] = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json' + + # Construct body + body_content = self._serialize.body(patchable_resource, 'ResourceProvidersUpdate') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + 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) + raise models.ErrorResponseException.from_response(response, self._deserialize) + + deserialized = self._deserialize('CustomRPManifest', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomProviders/resourceProviders/{resourceProviderName}'} + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> "models.ListByCustomRPManifest": + """Gets all the custom resource providers within a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ListByCustomRPManifest or the result of cls(response) + :rtype: ~customproviders.models.ListByCustomRPManifest + :raises: ~customproviders.models.ErrorResponseException: + """ + cls: ClsType["models.ListByCustomRPManifest"] = kwargs.pop('cls', None ) + error_map = kwargs.pop('error_map', {}) + api_version = "2018-09-01-preview" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # Construct parameters + query_parameters: Dict[str, Any] = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters: Dict[str, Any] = {} + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ListByCustomRPManifest', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise models.ErrorResponseException.from_response(response, self._deserialize) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomProviders/resourceProviders'} + + def list_by_subscription( + self, + **kwargs + ) -> "models.ListByCustomRPManifest": + """Gets all the custom resource providers within a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ListByCustomRPManifest or the result of cls(response) + :rtype: ~customproviders.models.ListByCustomRPManifest + :raises: ~customproviders.models.ErrorResponseException: + """ + cls: ClsType["models.ListByCustomRPManifest"] = kwargs.pop('cls', None ) + error_map = kwargs.pop('error_map', {}) + api_version = "2018-09-01-preview" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # Construct parameters + query_parameters: Dict[str, Any] = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters: Dict[str, Any] = {} + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ListByCustomRPManifest', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise models.ErrorResponseException.from_response(response, self._deserialize) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.CustomProviders/resourceProviders'} diff --git a/src/customproviders/azext_customproviders/vendored_sdks/customproviders/aio/operations_async/_operation_operations_async.py b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/aio/operations_async/_operation_operations_async.py new file mode 100644 index 00000000000..0c59a8cfc54 --- /dev/null +++ b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/aio/operations_async/_operation_operations_async.py @@ -0,0 +1,98 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest + +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 directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~customproviders.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 + ) -> "models.ResourceProviderOperationList": + """The list of operations provided by Microsoft CustomProviders. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceProviderOperationList or the result of cls(response) + :rtype: ~customproviders.models.ResourceProviderOperationList + :raises: ~customproviders.models.ErrorResponseException: + """ + cls: ClsType["models.ResourceProviderOperationList"] = kwargs.pop('cls', None ) + error_map = kwargs.pop('error_map', {}) + api_version = "2018-09-01-preview" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + else: + url = next_link + + # Construct parameters + query_parameters: Dict[str, Any] = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters: Dict[str, Any] = {} + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceProviderOperationList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise models.ErrorResponseException.from_response(response, self._deserialize) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.CustomProviders/operations'} diff --git a/src/customproviders/azext_customproviders/vendored_sdks/customproviders/models/__init__.py b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/models/__init__.py new file mode 100644 index 00000000000..6c084401951 --- /dev/null +++ b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/models/__init__.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. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import Association + from ._models_py3 import AssociationProperties + from ._models_py3 import AssociationsList + from ._models_py3 import CustomRPActionRouteDefinition + from ._models_py3 import CustomRPManifest + from ._models_py3 import CustomRPManifestProperties + from ._models_py3 import CustomRPResourceTypeRouteDefinition + from ._models_py3 import CustomRPRouteDefinition + from ._models_py3 import CustomRPValidations + from ._models_py3 import ErrorDefinition + from ._models_py3 import ErrorResponse, ErrorResponseException + from ._models_py3 import ListByCustomRPManifest + from ._models_py3 import Resource + from ._models_py3 import ResourceProviderOperation + from ._models_py3 import ResourceProviderOperationDisplay + from ._models_py3 import ResourceProviderOperationList + from ._models_py3 import ResourceProvidersUpdate +except (SyntaxError, ImportError): + from ._models import Association # type: ignore + from ._models import AssociationProperties # type: ignore + from ._models import AssociationsList # type: ignore + from ._models import CustomRPActionRouteDefinition # type: ignore + from ._models import CustomRPManifest # type: ignore + from ._models import CustomRPManifestProperties # type: ignore + from ._models import CustomRPResourceTypeRouteDefinition # type: ignore + from ._models import CustomRPRouteDefinition # type: ignore + from ._models import CustomRPValidations # type: ignore + from ._models import ErrorDefinition # type: ignore + from ._models import ErrorResponse, ErrorResponseException # type: ignore + from ._models import ListByCustomRPManifest # type: ignore + from ._models import Resource # type: ignore + from ._models import ResourceProviderOperation # type: ignore + from ._models import ResourceProviderOperationDisplay # type: ignore + from ._models import ResourceProviderOperationList # type: ignore + from ._models import ResourceProvidersUpdate # type: ignore +from ._customproviders_enums import ( + ProvisioningState, + ResourceTypeRouting, +) + +__all__ = [ + 'Association', + 'AssociationProperties', + 'AssociationsList', + 'CustomRPActionRouteDefinition', + 'CustomRPManifest', + 'CustomRPManifestProperties', + 'CustomRPResourceTypeRouteDefinition', + 'CustomRPRouteDefinition', + 'CustomRPValidations', + 'ErrorDefinition', + 'ErrorResponse', 'ErrorResponseException', + 'ListByCustomRPManifest', + 'Resource', + 'ResourceProviderOperation', + 'ResourceProviderOperationDisplay', + 'ResourceProviderOperationList', + 'ResourceProvidersUpdate', + 'ProvisioningState', + 'ResourceTypeRouting', +] diff --git a/src/customproviders/azext_customproviders/vendored_sdks/customproviders/models/_customproviders_enums.py b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/models/_customproviders_enums.py new file mode 100644 index 00000000000..b17ff248474 --- /dev/null +++ b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/models/_customproviders_enums.py @@ -0,0 +1,22 @@ +# 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 + +class ResourceTypeRouting(str, Enum): + + proxy = "Proxy" + proxy_cache = "Proxy,Cache" + +class ProvisioningState(str, Enum): + + accepted = "Accepted" + deleting = "Deleting" + running = "Running" + succeeded = "Succeeded" + failed = "Failed" diff --git a/src/customproviders/azext_customproviders/vendored_sdks/customproviders/models/_models.py b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/models/_models.py new file mode 100644 index 00000000000..faf230a107a --- /dev/null +++ b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/models/_models.py @@ -0,0 +1,599 @@ +# 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 Association(msrest.serialization.Model): + """The resource definition of this association. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The association id. + :vartype id: str + :ivar name: The association name. + :vartype name: str + :ivar type: The association type. + :vartype type: str + :param target_resource_id: The REST resource instance of the target resource for this + association. + :type target_resource_id: str + :ivar provisioning_state: The provisioning state of the resource provider. Possible values + include: 'Accepted', 'Deleting', 'Running', 'Succeeded', 'Failed'. + :vartype provisioning_state: str or ~customproviders.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'target_resource_id': {'key': 'properties.targetResourceId', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Association, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.target_resource_id = kwargs.get('target_resource_id', None) + self.provisioning_state = None + + +class AssociationProperties(msrest.serialization.Model): + """The properties of the association. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param target_resource_id: The REST resource instance of the target resource for this + association. + :type target_resource_id: str + :ivar provisioning_state: The provisioning state of the resource provider. Possible values + include: 'Accepted', 'Deleting', 'Running', 'Succeeded', 'Failed'. + :vartype provisioning_state: str or ~customproviders.models.ProvisioningState + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'target_resource_id': {'key': 'targetResourceId', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AssociationProperties, self).__init__(**kwargs) + self.target_resource_id = kwargs.get('target_resource_id', None) + self.provisioning_state = None + + +class AssociationsList(msrest.serialization.Model): + """List of associations. + + :param value: The array of associations. + :type value: list[~customproviders.models.Association] + :param next_link: The URL to use for getting the next set of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Association]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AssociationsList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class CustomRPRouteDefinition(msrest.serialization.Model): + """A route definition that defines an action or resource that can be interacted with through the custom resource provider. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the route definition. This becomes the name for the ARM + extension (e.g. + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomProviders/resourceProviders/{resourceProviderName}/{name}'). + :type name: str + :param endpoint: Required. The route definition endpoint URI that the custom resource provider + will proxy requests to. This can be in the form of a flat URI (e.g. 'https://testendpoint/') or + can specify to route via a path (e.g. 'https://testendpoint/{requestPath}'). + :type endpoint: str + """ + + _validation = { + 'name': {'required': True}, + 'endpoint': {'required': True, 'pattern': '^https://.+'}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'endpoint': {'key': 'endpoint', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CustomRPRouteDefinition, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.endpoint = kwargs.get('endpoint', None) + + +class CustomRPActionRouteDefinition(CustomRPRouteDefinition): + """The route definition for an action implemented by the custom resource provider. + + 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. + + :param name: Required. The name of the route definition. This becomes the name for the ARM + extension (e.g. + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomProviders/resourceProviders/{resourceProviderName}/{name}'). + :type name: str + :param endpoint: Required. The route definition endpoint URI that the custom resource provider + will proxy requests to. This can be in the form of a flat URI (e.g. 'https://testendpoint/') or + can specify to route via a path (e.g. 'https://testendpoint/{requestPath}'). + :type endpoint: str + :ivar routing_type: The routing types that are supported for action requests. Default value: + "Proxy". + :vartype routing_type: str + """ + + _validation = { + 'name': {'required': True}, + 'endpoint': {'required': True, 'pattern': '^https://.+'}, + 'routing_type': {'constant': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'endpoint': {'key': 'endpoint', 'type': 'str'}, + 'routing_type': {'key': 'routingType', 'type': 'str'}, + } + + routing_type = "Proxy" + + def __init__( + self, + **kwargs + ): + super(CustomRPActionRouteDefinition, self).__init__(**kwargs) + + +class Resource(msrest.serialization.Model): + """The resource definition. + + 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: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, 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'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + + +class CustomRPManifest(Resource): + """A manifest file that defines the custom resource provider resources. + + 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: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param actions: A list of actions that the custom resource provider implements. + :type actions: list[~customproviders.models.CustomRPActionRouteDefinition] + :param resource_types: A list of resource types that the custom resource provider implements. + :type resource_types: list[~customproviders.models.CustomRPResourceTypeRouteDefinition] + :param validations: A list of validations to run on the custom resource provider's requests. + :type validations: list[~customproviders.models.CustomRPValidations] + :ivar provisioning_state: The provisioning state of the resource provider. Possible values + include: 'Accepted', 'Deleting', 'Running', 'Succeeded', 'Failed'. + :vartype provisioning_state: str or ~customproviders.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'actions': {'key': 'properties.actions', 'type': '[CustomRPActionRouteDefinition]'}, + 'resource_types': {'key': 'properties.resourceTypes', 'type': '[CustomRPResourceTypeRouteDefinition]'}, + 'validations': {'key': 'properties.validations', 'type': '[CustomRPValidations]'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CustomRPManifest, self).__init__(**kwargs) + self.actions = kwargs.get('actions', None) + self.resource_types = kwargs.get('resource_types', None) + self.validations = kwargs.get('validations', None) + self.provisioning_state = None + + +class CustomRPManifestProperties(msrest.serialization.Model): + """The manifest for the custom resource provider. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param actions: A list of actions that the custom resource provider implements. + :type actions: list[~customproviders.models.CustomRPActionRouteDefinition] + :param resource_types: A list of resource types that the custom resource provider implements. + :type resource_types: list[~customproviders.models.CustomRPResourceTypeRouteDefinition] + :param validations: A list of validations to run on the custom resource provider's requests. + :type validations: list[~customproviders.models.CustomRPValidations] + :ivar provisioning_state: The provisioning state of the resource provider. Possible values + include: 'Accepted', 'Deleting', 'Running', 'Succeeded', 'Failed'. + :vartype provisioning_state: str or ~customproviders.models.ProvisioningState + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'actions': {'key': 'actions', 'type': '[CustomRPActionRouteDefinition]'}, + 'resource_types': {'key': 'resourceTypes', 'type': '[CustomRPResourceTypeRouteDefinition]'}, + 'validations': {'key': 'validations', 'type': '[CustomRPValidations]'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CustomRPManifestProperties, self).__init__(**kwargs) + self.actions = kwargs.get('actions', None) + self.resource_types = kwargs.get('resource_types', None) + self.validations = kwargs.get('validations', None) + self.provisioning_state = None + + +class CustomRPResourceTypeRouteDefinition(CustomRPRouteDefinition): + """The route definition for a resource implemented by the custom resource provider. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the route definition. This becomes the name for the ARM + extension (e.g. + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomProviders/resourceProviders/{resourceProviderName}/{name}'). + :type name: str + :param endpoint: Required. The route definition endpoint URI that the custom resource provider + will proxy requests to. This can be in the form of a flat URI (e.g. 'https://testendpoint/') or + can specify to route via a path (e.g. 'https://testendpoint/{requestPath}'). + :type endpoint: str + :param routing_type: The routing types that are supported for resource requests. Possible + values include: 'Proxy', 'Proxy,Cache'. + :type routing_type: str or ~customproviders.models.ResourceTypeRouting + """ + + _validation = { + 'name': {'required': True}, + 'endpoint': {'required': True, 'pattern': '^https://.+'}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'endpoint': {'key': 'endpoint', 'type': 'str'}, + 'routing_type': {'key': 'routingType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CustomRPResourceTypeRouteDefinition, self).__init__(**kwargs) + self.routing_type = kwargs.get('routing_type', None) + + +class CustomRPValidations(msrest.serialization.Model): + """A validation to apply on custom resource provider requests. + + 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 validation_type: The type of validation to run against a matching request. Default value: + "Swagger". + :vartype validation_type: str + :param specification: Required. A link to the validation specification. The specification must + be hosted on raw.githubusercontent.com. + :type specification: str + """ + + _validation = { + 'validation_type': {'constant': True}, + 'specification': {'required': True, 'pattern': '^https://raw.githubusercontent.com/.+'}, + } + + _attribute_map = { + 'validation_type': {'key': 'validationType', 'type': 'str'}, + 'specification': {'key': 'specification', 'type': 'str'}, + } + + validation_type = "Swagger" + + def __init__( + self, + **kwargs + ): + super(CustomRPValidations, self).__init__(**kwargs) + self.specification = kwargs.get('specification', None) + + +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[~customproviders.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 ErrorResponseException(HttpResponseError): + """Server responded with exception of type: 'ErrorResponse'. + + :param response: Server response to be deserialized. + :param error_model: A deserialized model of the response body as model. + """ + + def __init__(self, response, error_model): + self.error = error_model + super(ErrorResponseException, self).__init__(response=response, error_model=error_model) + + @classmethod + def from_response(cls, response, deserialize): + """Deserialize this response as this exception, or a subclass of this exception. + + :param response: Server response to be deserialized. + :param deserialize: A deserializer + """ + model_name = 'ErrorResponse' + error = deserialize(model_name, response) + if error is None: + error = deserialize.dependencies[model_name]() + return error._EXCEPTION_TYPE(response, error) + + +class ErrorResponse(msrest.serialization.Model): + """Error response. + + :param error: Error definition. + :type error: ~customproviders.models.ErrorDefinition + """ + _EXCEPTION_TYPE = ErrorResponseException + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDefinition'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class ListByCustomRPManifest(msrest.serialization.Model): + """List of custom resource providers. + + :param value: The array of custom resource provider manifests. + :type value: list[~customproviders.models.CustomRPManifest] + :param next_link: The URL to use for getting the next set of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CustomRPManifest]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ListByCustomRPManifest, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class ResourceProviderOperation(msrest.serialization.Model): + """Supported operations of this resource provider. + + :param name: Operation name, in format of {provider}/{resource}/{operation}. + :type name: str + :param display: Display metadata associated with the operation. + :type display: ~customproviders.models.ResourceProviderOperationDisplay + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'ResourceProviderOperationDisplay'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceProviderOperation, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display = kwargs.get('display', None) + + +class ResourceProviderOperationDisplay(msrest.serialization.Model): + """Display metadata associated with the operation. + + :param provider: Resource provider: Microsoft Custom Providers. + :type provider: str + :param resource: Resource on which the operation is performed. + :type resource: str + :param operation: Type of operation: get, read, delete, etc. + :type operation: str + :param description: Description of this 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(ResourceProviderOperationDisplay, 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 ResourceProviderOperationList(msrest.serialization.Model): + """Results of the request to list operations. + + :param value: List of operations supported by this resource provider. + :type value: list[~customproviders.models.ResourceProviderOperation] + :param next_link: The URL to use for getting the next set of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceProviderOperation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceProviderOperationList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class ResourceProvidersUpdate(msrest.serialization.Model): + """custom resource provider update information. + + :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(ResourceProvidersUpdate, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) diff --git a/src/customproviders/azext_customproviders/vendored_sdks/customproviders/models/_models_py3.py b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/models/_models_py3.py new file mode 100644 index 00000000000..48a11854c0d --- /dev/null +++ b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/models/_models_py3.py @@ -0,0 +1,651 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Dict, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class Association(msrest.serialization.Model): + """The resource definition of this association. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The association id. + :vartype id: str + :ivar name: The association name. + :vartype name: str + :ivar type: The association type. + :vartype type: str + :param target_resource_id: The REST resource instance of the target resource for this + association. + :type target_resource_id: str + :ivar provisioning_state: The provisioning state of the resource provider. Possible values + include: 'Accepted', 'Deleting', 'Running', 'Succeeded', 'Failed'. + :vartype provisioning_state: str or ~customproviders.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'target_resource_id': {'key': 'properties.targetResourceId', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + target_resource_id: Optional[str] = None, + **kwargs + ): + super(Association, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.target_resource_id = target_resource_id + self.provisioning_state = None + + +class AssociationProperties(msrest.serialization.Model): + """The properties of the association. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param target_resource_id: The REST resource instance of the target resource for this + association. + :type target_resource_id: str + :ivar provisioning_state: The provisioning state of the resource provider. Possible values + include: 'Accepted', 'Deleting', 'Running', 'Succeeded', 'Failed'. + :vartype provisioning_state: str or ~customproviders.models.ProvisioningState + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'target_resource_id': {'key': 'targetResourceId', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + target_resource_id: Optional[str] = None, + **kwargs + ): + super(AssociationProperties, self).__init__(**kwargs) + self.target_resource_id = target_resource_id + self.provisioning_state = None + + +class AssociationsList(msrest.serialization.Model): + """List of associations. + + :param value: The array of associations. + :type value: list[~customproviders.models.Association] + :param next_link: The URL to use for getting the next set of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Association]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Association"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(AssociationsList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class CustomRPRouteDefinition(msrest.serialization.Model): + """A route definition that defines an action or resource that can be interacted with through the custom resource provider. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the route definition. This becomes the name for the ARM + extension (e.g. + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomProviders/resourceProviders/{resourceProviderName}/{name}'). + :type name: str + :param endpoint: Required. The route definition endpoint URI that the custom resource provider + will proxy requests to. This can be in the form of a flat URI (e.g. 'https://testendpoint/') or + can specify to route via a path (e.g. 'https://testendpoint/{requestPath}'). + :type endpoint: str + """ + + _validation = { + 'name': {'required': True}, + 'endpoint': {'required': True, 'pattern': '^https://.+'}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'endpoint': {'key': 'endpoint', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + endpoint: str, + **kwargs + ): + super(CustomRPRouteDefinition, self).__init__(**kwargs) + self.name = name + self.endpoint = endpoint + + +class CustomRPActionRouteDefinition(CustomRPRouteDefinition): + """The route definition for an action implemented by the custom resource provider. + + 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. + + :param name: Required. The name of the route definition. This becomes the name for the ARM + extension (e.g. + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomProviders/resourceProviders/{resourceProviderName}/{name}'). + :type name: str + :param endpoint: Required. The route definition endpoint URI that the custom resource provider + will proxy requests to. This can be in the form of a flat URI (e.g. 'https://testendpoint/') or + can specify to route via a path (e.g. 'https://testendpoint/{requestPath}'). + :type endpoint: str + :ivar routing_type: The routing types that are supported for action requests. Default value: + "Proxy". + :vartype routing_type: str + """ + + _validation = { + 'name': {'required': True}, + 'endpoint': {'required': True, 'pattern': '^https://.+'}, + 'routing_type': {'constant': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'endpoint': {'key': 'endpoint', 'type': 'str'}, + 'routing_type': {'key': 'routingType', 'type': 'str'}, + } + + routing_type = "Proxy" + + def __init__( + self, + *, + name: str, + endpoint: str, + **kwargs + ): + super(CustomRPActionRouteDefinition, self).__init__(name=name, endpoint=endpoint, **kwargs) + + +class Resource(msrest.serialization.Model): + """The resource definition. + + 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: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, 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'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + + +class CustomRPManifest(Resource): + """A manifest file that defines the custom resource provider resources. + + 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: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param actions: A list of actions that the custom resource provider implements. + :type actions: list[~customproviders.models.CustomRPActionRouteDefinition] + :param resource_types: A list of resource types that the custom resource provider implements. + :type resource_types: list[~customproviders.models.CustomRPResourceTypeRouteDefinition] + :param validations: A list of validations to run on the custom resource provider's requests. + :type validations: list[~customproviders.models.CustomRPValidations] + :ivar provisioning_state: The provisioning state of the resource provider. Possible values + include: 'Accepted', 'Deleting', 'Running', 'Succeeded', 'Failed'. + :vartype provisioning_state: str or ~customproviders.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'actions': {'key': 'properties.actions', 'type': '[CustomRPActionRouteDefinition]'}, + 'resource_types': {'key': 'properties.resourceTypes', 'type': '[CustomRPResourceTypeRouteDefinition]'}, + 'validations': {'key': 'properties.validations', 'type': '[CustomRPValidations]'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + actions: Optional[List["CustomRPActionRouteDefinition"]] = None, + resource_types: Optional[List["CustomRPResourceTypeRouteDefinition"]] = None, + validations: Optional[List["CustomRPValidations"]] = None, + **kwargs + ): + super(CustomRPManifest, self).__init__(location=location, tags=tags, **kwargs) + self.actions = actions + self.resource_types = resource_types + self.validations = validations + self.provisioning_state = None + + +class CustomRPManifestProperties(msrest.serialization.Model): + """The manifest for the custom resource provider. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param actions: A list of actions that the custom resource provider implements. + :type actions: list[~customproviders.models.CustomRPActionRouteDefinition] + :param resource_types: A list of resource types that the custom resource provider implements. + :type resource_types: list[~customproviders.models.CustomRPResourceTypeRouteDefinition] + :param validations: A list of validations to run on the custom resource provider's requests. + :type validations: list[~customproviders.models.CustomRPValidations] + :ivar provisioning_state: The provisioning state of the resource provider. Possible values + include: 'Accepted', 'Deleting', 'Running', 'Succeeded', 'Failed'. + :vartype provisioning_state: str or ~customproviders.models.ProvisioningState + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'actions': {'key': 'actions', 'type': '[CustomRPActionRouteDefinition]'}, + 'resource_types': {'key': 'resourceTypes', 'type': '[CustomRPResourceTypeRouteDefinition]'}, + 'validations': {'key': 'validations', 'type': '[CustomRPValidations]'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + actions: Optional[List["CustomRPActionRouteDefinition"]] = None, + resource_types: Optional[List["CustomRPResourceTypeRouteDefinition"]] = None, + validations: Optional[List["CustomRPValidations"]] = None, + **kwargs + ): + super(CustomRPManifestProperties, self).__init__(**kwargs) + self.actions = actions + self.resource_types = resource_types + self.validations = validations + self.provisioning_state = None + + +class CustomRPResourceTypeRouteDefinition(CustomRPRouteDefinition): + """The route definition for a resource implemented by the custom resource provider. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the route definition. This becomes the name for the ARM + extension (e.g. + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomProviders/resourceProviders/{resourceProviderName}/{name}'). + :type name: str + :param endpoint: Required. The route definition endpoint URI that the custom resource provider + will proxy requests to. This can be in the form of a flat URI (e.g. 'https://testendpoint/') or + can specify to route via a path (e.g. 'https://testendpoint/{requestPath}'). + :type endpoint: str + :param routing_type: The routing types that are supported for resource requests. Possible + values include: 'Proxy', 'Proxy,Cache'. + :type routing_type: str or ~customproviders.models.ResourceTypeRouting + """ + + _validation = { + 'name': {'required': True}, + 'endpoint': {'required': True, 'pattern': '^https://.+'}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'endpoint': {'key': 'endpoint', 'type': 'str'}, + 'routing_type': {'key': 'routingType', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + endpoint: str, + routing_type: Optional[Union[str, "ResourceTypeRouting"]] = None, + **kwargs + ): + super(CustomRPResourceTypeRouteDefinition, self).__init__(name=name, endpoint=endpoint, **kwargs) + self.routing_type = routing_type + + +class CustomRPValidations(msrest.serialization.Model): + """A validation to apply on custom resource provider requests. + + 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 validation_type: The type of validation to run against a matching request. Default value: + "Swagger". + :vartype validation_type: str + :param specification: Required. A link to the validation specification. The specification must + be hosted on raw.githubusercontent.com. + :type specification: str + """ + + _validation = { + 'validation_type': {'constant': True}, + 'specification': {'required': True, 'pattern': '^https://raw.githubusercontent.com/.+'}, + } + + _attribute_map = { + 'validation_type': {'key': 'validationType', 'type': 'str'}, + 'specification': {'key': 'specification', 'type': 'str'}, + } + + validation_type = "Swagger" + + def __init__( + self, + *, + specification: str, + **kwargs + ): + super(CustomRPValidations, self).__init__(**kwargs) + self.specification = specification + + +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[~customproviders.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 ErrorResponseException(HttpResponseError): + """Server responded with exception of type: 'ErrorResponse'. + + :param response: Server response to be deserialized. + :param error_model: A deserialized model of the response body as model. + """ + + def __init__(self, response, error_model): + self.error = error_model + super(ErrorResponseException, self).__init__(response=response, error_model=error_model) + + @classmethod + def from_response(cls, response, deserialize): + """Deserialize this response as this exception, or a subclass of this exception. + + :param response: Server response to be deserialized. + :param deserialize: A deserializer + """ + model_name = 'ErrorResponse' + error = deserialize(model_name, response) + if error is None: + error = deserialize.dependencies[model_name]() + return error._EXCEPTION_TYPE(response, error) + + +class ErrorResponse(msrest.serialization.Model): + """Error response. + + :param error: Error definition. + :type error: ~customproviders.models.ErrorDefinition + """ + _EXCEPTION_TYPE = ErrorResponseException + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDefinition'}, + } + + def __init__( + self, + *, + error: Optional["ErrorDefinition"] = None, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class ListByCustomRPManifest(msrest.serialization.Model): + """List of custom resource providers. + + :param value: The array of custom resource provider manifests. + :type value: list[~customproviders.models.CustomRPManifest] + :param next_link: The URL to use for getting the next set of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CustomRPManifest]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["CustomRPManifest"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(ListByCustomRPManifest, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ResourceProviderOperation(msrest.serialization.Model): + """Supported operations of this resource provider. + + :param name: Operation name, in format of {provider}/{resource}/{operation}. + :type name: str + :param display: Display metadata associated with the operation. + :type display: ~customproviders.models.ResourceProviderOperationDisplay + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'ResourceProviderOperationDisplay'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional["ResourceProviderOperationDisplay"] = None, + **kwargs + ): + super(ResourceProviderOperation, self).__init__(**kwargs) + self.name = name + self.display = display + + +class ResourceProviderOperationDisplay(msrest.serialization.Model): + """Display metadata associated with the operation. + + :param provider: Resource provider: Microsoft Custom Providers. + :type provider: str + :param resource: Resource on which the operation is performed. + :type resource: str + :param operation: Type of operation: get, read, delete, etc. + :type operation: str + :param description: Description of this 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(ResourceProviderOperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class ResourceProviderOperationList(msrest.serialization.Model): + """Results of the request to list operations. + + :param value: List of operations supported by this resource provider. + :type value: list[~customproviders.models.ResourceProviderOperation] + :param next_link: The URL to use for getting the next set of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceProviderOperation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ResourceProviderOperation"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(ResourceProviderOperationList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ResourceProvidersUpdate(msrest.serialization.Model): + """custom resource provider update information. + + :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(ResourceProvidersUpdate, self).__init__(**kwargs) + self.tags = tags diff --git a/src/customproviders/azext_customproviders/vendored_sdks/customproviders/operations/__init__.py b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/operations/__init__.py new file mode 100644 index 00000000000..865272625df --- /dev/null +++ b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/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 ._custom_resource_provider_operations import CustomResourceProviderOperations +from ._association_operations import AssociationOperations + +__all__ = [ + 'OperationOperations', + 'CustomResourceProviderOperations', + 'AssociationOperations', +] diff --git a/src/customproviders/azext_customproviders/vendored_sdks/customproviders/operations/_association_operations.py b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/operations/_association_operations.py new file mode 100644 index 00000000000..21094d77b4d --- /dev/null +++ b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/operations/_association_operations.py @@ -0,0 +1,365 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import 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.polling.arm_polling import ARMPolling + +from .. import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class AssociationOperations(object): + """AssociationOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~customproviders.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 _create_or_update_initial( + self, + scope, # type: str + association_name, # type: str + target_resource_id=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.Association" + cls = kwargs.pop('cls', None ) # type: ClsType["models.Association"] + error_map = kwargs.pop('error_map', {}) + + association = models.Association(target_resource_id=target_resource_id) + api_version = "2018-09-01-preview" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'associationName': self._serialize.url("association_name", association_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json' + + # Construct body + body_content = self._serialize.body(association, 'Association') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + 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) + raise models.ErrorResponseException.from_response(response, self._deserialize) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Association', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Association', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/{scope}/providers/Microsoft.CustomProviders/associations/{associationName}'} + + def begin_create_or_update( + self, + scope, # type: str + association_name, # type: str + target_resource_id=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.Association" + """Create or update an association. + + :param scope: The scope of the association. The scope can be any valid REST resource instance. + For example, use '/subscriptions/{subscription-id}/resourceGroups/{resource-group- + name}/providers/Microsoft.Compute/virtualMachines/{vm-name}' for a virtual machine resource. + :type scope: str + :param association_name: The name of the association. + :type association_name: str + :param target_resource_id: The REST resource instance of the target resource for this + association. + :type target_resource_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns Association + :rtype: ~azure.core.polling.LROPoller[~customproviders.models.Association] + + :raises ~customproviders.models.ErrorResponseException: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None ) # type: ClsType["models.Association"] + raw_result = self._create_or_update_initial( + scope=scope, + association_name=association_name, + target_resource_id=target_resource_id, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Association', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/{scope}/providers/Microsoft.CustomProviders/associations/{associationName}'} + + def _delete_initial( + self, + scope, # type: str + association_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None ) # type: ClsType[None] + error_map = kwargs.pop('error_map', {}) + api_version = "2018-09-01-preview" + + # Construct URL + url = self._delete_initial.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'associationName': self._serialize.url("association_name", association_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + + # Construct and send request + 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) + raise models.ErrorResponseException.from_response(response, self._deserialize) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/{scope}/providers/Microsoft.CustomProviders/associations/{associationName}'} + + def begin_delete( + self, + scope, # type: str + association_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Delete an association. + + :param scope: The scope of the association. The scope can be any valid REST resource instance. + For example, use '/subscriptions/{subscription-id}/resourceGroups/{resource-group- + name}/providers/Microsoft.Compute/virtualMachines/{vm-name}' for a virtual machine resource. + :type scope: str + :param association_name: The name of the association. + :type association_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + + :raises ~customproviders.models.ErrorResponseException: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None ) # type: ClsType[None] + raw_result = self._delete_initial( + scope=scope, + association_name=association_name, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/{scope}/providers/Microsoft.CustomProviders/associations/{associationName}'} + + def get( + self, + scope, # type: str + association_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Association" + """Get an association. + + :param scope: The scope of the association. The scope can be any valid REST resource instance. + For example, use '/subscriptions/{subscription-id}/resourceGroups/{resource-group- + name}/providers/Microsoft.Compute/virtualMachines/{vm-name}' for a virtual machine resource. + :type scope: str + :param association_name: The name of the association. + :type association_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Association or the result of cls(response) + :rtype: ~customproviders.models.Association + :raises: ~customproviders.models.ErrorResponseException: + """ + cls = kwargs.pop('cls', None ) # type: ClsType["models.Association"] + error_map = kwargs.pop('error_map', {}) + api_version = "2018-09-01-preview" + + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'associationName': self._serialize.url("association_name", association_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + + # Construct and send request + 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) + raise models.ErrorResponseException.from_response(response, self._deserialize) + + deserialized = self._deserialize('Association', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/{scope}/providers/Microsoft.CustomProviders/associations/{associationName}'} + + def list_all( + self, + scope, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.AssociationsList" + """Gets all association for the given scope. + + :param scope: The scope of the association. The scope can be any valid REST resource instance. + For example, use '/subscriptions/{subscription-id}/resourceGroups/{resource-group- + name}/providers/Microsoft.Compute/virtualMachines/{vm-name}' for a virtual machine resource. + :type scope: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AssociationsList or the result of cls(response) + :rtype: ~customproviders.models.AssociationsList + :raises: ~customproviders.models.ErrorResponseException: + """ + cls = kwargs.pop('cls', None ) # type: ClsType["models.AssociationsList"] + error_map = kwargs.pop('error_map', {}) + api_version = "2018-09-01-preview" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_all.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('AssociationsList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise models.ErrorResponseException.from_response(response, self._deserialize) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_all.metadata = {'url': '/{scope}/providers/Microsoft.CustomProviders/associations'} diff --git a/src/customproviders/azext_customproviders/vendored_sdks/customproviders/operations/_custom_resource_provider_operations.py b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/operations/_custom_resource_provider_operations.py new file mode 100644 index 00000000000..9df4a7a8be9 --- /dev/null +++ b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/operations/_custom_resource_provider_operations.py @@ -0,0 +1,508 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import 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.polling.arm_polling import ARMPolling + +from .. import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class CustomResourceProviderOperations(object): + """CustomResourceProviderOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~customproviders.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 _create_or_update_initial( + self, + resource_group_name, # type: str + resource_provider_name, # type: str + location, # type: str + tags=None, # type: Optional[Dict[str, str]] + actions=None, # type: Optional[List["CustomRPActionRouteDefinition"]] + resource_types=None, # type: Optional[List["CustomRPResourceTypeRouteDefinition"]] + validations=None, # type: Optional[List["CustomRPValidations"]] + **kwargs # type: Any + ): + # type: (...) -> "models.CustomRPManifest" + cls = kwargs.pop('cls', None ) # type: ClsType["models.CustomRPManifest"] + error_map = kwargs.pop('error_map', {}) + + resource_provider = models.CustomRPManifest(location=location, tags=tags, actions=actions, resource_types=resource_types, validations=validations) + api_version = "2018-09-01-preview" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceProviderName': self._serialize.url("resource_provider_name", resource_provider_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json' + + # Construct body + body_content = self._serialize.body(resource_provider, 'CustomRPManifest') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + 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) + raise models.ErrorResponseException.from_response(response, self._deserialize) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('CustomRPManifest', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('CustomRPManifest', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomProviders/resourceProviders/{resourceProviderName}'} + + def begin_create_or_update( + self, + resource_group_name, # type: str + resource_provider_name, # type: str + location, # type: str + tags=None, # type: Optional[Dict[str, str]] + actions=None, # type: Optional[List["CustomRPActionRouteDefinition"]] + resource_types=None, # type: Optional[List["CustomRPResourceTypeRouteDefinition"]] + validations=None, # type: Optional[List["CustomRPValidations"]] + **kwargs # type: Any + ): + # type: (...) -> "models.CustomRPManifest" + """Creates or updates the custom resource provider. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param resource_provider_name: The name of the resource provider. + :type resource_provider_name: str + :param location: Resource location. + :type location: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param actions: A list of actions that the custom resource provider implements. + :type actions: list[~customproviders.models.CustomRPActionRouteDefinition] + :param resource_types: A list of resource types that the custom resource provider implements. + :type resource_types: list[~customproviders.models.CustomRPResourceTypeRouteDefinition] + :param validations: A list of validations to run on the custom resource provider's requests. + :type validations: list[~customproviders.models.CustomRPValidations] + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns CustomRPManifest + :rtype: ~azure.core.polling.LROPoller[~customproviders.models.CustomRPManifest] + + :raises ~customproviders.models.ErrorResponseException: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None ) # type: ClsType["models.CustomRPManifest"] + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + resource_provider_name=resource_provider_name, + location=location, + tags=tags, + actions=actions, + resource_types=resource_types, + validations=validations, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('CustomRPManifest', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomProviders/resourceProviders/{resourceProviderName}'} + + def _delete_initial( + self, + resource_group_name, # type: str + resource_provider_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None ) # type: ClsType[None] + error_map = kwargs.pop('error_map', {}) + api_version = "2018-09-01-preview" + + # Construct URL + url = self._delete_initial.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceProviderName': self._serialize.url("resource_provider_name", resource_provider_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + + # Construct and send request + 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) + raise models.ErrorResponseException.from_response(response, self._deserialize) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomProviders/resourceProviders/{resourceProviderName}'} + + def begin_delete( + self, + resource_group_name, # type: str + resource_provider_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes the custom resource provider. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param resource_provider_name: The name of the resource provider. + :type resource_provider_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + + :raises ~customproviders.models.ErrorResponseException: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None ) # type: ClsType[None] + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + resource_provider_name=resource_provider_name, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomProviders/resourceProviders/{resourceProviderName}'} + + def get( + self, + resource_group_name, # type: str + resource_provider_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.CustomRPManifest" + """Gets the custom resource provider manifest. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param resource_provider_name: The name of the resource provider. + :type resource_provider_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomRPManifest or the result of cls(response) + :rtype: ~customproviders.models.CustomRPManifest + :raises: ~customproviders.models.ErrorResponseException: + """ + cls = kwargs.pop('cls', None ) # type: ClsType["models.CustomRPManifest"] + error_map = kwargs.pop('error_map', {}) + api_version = "2018-09-01-preview" + + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceProviderName': self._serialize.url("resource_provider_name", resource_provider_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + + # Construct and send request + 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) + raise models.ErrorResponseException.from_response(response, self._deserialize) + + deserialized = self._deserialize('CustomRPManifest', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomProviders/resourceProviders/{resourceProviderName}'} + + def update( + self, + resource_group_name, # type: str + resource_provider_name, # type: str + tags=None, # type: Optional[Dict[str, str]] + **kwargs # type: Any + ): + # type: (...) -> "models.CustomRPManifest" + """Updates an existing custom resource provider. The only value that can be updated via PATCH currently is the tags. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param resource_provider_name: The name of the resource provider. + :type resource_provider_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 + :return: CustomRPManifest or the result of cls(response) + :rtype: ~customproviders.models.CustomRPManifest + :raises: ~customproviders.models.ErrorResponseException: + """ + cls = kwargs.pop('cls', None ) # type: ClsType["models.CustomRPManifest"] + error_map = kwargs.pop('error_map', {}) + + patchable_resource = models.ResourceProvidersUpdate(tags=tags) + api_version = "2018-09-01-preview" + + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceProviderName': self._serialize.url("resource_provider_name", resource_provider_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json' + + # Construct body + body_content = self._serialize.body(patchable_resource, 'ResourceProvidersUpdate') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + 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) + raise models.ErrorResponseException.from_response(response, self._deserialize) + + deserialized = self._deserialize('CustomRPManifest', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomProviders/resourceProviders/{resourceProviderName}'} + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.ListByCustomRPManifest" + """Gets all the custom resource providers within a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ListByCustomRPManifest or the result of cls(response) + :rtype: ~customproviders.models.ListByCustomRPManifest + :raises: ~customproviders.models.ErrorResponseException: + """ + cls = kwargs.pop('cls', None ) # type: ClsType["models.ListByCustomRPManifest"] + error_map = kwargs.pop('error_map', {}) + api_version = "2018-09-01-preview" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ListByCustomRPManifest', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise models.ErrorResponseException.from_response(response, self._deserialize) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomProviders/resourceProviders'} + + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> "models.ListByCustomRPManifest" + """Gets all the custom resource providers within a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ListByCustomRPManifest or the result of cls(response) + :rtype: ~customproviders.models.ListByCustomRPManifest + :raises: ~customproviders.models.ErrorResponseException: + """ + cls = kwargs.pop('cls', None ) # type: ClsType["models.ListByCustomRPManifest"] + error_map = kwargs.pop('error_map', {}) + api_version = "2018-09-01-preview" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ListByCustomRPManifest', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise models.ErrorResponseException.from_response(response, self._deserialize) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.CustomProviders/resourceProviders'} diff --git a/src/customproviders/azext_customproviders/vendored_sdks/customproviders/operations/_operation_operations.py b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/operations/_operation_operations.py new file mode 100644 index 00000000000..c487cb38942 --- /dev/null +++ b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/operations/_operation_operations.py @@ -0,0 +1,99 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from .. import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class OperationOperations(object): + """OperationOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~customproviders.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: (...) -> "models.ResourceProviderOperationList" + """The list of operations provided by Microsoft CustomProviders. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceProviderOperationList or the result of cls(response) + :rtype: ~customproviders.models.ResourceProviderOperationList + :raises: ~customproviders.models.ErrorResponseException: + """ + cls = kwargs.pop('cls', None ) # type: ClsType["models.ResourceProviderOperationList"] + error_map = kwargs.pop('error_map', {}) + api_version = "2018-09-01-preview" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + else: + url = next_link + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceProviderOperationList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise models.ErrorResponseException.from_response(response, self._deserialize) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.CustomProviders/operations'} diff --git a/src/customproviders/report.md b/src/customproviders/report.md new file mode 100644 index 00000000000..a3879d29b6e --- /dev/null +++ b/src/customproviders/report.md @@ -0,0 +1,88 @@ +# Azure CLI Module Creation Report + +### customproviders association create + +create a customproviders association. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--scope**|string|The scope of the association. The scope can be any valid REST resource instance. For example, use '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Microsoft.Compute/virtualMachines/{vm-name}' for a virtual machine resource.|scope|scope| +|**--association_name**|string|The name of the association.|association_name|association_name| +|**--target_resource_id**|string|The REST resource instance of the target resource for this association.|target_resource_id|properties_target_resource_id| +### customproviders association delete + +delete a customproviders association. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--scope**|string|The scope of the association. The scope can be any valid REST resource instance. For example, use '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Microsoft.Compute/virtualMachines/{vm-name}' for a virtual machine resource.|scope|scope| +|**--association_name**|string|The name of the association.|association_name|association_name| +### customproviders association list + +list a customproviders association. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--scope**|string|The scope of the association. The scope can be any valid REST resource instance. For example, use '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Microsoft.Compute/virtualMachines/{vm-name}' for a virtual machine resource.|scope|scope| +### customproviders association show + +show a customproviders association. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--scope**|string|The scope of the association. The scope can be any valid REST resource instance. For example, use '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Microsoft.Compute/virtualMachines/{vm-name}' for a virtual machine resource.|scope|scope| +|**--association_name**|string|The name of the association.|association_name|association_name| +### customproviders association update + +create a customproviders association. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--scope**|string|The scope of the association. The scope can be any valid REST resource instance. For example, use '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Microsoft.Compute/virtualMachines/{vm-name}' for a virtual machine resource.|scope|scope| +|**--association_name**|string|The name of the association.|association_name|association_name| +|**--target_resource_id**|string|The REST resource instance of the target resource for this association.|target_resource_id|properties_target_resource_id| +### customproviders custom-resource-provider create + +create a customproviders custom-resource-provider. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource_group_name**|string|The name of the resource group.|resource_group_name|resource_group_name| +|**--resource_provider_name**|string|The name of the resource provider.|resource_provider_name|resource_provider_name| +|**--location**|string|Resource location|location|location| +|**--tags**|dictionary|Resource tags|tags|tags| +|**--actions**|array|A list of actions that the custom resource provider implements.|actions|properties_actions| +|**--resource_types**|array|A list of resource types that the custom resource provider implements.|resource_types|properties_resource_types| +|**--validations**|array|A list of validations to run on the custom resource provider's requests.|validations|properties_validations| +### customproviders custom-resource-provider delete + +delete a customproviders custom-resource-provider. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource_group_name**|string|The name of the resource group.|resource_group_name|resource_group_name| +|**--resource_provider_name**|string|The name of the resource provider.|resource_provider_name|resource_provider_name| +### customproviders custom-resource-provider list + +list a customproviders custom-resource-provider. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource_group_name**|string|The name of the resource group.|resource_group_name|resource_group_name| +### customproviders custom-resource-provider show + +show a customproviders custom-resource-provider. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource_group_name**|string|The name of the resource group.|resource_group_name|resource_group_name| +|**--resource_provider_name**|string|The name of the resource provider.|resource_provider_name|resource_provider_name| +### customproviders custom-resource-provider update + +update a customproviders custom-resource-provider. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource_group_name**|string|The name of the resource group.|resource_group_name|resource_group_name| +|**--resource_provider_name**|string|The name of the resource provider.|resource_provider_name|resource_provider_name| +|**--tags**|dictionary|Resource tags|tags|tags| \ No newline at end of file diff --git a/src/customproviders/setup.cfg b/src/customproviders/setup.cfg new file mode 100644 index 00000000000..5eab412034f --- /dev/null +++ b/src/customproviders/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/src/customproviders/setup.py b/src/customproviders/setup.py new file mode 100644 index 00000000000..c24a6a43a05 --- /dev/null +++ b/src/customproviders/setup.py @@ -0,0 +1,60 @@ +#!/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 +try: + from azure_bdist_wheel import cmdclass +except ImportError: + from distutils import log as logger + logger.warn("Wheel is not available, disabling bdist_wheel hook") + +# TODO: Confirm this is the right version number you want and it matches your +# HISTORY.rst entry. +VERSION = '0.1.0' + +# 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.4', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'License :: OSI Approved :: MIT License', +] + +# TODO: Add any additional SDK dependencies here +DEPENDENCIES = [] + +with open('README.rst', 'r', encoding='utf-8') as f: + README = f.read() +with open('HISTORY.rst', 'r', encoding='utf-8') as f: + HISTORY = f.read() + +setup( + name='customproviders', + version=VERSION, + description='Microsoft Azure Command-Line Tools Customproviders Extension', + # TODO: Update author and email, if applicable + author='Microsoft Corporation', + author_email='azpycli@microsoft.com', + # TODO: consider pointing directly to your source code instead of the generic repo + url='https://github.com/Azure/azure-cli-extensions', + long_description=README + '\n\n' + HISTORY, + license='MIT', + classifiers=CLASSIFIERS, + packages=find_packages(), + install_requires=DEPENDENCIES, + package_data={'azext_customproviders': ['azext_metadata.json']}, +)