diff --git a/src/adb2c/HISTORY.rst b/src/adb2c/HISTORY.rst new file mode 100644 index 00000000000..1c139576ba0 --- /dev/null +++ b/src/adb2c/HISTORY.rst @@ -0,0 +1,8 @@ +.. :changelog: + +Release History +=============== + +0.1.0 +++++++ +* Initial release. diff --git a/src/adb2c/README.md b/src/adb2c/README.md new file mode 100644 index 00000000000..f697ff5c800 --- /dev/null +++ b/src/adb2c/README.md @@ -0,0 +1,33 @@ +# Azure CLI adb2c Extension # +This is the extension for adb2c + +### How to use ### +Install this extension using the below CLI command +``` +az extension add --name adb2c +``` + +### Included Features ### +#### adb2c tenant #### +##### Create ##### +``` +az adb2c tenant create --location "United States" --properties display-name="Contoso" country-code="US" \ + --name "Standard" --resource-group "contosoResourceGroup" --resource-name "contoso.onmicrosoft.com" +``` +##### Show ##### +``` +az adb2c tenant show --resource-group "contosoResourceGroup" --resource-name "contoso.onmicrosoft.com" +``` +##### List ##### +``` +az adb2c tenant list --resource-group "contosoResourceGroup" +``` +##### Update ##### +``` +az adb2c tenant update --resource-group "contosoResourceGroup" --resource-name "contoso.onmicrosoft.com" \ + --billing-type "MAU" --name "PremiumP1" --tags key="value" +``` +##### Delete ##### +``` +az adb2c tenant delete --resource-group "rg1" --resource-name "contoso.onmicrosoft.com" +``` \ No newline at end of file diff --git a/src/adb2c/azext_adb2c/__init__.py b/src/adb2c/azext_adb2c/__init__.py new file mode 100644 index 00000000000..b945ff8daa2 --- /dev/null +++ b/src/adb2c/azext_adb2c/__init__.py @@ -0,0 +1,50 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from azure.cli.core import AzCommandsLoader +from azext_adb2c.generated._help import helps # pylint: disable=unused-import +try: + from azext_adb2c.manual._help import helps # pylint: disable=reimported +except ImportError: + pass + + +class CPIMConfigurationClientCommandsLoader(AzCommandsLoader): + + def __init__(self, cli_ctx=None): + from azure.cli.core.commands import CliCommandType + from azext_adb2c.generated._client_factory import cf_adb2c_cl + adb2c_custom = CliCommandType( + operations_tmpl='azext_adb2c.custom#{}', + client_factory=cf_adb2c_cl) + parent = super(CPIMConfigurationClientCommandsLoader, self) + parent.__init__(cli_ctx=cli_ctx, custom_command_type=adb2c_custom) + + def load_command_table(self, args): + from azext_adb2c.generated.commands import load_command_table + load_command_table(self, args) + try: + from azext_adb2c.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_adb2c.generated._params import load_arguments + load_arguments(self, command) + try: + from azext_adb2c.manual._params import load_arguments as load_arguments_manual + load_arguments_manual(self, command) + except ImportError: + pass + + +COMMAND_LOADER_CLS = CPIMConfigurationClientCommandsLoader diff --git a/src/adb2c/azext_adb2c/action.py b/src/adb2c/azext_adb2c/action.py new file mode 100644 index 00000000000..d95d53bf711 --- /dev/null +++ b/src/adb2c/azext_adb2c/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/adb2c/azext_adb2c/azext_metadata.json b/src/adb2c/azext_adb2c/azext_metadata.json new file mode 100644 index 00000000000..cfc30c747c7 --- /dev/null +++ b/src/adb2c/azext_adb2c/azext_metadata.json @@ -0,0 +1,4 @@ +{ + "azext.isExperimental": true, + "azext.minCliCoreVersion": "2.15.0" +} \ No newline at end of file diff --git a/src/adb2c/azext_adb2c/custom.py b/src/adb2c/azext_adb2c/custom.py new file mode 100644 index 00000000000..dbe9d5f9742 --- /dev/null +++ b/src/adb2c/azext_adb2c/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/adb2c/azext_adb2c/generated/__init__.py b/src/adb2c/azext_adb2c/generated/__init__.py new file mode 100644 index 00000000000..c9cfdc73e77 --- /dev/null +++ b/src/adb2c/azext_adb2c/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/adb2c/azext_adb2c/generated/_client_factory.py b/src/adb2c/azext_adb2c/generated/_client_factory.py new file mode 100644 index 00000000000..4a860337941 --- /dev/null +++ b/src/adb2c/azext_adb2c/generated/_client_factory.py @@ -0,0 +1,20 @@ +# -------------------------------------------------------------------------- +# 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_adb2c_cl(cli_ctx, *_): + from azure.cli.core.commands.client_factory import get_mgmt_service_client + from azext_adb2c.vendored_sdks.azureadb2c import CPIMConfigurationClient + return get_mgmt_service_client(cli_ctx, + CPIMConfigurationClient) + + +def cf_b2ctenant(cli_ctx, *_): + return cf_adb2c_cl(cli_ctx).b2_ctenants diff --git a/src/adb2c/azext_adb2c/generated/_help.py b/src/adb2c/azext_adb2c/generated/_help.py new file mode 100644 index 00000000000..c3d8f64bcf4 --- /dev/null +++ b/src/adb2c/azext_adb2c/generated/_help.py @@ -0,0 +1,83 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# 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['adb2c tenant'] = """ + type: group + short-summary: Manage b2 c tenant with adb2c +""" + +helps['adb2c tenant list'] = """ + type: command + short-summary: "Get all the Azure AD B2C tenant resources in a resource group. And Get all the Azure AD B2C tenant \ +resources in a subscription." + examples: + - name: B2CTenants_ListByResourceGroup + text: |- + az adb2c tenant list --resource-group "contosoResourceGroup" + - name: B2CTenants_ListBySubscription + text: |- + az adb2c tenant list +""" + +helps['adb2c tenant show'] = """ + type: command + short-summary: "Get the Azure AD B2C tenant resource." + examples: + - name: Get tenant + text: |- + az adb2c tenant show --resource-group "contosoResourceGroup" --name "contoso.onmicrosoft.com" +""" + +helps['adb2c tenant create'] = """ + type: command + short-summary: "Initiates an async request to create both the Azure AD B2C tenant and the corresponding Azure \ +resource linked to a subscription." + examples: + - name: Create tenant + text: |- + az adb2c tenant create --location "United States" --country-code "US" --display-name "Contoso" --sku \ +"Standard" --resource-group "contosoResourceGroup" --name "contoso.onmicrosoft.com" +""" + +helps['adb2c tenant update'] = """ + type: command + short-summary: "Update the Azure AD B2C tenant resource." + examples: + - name: Update tenant + text: |- + az adb2c tenant update --resource-group "contosoResourceGroup" --name "contoso.onmicrosoft.com" \ +--billing-type "MAU" --sku "PremiumP1" --tags key="value" +""" + +helps['adb2c tenant delete'] = """ + type: command + short-summary: "Initiates an async operation to delete the Azure AD B2C tenant and Azure resource. The resource \ +deletion can only happen as the last step in [the tenant deletion process](https://aka.ms/deleteB2Ctenant)." + examples: + - name: Delete tenant + text: |- + az adb2c tenant delete --resource-group "rg1" --name "contoso.onmicrosoft.com" +""" + +helps['adb2c tenant wait'] = """ + type: command + short-summary: Place the CLI in a waiting state until a condition of the adb2c tenant is met. + examples: + - name: Pause executing next line of CLI script until the adb2c tenant is successfully created. + text: |- + az adb2c tenant wait --resource-group "contosoResourceGroup" --name "contoso.onmicrosoft.com" --created + - name: Pause executing next line of CLI script until the adb2c tenant is successfully deleted. + text: |- + az adb2c tenant wait --resource-group "contosoResourceGroup" --name "contoso.onmicrosoft.com" --deleted +""" diff --git a/src/adb2c/azext_adb2c/generated/_params.py b/src/adb2c/azext_adb2c/generated/_params.py new file mode 100644 index 00000000000..c70d55803c8 --- /dev/null +++ b/src/adb2c/azext_adb2c/generated/_params.py @@ -0,0 +1,68 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=too-many-lines +# pylint: disable=too-many-statements + +from azure.cli.core.commands.parameters import ( + tags_type, + get_enum_type, + resource_group_name_type, + get_location_type +) +from azure.cli.core.commands.validators import get_default_location_from_resource_group + + +def load_arguments(self, _): + + with self.argument_context('adb2c tenant list') as c: + c.argument('resource_group_name', resource_group_name_type) + + with self.argument_context('adb2c tenant show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('resource_name', options_list=['--name'], type=str, help='The initial domain name of the B2C ' + 'tenant.', id_part='name') + + with self.argument_context('adb2c tenant create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('resource_name', options_list=['--name'], type=str, help='The initial domain name of the B2C ' + 'tenant.') + c.argument('location', arg_type=get_location_type(self.cli_ctx), required=False, + validator=get_default_location_from_resource_group) + c.argument('tags', tags_type) + c.argument('name', options_list=['--sku'], arg_type=get_enum_type(['Standard', 'PremiumP1', 'PremiumP2']), + help='The name of the SKU for the tenant.', arg_group='Sku') + c.argument('display_name', type=str, help='The display name of the B2C tenant.', arg_group='Create Tenant ' + 'Properties') + c.argument('country_code', type=str, help='Country code of Azure tenant (e.g. \'US\'). Refer to ' + '[aka.ms/B2CDataResidency](https://aka.ms/B2CDataResidency) to see valid country codes and ' + 'corresponding data residency locations. If you do not see a country code in an valid data ' + 'residency location, choose one from the list.', arg_group='Create Tenant Properties') + + with self.argument_context('adb2c tenant update') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('resource_name', options_list=['--name'], type=str, help='The initial domain name of the B2C ' + 'tenant.', id_part='name') + c.argument('tags', tags_type) + c.argument('billing_type', arg_type=get_enum_type(['MAU', 'Auths']), help='The type of billing. Will be MAU ' + 'for all new customers. If \'Auths\', it can be updated to \'MAU\'. Cannot be changed if value is ' + '\'MAU\'. Learn more about Azure AD B2C billing at [aka.ms/b2cBilling](https://aka.ms/b2cbilling).', + arg_group='Billing Config') + c.argument('name', options_list=['--sku'], arg_type=get_enum_type(['Standard', 'PremiumP1', 'PremiumP2']), + help='The name of the SKU for the tenant.', arg_group='Sku') + + with self.argument_context('adb2c tenant delete') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('resource_name', options_list=['--name'], type=str, help='The initial domain name of the B2C ' + 'tenant.', id_part='name') + + with self.argument_context('adb2c tenant wait') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('resource_name', options_list=['--name'], type=str, help='The initial domain name of the B2C ' + 'tenant.', id_part='name') diff --git a/src/adb2c/azext_adb2c/generated/_validators.py b/src/adb2c/azext_adb2c/generated/_validators.py new file mode 100644 index 00000000000..b33a44c1ebf --- /dev/null +++ b/src/adb2c/azext_adb2c/generated/_validators.py @@ -0,0 +1,9 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- diff --git a/src/adb2c/azext_adb2c/generated/action.py b/src/adb2c/azext_adb2c/generated/action.py new file mode 100644 index 00000000000..b49bfaeeefe --- /dev/null +++ b/src/adb2c/azext_adb2c/generated/action.py @@ -0,0 +1,10 @@ +# -------------------------------------------------------------------------- +# 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 diff --git a/src/adb2c/azext_adb2c/generated/commands.py b/src/adb2c/azext_adb2c/generated/commands.py new file mode 100644 index 00000000000..64ae415b2a7 --- /dev/null +++ b/src/adb2c/azext_adb2c/generated/commands.py @@ -0,0 +1,32 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=too-many-statements +# pylint: disable=too-many-locals + +from azure.cli.core.commands import CliCommandType + + +def load_command_table(self, _): + + from azext_adb2c.generated._client_factory import cf_b2ctenant + adb2c_b2ctenant = CliCommandType( + operations_tmpl='azext_adb2c.vendored_sdks.azureadb2c.operations._b2_ctenants_operations#B2CTenantsOperations.{' + '}', + client_factory=cf_b2ctenant) + with self.command_group('adb2c tenant', adb2c_b2ctenant, client_factory=cf_b2ctenant) as g: + g.custom_command('list', 'adb2c_tenant_list') + g.custom_show_command('show', 'adb2c_tenant_show') + g.custom_command('create', 'adb2c_tenant_create', supports_no_wait=True) + g.custom_command('update', 'adb2c_tenant_update') + g.custom_command('delete', 'adb2c_tenant_delete', supports_no_wait=True, confirmation=True) + g.custom_wait_command('wait', 'adb2c_tenant_show') + + with self.command_group('adb2c', is_experimental=True): + pass diff --git a/src/adb2c/azext_adb2c/generated/custom.py b/src/adb2c/azext_adb2c/generated/custom.py new file mode 100644 index 00000000000..415523df34f --- /dev/null +++ b/src/adb2c/azext_adb2c/generated/custom.py @@ -0,0 +1,79 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=too-many-lines + +from azure.cli.core.util import sdk_no_wait + + +def adb2c_tenant_list(client, + resource_group_name=None): + if resource_group_name: + return client.list_by_resource_group(resource_group_name=resource_group_name) + return client.list_by_subscription() + + +def adb2c_tenant_show(client, + resource_group_name, + resource_name): + return client.get(resource_group_name=resource_group_name, + resource_name=resource_name) + + +def adb2c_tenant_create(client, + resource_group_name, + resource_name, + name, + display_name, + country_code, + location=None, + tags=None, + no_wait=False): + create_tenant_request_body = {} + create_tenant_request_body['location'] = location + create_tenant_request_body['tags'] = tags + create_tenant_request_body['sku'] = {} + create_tenant_request_body['sku']['name'] = name + create_tenant_request_body['sku']['tier'] = "A0" + create_tenant_request_body['properties'] = {} + create_tenant_request_body['properties']['display_name'] = display_name + create_tenant_request_body['properties']['country_code'] = country_code + return sdk_no_wait(no_wait, + client.begin_create, + resource_group_name=resource_group_name, + resource_name=resource_name, + create_tenant_request_body=create_tenant_request_body) + + +def adb2c_tenant_update(client, + resource_group_name, + resource_name, + tags=None, + billing_type=None, + name=None): + update_tenant_request_body = {} + update_tenant_request_body['tags'] = tags + update_tenant_request_body['billing_config'] = {} + update_tenant_request_body['billing_config']['billing_type'] = billing_type + update_tenant_request_body['sku'] = {} + update_tenant_request_body['sku']['name'] = name + update_tenant_request_body['sku']['tier'] = "A0" + return client.update(resource_group_name=resource_group_name, + resource_name=resource_name, + update_tenant_request_body=update_tenant_request_body) + + +def adb2c_tenant_delete(client, + resource_group_name, + resource_name, + no_wait=False): + return sdk_no_wait(no_wait, + client.begin_delete, + resource_group_name=resource_group_name, + resource_name=resource_name) diff --git a/src/adb2c/azext_adb2c/manual/__init__.py b/src/adb2c/azext_adb2c/manual/__init__.py new file mode 100644 index 00000000000..c9cfdc73e77 --- /dev/null +++ b/src/adb2c/azext_adb2c/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/adb2c/azext_adb2c/manual/_params.py b/src/adb2c/azext_adb2c/manual/_params.py new file mode 100644 index 00000000000..5336e7600b3 --- /dev/null +++ b/src/adb2c/azext_adb2c/manual/_params.py @@ -0,0 +1,43 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=too-many-lines +# pylint: disable=too-many-statements + +from azure.cli.core.commands.parameters import ( + tags_type, + get_enum_type, + resource_group_name_type, + get_location_type +) +from azure.cli.core.commands.validators import get_default_location_from_resource_group + + +def load_arguments(self, _): + + with self.argument_context('adb2c tenant create') as c: + c.argument('location', arg_type=get_location_type(self.cli_ctx), required=False, type=str, + validator=get_default_location_from_resource_group, + help="The location in which the resource is hosted and data resides. Refer to " + "this documentation() to see valid data residency locations. " + "Please choose one of 'United States', 'Europe', and 'Asia Pacific'.") + c.argument('name', options_list=['--sku'], arg_type=get_enum_type(['Standard', 'PremiumP1', 'PremiumP2']), + help='The name of the SKU for the tenant.') + c.argument('display_name', type=str, help='The display name of the B2C tenant.') + c.argument('country_code', type=str, help='Country code of Azure tenant (e.g. \'US\'). Refer to ' + '[aka.ms/B2CDataResidency](https://aka.ms/B2CDataResidency) to see valid country codes and ' + 'corresponding data residency locations. If you do not see a country code in an valid data ' + 'residency location, choose one from the list.') + + with self.argument_context('adb2c tenant update') as c: + c.argument('billing_type', arg_type=get_enum_type(['MAU', 'Auths']), help='The type of billing. Will be MAU ' + 'for all new customers. If \'Auths\', it can be updated to \'MAU\'. Cannot be changed if value is ' + '\'MAU\'. Learn more about Azure AD B2C billing at [aka.ms/b2cBilling](https://aka.ms/b2cbilling).') + c.argument('name', options_list=['--sku'], arg_type=get_enum_type(['Standard', 'PremiumP1', 'PremiumP2']), + help='The name of the SKU for the tenant.') diff --git a/src/adb2c/azext_adb2c/manual/custom.py b/src/adb2c/azext_adb2c/manual/custom.py new file mode 100644 index 00000000000..c991b0d1575 --- /dev/null +++ b/src/adb2c/azext_adb2c/manual/custom.py @@ -0,0 +1,69 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=too-many-lines + +from azure.cli.core.util import sdk_no_wait + + +def adb2c_tenant_create(client, + resource_group_name, + resource_name, + name, + display_name, + country_code, + location=None, + tags=None, + no_wait=False): + check_name_availability_request_body = {} + check_name_availability_request_body['name'] = resource_name + check_name_availability_request_body['country_code'] = country_code + name_availability_response = client.check_name_availability( + check_name_availability_request_body=check_name_availability_request_body) + if not name_availability_response.name_available: + from azure.cli.core.azclierror import InvalidArgumentValueError + if name_availability_response.reason and name_availability_response.message: + raise InvalidArgumentValueError('{}: {}'.format(name_availability_response.reason, + name_availability_response.message)) + else: + raise InvalidArgumentValueError("AlreadyExists: The given domain name is not available.") + create_tenant_request_body = {} + create_tenant_request_body['location'] = location + create_tenant_request_body['tags'] = tags + create_tenant_request_body['sku'] = {} + create_tenant_request_body['sku']['name'] = name + create_tenant_request_body['sku']['tier'] = "A0" + create_tenant_request_body['properties'] = {} + create_tenant_request_body['properties']['display_name'] = display_name + create_tenant_request_body['properties']['country_code'] = country_code + return sdk_no_wait(no_wait, + client.begin_create, + resource_group_name=resource_group_name, + resource_name=resource_name, + create_tenant_request_body=create_tenant_request_body) + + +def adb2c_tenant_update(client, + resource_group_name, + resource_name, + tags=None, + billing_type=None, + name=None): + update_tenant_request_body = {} + update_tenant_request_body['tags'] = tags + if billing_type: + update_tenant_request_body['billing_config'] = {} + update_tenant_request_body['billing_config']['billing_type'] = billing_type + if name: + update_tenant_request_body['sku'] = {} + update_tenant_request_body['sku']['name'] = name + update_tenant_request_body['sku']['tier'] = "A0" + return client.update(resource_group_name=resource_group_name, + resource_name=resource_name, + update_tenant_request_body=update_tenant_request_body) diff --git a/src/adb2c/azext_adb2c/tests/__init__.py b/src/adb2c/azext_adb2c/tests/__init__.py new file mode 100644 index 00000000000..70488e93851 --- /dev/null +++ b/src/adb2c/azext_adb2c/tests/__init__.py @@ -0,0 +1,116 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +import inspect +import logging +import os +import sys +import traceback +import datetime as dt + +from azure.core.exceptions import AzureError +from azure.cli.testsdk.exceptions import CliTestError, CliExecutionError, JMESPathCheckAssertionError + + +logger = logging.getLogger('azure.cli.testsdk') +logger.addHandler(logging.StreamHandler()) +__path__ = __import__('pkgutil').extend_path(__path__, __name__) +exceptions = [] +test_map = dict() +SUCCESSED = "successed" +FAILED = "failed" + + +def try_manual(func): + def import_manual_function(origin_func): + from importlib import import_module + decorated_path = inspect.getfile(origin_func).lower() + module_path = __path__[0].lower() + 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) + logger.info("Found manual override for %s(...)", func.__name__) + except (ImportError, AttributeError): + pass + return func_to_call + + def wrapper(*args, **kwargs): + func_to_call = get_func_to_call() + logger.info("running %s()...", func.__name__) + try: + test_map[func.__name__] = dict() + test_map[func.__name__]["result"] = SUCCESSED + test_map[func.__name__]["error_message"] = "" + test_map[func.__name__]["error_stack"] = "" + test_map[func.__name__]["error_normalized"] = "" + test_map[func.__name__]["start_dt"] = dt.datetime.utcnow() + ret = func_to_call(*args, **kwargs) + except (AssertionError, AzureError, CliTestError, CliExecutionError, SystemExit, + JMESPathCheckAssertionError) as e: + use_exception_cache = os.getenv("TEST_EXCEPTION_CACHE") + if use_exception_cache is None or use_exception_cache.lower() != "true": + raise + test_map[func.__name__]["end_dt"] = dt.datetime.utcnow() + test_map[func.__name__]["result"] = FAILED + test_map[func.__name__]["error_message"] = str(e).replace("\r\n", " ").replace("\n", " ")[:500] + test_map[func.__name__]["error_stack"] = traceback.format_exc().replace( + "\r\n", " ").replace("\n", " ")[:500] + logger.info("--------------------------------------") + logger.info("step exception: %s", e) + logger.error("--------------------------------------") + logger.error("step exception in %s: %s", func.__name__, e) + logger.info(traceback.format_exc()) + exceptions.append((func.__name__, sys.exc_info())) + else: + test_map[func.__name__]["end_dt"] = dt.datetime.utcnow() + return ret + + if inspect.isclass(func): + return get_func_to_call() + return wrapper + + +def calc_coverage(filename): + filename = filename.split(".")[0] + coverage_name = filename + "_coverage.md" + with open(coverage_name, "w") as f: + f.write("|Scenario|Result|ErrorMessage|ErrorStack|ErrorNormalized|StartDt|EndDt|\n") + total = len(test_map) + covered = 0 + for k, v in test_map.items(): + if not k.startswith("step_"): + total -= 1 + continue + if v["result"] == SUCCESSED: + covered += 1 + f.write("|{step_name}|{result}|{error_message}|{error_stack}|{error_normalized}|{start_dt}|" + "{end_dt}|\n".format(step_name=k, **v)) + f.write("Coverage: {}/{}\n".format(covered, total)) + print("Create coverage\n", file=sys.stderr) + + +def raise_if(): + if exceptions: + if len(exceptions) <= 1: + raise exceptions[0][1][1] + message = "{}\nFollowed with exceptions in other steps:\n".format(str(exceptions[0][1][1])) + message += "\n".join(["{}: {}".format(h[0], h[1][1]) for h in exceptions[1:]]) + raise exceptions[0][1][0](message).with_traceback(exceptions[0][1][2]) diff --git a/src/adb2c/azext_adb2c/tests/latest/__init__.py b/src/adb2c/azext_adb2c/tests/latest/__init__.py new file mode 100644 index 00000000000..c9cfdc73e77 --- /dev/null +++ b/src/adb2c/azext_adb2c/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/adb2c/azext_adb2c/tests/latest/example_steps.py b/src/adb2c/azext_adb2c/tests/latest/example_steps.py new file mode 100644 index 00000000000..a637c07da5b --- /dev/null +++ b/src/adb2c/azext_adb2c/tests/latest/example_steps.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. +# -------------------------------------------------------------------------- + + +from .. import try_manual + + +# EXAMPLE: /B2CTenants/put/Create tenant +@try_manual +def step_tenant_create(test, rg, rg_2, checks=None): + if checks is None: + checks = [] + test.cmd('az adb2c tenant create ' + '--location "United States" ' + '--country-code "US" ' + '--display-name "Contoso" ' + '--sku "Standard" ' + '--resource-group "{rg}" ' + '--name "contoso.onmicrosoft.com"', + checks=checks) + + +# EXAMPLE: /B2CTenants/get/B2CTenants_ListByResourceGroup +@try_manual +def step_tenant_list(test, rg, rg_2, checks=None): + if checks is None: + checks = [] + test.cmd('az adb2c tenant list ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /B2CTenants/get/B2CTenants_ListBySubscription +@try_manual +def step_tenant_list2(test, rg, rg_2, checks=None): + if checks is None: + checks = [] + test.cmd('az adb2c tenant list ' + '-g ""', + checks=checks) + + +# EXAMPLE: /B2CTenants/get/Get tenant +@try_manual +def step_tenant_show(test, rg, rg_2, checks=None): + if checks is None: + checks = [] + test.cmd('az adb2c tenant show ' + '--resource-group "{rg}" ' + '--name "contoso.onmicrosoft.com"', + checks=checks) + + +# EXAMPLE: /B2CTenants/patch/Update tenant +@try_manual +def step_tenant_update(test, rg, rg_2, checks=None): + if checks is None: + checks = [] + test.cmd('az adb2c tenant update ' + '--resource-group "{rg}" ' + '--name "contoso.onmicrosoft.com" ' + '--billing-type "MAU" ' + '--sku "PremiumP1" ' + '--tags key="value"', + checks=checks) + + +# EXAMPLE: /B2CTenants/delete/Delete tenant +@try_manual +def step_tenant_delete(test, rg, rg_2, checks=None): + if checks is None: + checks = [] + test.cmd('az adb2c tenant delete -y ' + '--resource-group "{rg_2}" ' + '--name "contoso.onmicrosoft.com"', + checks=checks) + diff --git a/src/adb2c/azext_adb2c/tests/latest/test_adb2c_scenario.py b/src/adb2c/azext_adb2c/tests/latest/test_adb2c_scenario.py new file mode 100644 index 00000000000..ed5e9442f93 --- /dev/null +++ b/src/adb2c/azext_adb2c/tests/latest/test_adb2c_scenario.py @@ -0,0 +1,71 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import os +from azure.cli.testsdk import ScenarioTest +from azure.cli.testsdk import ResourceGroupPreparer +from .example_steps import step_tenant_create +from .example_steps import step_tenant_list +from .example_steps import step_tenant_list2 +from .example_steps import step_tenant_update +from .example_steps import step_tenant_show +from .example_steps import step_tenant_delete +from .. import ( + try_manual, + raise_if, + calc_coverage +) + + +TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..')) + + +# Env setup_scenario +@try_manual +def setup_scenario(test, rg, rg_2): + pass + + +# Env cleanup_scenario +@try_manual +def cleanup_scenario(test, rg, rg_2): + pass + + +# Testcase: Scenario +@try_manual +def call_scenario(test, rg, rg_2): + setup_scenario(test, rg, rg_2) + # STEP NOT FOUND: Check name availability - available + # STEP NOT FOUND: Check name availability - taken + step_tenant_create(test, rg, rg_2, checks=[]) + step_tenant_list(test, rg, rg_2, checks=[]) + step_tenant_list2(test, rg, rg_2, checks=[]) + step_tenant_update(test, rg, rg_2, checks=[]) + step_tenant_show(test, rg, rg_2, checks=[]) + step_tenant_delete(test, rg, rg_2, checks=[]) + cleanup_scenario(test, rg, rg_2) + + +# Test class for Scenario +@try_manual +class Adb2cScenarioTest(ScenarioTest): + + def __init__(self, *args, **kwargs): + super(Adb2cScenarioTest, self).__init__(*args, **kwargs) + + + @ResourceGroupPreparer(name_prefix='clitestadb2c_contosoResourceGroup'[:7], key='rg', parameter_name='rg') + @ResourceGroupPreparer(name_prefix='clitestadb2c_rg1'[:7], key='rg_2', parameter_name='rg_2') + def test_adb2c_Scenario(self, rg, rg_2): + call_scenario(self, rg, rg_2) + calc_coverage(__file__) + raise_if() + diff --git a/src/adb2c/azext_adb2c/vendored_sdks/__init__.py b/src/adb2c/azext_adb2c/vendored_sdks/__init__.py new file mode 100644 index 00000000000..c9cfdc73e77 --- /dev/null +++ b/src/adb2c/azext_adb2c/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/adb2c/azext_adb2c/vendored_sdks/azureadb2c/__init__.py b/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/__init__.py new file mode 100644 index 00000000000..223e0381b0a --- /dev/null +++ b/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/__init__.py @@ -0,0 +1,16 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._cpim_configuration_client import CPIMConfigurationClient +__all__ = ['CPIMConfigurationClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/_configuration.py b/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/_configuration.py new file mode 100644 index 00000000000..1b547a7d43e --- /dev/null +++ b/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/_configuration.py @@ -0,0 +1,70 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + +VERSION = "unknown" + +class CPIMConfigurationClientConfiguration(Configuration): + """Configuration for CPIMConfigurationClient. + + 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: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :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(CPIMConfigurationClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2019-01-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-azureadb2c/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/_cpim_configuration_client.py b/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/_cpim_configuration_client.py new file mode 100644 index 00000000000..668d3bbc9d7 --- /dev/null +++ b/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/_cpim_configuration_client.py @@ -0,0 +1,75 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + +from ._configuration import CPIMConfigurationClientConfiguration +from .operations import B2CTenantsOperations +from .operations import Operations +from . import models + + +class CPIMConfigurationClient(object): + """CPIM Configuration Client. + + :ivar b2_ctenants: B2CTenantsOperations operations + :vartype b2_ctenants: $(python-base-namespace).v2019_01_01_preview.operations.B2CTenantsOperations + :ivar operations: Operations operations + :vartype operations: $(python-base-namespace).v2019_01_01_preview.operations.Operations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = CPIMConfigurationClientConfiguration(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._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.b2_ctenants = B2CTenantsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> CPIMConfigurationClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/aio/__init__.py b/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/aio/__init__.py new file mode 100644 index 00000000000..18526cb20b4 --- /dev/null +++ b/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/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 ._cpim_configuration_client import CPIMConfigurationClient +__all__ = ['CPIMConfigurationClient'] diff --git a/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/aio/_configuration.py b/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/aio/_configuration.py new file mode 100644 index 00000000000..b9759ca2f80 --- /dev/null +++ b/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/aio/_configuration.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +VERSION = "unknown" + +class CPIMConfigurationClientConfiguration(Configuration): + """Configuration for CPIMConfigurationClient. + + 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: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :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(CPIMConfigurationClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2019-01-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-azureadb2c/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/aio/_cpim_configuration_client.py b/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/aio/_cpim_configuration_client.py new file mode 100644 index 00000000000..0b6577a2895 --- /dev/null +++ b/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/aio/_cpim_configuration_client.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 Any, Optional, TYPE_CHECKING + +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import CPIMConfigurationClientConfiguration +from .operations import B2CTenantsOperations +from .operations import Operations +from .. import models + + +class CPIMConfigurationClient(object): + """CPIM Configuration Client. + + :ivar b2_ctenants: B2CTenantsOperations operations + :vartype b2_ctenants: $(python-base-namespace).v2019_01_01_preview.aio.operations.B2CTenantsOperations + :ivar operations: Operations operations + :vartype operations: $(python-base-namespace).v2019_01_01_preview.aio.operations.Operations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = CPIMConfigurationClientConfiguration(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._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.b2_ctenants = B2CTenantsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "CPIMConfigurationClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/aio/operations/__init__.py b/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/aio/operations/__init__.py new file mode 100644 index 00000000000..368202cb4d7 --- /dev/null +++ b/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/aio/operations/__init__.py @@ -0,0 +1,15 @@ +# 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 ._b2_ctenants_operations import B2CTenantsOperations +from ._operations import Operations + +__all__ = [ + 'B2CTenantsOperations', + 'Operations', +] diff --git a/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/aio/operations/_b2_ctenants_operations.py b/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/aio/operations/_b2_ctenants_operations.py new file mode 100644 index 00000000000..4535ee624eb --- /dev/null +++ b/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/aio/operations/_b2_ctenants_operations.py @@ -0,0 +1,621 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class B2CTenantsOperations: + """B2CTenantsOperations 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: ~$(python-base-namespace).v2019_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def check_name_availability( + self, + check_name_availability_request_body: Optional["models.CheckNameAvailabilityRequestBody"] = None, + **kwargs + ) -> "models.NameAvailabilityResponse": + """Checks the availability and validity of a domain name for the tenant. + + :param check_name_availability_request_body: + :type check_name_availability_request_body: ~$(python-base-namespace).v2019_01_01_preview.models.CheckNameAvailabilityRequestBody + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailabilityResponse, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2019_01_01_preview.models.NameAvailabilityResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.NameAvailabilityResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + 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) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if check_name_availability_request_body is not None: + body_content = self._serialize.body(check_name_availability_request_body, 'CheckNameAvailabilityRequestBody') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NameAvailabilityResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureActiveDirectory/checkNameAvailability'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["models.B2CTenantResourceList"]: + """Get all the Azure AD B2C tenant resources in 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: An iterator like instance of either B2CTenantResourceList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.B2CTenantResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_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') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('B2CTenantResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories'} # type: ignore + + def list_by_subscription( + self, + **kwargs + ) -> AsyncIterable["models.B2CTenantResourceList"]: + """Get all the Azure AD B2C tenant resources in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either B2CTenantResourceList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.B2CTenantResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + 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) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('B2CTenantResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureActiveDirectory/b2cDirectories'} # type: ignore + + async def get( + self, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> "models.B2CTenantResource": + """Get the Azure AD B2C tenant resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param resource_name: The initial domain name of the B2C tenant. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: B2CTenantResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.B2CTenantResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('B2CTenantResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + resource_name: str, + update_tenant_request_body: Optional["models.B2CTenantUpdateRequest"] = None, + **kwargs + ) -> "models.B2CTenantResource": + """Update the Azure AD B2C tenant resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param resource_name: The initial domain name of the B2C tenant. + :type resource_name: str + :param update_tenant_request_body: + :type update_tenant_request_body: ~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantUpdateRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: B2CTenantResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.B2CTenantResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + 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'), + 'resourceName': self._serialize.url("resource_name", resource_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'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if update_tenant_request_body is not None: + body_content = self._serialize.body(update_tenant_request_body, 'B2CTenantUpdateRequest') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('B2CTenantResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + resource_name: str, + create_tenant_request_body: Optional["models.CreateTenantRequestBody"] = None, + **kwargs + ) -> Optional["models.B2CTenantResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.B2CTenantResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + 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'), + 'resourceName': self._serialize.url("resource_name", resource_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'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if create_tenant_request_body is not None: + body_content = self._serialize.body(create_tenant_request_body, 'CreateTenantRequestBody') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('B2CTenantResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('B2CTenantResource', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore + + async def begin_create( + self, + resource_group_name: str, + resource_name: str, + create_tenant_request_body: Optional["models.CreateTenantRequestBody"] = None, + **kwargs + ) -> AsyncLROPoller["models.B2CTenantResource"]: + """Initiates an async request to create both the Azure AD B2C tenant and the corresponding Azure + resource linked to a subscription. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param resource_name: The initial domain name of the B2C tenant. + :type resource_name: str + :param create_tenant_request_body: + :type create_tenant_request_body: ~$(python-base-namespace).v2019_01_01_preview.models.CreateTenantRequestBody + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either B2CTenantResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.B2CTenantResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + create_tenant_request_body=create_tenant_request_body, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('B2CTenantResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Initiates an async operation to delete the Azure AD B2C tenant and Azure resource. The resource + deletion can only happen as the last step in `the tenant deletion process + `_. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param resource_name: The initial domain name of the B2C tenant. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore diff --git a/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/aio/operations/_operations.py b/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/aio/operations/_operations.py new file mode 100644 index 00000000000..ec346a1768c --- /dev/null +++ b/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/aio/operations/_operations.py @@ -0,0 +1,158 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations 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: ~$(python-base-namespace).v2019_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs + ) -> AsyncIterable["models.OperationListResult"]: + """Lists the operations available from this provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2019_01_01_preview.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.AzureActiveDirectory/operations'} # type: ignore + + async def get_async_status( + self, + operation_id: str, + **kwargs + ) -> "models.AsyncOperationStatus": + """Gets the status of the async operation. + + :param operation_id: The operation ID. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AsyncOperationStatus, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2019_01_01_preview.models.AsyncOperationStatus + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AsyncOperationStatus"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_async_status.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'operationId': self._serialize.url("operation_id", operation_id, '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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AsyncOperationStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_async_status.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureActiveDirectory/operations/{operationId}'} # type: ignore diff --git a/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/models/__init__.py b/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/models/__init__.py new file mode 100644 index 00000000000..32ee0f2c651 --- /dev/null +++ b/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/models/__init__.py @@ -0,0 +1,72 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import AsyncOperationStatus + from ._models_py3 import AsyncOperationStatusError + from ._models_py3 import B2CResourceSku + from ._models_py3 import B2CTenantResource + from ._models_py3 import B2CTenantResourceList + from ._models_py3 import B2CTenantResourcePropertiesBillingConfig + from ._models_py3 import B2CTenantUpdateRequest + from ._models_py3 import CheckNameAvailabilityRequestBody + from ._models_py3 import CreateTenantRequestBody + from ._models_py3 import CreateTenantRequestBodyProperties + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorResponse + from ._models_py3 import NameAvailabilityResponse + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationListResult +except (SyntaxError, ImportError): + from ._models import AsyncOperationStatus # type: ignore + from ._models import AsyncOperationStatusError # type: ignore + from ._models import B2CResourceSku # type: ignore + from ._models import B2CTenantResource # type: ignore + from ._models import B2CTenantResourceList # type: ignore + from ._models import B2CTenantResourcePropertiesBillingConfig # type: ignore + from ._models import B2CTenantUpdateRequest # type: ignore + from ._models import CheckNameAvailabilityRequestBody # type: ignore + from ._models import CreateTenantRequestBody # type: ignore + from ._models import CreateTenantRequestBodyProperties # type: ignore + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import NameAvailabilityResponse # type: ignore + from ._models import Operation # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationListResult # type: ignore + +from ._cpim_configuration_client_enums import ( + B2CResourceSkuName, + BillingType, + NameAvailabilityReasonType, + StatusType, +) + +__all__ = [ + 'AsyncOperationStatus', + 'AsyncOperationStatusError', + 'B2CResourceSku', + 'B2CTenantResource', + 'B2CTenantResourceList', + 'B2CTenantResourcePropertiesBillingConfig', + 'B2CTenantUpdateRequest', + 'CheckNameAvailabilityRequestBody', + 'CreateTenantRequestBody', + 'CreateTenantRequestBodyProperties', + 'ErrorAdditionalInfo', + 'ErrorResponse', + 'NameAvailabilityResponse', + 'Operation', + 'OperationDisplay', + 'OperationListResult', + 'B2CResourceSkuName', + 'BillingType', + 'NameAvailabilityReasonType', + 'StatusType', +] diff --git a/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/models/_cpim_configuration_client_enums.py b/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/models/_cpim_configuration_client_enums.py new file mode 100644 index 00000000000..65654295eb7 --- /dev/null +++ b/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/models/_cpim_configuration_client_enums.py @@ -0,0 +1,59 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class B2CResourceSkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The name of the SKU for the tenant. + """ + + STANDARD = "Standard" #: Azure AD B2C usage is billed to a linked Azure subscription and uses a monthly active users (MAU) billing model. + PREMIUM_P1 = "PremiumP1" #: Azure AD B2C usage is billed to a linked Azure subscription and uses number of authentications based billing. + PREMIUM_P2 = "PremiumP2" #: Azure AD B2C usage is billed to a linked Azure subscription and uses number of authentications based billing. + +class BillingType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of billing. Will be MAU for all new customers. If 'Auths', it can be updated to 'MAU'. + Cannot be changed if value is 'MAU'. Learn more about Azure AD B2C billing at + `aka.ms/b2cBilling `_. + """ + + MAU = "MAU" #: Azure AD B2C usage is billed to a linked Azure subscription and uses a monthly active users (MAU) billing model. + AUTHS = "Auths" #: Azure AD B2C usage is billed to a linked Azure subscription and uses number of authentications based billing. + +class NameAvailabilityReasonType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Describes the reason for the 'nameAvailable' value. + """ + + ALREADY_EXISTS = "AlreadyExists" #: The name is already in use and is therefore unavailable. + INVALID = "Invalid" #: The name provided does not match the resource provider’s naming requirements (incorrect length, unsupported characters, etc.). + +class StatusType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The status of the operation. + """ + + SUCCEEDED = "Succeeded" #: The operation succeeded. + PENDING = "Pending" #: The operation is pending. + FAILED = "Failed" #: The operation failed. diff --git a/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/models/_models.py b/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/models/_models.py new file mode 100644 index 00000000000..61b9eb428ca --- /dev/null +++ b/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/models/_models.py @@ -0,0 +1,573 @@ +# 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 msrest.serialization + + +class AsyncOperationStatus(msrest.serialization.Model): + """The async operation status. + + :param subscription_id: Subscription ID that the resource belongs to. + :type subscription_id: str + :param id: The GET resource path for the operation. + :type id: str + :param name: The operation ID. + :type name: str + :param status: The status of the operation. Possible values include: "Succeeded", "Pending", + "Failed". + :type status: str or ~$(python-base-namespace).v2019_01_01_preview.models.StatusType + :param start_time: Start time of the async operation. + :type start_time: str + :param end_time: End time of the async operation. + :type end_time: str + :param error: Error response if async operation failed. + :type error: ~$(python-base-namespace).v2019_01_01_preview.models.AsyncOperationStatusError + :param billing_config: The billing configuration for the tenant. + :type billing_config: ~$(python-base- + namespace).v2019_01_01_preview.models.B2CTenantResourcePropertiesBillingConfig + :param tenant_id: An identifier of the B2C tenant. + :type tenant_id: str + """ + + _attribute_map = { + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'str'}, + 'end_time': {'key': 'endTime', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'AsyncOperationStatusError'}, + 'billing_config': {'key': 'properties.billingConfig', 'type': 'B2CTenantResourcePropertiesBillingConfig'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AsyncOperationStatus, self).__init__(**kwargs) + self.subscription_id = kwargs.get('subscription_id', None) + self.id = kwargs.get('id', None) + self.name = kwargs.get('name', None) + self.status = kwargs.get('status', None) + self.start_time = kwargs.get('start_time', None) + self.end_time = kwargs.get('end_time', None) + self.error = kwargs.get('error', None) + self.billing_config = kwargs.get('billing_config', None) + self.tenant_id = kwargs.get('tenant_id', None) + + +class AsyncOperationStatusError(msrest.serialization.Model): + """Error response if async operation failed. + + :param code: Error code. + :type code: str + :param message: Error message. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AsyncOperationStatusError, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + + +class B2CResourceSku(msrest.serialization.Model): + """SKU properties of the Azure AD B2C tenant. Learn more about Azure AD B2C billing at `aka.ms/b2cBilling `_. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param name: The name of the SKU for the tenant. Possible values include: "Standard", + "PremiumP1", "PremiumP2". + :type name: str or ~$(python-base-namespace).v2019_01_01_preview.models.B2CResourceSkuName + :ivar tier: The tier of the tenant. Default value: "A0". + :vartype tier: str + """ + + _validation = { + 'tier': {'constant': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + } + + tier = "A0" + + def __init__( + self, + **kwargs + ): + super(B2CResourceSku, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + + +class B2CTenantResource(msrest.serialization.Model): + """B2CTenantResource. + + 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 type: The type of the B2C tenant resource. Default value: + "Microsoft.AzureActiveDirectory/b2cDirectories". + :vartype type: str + :param sku: Required. SKU properties of the Azure AD B2C tenant. Learn more about Azure AD B2C + billing at `aka.ms/b2cBilling `_. + :type sku: ~$(python-base-namespace).v2019_01_01_preview.models.B2CResourceSku + :ivar id: An identifier that represents the B2C tenant resource. + :vartype id: str + :ivar name: The name of the B2C tenant resource. + :vartype name: str + :param location: Required. The location in which the resource is hosted and data resides. Refer + to `this documentation `_ to see valid data residency + locations. Please choose one of 'United States', 'Europe', and 'Asia Pacific'. + :type location: str + :param tags: A set of tags. Resource Tags. + :type tags: dict[str, str] + :param billing_config: The billing configuration for the tenant. + :type billing_config: ~$(python-base- + namespace).v2019_01_01_preview.models.B2CTenantResourcePropertiesBillingConfig + :param tenant_id: An identifier of the B2C tenant. + :type tenant_id: str + """ + + _validation = { + 'type': {'readonly': True, 'constant': True}, + 'sku': {'required': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'B2CResourceSku'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'billing_config': {'key': 'properties.billingConfig', 'type': 'B2CTenantResourcePropertiesBillingConfig'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + } + + type = "Microsoft.AzureActiveDirectory/b2cDirectories" + + def __init__( + self, + **kwargs + ): + super(B2CTenantResource, self).__init__(**kwargs) + self.type = None + self.sku = kwargs['sku'] + self.id = None + self.name = None + self.location = kwargs['location'] + self.tags = kwargs.get('tags', None) + self.billing_config = kwargs.get('billing_config', None) + self.tenant_id = kwargs.get('tenant_id', None) + + +class B2CTenantResourceList(msrest.serialization.Model): + """The collection of Azure AD B2C tenant resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of guest usages resources. + :vartype value: list[~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResource] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[B2CTenantResource]'}, + } + + def __init__( + self, + **kwargs + ): + super(B2CTenantResourceList, self).__init__(**kwargs) + self.value = None + + +class B2CTenantResourcePropertiesBillingConfig(msrest.serialization.Model): + """The billing configuration for the tenant. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param billing_type: The type of billing. Will be MAU for all new customers. If 'Auths', it can + be updated to 'MAU'. Cannot be changed if value is 'MAU'. Learn more about Azure AD B2C billing + at `aka.ms/b2cBilling `_. Possible values include: "MAU", "Auths". + :type billing_type: str or ~$(python-base-namespace).v2019_01_01_preview.models.BillingType + :ivar effective_start_date_utc: The data from which the billing type took effect. + :vartype effective_start_date_utc: str + """ + + _validation = { + 'effective_start_date_utc': {'readonly': True}, + } + + _attribute_map = { + 'billing_type': {'key': 'billingType', 'type': 'str'}, + 'effective_start_date_utc': {'key': 'effectiveStartDateUtc', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(B2CTenantResourcePropertiesBillingConfig, self).__init__(**kwargs) + self.billing_type = kwargs.get('billing_type', None) + self.effective_start_date_utc = None + + +class B2CTenantUpdateRequest(msrest.serialization.Model): + """The request body to update the Azure AD B2C tenant resource. + + :param sku: SKU properties of the Azure AD B2C tenant. Learn more about Azure AD B2C billing at + `aka.ms/b2cBilling `_. + :type sku: ~$(python-base-namespace).v2019_01_01_preview.models.B2CResourceSku + :param tags: A set of tags. Resource Tags. + :type tags: dict[str, str] + :param billing_config: The billing configuration for the tenant. + :type billing_config: ~$(python-base- + namespace).v2019_01_01_preview.models.B2CTenantResourcePropertiesBillingConfig + :param tenant_id: An identifier of the B2C tenant. + :type tenant_id: str + """ + + _attribute_map = { + 'sku': {'key': 'sku', 'type': 'B2CResourceSku'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'billing_config': {'key': 'properties.billingConfig', 'type': 'B2CTenantResourcePropertiesBillingConfig'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(B2CTenantUpdateRequest, self).__init__(**kwargs) + self.sku = kwargs.get('sku', None) + self.tags = kwargs.get('tags', None) + self.billing_config = kwargs.get('billing_config', None) + self.tenant_id = kwargs.get('tenant_id', None) + + +class CheckNameAvailabilityRequestBody(msrest.serialization.Model): + """The information required to check the availability of the name for the tenant. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The domain name to check for availability. + :type name: str + :param country_code: Required. Country code of Azure tenant (e.g. 'US'). Refer to + `aka.ms/B2CDataResidency `_ to see valid country codes and + corresponding data residency locations. If you do not see a country code in an valid data + residency location, choose one from the list. + :type country_code: str + """ + + _validation = { + 'name': {'required': True}, + 'country_code': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'country_code': {'key': 'countryCode', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CheckNameAvailabilityRequestBody, self).__init__(**kwargs) + self.name = kwargs['name'] + self.country_code = kwargs['country_code'] + + +class CreateTenantRequestBody(msrest.serialization.Model): + """The information needed to create the Azure AD B2C tenant and corresponding Azure resource, which is used for billing purposes. + + All required parameters must be populated in order to send to Azure. + + :param location: Required. The location in which the resource is hosted and data resides. Refer + to `this documentation `_ to see valid data residency + locations. Please choose one of 'United States', 'Europe', and 'Asia Pacific'. + :type location: str + :param properties: Required. + :type properties: ~$(python-base- + namespace).v2019_01_01_preview.models.CreateTenantRequestBodyProperties + :param sku: Required. SKU properties of the Azure AD B2C tenant. Learn more about Azure AD B2C + billing at `aka.ms/b2cBilling `_. + :type sku: ~$(python-base-namespace).v2019_01_01_preview.models.B2CResourceSku + :param tags: A set of tags. Resource Tags. + :type tags: dict[str, str] + """ + + _validation = { + 'location': {'required': True}, + 'properties': {'required': True}, + 'sku': {'required': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'CreateTenantRequestBodyProperties'}, + 'sku': {'key': 'sku', 'type': 'B2CResourceSku'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(CreateTenantRequestBody, self).__init__(**kwargs) + self.location = kwargs['location'] + self.properties = kwargs['properties'] + self.sku = kwargs['sku'] + self.tags = kwargs.get('tags', None) + + +class CreateTenantRequestBodyProperties(msrest.serialization.Model): + """CreateTenantRequestBodyProperties. + + :param display_name: The display name of the B2C tenant. + :type display_name: str + :param country_code: Country code of Azure tenant (e.g. 'US'). Refer to + `aka.ms/B2CDataResidency `_ to see valid country codes and + corresponding data residency locations. If you do not see a country code in an valid data + residency location, choose one from the list. + :type country_code: str + """ + + _attribute_map = { + 'display_name': {'key': 'createTenantProperties.displayName', 'type': 'str'}, + 'country_code': {'key': 'createTenantProperties.countryCode', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CreateTenantRequestBodyProperties, self).__init__(**kwargs) + self.display_name = kwargs.get('display_name', None) + self.country_code = kwargs.get('country_code', None) + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~$(python-base-namespace).v2019_01_01_preview.models.ErrorResponse] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~$(python-base- + namespace).v2019_01_01_preview.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponse]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class NameAvailabilityResponse(msrest.serialization.Model): + """Response of the CheckNameAvailability operation. + + :param message: Description of the reason if name is not available. + :type message: str + :param name_available: True if the name is available and can be used to create a new tenant. + Otherwise false. + :type name_available: bool + :param reason: Describes the reason for the 'nameAvailable' value. Possible values include: + "AlreadyExists", "Invalid". + :type reason: str or ~$(python-base- + namespace).v2019_01_01_preview.models.NameAvailabilityReasonType + """ + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NameAvailabilityResponse, self).__init__(**kwargs) + self.message = kwargs.get('message', None) + self.name_available = kwargs.get('name_available', None) + self.reason = kwargs.get('reason', None) + + +class Operation(msrest.serialization.Model): + """Microsoft.AzureActiveDirectory REST API operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :param display: The object that represents the operation. + :type display: ~$(python-base-namespace).v2019_01_01_preview.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = kwargs.get('display', None) + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: Service provider: Microsoft.AzureActiveDirectory. + :vartype provider: str + :ivar resource: Resource on which the operation is performed: GuestUsages, etc. + :vartype resource: str + :ivar operation: Operation type: Read, write, delete, etc. + :vartype operation: str + :param description: Friendly name of the operation. + :type description: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = kwargs.get('description', None) + + +class OperationListResult(msrest.serialization.Model): + """Result of listing operations for the resourceProvider. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of cpim service operations supported by the Microsoft.AzureActiveDirectory + resource provider. + :vartype value: list[~$(python-base-namespace).v2019_01_01_preview.models.Operation] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = None diff --git a/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/models/_models_py3.py b/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/models/_models_py3.py new file mode 100644 index 00000000000..7333da148c5 --- /dev/null +++ b/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/models/_models_py3.py @@ -0,0 +1,624 @@ +# 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, Optional, Union + +import msrest.serialization + +from ._cpim_configuration_client_enums import * + + +class AsyncOperationStatus(msrest.serialization.Model): + """The async operation status. + + :param subscription_id: Subscription ID that the resource belongs to. + :type subscription_id: str + :param id: The GET resource path for the operation. + :type id: str + :param name: The operation ID. + :type name: str + :param status: The status of the operation. Possible values include: "Succeeded", "Pending", + "Failed". + :type status: str or ~$(python-base-namespace).v2019_01_01_preview.models.StatusType + :param start_time: Start time of the async operation. + :type start_time: str + :param end_time: End time of the async operation. + :type end_time: str + :param error: Error response if async operation failed. + :type error: ~$(python-base-namespace).v2019_01_01_preview.models.AsyncOperationStatusError + :param billing_config: The billing configuration for the tenant. + :type billing_config: ~$(python-base- + namespace).v2019_01_01_preview.models.B2CTenantResourcePropertiesBillingConfig + :param tenant_id: An identifier of the B2C tenant. + :type tenant_id: str + """ + + _attribute_map = { + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'str'}, + 'end_time': {'key': 'endTime', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'AsyncOperationStatusError'}, + 'billing_config': {'key': 'properties.billingConfig', 'type': 'B2CTenantResourcePropertiesBillingConfig'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + } + + def __init__( + self, + *, + subscription_id: Optional[str] = None, + id: Optional[str] = None, + name: Optional[str] = None, + status: Optional[Union[str, "StatusType"]] = None, + start_time: Optional[str] = None, + end_time: Optional[str] = None, + error: Optional["AsyncOperationStatusError"] = None, + billing_config: Optional["B2CTenantResourcePropertiesBillingConfig"] = None, + tenant_id: Optional[str] = None, + **kwargs + ): + super(AsyncOperationStatus, self).__init__(**kwargs) + self.subscription_id = subscription_id + self.id = id + self.name = name + self.status = status + self.start_time = start_time + self.end_time = end_time + self.error = error + self.billing_config = billing_config + self.tenant_id = tenant_id + + +class AsyncOperationStatusError(msrest.serialization.Model): + """Error response if async operation failed. + + :param code: Error code. + :type code: str + :param message: Error message. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): + super(AsyncOperationStatusError, self).__init__(**kwargs) + self.code = code + self.message = message + + +class B2CResourceSku(msrest.serialization.Model): + """SKU properties of the Azure AD B2C tenant. Learn more about Azure AD B2C billing at `aka.ms/b2cBilling `_. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param name: The name of the SKU for the tenant. Possible values include: "Standard", + "PremiumP1", "PremiumP2". + :type name: str or ~$(python-base-namespace).v2019_01_01_preview.models.B2CResourceSkuName + :ivar tier: The tier of the tenant. Default value: "A0". + :vartype tier: str + """ + + _validation = { + 'tier': {'constant': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + } + + tier = "A0" + + def __init__( + self, + *, + name: Optional[Union[str, "B2CResourceSkuName"]] = None, + **kwargs + ): + super(B2CResourceSku, self).__init__(**kwargs) + self.name = name + + +class B2CTenantResource(msrest.serialization.Model): + """B2CTenantResource. + + 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 type: The type of the B2C tenant resource. Default value: + "Microsoft.AzureActiveDirectory/b2cDirectories". + :vartype type: str + :param sku: Required. SKU properties of the Azure AD B2C tenant. Learn more about Azure AD B2C + billing at `aka.ms/b2cBilling `_. + :type sku: ~$(python-base-namespace).v2019_01_01_preview.models.B2CResourceSku + :ivar id: An identifier that represents the B2C tenant resource. + :vartype id: str + :ivar name: The name of the B2C tenant resource. + :vartype name: str + :param location: Required. The location in which the resource is hosted and data resides. Refer + to `this documentation `_ to see valid data residency + locations. Please choose one of 'United States', 'Europe', and 'Asia Pacific'. + :type location: str + :param tags: A set of tags. Resource Tags. + :type tags: dict[str, str] + :param billing_config: The billing configuration for the tenant. + :type billing_config: ~$(python-base- + namespace).v2019_01_01_preview.models.B2CTenantResourcePropertiesBillingConfig + :param tenant_id: An identifier of the B2C tenant. + :type tenant_id: str + """ + + _validation = { + 'type': {'readonly': True, 'constant': True}, + 'sku': {'required': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'B2CResourceSku'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'billing_config': {'key': 'properties.billingConfig', 'type': 'B2CTenantResourcePropertiesBillingConfig'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + } + + type = "Microsoft.AzureActiveDirectory/b2cDirectories" + + def __init__( + self, + *, + sku: "B2CResourceSku", + location: str, + tags: Optional[Dict[str, str]] = None, + billing_config: Optional["B2CTenantResourcePropertiesBillingConfig"] = None, + tenant_id: Optional[str] = None, + **kwargs + ): + super(B2CTenantResource, self).__init__(**kwargs) + self.type = None + self.sku = sku + self.id = None + self.name = None + self.location = location + self.tags = tags + self.billing_config = billing_config + self.tenant_id = tenant_id + + +class B2CTenantResourceList(msrest.serialization.Model): + """The collection of Azure AD B2C tenant resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of guest usages resources. + :vartype value: list[~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResource] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[B2CTenantResource]'}, + } + + def __init__( + self, + **kwargs + ): + super(B2CTenantResourceList, self).__init__(**kwargs) + self.value = None + + +class B2CTenantResourcePropertiesBillingConfig(msrest.serialization.Model): + """The billing configuration for the tenant. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param billing_type: The type of billing. Will be MAU for all new customers. If 'Auths', it can + be updated to 'MAU'. Cannot be changed if value is 'MAU'. Learn more about Azure AD B2C billing + at `aka.ms/b2cBilling `_. Possible values include: "MAU", "Auths". + :type billing_type: str or ~$(python-base-namespace).v2019_01_01_preview.models.BillingType + :ivar effective_start_date_utc: The data from which the billing type took effect. + :vartype effective_start_date_utc: str + """ + + _validation = { + 'effective_start_date_utc': {'readonly': True}, + } + + _attribute_map = { + 'billing_type': {'key': 'billingType', 'type': 'str'}, + 'effective_start_date_utc': {'key': 'effectiveStartDateUtc', 'type': 'str'}, + } + + def __init__( + self, + *, + billing_type: Optional[Union[str, "BillingType"]] = None, + **kwargs + ): + super(B2CTenantResourcePropertiesBillingConfig, self).__init__(**kwargs) + self.billing_type = billing_type + self.effective_start_date_utc = None + + +class B2CTenantUpdateRequest(msrest.serialization.Model): + """The request body to update the Azure AD B2C tenant resource. + + :param sku: SKU properties of the Azure AD B2C tenant. Learn more about Azure AD B2C billing at + `aka.ms/b2cBilling `_. + :type sku: ~$(python-base-namespace).v2019_01_01_preview.models.B2CResourceSku + :param tags: A set of tags. Resource Tags. + :type tags: dict[str, str] + :param billing_config: The billing configuration for the tenant. + :type billing_config: ~$(python-base- + namespace).v2019_01_01_preview.models.B2CTenantResourcePropertiesBillingConfig + :param tenant_id: An identifier of the B2C tenant. + :type tenant_id: str + """ + + _attribute_map = { + 'sku': {'key': 'sku', 'type': 'B2CResourceSku'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'billing_config': {'key': 'properties.billingConfig', 'type': 'B2CTenantResourcePropertiesBillingConfig'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + } + + def __init__( + self, + *, + sku: Optional["B2CResourceSku"] = None, + tags: Optional[Dict[str, str]] = None, + billing_config: Optional["B2CTenantResourcePropertiesBillingConfig"] = None, + tenant_id: Optional[str] = None, + **kwargs + ): + super(B2CTenantUpdateRequest, self).__init__(**kwargs) + self.sku = sku + self.tags = tags + self.billing_config = billing_config + self.tenant_id = tenant_id + + +class CheckNameAvailabilityRequestBody(msrest.serialization.Model): + """The information required to check the availability of the name for the tenant. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The domain name to check for availability. + :type name: str + :param country_code: Required. Country code of Azure tenant (e.g. 'US'). Refer to + `aka.ms/B2CDataResidency `_ to see valid country codes and + corresponding data residency locations. If you do not see a country code in an valid data + residency location, choose one from the list. + :type country_code: str + """ + + _validation = { + 'name': {'required': True}, + 'country_code': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'country_code': {'key': 'countryCode', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + country_code: str, + **kwargs + ): + super(CheckNameAvailabilityRequestBody, self).__init__(**kwargs) + self.name = name + self.country_code = country_code + + +class CreateTenantRequestBody(msrest.serialization.Model): + """The information needed to create the Azure AD B2C tenant and corresponding Azure resource, which is used for billing purposes. + + All required parameters must be populated in order to send to Azure. + + :param location: Required. The location in which the resource is hosted and data resides. Refer + to `this documentation `_ to see valid data residency + locations. Please choose one of 'United States', 'Europe', and 'Asia Pacific'. + :type location: str + :param properties: Required. + :type properties: ~$(python-base- + namespace).v2019_01_01_preview.models.CreateTenantRequestBodyProperties + :param sku: Required. SKU properties of the Azure AD B2C tenant. Learn more about Azure AD B2C + billing at `aka.ms/b2cBilling `_. + :type sku: ~$(python-base-namespace).v2019_01_01_preview.models.B2CResourceSku + :param tags: A set of tags. Resource Tags. + :type tags: dict[str, str] + """ + + _validation = { + 'location': {'required': True}, + 'properties': {'required': True}, + 'sku': {'required': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'CreateTenantRequestBodyProperties'}, + 'sku': {'key': 'sku', 'type': 'B2CResourceSku'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + location: str, + properties: "CreateTenantRequestBodyProperties", + sku: "B2CResourceSku", + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(CreateTenantRequestBody, self).__init__(**kwargs) + self.location = location + self.properties = properties + self.sku = sku + self.tags = tags + + +class CreateTenantRequestBodyProperties(msrest.serialization.Model): + """CreateTenantRequestBodyProperties. + + :param display_name: The display name of the B2C tenant. + :type display_name: str + :param country_code: Country code of Azure tenant (e.g. 'US'). Refer to + `aka.ms/B2CDataResidency `_ to see valid country codes and + corresponding data residency locations. If you do not see a country code in an valid data + residency location, choose one from the list. + :type country_code: str + """ + + _attribute_map = { + 'display_name': {'key': 'createTenantProperties.displayName', 'type': 'str'}, + 'country_code': {'key': 'createTenantProperties.countryCode', 'type': 'str'}, + } + + def __init__( + self, + *, + display_name: Optional[str] = None, + country_code: Optional[str] = None, + **kwargs + ): + super(CreateTenantRequestBodyProperties, self).__init__(**kwargs) + self.display_name = display_name + self.country_code = country_code + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~$(python-base-namespace).v2019_01_01_preview.models.ErrorResponse] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~$(python-base- + namespace).v2019_01_01_preview.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponse]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class NameAvailabilityResponse(msrest.serialization.Model): + """Response of the CheckNameAvailability operation. + + :param message: Description of the reason if name is not available. + :type message: str + :param name_available: True if the name is available and can be used to create a new tenant. + Otherwise false. + :type name_available: bool + :param reason: Describes the reason for the 'nameAvailable' value. Possible values include: + "AlreadyExists", "Invalid". + :type reason: str or ~$(python-base- + namespace).v2019_01_01_preview.models.NameAvailabilityReasonType + """ + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + } + + def __init__( + self, + *, + message: Optional[str] = None, + name_available: Optional[bool] = None, + reason: Optional[Union[str, "NameAvailabilityReasonType"]] = None, + **kwargs + ): + super(NameAvailabilityResponse, self).__init__(**kwargs) + self.message = message + self.name_available = name_available + self.reason = reason + + +class Operation(msrest.serialization.Model): + """Microsoft.AzureActiveDirectory REST API operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :param display: The object that represents the operation. + :type display: ~$(python-base-namespace).v2019_01_01_preview.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + *, + display: Optional["OperationDisplay"] = None, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = display + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: Service provider: Microsoft.AzureActiveDirectory. + :vartype provider: str + :ivar resource: Resource on which the operation is performed: GuestUsages, etc. + :vartype resource: str + :ivar operation: Operation type: Read, write, delete, etc. + :vartype operation: str + :param description: Friendly name of the operation. + :type description: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = description + + +class OperationListResult(msrest.serialization.Model): + """Result of listing operations for the resourceProvider. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of cpim service operations supported by the Microsoft.AzureActiveDirectory + resource provider. + :vartype value: list[~$(python-base-namespace).v2019_01_01_preview.models.Operation] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = None diff --git a/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/operations/__init__.py b/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/operations/__init__.py new file mode 100644 index 00000000000..368202cb4d7 --- /dev/null +++ b/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/operations/__init__.py @@ -0,0 +1,15 @@ +# 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 ._b2_ctenants_operations import B2CTenantsOperations +from ._operations import Operations + +__all__ = [ + 'B2CTenantsOperations', + 'Operations', +] diff --git a/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/operations/_b2_ctenants_operations.py b/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/operations/_b2_ctenants_operations.py new file mode 100644 index 00000000000..ef89d18ee0f --- /dev/null +++ b/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/operations/_b2_ctenants_operations.py @@ -0,0 +1,634 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class B2CTenantsOperations(object): + """B2CTenantsOperations 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: ~$(python-base-namespace).v2019_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def check_name_availability( + self, + check_name_availability_request_body=None, # type: Optional["models.CheckNameAvailabilityRequestBody"] + **kwargs # type: Any + ): + # type: (...) -> "models.NameAvailabilityResponse" + """Checks the availability and validity of a domain name for the tenant. + + :param check_name_availability_request_body: + :type check_name_availability_request_body: ~$(python-base-namespace).v2019_01_01_preview.models.CheckNameAvailabilityRequestBody + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailabilityResponse, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2019_01_01_preview.models.NameAvailabilityResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.NameAvailabilityResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + 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) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if check_name_availability_request_body is not None: + body_content = self._serialize.body(check_name_availability_request_body, 'CheckNameAvailabilityRequestBody') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NameAvailabilityResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureActiveDirectory/checkNameAvailability'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.B2CTenantResourceList"] + """Get all the Azure AD B2C tenant resources in 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: An iterator like instance of either B2CTenantResourceList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.B2CTenantResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_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') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('B2CTenantResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories'} # type: ignore + + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.B2CTenantResourceList"] + """Get all the Azure AD B2C tenant resources in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either B2CTenantResourceList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.B2CTenantResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + 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) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('B2CTenantResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureActiveDirectory/b2cDirectories'} # type: ignore + + def get( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.B2CTenantResource" + """Get the Azure AD B2C tenant resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param resource_name: The initial domain name of the B2C tenant. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: B2CTenantResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.B2CTenantResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('B2CTenantResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + resource_name, # type: str + update_tenant_request_body=None, # type: Optional["models.B2CTenantUpdateRequest"] + **kwargs # type: Any + ): + # type: (...) -> "models.B2CTenantResource" + """Update the Azure AD B2C tenant resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param resource_name: The initial domain name of the B2C tenant. + :type resource_name: str + :param update_tenant_request_body: + :type update_tenant_request_body: ~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantUpdateRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: B2CTenantResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.B2CTenantResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + 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'), + 'resourceName': self._serialize.url("resource_name", resource_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'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if update_tenant_request_body is not None: + body_content = self._serialize.body(update_tenant_request_body, 'B2CTenantUpdateRequest') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('B2CTenantResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore + + def _create_initial( + self, + resource_group_name, # type: str + resource_name, # type: str + create_tenant_request_body=None, # type: Optional["models.CreateTenantRequestBody"] + **kwargs # type: Any + ): + # type: (...) -> Optional["models.B2CTenantResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.B2CTenantResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + 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'), + 'resourceName': self._serialize.url("resource_name", resource_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'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if create_tenant_request_body is not None: + body_content = self._serialize.body(create_tenant_request_body, 'CreateTenantRequestBody') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('B2CTenantResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('B2CTenantResource', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore + + def begin_create( + self, + resource_group_name, # type: str + resource_name, # type: str + create_tenant_request_body=None, # type: Optional["models.CreateTenantRequestBody"] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.B2CTenantResource"] + """Initiates an async request to create both the Azure AD B2C tenant and the corresponding Azure + resource linked to a subscription. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param resource_name: The initial domain name of the B2C tenant. + :type resource_name: str + :param create_tenant_request_body: + :type create_tenant_request_body: ~$(python-base-namespace).v2019_01_01_preview.models.CreateTenantRequestBody + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either B2CTenantResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.B2CTenantResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + create_tenant_request_body=create_tenant_request_body, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('B2CTenantResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Initiates an async operation to delete the Azure AD B2C tenant and Azure resource. The resource + deletion can only happen as the last step in `the tenant deletion process + `_. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param resource_name: The initial domain name of the B2C tenant. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore diff --git a/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/operations/_operations.py b/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/operations/_operations.py new file mode 100644 index 00000000000..87542c9a52e --- /dev/null +++ b/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/operations/_operations.py @@ -0,0 +1,164 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class Operations(object): + """Operations 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: ~$(python-base-namespace).v2019_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.OperationListResult"] + """Lists the operations available from this provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2019_01_01_preview.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.AzureActiveDirectory/operations'} # type: ignore + + def get_async_status( + self, + operation_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.AsyncOperationStatus" + """Gets the status of the async operation. + + :param operation_id: The operation ID. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AsyncOperationStatus, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2019_01_01_preview.models.AsyncOperationStatus + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AsyncOperationStatus"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_async_status.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'operationId': self._serialize.url("operation_id", operation_id, '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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AsyncOperationStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_async_status.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureActiveDirectory/operations/{operationId}'} # type: ignore diff --git a/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/py.typed b/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/py.typed new file mode 100644 index 00000000000..e5aff4f83af --- /dev/null +++ b/src/adb2c/azext_adb2c/vendored_sdks/azureadb2c/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/src/adb2c/gen.zip b/src/adb2c/gen.zip new file mode 100644 index 00000000000..41015a1e745 Binary files /dev/null and b/src/adb2c/gen.zip differ diff --git a/src/adb2c/report.md b/src/adb2c/report.md new file mode 100644 index 00000000000..494f9b0b949 --- /dev/null +++ b/src/adb2c/report.md @@ -0,0 +1,105 @@ +# Azure CLI Module Creation Report + +## EXTENSION +|CLI Extension|Command Groups| +|---------|------------| +|az adb2c|[groups](#CommandGroups) + +## GROUPS +### Command groups in `az adb2c` extension +|CLI Command Group|Group Swagger name|Commands| +|---------|------------|--------| +|az adb2c tenant|B2CTenants|[commands](#CommandsInB2CTenants)| + +## COMMANDS +### Commands in `az adb2c tenant` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az adb2c tenant list](#B2CTenantsListByResourceGroup)|ListByResourceGroup|[Parameters](#ParametersB2CTenantsListByResourceGroup)|[Example](#ExamplesB2CTenantsListByResourceGroup)| +|[az adb2c tenant list](#B2CTenantsListBySubscription)|ListBySubscription|[Parameters](#ParametersB2CTenantsListBySubscription)|[Example](#ExamplesB2CTenantsListBySubscription)| +|[az adb2c tenant show](#B2CTenantsGet)|Get|[Parameters](#ParametersB2CTenantsGet)|[Example](#ExamplesB2CTenantsGet)| +|[az adb2c tenant create](#B2CTenantsCreate)|Create|[Parameters](#ParametersB2CTenantsCreate)|[Example](#ExamplesB2CTenantsCreate)| +|[az adb2c tenant update](#B2CTenantsUpdate)|Update|[Parameters](#ParametersB2CTenantsUpdate)|[Example](#ExamplesB2CTenantsUpdate)| +|[az adb2c tenant delete](#B2CTenantsDelete)|Delete|[Parameters](#ParametersB2CTenantsDelete)|[Example](#ExamplesB2CTenantsDelete)| + + +## COMMAND DETAILS + +### group `az adb2c tenant` +#### Command `az adb2c tenant list` + +##### Example +``` +az adb2c tenant list --resource-group "contosoResourceGroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group.|resource_group_name|resourceGroupName| + +#### Command `az adb2c tenant list` + +##### Example +``` +az adb2c tenant list +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +#### Command `az adb2c tenant show` + +##### Example +``` +az adb2c tenant show --resource-group "contosoResourceGroup" --name "contoso.onmicrosoft.com" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group.|resource_group_name|resourceGroupName| +|**--resource-name**|string|The initial domain name of the B2C tenant.|resource_name|resourceName| + +#### Command `az adb2c tenant create` + +##### Example +``` +az adb2c tenant create --location "United States" --country-code "US" --display-name "Contoso" --sku "Standard" \ +--resource-group "contosoResourceGroup" --name "contoso.onmicrosoft.com" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group.|resource_group_name|resourceGroupName| +|**--resource-name**|string|The initial domain name of the B2C tenant.|resource_name|resourceName| +|**--location**|string|The location in which the resource is hosted and data resides. Refer to [this documentation](https://aka.ms/B2CDataResidency) to see valid data residency locations. Please choose one of 'United States', 'Europe', and 'Asia Pacific'.|location|location| +|**--tags**|dictionary|Resource Tags|tags|tags| +|**--name**|sealed-choice|The name of the SKU for the tenant.|name|name| +|**--display-name**|string|The display name of the B2C tenant.|display_name|displayName| +|**--country-code**|string|Country code of Azure tenant (e.g. 'US'). Refer to [aka.ms/B2CDataResidency](https://aka.ms/B2CDataResidency) to see valid country codes and corresponding data residency locations. If you do not see a country code in an valid data residency location, choose one from the list.|country_code|countryCode| + +#### Command `az adb2c tenant update` + +##### Example +``` +az adb2c tenant update --resource-group "contosoResourceGroup" --name "contoso.onmicrosoft.com" --billing-type "MAU" \ +--sku "PremiumP1" --tags key="value" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group.|resource_group_name|resourceGroupName| +|**--resource-name**|string|The initial domain name of the B2C tenant.|resource_name|resourceName| +|**--tags**|dictionary|Resource Tags|tags|tags| +|**--billing-type**|sealed-choice|The type of billing. Will be MAU for all new customers. If 'Auths', it can be updated to 'MAU'. Cannot be changed if value is 'MAU'. Learn more about Azure AD B2C billing at [aka.ms/b2cBilling](https://aka.ms/b2cbilling).|billing_type|billingType| +|**--name**|sealed-choice|The name of the SKU for the tenant.|name|name| + +#### Command `az adb2c tenant delete` + +##### Example +``` +az adb2c tenant delete --resource-group "rg1" --name "contoso.onmicrosoft.com" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group.|resource_group_name|resourceGroupName| +|**--resource-name**|string|The initial domain name of the B2C tenant.|resource_name|resourceName| diff --git a/src/adb2c/setup.cfg b/src/adb2c/setup.cfg new file mode 100644 index 00000000000..2fdd96e5d39 --- /dev/null +++ b/src/adb2c/setup.cfg @@ -0,0 +1 @@ +#setup.cfg \ No newline at end of file diff --git a/src/adb2c/setup.py b/src/adb2c/setup.py new file mode 100644 index 00000000000..e9f765db919 --- /dev/null +++ b/src/adb2c/setup.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python + +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + + +from codecs import open +from setuptools import setup, find_packages + +# HISTORY.rst entry. +VERSION = '0.1.0' +try: + from azext_adb2c.manual.version import VERSION +except ImportError: + pass + +# The full list of classifiers is available at +# https://pypi.python.org/pypi?%3Aaction=list_classifiers +CLASSIFIERS = [ + 'Development Status :: 4 - Beta', + 'Intended Audience :: Developers', + 'Intended Audience :: System Administrators', + 'Programming Language :: Python', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'License :: OSI Approved :: MIT License', +] + +DEPENDENCIES = [] + +try: + from azext_adb2c.manual.dependency import DEPENDENCIES +except ImportError: + pass + +with open('README.md', 'r', encoding='utf-8') as f: + README = f.read() +with open('HISTORY.rst', 'r', encoding='utf-8') as f: + HISTORY = f.read() + +setup( + name='adb2c', + version=VERSION, + description='Microsoft Azure Command-Line Tools CPIMConfigurationClient Extension', + author='Microsoft Corporation', + author_email='azpycli@microsoft.com', + url='https://github.com/Azure/azure-cli-extensions/tree/master/src/adb2c', + long_description=README + '\n\n' + HISTORY, + license='MIT', + classifiers=CLASSIFIERS, + packages=find_packages(), + install_requires=DEPENDENCIES, + package_data={'azext_adb2c': ['azext_metadata.json']}, +)