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.md b/src/customproviders/README.md new file mode 100644 index 00000000000..c993828b1e5 --- /dev/null +++ b/src/customproviders/README.md @@ -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..b4430cc5d82 --- /dev/null +++ b/src/customproviders/azext_customproviders/__init__.py @@ -0,0 +1,46 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from azure.cli.core import AzCommandsLoader +from azext_customproviders.generated._help import helps # pylint: disable=unused-import + + +class CustomprovidersCommandsLoader(AzCommandsLoader): + + def __init__(self, cli_ctx=None): + from azure.cli.core.commands import CliCommandType + from azext_customproviders.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 azext_customproviders.generated.commands import load_command_table + load_command_table(self, args) + try: + from azext_customproviders.manual.commands import load_command_table as load_command_table_manual + load_command_table_manual(self, args) + except ImportError: + pass + return self.command_table + + def load_arguments(self, command): + from azext_customproviders.generated._params import load_arguments + load_arguments(self, command) + try: + from azext_customproviders.manual._params import load_arguments as load_arguments_manual + load_arguments_manual(self, command) + except ImportError: + pass + + +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..a846b2766c4 --- /dev/null +++ b/src/customproviders/azext_customproviders/action.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wildcard-import +# pylint: disable=unused-wildcard-import + +from .generated.action import * # noqa: F403 +try: + from .manual.action import * # noqa: F403 +except ImportError: + pass diff --git a/src/customproviders/azext_customproviders/azext_metadata.json b/src/customproviders/azext_customproviders/azext_metadata.json new file mode 100644 index 00000000000..7b56fb1e11a --- /dev/null +++ b/src/customproviders/azext_customproviders/azext_metadata.json @@ -0,0 +1,4 @@ +{ + "azext.isExperimental": true, + "azext.minCliCoreVersion": "2.3.1" +} \ No newline at end of file diff --git a/src/customproviders/azext_customproviders/custom.py b/src/customproviders/azext_customproviders/custom.py new file mode 100644 index 00000000000..7f31674ce96 --- /dev/null +++ b/src/customproviders/azext_customproviders/custom.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wildcard-import +# pylint: disable=unused-wildcard-import + +from .generated.custom import * # noqa: F403 +try: + from .manual.custom import * # noqa: F403 +except ImportError: + pass diff --git a/src/customproviders/azext_customproviders/generated/__init__.py b/src/customproviders/azext_customproviders/generated/__init__.py new file mode 100644 index 00000000000..ee0c4f36bd0 --- /dev/null +++ b/src/customproviders/azext_customproviders/generated/__init__.py @@ -0,0 +1,12 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/customproviders/azext_customproviders/generated/_client_factory.py b/src/customproviders/azext_customproviders/generated/_client_factory.py new file mode 100644 index 00000000000..2ea80e4cc5a --- /dev/null +++ b/src/customproviders/azext_customproviders/generated/_client_factory.py @@ -0,0 +1,23 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + + +def cf_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..b744f17a549 --- /dev/null +++ b/src/customproviders/azext_customproviders/generated/_help.py @@ -0,0 +1,123 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=too-many-lines + +from knack.help_files import helps + + +helps['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 "new\ +rp" +""" + +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" --actio\ +ns name="TestAction" endpoint="https://mytestendpoint/" routing-type="Proxy" --resource-types name="TestResource" endpo\ +int="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 "n\ +ewrp" +""" + +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 "n\ +ewrp" +""" + +helps['customproviders association'] = """ + type: group + short-summary: customproviders association +""" + +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 --target-resource-id "/subscriptions/00000000-0000-0000-0000-00000\ +0000000/resourceGroups/appRG/providers/Microsoft.Solutions/applications/applicationName" --association-name "associatio\ +nName" --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 update --target-resource-id "/subscriptions/00000000-0000-0000-0000-00000\ +0000000/resourceGroups/appRG/providers/Microsoft.Solutions/applications/applicationName" --association-name "associatio\ +nName" --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" +""" + +helps['customproviders association list-all'] = """ + type: command + short-summary: Gets all association for the given scope. + examples: + - name: Get all associations + text: |- + az customproviders association list-all --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..13d8c5c6dba --- /dev/null +++ b/src/customproviders/azext_customproviders/generated/_params.py @@ -0,0 +1,84 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=too-many-lines +# pylint: disable=too-many-statements + +from knack.arguments import CLIArgumentType +from azure.cli.core.commands.parameters import ( + tags_type, + resource_group_name_type, + get_location_type +) +from azure.cli.core.commands.validators import get_default_location_from_resource_group +from azext_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) + + with self.argument_context('customproviders custom-resource-provider show') as c: + c.argument('resource_group_name', resource_group_name_type) + 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) + c.argument('resource_provider_name', help='The name of the resource provider.') + c.argument('location', arg_type=get_location_type(self.cli_ctx), + validator=get_default_location_from_resource_group) + c.argument('tags', tags_type) + c.argument('actions', action=AddActions, nargs='+', help='A list of actions that the custom resource provider i' + 'mplements. Expect value: KEY1=VALUE1 KEY2=VALUE2 ... , available KEYs are: name, endpoint.') + c.argument('resource_types', action=AddResourceTypes, nargs='+', help='A list of resource types that the custom' + ' resource provider implements. Expect value: KEY1=VALUE1 KEY2=VALUE2 ... , available KEYs are: rout' + 'ing-type, name, endpoint.') + c.argument('validations', action=AddValidations, nargs='+', help='A list of validations to run on the custom re' + 'source provider\'s requests. Expect value: specification=xx.') + + with self.argument_context('customproviders custom-resource-provider update') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('resource_provider_name', help='The name of the resource provider.') + c.argument('tags', tags_type) + + with self.argument_context('customproviders custom-resource-provider delete') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('resource_provider_name', help='The name of the resource provider.') + + with self.argument_context('customproviders association show') as c: + c.argument('scope', help='The scope of the association.') + 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/Micr' + 'osoft.Compute/virtualMachines/{vm-name}\' for a virtual machine resource.') + c.argument('association_name', help='The name of the association.') + c.argument('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/Micr' + 'osoft.Compute/virtualMachines/{vm-name}\' for a virtual machine resource.') + c.argument('association_name', help='The name of the association.') + c.argument('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.') + c.argument('association_name', help='The name of the association.') + + with self.argument_context('customproviders association list-all') as c: + c.argument('scope', help='The scope 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..7536d0531ea --- /dev/null +++ b/src/customproviders/azext_customproviders/generated/_validators.py @@ -0,0 +1,23 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + + +def 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..6d0a22f1c97 --- /dev/null +++ b/src/customproviders/azext_customproviders/generated/action.py @@ -0,0 +1,89 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=protected-access + +import argparse +from knack.util import CLIError +from collections import defaultdict + + +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 = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'name': + d['name'] = v[0] + elif kl == 'endpoint': + d['endpoint'] = v[0] + 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 = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'routing-type': + d['routing_type'] = v[0] + elif kl == 'name': + d['name'] = v[0] + elif kl == 'endpoint': + d['endpoint'] = v[0] + 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 = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'specification': + d['specification'] = v[0] + 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..d137f7df1ea --- /dev/null +++ b/src/customproviders/azext_customproviders/generated/commands.py @@ -0,0 +1,42 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from azure.cli.core.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_opera' + 'tions#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, is_experimental=True) 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#Associa' + 'tionOperations.{}', + client_factory=cf_association) + with self.command_group('customproviders association', customproviders_association, client_factory=cf_association, + is_experimental=True) as g: + g.custom_show_command('show', 'customproviders_association_show') + g.custom_command('create', 'customproviders_association_create', supports_no_wait=True) + g.custom_command('update', 'customproviders_association_update', supports_no_wait=True) + g.custom_command('delete', 'customproviders_association_delete', supports_no_wait=True) + g.custom_command('list-all', 'customproviders_association_list_all') + 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..5efdc71a305 --- /dev/null +++ b/src/customproviders/azext_customproviders/generated/custom.py @@ -0,0 +1,94 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=too-many-lines + + +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, + actions=None, + resource_types=None, + 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=actions, + resource_types=resource_types, + validations=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_show(cmd, client, + scope, + association_name): + return client.get(scope=scope, + association_name=association_name) + + +def customproviders_association_create(cmd, client, + scope, + association_name, + target_resource_id=None): + return client.begin_create_or_update(scope=scope, + association_name=association_name, + target_resource_id=target_resource_id) + + +def customproviders_association_update(cmd, client, + scope, + association_name, + target_resource_id=None): + return client.begin_create_or_update(scope=scope, + association_name=association_name, + target_resource_id=target_resource_id) + + +def customproviders_association_delete(cmd, client, + scope, + association_name): + return client.begin_delete(scope=scope, + association_name=association_name) + + +def customproviders_association_list_all(cmd, client, + scope): + return client.list_all(scope=scope) diff --git a/src/customproviders/azext_customproviders/manual/__init__.py b/src/customproviders/azext_customproviders/manual/__init__.py new file mode 100644 index 00000000000..ee0c4f36bd0 --- /dev/null +++ b/src/customproviders/azext_customproviders/manual/__init__.py @@ -0,0 +1,12 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/customproviders/azext_customproviders/tests/__init__.py b/src/customproviders/azext_customproviders/tests/__init__.py new file mode 100644 index 00000000000..fe1bd438b46 --- /dev/null +++ b/src/customproviders/azext_customproviders/tests/__init__.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +import inspect +import os + + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) + + +def try_manual(func): + def import_manual_function(origin_func): + from importlib import import_module + decorated_path = inspect.getfile(origin_func) + module_path = __path__[0] + if not decorated_path.startswith(module_path): + raise Exception("Decorator can only be used in submodules!") + manual_path = os.path.join( + decorated_path[module_path.rfind(os.path.sep) + 1:]) + manual_file_path, manual_file_name = os.path.split(manual_path) + module_name, _ = os.path.splitext(manual_file_name) + manual_module = "..manual." + \ + ".".join(manual_file_path.split(os.path.sep) + [module_name, ]) + return getattr(import_module(manual_module, package=__name__), origin_func.__name__) + + def get_func_to_call(): + func_to_call = func + try: + func_to_call = import_manual_function(func) + except (ImportError, AttributeError): + pass + return func_to_call + + def wrapper(*args, **kwargs): + func_to_call = get_func_to_call() + print("running {}()...".format(func.__name__)) + return func_to_call(*args, **kwargs) + + if inspect.isclass(func): + return get_func_to_call() + else: + return wrapper 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..ee0c4f36bd0 --- /dev/null +++ b/src/customproviders/azext_customproviders/tests/latest/__init__.py @@ -0,0 +1,12 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/customproviders/azext_customproviders/tests/latest/preparers.py b/src/customproviders/azext_customproviders/tests/latest/preparers.py new file mode 100644 index 00000000000..3d6672de64f --- /dev/null +++ b/src/customproviders/azext_customproviders/tests/latest/preparers.py @@ -0,0 +1,116 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import os +from 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..8ba365890df --- /dev/null +++ b/src/customproviders/azext_customproviders/tests/latest/test_customproviders_scenario.py @@ -0,0 +1,161 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import os +import unittest + +from azure_devtools.scenario_tests import AllowLargeResponse +from azure.cli.testsdk import ScenarioTest +from .. import try_manual +from azure.cli.testsdk import ResourceGroupPreparer + + +TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..')) + + +@try_manual +def setup(test, rg, rg_2): + pass + + +# EXAMPLE: /Associations/put/Create or update an association +@try_manual +def step__associations_put_create_or_update_an_association(test, rg, rg_2): + test.cmd('az customproviders association create ' + '--target-resource-id "/subscriptions/{subscription_id}/resourceGroups/{rg}/providers/Microsoft.Solutions/' + 'applications/applicationName" ' + '--association-name "{associationName}" ' + '--scope "scope"', + checks=[]) + test.cmd('az customproviders association wait --created ' + '--association-name "{associationName}"', + checks=[]) + + +# EXAMPLE: /Associations/get/Get all associations +@try_manual +def step__associations_get_get_all_associations(test, rg, rg_2): + test.cmd('az customproviders association list-all ' + '--scope "scope"', + checks=[]) + + +# EXAMPLE: /Associations/get/Get an association +@try_manual +def step__associations_get_get_an_association(test, rg, rg_2): + test.cmd('az customproviders association show ' + '--association-name "{associationName}" ' + '--scope "scope"', + checks=[]) + + +# EXAMPLE: /CustomResourceProvider/put/Create or update the custom resource provider +@try_manual +def step__customresourceprovider_put_create_or_update_the_custom_resource_provider(test, rg, rg_2): + test.cmd('az customproviders custom-resource-provider create ' + '--resource-group "{rg_2}" ' + '--location "eastus" ' + '--actions name="TestAction" endpoint="https://mytestendpoint/" routing-type="Proxy" ' + '--resource-types name="TestResource" endpoint="https://mytestendpoint2/" routing-type="Proxy,Cache" ' + '--resource-provider-name "newrp"', + checks=[]) + test.cmd('az customproviders custom-resource-provider wait --created ' + '--resource-group "{rg_2}"', + checks=[]) + + +# EXAMPLE: /CustomResourceProvider/get/Get a custom resource provider +@try_manual +def step__customresourceprovider_get_get_a_custom_resource_provider(test, rg, rg_2): + test.cmd('az customproviders custom-resource-provider show ' + '--resource-group "{rg_2}" ' + '--resource-provider-name "newrp"', + checks=[]) + + +# EXAMPLE: /CustomResourceProvider/get/List all custom resource providers on the resourceGroup +@try_manual +def step__customresourceprovider_get_list_all_custom_resource_providers_on_the_resourcegroup(test, rg, rg_2): + test.cmd('az customproviders custom-resource-provider list ' + '--resource-group "{rg_2}"', + checks=[]) + + +# EXAMPLE: /CustomResourceProvider/get/List all custom resource providers on the subscription +@try_manual +def step__customresourceprovider_get_list_all_custom_resource_providers_on_the_subscription(test, rg, rg_2): + test.cmd('az customproviders custom-resource-provider list', + checks=[]) + + +# EXAMPLE: /CustomResourceProvider/patch/Update a custom resource provider +@try_manual +def step__customresourceprovider_patch_update_a_custom_resource_provider(test, rg, rg_2): + test.cmd('az customproviders custom-resource-provider update ' + '--resource-group "{rg_2}" ' + '--resource-provider-name "newrp"', + checks=[]) + + +# EXAMPLE: /Associations/delete/Delete an association +@try_manual +def step__associations_delete_delete_an_association(test, rg, rg_2): + test.cmd('az customproviders association delete ' + '--association-name "{associationName}" ' + '--scope "scope"', + checks=[]) + + +# EXAMPLE: /CustomResourceProvider/delete/Delete a custom resource provider +@try_manual +def step__customresourceprovider_delete_delete_a_custom_resource_provider(test, rg, rg_2): + test.cmd('az customproviders custom-resource-provider delete ' + '--resource-group "{rg_2}" ' + '--resource-provider-name "newrp"', + checks=[]) + + +@try_manual +def cleanup(test, rg, rg_2): + pass + + +@try_manual +def call_scenario(test, rg, rg_2): + setup(test, rg, rg_2) + step__associations_put_create_or_update_an_association(test, rg, rg_2) + step__associations_get_get_all_associations(test, rg, rg_2) + step__associations_get_get_an_association(test, rg, rg_2) + step__customresourceprovider_put_create_or_update_the_custom_resource_provider(test, rg, rg_2) + step__customresourceprovider_get_get_a_custom_resource_provider(test, rg, rg_2) + step__customresourceprovider_get_list_all_custom_resource_providers_on_the_resourcegroup(test, rg, rg_2) + step__customresourceprovider_get_list_all_custom_resource_providers_on_the_subscription(test, rg, rg_2) + step__customresourceprovider_patch_update_a_custom_resource_provider(test, rg, rg_2) + step__associations_delete_delete_an_association(test, rg, rg_2) + step__customresourceprovider_delete_delete_a_custom_resource_provider(test, rg, rg_2) + cleanup(test, rg, rg_2) + + +@try_manual +class CustomprovidersScenarioTest(ScenarioTest): + + @ResourceGroupPreparer(name_prefix='clitestcustomproviders_appRG'[:7], key='rg', parameter_name='rg') + @ResourceGroupPreparer(name_prefix='clitestcustomproviders_testRG'[:7], key='rg_2', parameter_name='rg_2') + def test_customproviders(self, rg, rg_2): + + self.kwargs.update({ + 'subscription_id': self.get_subscription_id() + }) + + self.kwargs.update({ + 'associationName': 'associationName', + }) + + call_scenario(self, rg, rg_2) 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..ee0c4f36bd0 --- /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__) 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..4e258374741 --- /dev/null +++ b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/__init__.py @@ -0,0 +1,19 @@ +# 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 +from ._version import VERSION + +__version__ = VERSION +__all__ = ['Customproviders'] + +try: + from .patch import patch_sdk + patch_sdk() +except ImportError: + pass 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..a5f07efa2bc --- /dev/null +++ b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/_configuration.py @@ -0,0 +1,69 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + + +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.credential_scopes = ['https://management.azure.com/.default'] + kwargs.setdefault('sdk_moniker', 'mgmt-customproviders/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/customproviders/azext_customproviders/vendored_sdks/customproviders/_customproviders.py b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/_customproviders.py new file mode 100644 index 00000000000..937f88a1b19 --- /dev/null +++ b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/_customproviders.py @@ -0,0 +1,76 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + +from ._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: azure.mgmt.customproviders.operations.OperationOperations + :ivar custom_resource_provider: CustomResourceProviderOperations operations + :vartype custom_resource_provider: azure.mgmt.customproviders.operations.CustomResourceProviderOperations + :ivar association: AssociationOperations operations + :vartype association: azure.mgmt.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 = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.operation = OperationOperations( + self._client, self._config, self._serialize, self._deserialize) + self.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/_version.py b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/_version.py new file mode 100644 index 00000000000..af172d5ea39 --- /dev/null +++ b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "2018-09-01-preview" 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..bd547220f83 --- /dev/null +++ b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/aio/_configuration_async.py @@ -0,0 +1,65 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +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_async.AsyncTokenCredential + :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: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(CustomprovidersConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2018-09-01-preview" + self.credential_scopes = ['https://management.azure.com/.default'] + kwargs.setdefault('sdk_moniker', 'mgmt-customproviders/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/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..2d9a4c60f9b --- /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.mgmt.core import AsyncARMPipelineClient +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: azure.mgmt.customproviders.aio.operations_async.OperationOperations + :ivar custom_resource_provider: CustomResourceProviderOperations operations + :vartype custom_resource_provider: azure.mgmt.customproviders.aio.operations_async.CustomResourceProviderOperations + :ivar association: AssociationOperations operations + :vartype association: azure.mgmt.customproviders.aio.operations_async.AssociationOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :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: "AsyncTokenCredential", + 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 = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.operation = OperationOperations( + self._client, self._config, self._serialize, self._deserialize) + self.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..1e2663e8274 --- /dev/null +++ b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/aio/operations_async/_association_operations_async.py @@ -0,0 +1,361 @@ +# 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 HttpResponseError, ResourceExistsError, ResourceNotFoundError, 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.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AssociationOperations: + """AssociationOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.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 = kwargs.pop('cls', None) # type: ClsType["models.Association"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _association = models.Association(target_resource_id=target_resource_id) + api_version = "2018-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + + # 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_association, 'Association') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + 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[~azure.mgmt.customproviders.models.Association] + + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Association"] + 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 = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: 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) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/{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. + :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 ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[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. + :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: ~azure.mgmt.customproviders.models.Association + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Association"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = '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) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + 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. + :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: ~azure.mgmt.customproviders.models.AssociationsList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AssociationsList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = '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 or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_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..bd1ae00367f --- /dev/null +++ b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/aio/operations_async/_custom_resource_provider_operations_async.py @@ -0,0 +1,512 @@ +# 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 HttpResponseError, ResourceExistsError, ResourceNotFoundError, 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.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class CustomResourceProviderOperations: + """CustomResourceProviderOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.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 = kwargs.pop('cls', None) # type: ClsType["models.CustomRPManifest"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _resource_provider = models.CustomRPManifest(location=location, tags=tags, actions=actions, resource_types=resource_types, validations=validations) + api_version = "2018-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + + # 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_resource_provider, 'CustomRPManifest') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + 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[~azure.mgmt.customproviders.models.CustomRPActionRouteDefinition] + :param resource_types: A list of resource types that the custom resource provider implements. + :type resource_types: list[~azure.mgmt.customproviders.models.CustomRPResourceTypeRouteDefinition] + :param validations: A list of validations to run on the custom resource provider's requests. + :type validations: list[~azure.mgmt.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[~azure.mgmt.customproviders.models.CustomRPManifest] + + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.CustomRPManifest"] + 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 = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: 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) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[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: ~azure.mgmt.customproviders.models.CustomRPManifest + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CustomRPManifest"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = '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) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + 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: ~azure.mgmt.customproviders.models.CustomRPManifest + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CustomRPManifest"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _patchable_resource = models.ResourceProvidersUpdate(tags=tags) + api_version = "2018-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + + # 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_patchable_resource, 'ResourceProvidersUpdate') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('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: ~azure.mgmt.customproviders.models.ListByCustomRPManifest + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ListByCustomRPManifest"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = '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 or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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: ~azure.mgmt.customproviders.models.ListByCustomRPManifest + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ListByCustomRPManifest"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = '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 or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_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..6abb795229f --- /dev/null +++ b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/aio/operations_async/_operation_operations_async.py @@ -0,0 +1,101 @@ +# 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 HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class OperationOperations: + """OperationOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.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: ~azure.mgmt.customproviders.models.ResourceProviderOperationList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceProviderOperationList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = '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 or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.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..f03f0111132 --- /dev/null +++ b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/models/__init__.py @@ -0,0 +1,65 @@ +# 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 AssociationsList + from ._models_py3 import CustomRPActionRouteDefinition + from ._models_py3 import CustomRPManifest + 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 + 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 AssociationsList # type: ignore + from ._models import CustomRPActionRouteDefinition # type: ignore + from ._models import CustomRPManifest # 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 # 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', + 'AssociationsList', + 'CustomRPActionRouteDefinition', + 'CustomRPManifest', + 'CustomRPResourceTypeRouteDefinition', + 'CustomRPRouteDefinition', + 'CustomRPValidations', + 'ErrorDefinition', + 'ErrorResponse', + '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..2e8014ba2fe --- /dev/null +++ b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/models/_customproviders_enums.py @@ -0,0 +1,26 @@ +# 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 ProvisioningState(str, Enum): + """The provisioning state of the resource provider. + """ + + accepted = "Accepted" + deleting = "Deleting" + running = "Running" + succeeded = "Succeeded" + failed = "Failed" + +class ResourceTypeRouting(str, Enum): + """The routing types that are supported for resource requests. + """ + + proxy = "Proxy" + proxy_cache = "Proxy,Cache" 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..d10ff2847ba --- /dev/null +++ b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/models/_models.py @@ -0,0 +1,505 @@ +# 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 association. Possible values include: + "Accepted", "Deleting", "Running", "Succeeded", "Failed". + :vartype provisioning_state: str or ~azure.mgmt.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 AssociationsList(msrest.serialization.Model): + """List of associations. + + :param value: The array of associations. + :type value: list[~azure.mgmt.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': r'^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['name'] + self.endpoint = kwargs['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': r'^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['location'] + 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[~azure.mgmt.customproviders.models.CustomRPActionRouteDefinition] + :param resource_types: A list of resource types that the custom resource provider implements. + :type resource_types: + list[~azure.mgmt.customproviders.models.CustomRPResourceTypeRouteDefinition] + :param validations: A list of validations to run on the custom resource provider's requests. + :type validations: list[~azure.mgmt.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 ~azure.mgmt.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 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 ~azure.mgmt.customproviders.models.ResourceTypeRouting + """ + + _validation = { + 'name': {'required': True}, + 'endpoint': {'required': True, 'pattern': r'^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': r'^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['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[~azure.mgmt.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 ErrorResponse(msrest.serialization.Model): + """Error response. + + :param error: The error details. + :type error: ~azure.mgmt.customproviders.models.ErrorDefinition + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDefinition'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class ListByCustomRPManifest(msrest.serialization.Model): + """List of custom resource providers. + + :param value: The array of custom resource provider manifests. + :type value: list[~azure.mgmt.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: ~azure.mgmt.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[~azure.mgmt.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..bba72daca70 --- /dev/null +++ b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/models/_models_py3.py @@ -0,0 +1,551 @@ +# 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 association. Possible values include: + "Accepted", "Deleting", "Running", "Succeeded", "Failed". + :vartype provisioning_state: str or ~azure.mgmt.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 AssociationsList(msrest.serialization.Model): + """List of associations. + + :param value: The array of associations. + :type value: list[~azure.mgmt.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': r'^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': r'^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[~azure.mgmt.customproviders.models.CustomRPActionRouteDefinition] + :param resource_types: A list of resource types that the custom resource provider implements. + :type resource_types: + list[~azure.mgmt.customproviders.models.CustomRPResourceTypeRouteDefinition] + :param validations: A list of validations to run on the custom resource provider's requests. + :type validations: list[~azure.mgmt.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 ~azure.mgmt.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 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 ~azure.mgmt.customproviders.models.ResourceTypeRouting + """ + + _validation = { + 'name': {'required': True}, + 'endpoint': {'required': True, 'pattern': r'^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': r'^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[~azure.mgmt.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 ErrorResponse(msrest.serialization.Model): + """Error response. + + :param error: The error details. + :type error: ~azure.mgmt.customproviders.models.ErrorDefinition + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDefinition'}, + } + + def __init__( + self, + *, + error: Optional["ErrorDefinition"] = None, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class ListByCustomRPManifest(msrest.serialization.Model): + """List of custom resource providers. + + :param value: The array of custom resource provider manifests. + :type value: list[~azure.mgmt.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: ~azure.mgmt.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[~azure.mgmt.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..b07ae1508fd --- /dev/null +++ b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/operations/_association_operations.py @@ -0,0 +1,371 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class AssociationOperations(object): + """AssociationOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.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', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _association = models.Association(target_resource_id=target_resource_id) + api_version = "2018-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + + # 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_association, 'Association') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + 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[~azure.mgmt.customproviders.models.Association] + + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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', {404: ResourceNotFoundError, 409: ResourceExistsError}) + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + # 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) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/{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. + :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 ~azure.core.exceptions.HttpResponseError: + """ + 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. + :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: ~azure.mgmt.customproviders.models.Association + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Association"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = '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) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + 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. + :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: ~azure.mgmt.customproviders.models.AssociationsList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AssociationsList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = '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 or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_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..b27b7463e44 --- /dev/null +++ b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/operations/_custom_resource_provider_operations.py @@ -0,0 +1,524 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class CustomResourceProviderOperations(object): + """CustomResourceProviderOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.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', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _resource_provider = models.CustomRPManifest(location=location, tags=tags, actions=actions, resource_types=resource_types, validations=validations) + api_version = "2018-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + + # 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_resource_provider, 'CustomRPManifest') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + 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[~azure.mgmt.customproviders.models.CustomRPActionRouteDefinition] + :param resource_types: A list of resource types that the custom resource provider implements. + :type resource_types: list[~azure.mgmt.customproviders.models.CustomRPResourceTypeRouteDefinition] + :param validations: A list of validations to run on the custom resource provider's requests. + :type validations: list[~azure.mgmt.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[~azure.mgmt.customproviders.models.CustomRPManifest] + + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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', {404: ResourceNotFoundError, 409: ResourceExistsError}) + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + # 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) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 ~azure.core.exceptions.HttpResponseError: + """ + 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: ~azure.mgmt.customproviders.models.CustomRPManifest + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CustomRPManifest"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = '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) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + 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: ~azure.mgmt.customproviders.models.CustomRPManifest + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CustomRPManifest"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _patchable_resource = models.ResourceProvidersUpdate(tags=tags) + api_version = "2018-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + + # 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_patchable_resource, 'ResourceProvidersUpdate') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('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: ~azure.mgmt.customproviders.models.ListByCustomRPManifest + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ListByCustomRPManifest"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = '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 or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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: ~azure.mgmt.customproviders.models.ListByCustomRPManifest + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ListByCustomRPManifest"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = '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 or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_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..900b7788fc1 --- /dev/null +++ b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/operations/_operation_operations.py @@ -0,0 +1,106 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class OperationOperations(object): + """OperationOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.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: ~azure.mgmt.customproviders.models.ResourceProviderOperationList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceProviderOperationList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = '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 or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.CustomProviders/operations'} diff --git a/src/customproviders/azext_customproviders/vendored_sdks/customproviders/py.typed b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/py.typed new file mode 100644 index 00000000000..e5aff4f83af --- /dev/null +++ b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/src/customproviders/azext_customproviders/vendored_sdks/customproviders/setup.py b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/setup.py new file mode 100644 index 00000000000..4d347e9b229 --- /dev/null +++ b/src/customproviders/azext_customproviders/vendored_sdks/customproviders/setup.py @@ -0,0 +1,37 @@ +# 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. +# -------------------------------------------------------------------------- +# coding: utf-8 + +from setuptools import setup, find_packages + +NAME = "customproviders" +VERSION = "2018-09-01-preview" + +# To install the library, run the following +# +# python setup.py install +# +# prerequisite: setuptools +# http://pypi.python.org/pypi/setuptools + +REQUIRES = ["msrest>=0.6.0", "azure-core<2.0.0,>=1.2.0"] + +setup( + name=NAME, + version=VERSION, + description="Customproviders", + author_email="", + url="", + keywords=["Swagger", "Customproviders"], + install_requires=REQUIRES, + packages=find_packages(), + include_package_data=True, + long_description="""\ + Allows extension of ARM control plane with custom resource providers. + """ +) diff --git a/src/customproviders/report.md b/src/customproviders/report.md new file mode 100644 index 00000000000..2723283b5a6 --- /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| +|**--association-name**|string|The name of the association.|association_name| +|**--target-resource-id**|string|The REST resource instance of the target resource for this association.|target_resource_id| +### customproviders association delete + +delete a customproviders association. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--scope**|string|The scope of the association.|scope| +|**--association-name**|string|The name of the association.|association_name| +### customproviders association list-all + +list-all a customproviders association. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--scope**|string|The scope of the association.|scope| +### customproviders association show + +show a customproviders association. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--scope**|string|The scope of the association.|scope| +|**--association-name**|string|The name of the association.|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| +|**--association-name**|string|The name of the association.|association_name| +|**--target-resource-id**|string|The REST resource instance of the target resource for this association.|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-provider-name**|string|The name of the resource provider.|resource_provider_name| +|**--location**|string|Resource location|location| +|**--tags**|dictionary|Resource tags|tags| +|**--actions**|array|A list of actions that the custom resource provider implements.|actions| +|**--resource-types**|array|A list of resource types that the custom resource provider implements.|resource_types| +|**--validations**|array|A list of validations to run on the custom resource provider's requests.|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-provider-name**|string|The name of the resource provider.|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| +### 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-provider-name**|string|The name of the resource provider.|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-provider-name**|string|The name of the resource provider.|resource_provider_name| +|**--tags**|dictionary|Resource 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..2fdd96e5d39 --- /dev/null +++ b/src/customproviders/setup.cfg @@ -0,0 +1 @@ +#setup.cfg \ No newline at end of file diff --git a/src/customproviders/setup.py b/src/customproviders/setup.py new file mode 100644 index 00000000000..e08472de414 --- /dev/null +++ b/src/customproviders/setup.py @@ -0,0 +1,53 @@ +#!/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 + +# 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.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.md', 'r', encoding='utf-8') as f: + README = f.read() +with open('HISTORY.rst', 'r', encoding='utf-8') as f: + HISTORY = f.read() + +setup( + name='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']}, +)