From 540700c2734521391e4ffb233c5cc138834feaa4 Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Thu, 13 Aug 2020 05:08:38 +0000 Subject: [PATCH] Generated from 252aae51d01c13bd9f5f3215a5770e7a2c9e6213 Update readme for onboard autorest.schema to sdkautomation --- src/managementgroup/HISTORY.rst | 8 + src/managementgroup/README.md | 5 + .../azext_managementgroup/__init__.py | 46 + .../azext_managementgroup/action.py | 17 + .../azext_managementgroup/azext_metadata.json | 4 + .../azext_managementgroup/custom.py | 17 + .../generated/__init__.py | 12 + .../generated/_client_factory.py | 33 + .../azext_managementgroup/generated/_help.py | 236 +++ .../generated/_params.py | 155 ++ .../generated/_validators.py | 9 + .../azext_managementgroup/generated/action.py | 14 + .../generated/commands.py | 75 + .../azext_managementgroup/generated/custom.py | 178 +++ .../azext_managementgroup/manual/__init__.py | 12 + .../azext_managementgroup/tests/__init__.py | 71 + .../tests/latest/__init__.py | 12 + .../tests/latest/preparers.py | 159 ++ .../latest/test_managementgroup_scenario.py | 241 +++ .../vendored_sdks/__init__.py | 12 + .../vendored_sdks/managementgroup/__init__.py | 16 + .../managementgroup/_configuration.py | 76 + .../managementgroup/_management_groups_api.py | 99 ++ .../managementgroup/aio/__init__.py | 10 + .../aio/_configuration_async.py | 72 + .../aio/_management_groups_api_async.py | 93 ++ .../aio/operations_async/__init__.py | 23 + .../_entity_operations_async.py | 160 ++ .../_hierarchy_setting_operations_async.py | 337 ++++ .../_management_group_operations_async.py | 568 +++++++ ...ent_group_subscription_operations_async.py | 290 ++++ ..._management_groups_api_operations_async.py | 167 ++ .../_operation_operations_async.py | 102 ++ .../managementgroup/models/__init__.py | 131 ++ .../models/_management_groups_api_enums.py | 70 + .../managementgroup/models/_models.py | 1304 +++++++++++++++ .../managementgroup/models/_models_py3.py | 1407 +++++++++++++++++ .../managementgroup/operations/__init__.py | 23 + .../operations/_entity_operations.py | 165 ++ .../_hierarchy_setting_operations.py | 346 ++++ .../_management_group_operations.py | 580 +++++++ ...anagement_group_subscription_operations.py | 298 ++++ .../_management_groups_api_operations.py | 174 ++ .../operations/_operation_operations.py | 107 ++ .../vendored_sdks/managementgroup/py.typed | 1 + src/managementgroup/report.md | 158 ++ src/managementgroup/setup.cfg | 1 + src/managementgroup/setup.py | 57 + 48 files changed, 8151 insertions(+) create mode 100644 src/managementgroup/HISTORY.rst create mode 100644 src/managementgroup/README.md create mode 100644 src/managementgroup/azext_managementgroup/__init__.py create mode 100644 src/managementgroup/azext_managementgroup/action.py create mode 100644 src/managementgroup/azext_managementgroup/azext_metadata.json create mode 100644 src/managementgroup/azext_managementgroup/custom.py create mode 100644 src/managementgroup/azext_managementgroup/generated/__init__.py create mode 100644 src/managementgroup/azext_managementgroup/generated/_client_factory.py create mode 100644 src/managementgroup/azext_managementgroup/generated/_help.py create mode 100644 src/managementgroup/azext_managementgroup/generated/_params.py create mode 100644 src/managementgroup/azext_managementgroup/generated/_validators.py create mode 100644 src/managementgroup/azext_managementgroup/generated/action.py create mode 100644 src/managementgroup/azext_managementgroup/generated/commands.py create mode 100644 src/managementgroup/azext_managementgroup/generated/custom.py create mode 100644 src/managementgroup/azext_managementgroup/manual/__init__.py create mode 100644 src/managementgroup/azext_managementgroup/tests/__init__.py create mode 100644 src/managementgroup/azext_managementgroup/tests/latest/__init__.py create mode 100644 src/managementgroup/azext_managementgroup/tests/latest/preparers.py create mode 100644 src/managementgroup/azext_managementgroup/tests/latest/test_managementgroup_scenario.py create mode 100644 src/managementgroup/azext_managementgroup/vendored_sdks/__init__.py create mode 100644 src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/__init__.py create mode 100644 src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/_configuration.py create mode 100644 src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/_management_groups_api.py create mode 100644 src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/aio/__init__.py create mode 100644 src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/aio/_configuration_async.py create mode 100644 src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/aio/_management_groups_api_async.py create mode 100644 src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/aio/operations_async/__init__.py create mode 100644 src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/aio/operations_async/_entity_operations_async.py create mode 100644 src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/aio/operations_async/_hierarchy_setting_operations_async.py create mode 100644 src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/aio/operations_async/_management_group_operations_async.py create mode 100644 src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/aio/operations_async/_management_group_subscription_operations_async.py create mode 100644 src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/aio/operations_async/_management_groups_api_operations_async.py create mode 100644 src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/aio/operations_async/_operation_operations_async.py create mode 100644 src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/models/__init__.py create mode 100644 src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/models/_management_groups_api_enums.py create mode 100644 src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/models/_models.py create mode 100644 src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/models/_models_py3.py create mode 100644 src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/operations/__init__.py create mode 100644 src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/operations/_entity_operations.py create mode 100644 src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/operations/_hierarchy_setting_operations.py create mode 100644 src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/operations/_management_group_operations.py create mode 100644 src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/operations/_management_group_subscription_operations.py create mode 100644 src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/operations/_management_groups_api_operations.py create mode 100644 src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/operations/_operation_operations.py create mode 100644 src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/py.typed create mode 100644 src/managementgroup/report.md create mode 100644 src/managementgroup/setup.cfg create mode 100644 src/managementgroup/setup.py diff --git a/src/managementgroup/HISTORY.rst b/src/managementgroup/HISTORY.rst new file mode 100644 index 00000000000..27f152061e8 --- /dev/null +++ b/src/managementgroup/HISTORY.rst @@ -0,0 +1,8 @@ +.. :changelog: + +Release History +=============== + +0.1.0 +++++++ +* Initial release. diff --git a/src/managementgroup/README.md b/src/managementgroup/README.md new file mode 100644 index 00000000000..d54a769d320 --- /dev/null +++ b/src/managementgroup/README.md @@ -0,0 +1,5 @@ +Microsoft Azure CLI 'managementgroup' Extension +========================================== + +This package is for the 'managementgroup' extension. +i.e. 'az managementgroup' diff --git a/src/managementgroup/azext_managementgroup/__init__.py b/src/managementgroup/azext_managementgroup/__init__.py new file mode 100644 index 00000000000..82a3fa7cb46 --- /dev/null +++ b/src/managementgroup/azext_managementgroup/__init__.py @@ -0,0 +1,46 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from azure.cli.core import AzCommandsLoader +from azext_managementgroup.generated._help import helps # pylint: disable=unused-import + + +class ManagementGroupsAPICommandsLoader(AzCommandsLoader): + + def __init__(self, cli_ctx=None): + from azure.cli.core.commands import CliCommandType + from azext_managementgroup.generated._client_factory import cf_managementgroup + managementgroup_custom = CliCommandType( + operations_tmpl='azext_managementgroup.custom#{}', + client_factory=cf_managementgroup) + parent = super(ManagementGroupsAPICommandsLoader, self) + parent.__init__(cli_ctx=cli_ctx, custom_command_type=managementgroup_custom) + + def load_command_table(self, args): + from azext_managementgroup.generated.commands import load_command_table + load_command_table(self, args) + try: + from azext_managementgroup.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_managementgroup.generated._params import load_arguments + load_arguments(self, command) + try: + from azext_managementgroup.manual._params import load_arguments as load_arguments_manual + load_arguments_manual(self, command) + except ImportError: + pass + + +COMMAND_LOADER_CLS = ManagementGroupsAPICommandsLoader diff --git a/src/managementgroup/azext_managementgroup/action.py b/src/managementgroup/azext_managementgroup/action.py new file mode 100644 index 00000000000..a846b2766c4 --- /dev/null +++ b/src/managementgroup/azext_managementgroup/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/managementgroup/azext_managementgroup/azext_metadata.json b/src/managementgroup/azext_managementgroup/azext_metadata.json new file mode 100644 index 00000000000..7b56fb1e11a --- /dev/null +++ b/src/managementgroup/azext_managementgroup/azext_metadata.json @@ -0,0 +1,4 @@ +{ + "azext.isExperimental": true, + "azext.minCliCoreVersion": "2.3.1" +} \ No newline at end of file diff --git a/src/managementgroup/azext_managementgroup/custom.py b/src/managementgroup/azext_managementgroup/custom.py new file mode 100644 index 00000000000..7f31674ce96 --- /dev/null +++ b/src/managementgroup/azext_managementgroup/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/managementgroup/azext_managementgroup/generated/__init__.py b/src/managementgroup/azext_managementgroup/generated/__init__.py new file mode 100644 index 00000000000..ee0c4f36bd0 --- /dev/null +++ b/src/managementgroup/azext_managementgroup/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/managementgroup/azext_managementgroup/generated/_client_factory.py b/src/managementgroup/azext_managementgroup/generated/_client_factory.py new file mode 100644 index 00000000000..e5e26b6b057 --- /dev/null +++ b/src/managementgroup/azext_managementgroup/generated/_client_factory.py @@ -0,0 +1,33 @@ +# -------------------------------------------------------------------------- +# 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_managementgroup(cli_ctx, *_): + from azure.cli.core.commands.client_factory import get_mgmt_service_client + from ..vendored_sdks.managementgroup import ManagementGroupsAPI + return get_mgmt_service_client(cli_ctx, ManagementGroupsAPI, + subscription_bound=False, + base_url_bound=True) + + +def cf_management_group(cli_ctx, *_): + return cf_managementgroup(cli_ctx).management_group + + +def cf_management_group_subscription(cli_ctx, *_): + return cf_managementgroup(cli_ctx).management_group_subscription + + +def cf_hierarchy_setting(cli_ctx, *_): + return cf_managementgroup(cli_ctx).hierarchy_setting + + +def cf_entity(cli_ctx, *_): + return cf_managementgroup(cli_ctx).entity diff --git a/src/managementgroup/azext_managementgroup/generated/_help.py b/src/managementgroup/azext_managementgroup/generated/_help.py new file mode 100644 index 00000000000..c1d7b2cba3f --- /dev/null +++ b/src/managementgroup/azext_managementgroup/generated/_help.py @@ -0,0 +1,236 @@ +# -------------------------------------------------------------------------- +# 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['managementgroup management-group'] = """ + type: group + short-summary: managementgroup management-group +""" + +helps['managementgroup management-group list'] = """ + type: command + short-summary: List management groups for the authenticated user. + examples: + - name: ListManagementGroups + text: |- + az managementgroup management-group list --cache-control "no-cache" +""" + +helps['managementgroup management-group show'] = """ + type: command + short-summary: Get the details of the management group. + examples: + - name: GetManagementGroup + text: |- + az managementgroup management-group show --cache-control "no-cache" --group-id "20000000-0001-0000-0000-\ +000000000000" + - name: GetManagementGroupWithExpand + text: |- + az managementgroup management-group show --expand "children" --cache-control "no-cache" --group-id "2000\ +0000-0001-0000-0000-000000000000" + - name: GetManagementGroupsWithExpandAndRecurse + text: |- + az managementgroup management-group show --expand "children" --recurse true --cache-control "no-cache" -\ +-group-id "20000000-0001-0000-0000-000000000000" +""" + +helps['managementgroup management-group create'] = """ + type: command + short-summary: Create or update a management group. If a management group is already created and a subsequent creat\ +e request is issued with different properties, the management group properties will be updated. + examples: + - name: PutManagementGroup + text: |- + az managementgroup management-group create --cache-control "no-cache" --display-name "ChildGroup" --deta\ +ils-parent-id "/providers/Microsoft.Management/managementGroups/RootGroup" --group-id "ChildGroup" +""" + +helps['managementgroup management-group update'] = """ + type: command + short-summary: Update a management group. + examples: + - name: PatchManagementGroup + text: |- + az managementgroup management-group update --cache-control "no-cache" --group-id "ChildGroup" --display-\ +name "AlternateDisplayName" --parent-group-id "/providers/Microsoft.Management/managementGroups/AlternateRootGroup" +""" + +helps['managementgroup management-group delete'] = """ + type: command + short-summary: Delete management group. If a management group contains child resources, the request will fail. + examples: + - name: DeleteManagementGroup + text: |- + az managementgroup management-group delete --cache-control "no-cache" --group-id "GroupToDelete" +""" + +helps['managementgroup management-group get-descendant'] = """ + type: command + short-summary: List all entities that descend from a management group. + examples: + - name: GetDescendants + text: |- + az managementgroup management-group get-descendant --group-id "20000000-0000-0000-0000-000000000000" +""" + +helps['managementgroup management-group wait'] = """ + type: command + short-summary: Place the CLI in a waiting state until a condition of the managementgroup management-group is met. + examples: + - name: Pause executing next line of CLI script until the managementgroup management-group is successfully create\ +d. + text: |- + az managementgroup management-group wait --expand "children" --recurse true --cache-control "no-cache" -\ +-group-id "20000000-0001-0000-0000-000000000000" --created + - name: Pause executing next line of CLI script until the managementgroup management-group is successfully delete\ +d. + text: |- + az managementgroup management-group wait --expand "children" --recurse true --cache-control "no-cache" -\ +-group-id "20000000-0001-0000-0000-000000000000" --deleted +""" + +helps['managementgroup management-group-subscription'] = """ + type: group + short-summary: managementgroup management-group-subscription +""" + +helps['managementgroup management-group-subscription create'] = """ + type: command + short-summary: Associates existing subscription with the management group. + examples: + - name: AddSubscriptionToManagementGroup + text: |- + az managementgroup management-group-subscription create --cache-control "no-cache" --group-id "Group" --\ +subscription-id "728bcbe4-8d56-4510-86c2-4921b8beefbc" +""" + +helps['managementgroup management-group-subscription delete'] = """ + type: command + short-summary: De-associates subscription from the management group. + examples: + - name: DeleteSubscriptionFromManagementGroup + text: |- + az managementgroup management-group-subscription delete --cache-control "no-cache" --group-id "Group" --\ +subscription-id "728bcbe4-8d56-4510-86c2-4921b8beefbc" +""" + +helps['managementgroup management-group-subscription get-subscription'] = """ + type: command + short-summary: Retrieves details about given subscription which is associated with the management group. + examples: + - name: GetSubscriptionFromManagementGroup + text: |- + az managementgroup management-group-subscription get-subscription --cache-control "no-cache" --group-id \ +"Group" --subscription-id "728bcbe4-8d56-4510-86c2-4921b8beefbc" +""" + +helps['managementgroup management-group-subscription get-subscription-under-management-group'] = """ + type: command + short-summary: Retrieves details about all subscriptions which are associated with the management group. + examples: + - name: GetAllSubscriptionsFromManagementGroup + text: |- + az managementgroup management-group-subscription get-subscription-under-management-group --group-id "Gro\ +up" +""" + +helps['managementgroup hierarchy-setting'] = """ + type: group + short-summary: managementgroup hierarchy-setting +""" + +helps['managementgroup hierarchy-setting list'] = """ + type: command + short-summary: Gets all the hierarchy settings defined at the Management Group level. Settings can only be set on t\ +he root Management Group of the hierarchy. + examples: + - name: ListGroupSettings + text: |- + az managementgroup hierarchy-setting list --group-id "root" +""" + +helps['managementgroup hierarchy-setting show'] = """ + type: command + short-summary: Gets the hierarchy settings defined at the Management Group level. Settings can only be set on the r\ +oot Management Group of the hierarchy. + examples: + - name: GetGroupSettings + text: |- + az managementgroup hierarchy-setting show --group-id "root" +""" + +helps['managementgroup hierarchy-setting create'] = """ + type: command + short-summary: Creates or updates the hierarchy settings defined at the Management Group level. + examples: + - name: GetGroupSettings + text: |- + az managementgroup hierarchy-setting create --default-management-group "/providers/Microsoft.Management/\ +managementGroups/DefaultGroup" --require-authorization-for-group-creation true --group-id "root" +""" + +helps['managementgroup hierarchy-setting update'] = """ + type: command + short-summary: Updates the hierarchy settings defined at the Management Group level. + examples: + - name: GetGroupSettings + text: |- + az managementgroup hierarchy-setting update --default-management-group "/providers/Microsoft.Management/\ +managementGroups/DefaultGroup" --require-authorization-for-group-creation true --group-id "root" +""" + +helps['managementgroup hierarchy-setting delete'] = """ + type: command + short-summary: Deletes the hierarchy settings defined at the Management Group level. + examples: + - name: GetGroupSettings + text: |- + az managementgroup hierarchy-setting delete --group-id "root" +""" + +helps['managementgroup '] = """ + type: group + short-summary: managementgroup +""" + +helps['managementgroup start-tenant-backfill'] = """ + type: command + short-summary: Starts backfilling subscriptions for the Tenant. + examples: + - name: StartTenantBackfill + text: |- + az managementgroup start-tenant-backfill +""" + +helps['managementgroup tenant-backfill-status'] = """ + type: command + short-summary: Gets tenant backfill status + examples: + - name: TenantBackfillStatus + text: |- + az managementgroup tenant-backfill-status +""" + +helps['managementgroup entity'] = """ + type: group + short-summary: managementgroup entity +""" + +helps['managementgroup entity list'] = """ + type: command + short-summary: List all entities (Management Groups, Subscriptions, etc.) for the authenticated user. + examples: + - name: GetEntities + text: |- + az managementgroup entity list +""" diff --git a/src/managementgroup/azext_managementgroup/generated/_params.py b/src/managementgroup/azext_managementgroup/generated/_params.py new file mode 100644 index 00000000000..22274d3c0d5 --- /dev/null +++ b/src/managementgroup/azext_managementgroup/generated/_params.py @@ -0,0 +1,155 @@ +# -------------------------------------------------------------------------- +# 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=line-too-long +# pylint: disable=too-many-lines +# pylint: disable=too-many-statements + +from azure.cli.core.commands.parameters import ( + get_three_state_flag, + get_enum_type +) + + +def load_arguments(self, _): + + with self.argument_context('managementgroup management-group list') as c: + c.argument('cache_control', help='Indicates that the request shouldn\'t utilize any caches.') + + with self.argument_context('managementgroup management-group show') as c: + c.argument('group_id', help='Management Group ID.') + c.argument('expand', arg_type=get_enum_type(['children', 'path']), help='The $expand=children query string para' + 'meter allows clients to request inclusion of children in the response payload. $expand=path includ' + 'es the path from the root group to the current group.') + c.argument('recurse', arg_type=get_three_state_flag(), help='The $recurse=true query string parameter allows cl' + 'ients to request inclusion of entire hierarchy in the response payload. Note that $expand=children' + ' must be passed up if $recurse is set to true.') + c.argument('filter', help='A filter which allows the exclusion of subscriptions from results (i.e. \'$filter=ch' + 'ildren.childType ne Subscription\')') + c.argument('cache_control', help='Indicates that the request shouldn\'t utilize any caches.') + + with self.argument_context('managementgroup management-group create') as c: + c.argument('group_id', help='Management Group ID.') + c.argument('cache_control', help='Indicates that the request shouldn\'t utilize any caches.') + c.argument('name', help='The name of the management group. For example, 00000000-0000-0000-0000-000000000000') + c.argument('display_name', help='The friendly name of the management group. If no value is passed then this fi' + 'eld will be set to the groupId.') + c.argument('details_parent_id', help='The fully qualified ID for the parent management group. For example, /pr' + 'oviders/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000') + + with self.argument_context('managementgroup management-group update') as c: + c.argument('group_id', help='Management Group ID.') + c.argument('cache_control', help='Indicates that the request shouldn\'t utilize any caches.') + c.argument('display_name', help='The friendly name of the management group.') + c.argument('parent_group_id', help='(Optional) The fully qualified ID for the parent management group. For exa' + 'mple, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000') + + with self.argument_context('managementgroup management-group delete') as c: + c.argument('group_id', help='Management Group ID.') + c.argument('cache_control', help='Indicates that the request shouldn\'t utilize any caches.') + + with self.argument_context('managementgroup management-group get-descendant') as c: + c.argument('group_id', help='Management Group ID.') + + with self.argument_context('managementgroup management-group wait') as c: + c.argument('group_id', help='Management Group ID.') + c.argument('expand', arg_type=get_enum_type(['children', 'path']), help='The $expand=children query string para' + 'meter allows clients to request inclusion of children in the response payload. $expand=path includ' + 'es the path from the root group to the current group.') + c.argument('recurse', arg_type=get_three_state_flag(), help='The $recurse=true query string parameter allows cl' + 'ients to request inclusion of entire hierarchy in the response payload. Note that $expand=children' + ' must be passed up if $recurse is set to true.') + c.argument('filter', help='A filter which allows the exclusion of subscriptions from results (i.e. \'$filter=ch' + 'ildren.childType ne Subscription\')') + c.argument('cache_control', help='Indicates that the request shouldn\'t utilize any caches.') + + with self.argument_context('managementgroup management-group-subscription create') as c: + c.argument('group_id', help='Management Group ID.') + c.argument('subscription_id', help='Subscription ID.') + c.argument('cache_control', help='Indicates that the request shouldn\'t utilize any caches.') + + with self.argument_context('managementgroup management-group-subscription delete') as c: + c.argument('group_id', help='Management Group ID.') + c.argument('subscription_id', help='Subscription ID.', id_part='subscription') + c.argument('cache_control', help='Indicates that the request shouldn\'t utilize any caches.') + + with self.argument_context('managementgroup management-group-subscription get-subscription') as c: + c.argument('group_id', help='Management Group ID.') + c.argument('subscription_id', help='Subscription ID.', id_part='subscription') + c.argument('cache_control', help='Indicates that the request shouldn\'t utilize any caches.') + + with self.argument_context('managementgroup management-group-subscription get-subscription-under-management-group') as c: + c.argument('group_id', help='Management Group ID.') + + with self.argument_context('managementgroup hierarchy-setting list') as c: + c.argument('group_id', help='Management Group ID.') + + with self.argument_context('managementgroup hierarchy-setting show') as c: + c.argument('group_id', help='Management Group ID.') + + with self.argument_context('managementgroup hierarchy-setting create') as c: + c.argument('group_id', help='Management Group ID.') + c.argument('require_authorization_for_group_creation', arg_type=get_three_state_flag(), help='Indicates whether' + ' RBAC access is required upon group creation under the root Management Group. If set to true, user ' + 'will require Microsoft.Management/managementGroups/write action on the root Management Group scope ' + 'in order to create new Groups directly under the root. This will prevent new users from creating ne' + 'w Management Groups, unless they are given access.') + c.argument('default_management_group', help='Settings that sets the default Management Group under which new su' + 'bscriptions get added in this tenant. For example, /providers/Microsoft.Management/managementGroups' + '/defaultGroup') + + with self.argument_context('managementgroup hierarchy-setting update') as c: + c.argument('group_id', help='Management Group ID.') + c.argument('require_authorization_for_group_creation', arg_type=get_three_state_flag(), help='Indicates whether' + ' RBAC access is required upon group creation under the root Management Group. If set to true, user ' + 'will require Microsoft.Management/managementGroups/write action on the root Management Group scope ' + 'in order to create new Groups directly under the root. This will prevent new users from creating ne' + 'w Management Groups, unless they are given access.') + c.argument('default_management_group', help='Settings that sets the default Management Group under which new su' + 'bscriptions get added in this tenant. For example, /providers/Microsoft.Management/managementGroups' + '/defaultGroup') + + with self.argument_context('managementgroup hierarchy-setting delete') as c: + c.argument('group_id', help='Management Group ID.') + + with self.argument_context('managementgroup start-tenant-backfill') as c: + pass + + with self.argument_context('managementgroup tenant-backfill-status') as c: + pass + + with self.argument_context('managementgroup entity list') as c: + c.argument('select', help='This parameter specifies the fields to include in the response. Can include any comb' + 'ination of Name,DisplayName,Type,ParentDisplayNameChain,ParentChain, e.g. \'$select=Name,DisplayNam' + 'e,Type,ParentDisplayNameChain,ParentNameChain\'. When specified the $select parameter can override ' + 'select in $skipToken.') + c.argument('search', arg_type=get_enum_type(['AllowedParents', 'AllowedChildren', + 'ParentAndFirstLevelChildren', 'ParentOnly', 'ChildrenOnly']), help='The $search parameter is used i' + 'n conjunction with the $filter parameter to return three different outputs depending on the paramet' + 'er passed in. With $search=AllowedParents the API will return the entity info of all groups that t' + 'he requested entity will be able to reparent to as determined by the user\'s permissions. With $sea' + 'rch=AllowedChildren the API will return the entity info of all entities that can be added as childr' + 'en of the requested entity. With $search=ParentAndFirstLevelChildren the API will return the parent' + ' and first level of children that the user has either direct access to or indirect access via one ' + 'of their descendants. With $search=ParentOnly the API will return only the group if the user has ac' + 'cess to at least one of the descendants of the group. With $search=ChildrenOnly the API will return' + ' only the first level of children of the group entity info specified in $filter. The user must hav' + 'e direct access to the children entities or one of it\'s descendants for it to show up in the resul' + 'ts.') + c.argument('filter', help='The filter parameter allows you to filter on the the name or display name fields. Yo' + 'u can check for equality on the name field (e.g. name eq \'{entityName}\') and you can check for s' + 'ubstrings on either the name or display name fields(e.g. contains(name, \'{substringToSearch}\'), c' + 'ontains(displayName, \'{substringToSearch\')). Note that the \'{entityName}\' and \'{substringToSea' + 'rch}\' fields are checked case insensitively.') + c.argument('view', arg_type=get_enum_type(['FullHierarchy', 'GroupsOnly', 'SubscriptionsOnly', 'Audit']), + help='The view parameter allows clients to filter the type of data that is returned by the getEntiti' + 'es call.') + c.argument('group_name', help='A filter which allows the get entities call to focus on a particular group (i.e.' + ' "$filter=name eq \'groupName\'")') + c.argument('cache_control', help='Indicates that the request shouldn\'t utilize any caches.') diff --git a/src/managementgroup/azext_managementgroup/generated/_validators.py b/src/managementgroup/azext_managementgroup/generated/_validators.py new file mode 100644 index 00000000000..e5ac7838677 --- /dev/null +++ b/src/managementgroup/azext_managementgroup/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/managementgroup/azext_managementgroup/generated/action.py b/src/managementgroup/azext_managementgroup/generated/action.py new file mode 100644 index 00000000000..01ed94902ce --- /dev/null +++ b/src/managementgroup/azext_managementgroup/generated/action.py @@ -0,0 +1,14 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=protected-access + +import argparse +from knack.util import CLIError +from collections import defaultdict diff --git a/src/managementgroup/azext_managementgroup/generated/commands.py b/src/managementgroup/azext_managementgroup/generated/commands.py new file mode 100644 index 00000000000..c51121fa11f --- /dev/null +++ b/src/managementgroup/azext_managementgroup/generated/commands.py @@ -0,0 +1,75 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from azure.cli.core.commands import CliCommandType + + +def load_command_table(self, _): + + from azext_managementgroup.generated._client_factory import cf_management_group + managementgroup_management_group = CliCommandType( + operations_tmpl='azext_managementgroup.vendored_sdks.managementgroup.operations._management_group_operations#Ma' + 'nagementGroupOperations.{}', + client_factory=cf_management_group) + with self.command_group('managementgroup management-group', managementgroup_management_group, + client_factory=cf_management_group, is_experimental=True) as g: + g.custom_command('list', 'managementgroup_management_group_list') + g.custom_show_command('show', 'managementgroup_management_group_show') + g.custom_command('create', 'managementgroup_management_group_create', supports_no_wait=True) + g.custom_command('update', 'managementgroup_management_group_update') + g.custom_command('delete', 'managementgroup_management_group_delete', supports_no_wait=True) + g.custom_command('get-descendant', 'managementgroup_management_group_get_descendant') + g.custom_wait_command('wait', 'managementgroup_management_group_show') + + from azext_managementgroup.generated._client_factory import cf_management_group_subscription + managementgroup_management_group_subscription = CliCommandType( + operations_tmpl='azext_managementgroup.vendored_sdks.managementgroup.operations._management_group_subscription_' + 'operations#ManagementGroupSubscriptionOperations.{}', + client_factory=cf_management_group_subscription) + with self.command_group('managementgroup management-group-subscription', + managementgroup_management_group_subscription, + client_factory=cf_management_group_subscription, is_experimental=True) as g: + g.custom_command('create', 'managementgroup_management_group_subscription_create') + g.custom_command('delete', 'managementgroup_management_group_subscription_delete') + g.custom_command('get-subscription', 'managementgroup_management_group_subscription_get_subscription') + g.custom_command('get-subscription-under-management-group', 'managementgroup_management_group_subscription_get_' + 'subscription_under_management_group') + + from azext_managementgroup.generated._client_factory import cf_hierarchy_setting + managementgroup_hierarchy_setting = CliCommandType( + operations_tmpl='azext_managementgroup.vendored_sdks.managementgroup.operations._hierarchy_setting_operations#H' + 'ierarchySettingOperations.{}', + client_factory=cf_hierarchy_setting) + with self.command_group('managementgroup hierarchy-setting', managementgroup_hierarchy_setting, + client_factory=cf_hierarchy_setting, is_experimental=True) as g: + g.custom_command('list', 'managementgroup_hierarchy_setting_list') + g.custom_show_command('show', 'managementgroup_hierarchy_setting_show') + g.custom_command('create', 'managementgroup_hierarchy_setting_create') + g.custom_command('update', 'managementgroup_hierarchy_setting_update') + g.custom_command('delete', 'managementgroup_hierarchy_setting_delete') + + from azext_managementgroup.generated._client_factory import cf_managementgroup + managementgroup_ = CliCommandType( + operations_tmpl='azext_managementgroup.vendored_sdks.managementgroup.operations._model_operations#ModelOperatio' + 'ns.{}', + client_factory=cf_managementgroup) + with self.command_group('managementgroup ', managementgroup_, client_factory=cf_managementgroup, + is_experimental=True) as g: + g.custom_command('start-tenant-backfill', 'managementgroup__start_tenant_backfill') + g.custom_command('tenant-backfill-status', 'managementgroup__tenant_backfill_status') + + from azext_managementgroup.generated._client_factory import cf_entity + managementgroup_entity = CliCommandType( + operations_tmpl='azext_managementgroup.vendored_sdks.managementgroup.operations._entity_operations#EntityOperat' + 'ions.{}', + client_factory=cf_entity) + with self.command_group('managementgroup entity', managementgroup_entity, client_factory=cf_entity, + is_experimental=True) as g: + g.custom_command('list', 'managementgroup_entity_list') diff --git a/src/managementgroup/azext_managementgroup/generated/custom.py b/src/managementgroup/azext_managementgroup/generated/custom.py new file mode 100644 index 00000000000..7d7a72810eb --- /dev/null +++ b/src/managementgroup/azext_managementgroup/generated/custom.py @@ -0,0 +1,178 @@ +# -------------------------------------------------------------------------- +# 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 managementgroup_management_group_list(client, + cache_control=None): + if cache_control == None: + cache_control = "no-cache" + return client.list(cache_control=cache_control) + + +def managementgroup_management_group_show(client, + group_id, + expand=None, + recurse=None, + filter=None, + cache_control=None): + if cache_control == None: + cache_control = "no-cache" + return client.get(group_id=group_id, + expand=expand, + recurse=recurse, + filter=filter, + cache_control=cache_control) + + +def managementgroup_management_group_create(client, + group_id, + cache_control=None, + name=None, + display_name=None, + details_parent_id=None, + no_wait=False): + if cache_control == None: + cache_control = "no-cache" + return sdk_no_wait(no_wait, + client.begin_create_or_update, + group_id=group_id, + cache_control=cache_control, + name=name, + display_name=display_name, + id=details_parent_id) + + +def managementgroup_management_group_update(client, + group_id, + cache_control=None, + display_name=None, + parent_group_id=None): + if cache_control == None: + cache_control = "no-cache" + return client.update(group_id=group_id, + cache_control=cache_control, + display_name=display_name, + parent_group_id=parent_group_id) + + +def managementgroup_management_group_delete(client, + group_id, + cache_control=None, + no_wait=False): + if cache_control == None: + cache_control = "no-cache" + return sdk_no_wait(no_wait, + client.begin_delete, + group_id=group_id, + cache_control=cache_control) + + +def managementgroup_management_group_get_descendant(client, + group_id): + return client.get_descendant(group_id=group_id) + + +def managementgroup_management_group_subscription_create(client, + group_id, + subscription_id, + cache_control=None): + if cache_control == None: + cache_control = "no-cache" + return client.create(group_id=group_id, + subscription_id=subscription_id, + cache_control=cache_control) + + +def managementgroup_management_group_subscription_delete(client, + group_id, + subscription_id, + cache_control=None): + if cache_control == None: + cache_control = "no-cache" + return client.delete(group_id=group_id, + subscription_id=subscription_id, + cache_control=cache_control) + + +def managementgroup_management_group_subscription_get_subscription(client, + group_id, + subscription_id, + cache_control=None): + if cache_control == None: + cache_control = "no-cache" + return client.get_subscription(group_id=group_id, + subscription_id=subscription_id, + cache_control=cache_control) + + +def managementgroup_management_group_subscription_get_subscription_under_management_group(client, + group_id): + return client.get_subscription_under_management_group(group_id=group_id) + + +def managementgroup_hierarchy_setting_list(client, + group_id): + return client.list(group_id=group_id) + + +def managementgroup_hierarchy_setting_show(client, + group_id): + return client.get(group_id=group_id) + + +def managementgroup_hierarchy_setting_create(client, + group_id, + require_authorization_for_group_creation=None, + default_management_group=None): + return client.create_or_update(group_id=group_id, + require_authorization_for_group_creation=require_authorization_for_group_creation, + default_management_group=default_management_group) + + +def managementgroup_hierarchy_setting_update(client, + group_id, + require_authorization_for_group_creation=None, + default_management_group=None): + return client.update(group_id=group_id, + require_authorization_for_group_creation=require_authorization_for_group_creation, + default_management_group=default_management_group) + + +def managementgroup_hierarchy_setting_delete(client, + group_id): + return client.delete(group_id=group_id) + + +def managementgroup__start_tenant_backfill(client): + return client.start_tenant_backfill() + + +def managementgroup__tenant_backfill_status(client): + return client.tenant_backfill_status() + + +def managementgroup_entity_list(client, + select=None, + search=None, + filter=None, + view=None, + group_name=None, + cache_control=None): + if cache_control == None: + cache_control = "no-cache" + return client.list(select=select, + search=search, + filter=filter, + view=view, + group_name=group_name, + cache_control=cache_control) diff --git a/src/managementgroup/azext_managementgroup/manual/__init__.py b/src/managementgroup/azext_managementgroup/manual/__init__.py new file mode 100644 index 00000000000..ee0c4f36bd0 --- /dev/null +++ b/src/managementgroup/azext_managementgroup/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/managementgroup/azext_managementgroup/tests/__init__.py b/src/managementgroup/azext_managementgroup/tests/__init__.py new file mode 100644 index 00000000000..5f8f1fd97ad --- /dev/null +++ b/src/managementgroup/azext_managementgroup/tests/__init__.py @@ -0,0 +1,71 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +import inspect +import os +import sys +import traceback +from azure.core.exceptions import AzureError +from azure.cli.testsdk.exceptions import CliTestError, CliExecutionError, JMESPathCheckAssertionError + + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) +exceptions = [] + + +def try_manual(func): + def import_manual_function(origin_func): + from importlib import import_module + decorated_path = inspect.getfile(origin_func) + module_path = __path__[0] + if not decorated_path.startswith(module_path): + raise Exception("Decorator can only be used in submodules!") + manual_path = os.path.join( + decorated_path[module_path.rfind(os.path.sep) + 1:]) + manual_file_path, manual_file_name = os.path.split(manual_path) + module_name, _ = os.path.splitext(manual_file_name) + manual_module = "..manual." + \ + ".".join(manual_file_path.split(os.path.sep) + [module_name, ]) + return getattr(import_module(manual_module, package=__name__), origin_func.__name__) + + def get_func_to_call(): + func_to_call = func + try: + func_to_call = import_manual_function(func) + print("Found manual override for {}(...)".format(func.__name__)) + except (ImportError, AttributeError): + pass + return func_to_call + + def wrapper(*args, **kwargs): + func_to_call = get_func_to_call() + print("running {}()...".format(func.__name__)) + try: + return func_to_call(*args, **kwargs) + except (AssertionError, AzureError, CliTestError, CliExecutionError, JMESPathCheckAssertionError) as e: + print("--------------------------------------") + print("step exception: ", e) + print("--------------------------------------", file=sys.stderr) + print("step exception in {}: {}".format(func.__name__, e), file=sys.stderr) + traceback.print_exc() + exceptions.append((func.__name__, sys.exc_info())) + + if inspect.isclass(func): + return get_func_to_call() + return wrapper + + +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/managementgroup/azext_managementgroup/tests/latest/__init__.py b/src/managementgroup/azext_managementgroup/tests/latest/__init__.py new file mode 100644 index 00000000000..ee0c4f36bd0 --- /dev/null +++ b/src/managementgroup/azext_managementgroup/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/managementgroup/azext_managementgroup/tests/latest/preparers.py b/src/managementgroup/azext_managementgroup/tests/latest/preparers.py new file mode 100644 index 00000000000..4702355b2bd --- /dev/null +++ b/src/managementgroup/azext_managementgroup/tests/latest/preparers.py @@ -0,0 +1,159 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import os +from datetime import datetime +from azure_devtools.scenario_tests import SingleValueReplacer +from azure.cli.testsdk.preparers import NoTrafficRecordingPreparer +from azure.cli.testsdk.exceptions import CliTestError +from azure.cli.testsdk.reverse_dependency import get_dummy_cli + + +KEY_RESOURCE_GROUP = 'rg' +KEY_VIRTUAL_NETWORK = 'vnet' +KEY_VNET_SUBNET = 'subnet' +KEY_VNET_NIC = 'nic' + + +class VirtualNetworkPreparer(NoTrafficRecordingPreparer, SingleValueReplacer): + def __init__(self, name_prefix='clitest.vn', + parameter_name='virtual_network', + resource_group_name=None, + resource_group_key=KEY_RESOURCE_GROUP, + dev_setting_name='AZURE_CLI_TEST_DEV_VIRTUAL_NETWORK_NAME', + random_name_length=24, key=KEY_VIRTUAL_NETWORK): + if ' ' in name_prefix: + raise CliTestError( + 'Error: Space character in name prefix \'%s\'' % name_prefix) + super(VirtualNetworkPreparer, self).__init__( + name_prefix, random_name_length) + self.cli_ctx = get_dummy_cli() + self.parameter_name = parameter_name + self.key = key + self.resource_group_name = resource_group_name + self.resource_group_key = resource_group_key + self.dev_setting_name = os.environ.get(dev_setting_name, None) + + def create_resource(self, name, **_): + if self.dev_setting_name: + return {self.parameter_name: self.dev_setting_name, } + + if not self.resource_group_name: + self.resource_group_name = self.test_class_instance.kwargs.get( + self.resource_group_key) + if not self.resource_group_name: + raise CliTestError("Error: No resource group configured!") + + tags = {'product': 'azurecli', 'cause': 'automation', + 'date': datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%SZ')} + if 'ENV_JOB_NAME' in os.environ: + tags['job'] = os.environ['ENV_JOB_NAME'] + tags = ' '.join(['{}={}'.format(key, value) + for key, value in tags.items()]) + template = 'az network vnet create --resource-group {} --name {} --subnet-name default --tag ' + tags + self.live_only_execute(self.cli_ctx, template.format( + self.resource_group_name, name)) + + self.test_class_instance.kwargs[self.key] = name + return {self.parameter_name: name} + + def remove_resource(self, name, **_): + # delete vnet if test is being recorded and if the vnet is not a dev rg + if not self.dev_setting_name: + self.live_only_execute( + self.cli_ctx, + 'az network vnet delete --name {} --resource-group {}'.format(name, self.resource_group_name)) + + +class VnetSubnetPreparer(NoTrafficRecordingPreparer, SingleValueReplacer): + def __init__(self, name_prefix='clitest.vn', + parameter_name='subnet', + resource_group_key=KEY_RESOURCE_GROUP, + vnet_key=KEY_VIRTUAL_NETWORK, + address_prefixes="11.0.0.0/24", + dev_setting_name='AZURE_CLI_TEST_DEV_VNET_SUBNET_NAME', + key=KEY_VNET_SUBNET): + if ' ' in name_prefix: + raise CliTestError( + 'Error: Space character in name prefix \'%s\'' % name_prefix) + super(VnetSubnetPreparer, self).__init__(name_prefix, 15) + self.cli_ctx = get_dummy_cli() + self.parameter_name = parameter_name + self.key = key + self.resource_group = [resource_group_key, None] + self.vnet = [vnet_key, None] + self.address_prefixes = address_prefixes + self.dev_setting_name = os.environ.get(dev_setting_name, None) + + def create_resource(self, name, **_): + if self.dev_setting_name: + return {self.parameter_name: self.dev_setting_name, } + + if not self.resource_group[1]: + self.resource_group[1] = self.test_class_instance.kwargs.get( + self.resource_group[0]) + if not self.resource_group[1]: + raise CliTestError("Error: No resource group configured!") + if not self.vnet[1]: + self.vnet[1] = self.test_class_instance.kwargs.get(self.vnet[0]) + if not self.vnet[1]: + raise CliTestError("Error: No vnet configured!") + + self.test_class_instance.kwargs[self.key] = 'default' + return {self.parameter_name: name} + + def remove_resource(self, name, **_): + pass + + +class VnetNicPreparer(NoTrafficRecordingPreparer, SingleValueReplacer): + def __init__(self, name_prefix='clitest.nic', + parameter_name='subnet', + resource_group_key=KEY_RESOURCE_GROUP, + vnet_key=KEY_VIRTUAL_NETWORK, + dev_setting_name='AZURE_CLI_TEST_DEV_VNET_NIC_NAME', + key=KEY_VNET_NIC): + if ' ' in name_prefix: + raise CliTestError( + 'Error: Space character in name prefix \'%s\'' % name_prefix) + super(VnetNicPreparer, self).__init__(name_prefix, 15) + self.cli_ctx = get_dummy_cli() + self.parameter_name = parameter_name + self.key = key + self.resource_group = [resource_group_key, None] + self.vnet = [vnet_key, None] + self.dev_setting_name = os.environ.get(dev_setting_name, None) + + def create_resource(self, name, **_): + if self.dev_setting_name: + return {self.parameter_name: self.dev_setting_name, } + + if not self.resource_group[1]: + self.resource_group[1] = self.test_class_instance.kwargs.get( + self.resource_group[0]) + if not self.resource_group[1]: + raise CliTestError("Error: No resource group configured!") + if not self.vnet[1]: + self.vnet[1] = self.test_class_instance.kwargs.get(self.vnet[0]) + if not self.vnet[1]: + raise CliTestError("Error: No vnet configured!") + + template = 'az network nic create --resource-group {} --name {} --vnet-name {} --subnet default ' + self.live_only_execute(self.cli_ctx, template.format( + self.resource_group[1], name, self.vnet[1])) + + self.test_class_instance.kwargs[self.key] = name + return {self.parameter_name: name} + + def remove_resource(self, name, **_): + if not self.dev_setting_name: + self.live_only_execute( + self.cli_ctx, + 'az network nic delete --name {} --resource-group {}'.format(name, self.resource_group[1])) diff --git a/src/managementgroup/azext_managementgroup/tests/latest/test_managementgroup_scenario.py b/src/managementgroup/azext_managementgroup/tests/latest/test_managementgroup_scenario.py new file mode 100644 index 00000000000..b4b6f2e0b54 --- /dev/null +++ b/src/managementgroup/azext_managementgroup/tests/latest/test_managementgroup_scenario.py @@ -0,0 +1,241 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import os +from azure.cli.testsdk import ScenarioTest +from .. import try_manual, raise_if + + +TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..')) + + +@try_manual +def setup(test): + pass + + +# EXAMPLE: /Entities/post/GetEntities +@try_manual +def step__entities_post_getentities(test): + test.cmd('az managementgroup entity list', + checks=[]) + + +# EXAMPLE: /HierarchySettings/put/GetGroupSettings +@try_manual +def step__hierarchysettings_put_getgroupsettings(test): + test.cmd('az managementgroup hierarchy-setting create ' + '--default-management-group "/providers/Microsoft.Management/managementGroups/DefaultGroup" ' + '--require-authorization-for-group-creation true ' + '--group-id "root"', + checks=[]) + + +# EXAMPLE: /HierarchySettings/get/GetGroupSettings +@try_manual +def step__hierarchysettings_get_getgroupsettings(test): + test.cmd('az managementgroup hierarchy-setting show ' + '--group-id "root"', + checks=[]) + + +# EXAMPLE: /HierarchySettings/get/ListGroupSettings +@try_manual +def step__hierarchysettings_get_listgroupsettings(test): + test.cmd('az managementgroup hierarchy-setting list ' + '--group-id "root"', + checks=[]) + + +# EXAMPLE: /HierarchySettings/patch/GetGroupSettings +@try_manual +def step__hierarchysettings_patch_getgroupsettings(test): + test.cmd('az managementgroup hierarchy-setting update ' + '--default-management-group "/providers/Microsoft.Management/managementGroups/DefaultGroup" ' + '--require-authorization-for-group-creation true ' + '--group-id "root"', + checks=[]) + + +# EXAMPLE: /ManagementGroupSubscriptions/put/AddSubscriptionToManagementGroup +@try_manual +def step__managementgroupsubscriptions_put_addsubscriptiontomanagementgroup(test): + test.cmd('az managementgroup management-group-subscription create ' + '--cache-control "no-cache" ' + '--group-id "Group" ' + '--subscription-id "728bcbe4-8d56-4510-86c2-4921b8beefbc"', + checks=[]) + + +# EXAMPLE: /ManagementGroupSubscriptions/get/GetAllSubscriptionsFromManagementGroup +@try_manual +def step__managementgroupsubscriptions_get_getallsubscriptionsfrommanagementgroup(test): + test.cmd('az managementgroup management-group-subscription get-subscription-under-management-group ' + '--group-id "Group"', + checks=[]) + + +# EXAMPLE: /ManagementGroupSubscriptions/get/GetSubscriptionFromManagementGroup +@try_manual +def step__managementgroupsubscriptions_get_getsubscriptionfrommanagementgroup(test): + test.cmd('az managementgroup management-group-subscription get-subscription ' + '--cache-control "no-cache" ' + '--group-id "Group" ' + '--subscription-id "728bcbe4-8d56-4510-86c2-4921b8beefbc"', + checks=[]) + + +# EXAMPLE: /ManagementGroups/put/PutManagementGroup +@try_manual +def step__managementgroups_put_putmanagementgroup(test): + test.cmd('az managementgroup management-group create ' + '--cache-control "no-cache" ' + '--display-name "ChildGroup" ' + '--details-parent-id "/providers/Microsoft.Management/managementGroups/RootGroup" ' + '--group-id "ChildGroup"', + checks=[]) + + +# EXAMPLE: /ManagementGroups/get/GetDescendants +@try_manual +def step__managementgroups_get_getdescendants(test): + test.cmd('az managementgroup management-group get-descendant ' + '--group-id "20000000-0000-0000-0000-000000000000"', + checks=[]) + + +# EXAMPLE: /ManagementGroups/get/GetManagementGroup +@try_manual +def step__managementgroups_get_getmanagementgroup(test): + test.cmd('az managementgroup management-group show ' + '--cache-control "no-cache" ' + '--group-id "20000000-0001-0000-0000-000000000000"', + checks=[]) + + +# EXAMPLE: /ManagementGroups/get/GetManagementGroupWithExpand +@try_manual +def step__managementgroups_get_getmanagementgroupwithexpand(test): + test.cmd('az managementgroup management-group show ' + '--expand "children" ' + '--cache-control "no-cache" ' + '--group-id "20000000-0001-0000-0000-000000000000"', + checks=[]) + + +# EXAMPLE: /ManagementGroups/get/GetManagementGroupsWithExpandAndRecurse +@try_manual +def step__managementgroups_get_getmanagementgroupswithexpandandrecurse(test): + test.cmd('az managementgroup management-group show ' + '--expand "children" ' + '--recurse true ' + '--cache-control "no-cache" ' + '--group-id "20000000-0001-0000-0000-000000000000"', + checks=[]) + + +# EXAMPLE: /ManagementGroups/get/ListManagementGroups +@try_manual +def step__managementgroups_get_listmanagementgroups(test): + test.cmd('az managementgroup management-group list ' + '--cache-control "no-cache"', + checks=[]) + + +# EXAMPLE: /ManagementGroups/patch/PatchManagementGroup +@try_manual +def step__managementgroups_patch_patchmanagementgroup(test): + test.cmd('az managementgroup management-group update ' + '--cache-control "no-cache" ' + '--group-id "ChildGroup" ' + '--display-name "AlternateDisplayName" ' + '--parent-group-id "/providers/Microsoft.Management/managementGroups/AlternateRootGroup"', + checks=[]) + + +# EXAMPLE: /managementgroup /post/StartTenantBackfill +@try_manual +def step__managementgroup__post_starttenantbackfill(test): + test.cmd('az managementgroup start-tenant-backfill', + checks=[]) + + +# EXAMPLE: /managementgroup /post/TenantBackfillStatus +@try_manual +def step__managementgroup__post_tenantbackfillstatus(test): + test.cmd('az managementgroup tenant-backfill-status', + checks=[]) + + +# EXAMPLE: /HierarchySettings/delete/GetGroupSettings +@try_manual +def step__hierarchysettings_delete_getgroupsettings(test): + test.cmd('az managementgroup hierarchy-setting delete ' + '--group-id "root"', + checks=[]) + + +# EXAMPLE: /ManagementGroupSubscriptions/delete/DeleteSubscriptionFromManagementGroup +@try_manual +def step__managementgroupsubscriptions_delete_deletesubscriptionfrommanagementgroup(test): + test.cmd('az managementgroup management-group-subscription delete ' + '--cache-control "no-cache" ' + '--group-id "Group" ' + '--subscription-id "728bcbe4-8d56-4510-86c2-4921b8beefbc"', + checks=[]) + + +# EXAMPLE: /ManagementGroups/delete/DeleteManagementGroup +@try_manual +def step__managementgroups_delete_deletemanagementgroup(test): + test.cmd('az managementgroup management-group delete ' + '--cache-control "no-cache" ' + '--group-id "GroupToDelete"', + checks=[]) + + +@try_manual +def cleanup(test): + pass + + +@try_manual +def call_scenario(test): + setup(test) + step__entities_post_getentities(test) + step__hierarchysettings_put_getgroupsettings(test) + step__hierarchysettings_get_getgroupsettings(test) + step__hierarchysettings_get_listgroupsettings(test) + step__hierarchysettings_patch_getgroupsettings(test) + step__managementgroupsubscriptions_put_addsubscriptiontomanagementgroup(test) + step__managementgroupsubscriptions_get_getallsubscriptionsfrommanagementgroup(test) + step__managementgroupsubscriptions_get_getsubscriptionfrommanagementgroup(test) + step__managementgroups_put_putmanagementgroup(test) + step__managementgroups_get_getdescendants(test) + step__managementgroups_get_getmanagementgroup(test) + step__managementgroups_get_getmanagementgroupwithexpand(test) + step__managementgroups_get_getmanagementgroupswithexpandandrecurse(test) + step__managementgroups_get_listmanagementgroups(test) + step__managementgroups_patch_patchmanagementgroup(test) + step__managementgroup__post_starttenantbackfill(test) + step__managementgroup__post_tenantbackfillstatus(test) + step__hierarchysettings_delete_getgroupsettings(test) + step__managementgroupsubscriptions_delete_deletesubscriptionfrommanagementgroup(test) + step__managementgroups_delete_deletemanagementgroup(test) + cleanup(test) + + +@try_manual +class ManagementGroupsAPIScenarioTest(ScenarioTest): + + def test_managementgroup(self): + + call_scenario(self) + raise_if() diff --git a/src/managementgroup/azext_managementgroup/vendored_sdks/__init__.py b/src/managementgroup/azext_managementgroup/vendored_sdks/__init__.py new file mode 100644 index 00000000000..ee0c4f36bd0 --- /dev/null +++ b/src/managementgroup/azext_managementgroup/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/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/__init__.py b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/__init__.py new file mode 100644 index 00000000000..f97bf2a56e3 --- /dev/null +++ b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/__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 ._management_groups_api import ManagementGroupsAPI +__all__ = ['ManagementGroupsAPI'] + +try: + from ._patch import patch_sdk + patch_sdk() +except ImportError: + pass diff --git a/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/_configuration.py b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/_configuration.py new file mode 100644 index 00000000000..43de01cf681 --- /dev/null +++ b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/_configuration.py @@ -0,0 +1,76 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + +VERSION = "unknown" + +class ManagementGroupsAPIConfiguration(Configuration): + """Configuration for ManagementGroupsAPI. + + 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 skip: Number of entities to skip over when retrieving results. Passing this in will override $skipToken. + :type skip: int + :param top: Number of elements to return when retrieving results. Passing this in will override $skipToken. + :type top: int + :param skiptoken: Page continuation token is only used if a previous operation returned a partial result. +If a previous response contains a nextLink element, the value of the nextLink element will include a token parameter that specifies a starting point to use for subsequent calls. + :type skiptoken: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + skip=None, # type: Optional[int] + top=None, # type: Optional[int] + skiptoken=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + super(ManagementGroupsAPIConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.skip = skip + self.top = top + self.skiptoken = skiptoken + self.api_version = "2020-05-01" + self.credential_scopes = ['https://management.azure.com/.default'] + self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + kwargs.setdefault('sdk_moniker', 'managementgroupsapi/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/_management_groups_api.py b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/_management_groups_api.py new file mode 100644 index 00000000000..95a86295fd1 --- /dev/null +++ b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/_management_groups_api.py @@ -0,0 +1,99 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import 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 ManagementGroupsAPIConfiguration +from .operations import ManagementGroupOperations +from .operations import ManagementGroupSubscriptionOperations +from .operations import HierarchySettingOperations +from .operations import OperationOperations +from .operations import ManagementGroupsAPIOperationsMixin +from .operations import EntityOperations +from . import models + + +class ManagementGroupsAPI(ManagementGroupsAPIOperationsMixin): + """The Azure Management Groups API enables consolidation of multiple +subscriptions/resources into an organizational hierarchy and centrally +manage access control, policies, alerting and reporting for those resources. + + :ivar management_group: ManagementGroupOperations operations + :vartype management_group: management_groups_api.operations.ManagementGroupOperations + :ivar management_group_subscription: ManagementGroupSubscriptionOperations operations + :vartype management_group_subscription: management_groups_api.operations.ManagementGroupSubscriptionOperations + :ivar hierarchy_setting: HierarchySettingOperations operations + :vartype hierarchy_setting: management_groups_api.operations.HierarchySettingOperations + :ivar operation: OperationOperations operations + :vartype operation: management_groups_api.operations.OperationOperations + :ivar entity: EntityOperations operations + :vartype entity: management_groups_api.operations.EntityOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param skip: Number of entities to skip over when retrieving results. Passing this in will override $skipToken. + :type skip: int + :param top: Number of elements to return when retrieving results. Passing this in will override $skipToken. + :type top: int + :param skiptoken: Page continuation token is only used if a previous operation returned a partial result. +If a previous response contains a nextLink element, the value of the nextLink element will include a token parameter that specifies a starting point to use for subsequent calls. + :type skiptoken: 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" + skip=None, # type: Optional[int] + top=None, # type: Optional[int] + skiptoken=None, # type: Optional[str] + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = ManagementGroupsAPIConfiguration(credential, skip, top, skiptoken, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.management_group = ManagementGroupOperations( + self._client, self._config, self._serialize, self._deserialize) + self.management_group_subscription = ManagementGroupSubscriptionOperations( + self._client, self._config, self._serialize, self._deserialize) + self.hierarchy_setting = HierarchySettingOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operation = OperationOperations( + self._client, self._config, self._serialize, self._deserialize) + self.entity = EntityOperations( + self._client, self._config, self._serialize, self._deserialize) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> ManagementGroupsAPI + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/aio/__init__.py b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/aio/__init__.py new file mode 100644 index 00000000000..5a1a98ad380 --- /dev/null +++ b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/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 ._management_groups_api_async import ManagementGroupsAPI +__all__ = ['ManagementGroupsAPI'] diff --git a/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/aio/_configuration_async.py b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/aio/_configuration_async.py new file mode 100644 index 00000000000..1c8217b8876 --- /dev/null +++ b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/aio/_configuration_async.py @@ -0,0 +1,72 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +VERSION = "unknown" + +class ManagementGroupsAPIConfiguration(Configuration): + """Configuration for ManagementGroupsAPI. + + 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 skip: Number of entities to skip over when retrieving results. Passing this in will override $skipToken. + :type skip: int + :param top: Number of elements to return when retrieving results. Passing this in will override $skipToken. + :type top: int + :param skiptoken: Page continuation token is only used if a previous operation returned a partial result. +If a previous response contains a nextLink element, the value of the nextLink element will include a token parameter that specifies a starting point to use for subsequent calls. + :type skiptoken: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + skip: Optional[int] = None, + top: Optional[int] = None, + skiptoken: Optional[str] = None, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + super(ManagementGroupsAPIConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.skip = skip + self.top = top + self.skiptoken = skiptoken + self.api_version = "2020-05-01" + self.credential_scopes = ['https://management.azure.com/.default'] + self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + kwargs.setdefault('sdk_moniker', 'managementgroupsapi/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/aio/_management_groups_api_async.py b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/aio/_management_groups_api_async.py new file mode 100644 index 00000000000..616e0b1518e --- /dev/null +++ b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/aio/_management_groups_api_async.py @@ -0,0 +1,93 @@ +# 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_async import ManagementGroupsAPIConfiguration +from .operations_async import ManagementGroupOperations +from .operations_async import ManagementGroupSubscriptionOperations +from .operations_async import HierarchySettingOperations +from .operations_async import OperationOperations +from .operations_async import ManagementGroupsAPIOperationsMixin +from .operations_async import EntityOperations +from .. import models + + +class ManagementGroupsAPI(ManagementGroupsAPIOperationsMixin): + """The Azure Management Groups API enables consolidation of multiple +subscriptions/resources into an organizational hierarchy and centrally +manage access control, policies, alerting and reporting for those resources. + + :ivar management_group: ManagementGroupOperations operations + :vartype management_group: management_groups_api.aio.operations_async.ManagementGroupOperations + :ivar management_group_subscription: ManagementGroupSubscriptionOperations operations + :vartype management_group_subscription: management_groups_api.aio.operations_async.ManagementGroupSubscriptionOperations + :ivar hierarchy_setting: HierarchySettingOperations operations + :vartype hierarchy_setting: management_groups_api.aio.operations_async.HierarchySettingOperations + :ivar operation: OperationOperations operations + :vartype operation: management_groups_api.aio.operations_async.OperationOperations + :ivar entity: EntityOperations operations + :vartype entity: management_groups_api.aio.operations_async.EntityOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param skip: Number of entities to skip over when retrieving results. Passing this in will override $skipToken. + :type skip: int + :param top: Number of elements to return when retrieving results. Passing this in will override $skipToken. + :type top: int + :param skiptoken: Page continuation token is only used if a previous operation returned a partial result. +If a previous response contains a nextLink element, the value of the nextLink element will include a token parameter that specifies a starting point to use for subsequent calls. + :type skiptoken: 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", + skip: Optional[int] = None, + top: Optional[int] = None, + skiptoken: Optional[str] = None, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = ManagementGroupsAPIConfiguration(credential, skip, top, skiptoken, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.management_group = ManagementGroupOperations( + self._client, self._config, self._serialize, self._deserialize) + self.management_group_subscription = ManagementGroupSubscriptionOperations( + self._client, self._config, self._serialize, self._deserialize) + self.hierarchy_setting = HierarchySettingOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operation = OperationOperations( + self._client, self._config, self._serialize, self._deserialize) + self.entity = EntityOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "ManagementGroupsAPI": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/aio/operations_async/__init__.py b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/aio/operations_async/__init__.py new file mode 100644 index 00000000000..a5c23b339e5 --- /dev/null +++ b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/aio/operations_async/__init__.py @@ -0,0 +1,23 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._management_group_operations_async import ManagementGroupOperations +from ._management_group_subscription_operations_async import ManagementGroupSubscriptionOperations +from ._hierarchy_setting_operations_async import HierarchySettingOperations +from ._operation_operations_async import OperationOperations +from ._management_groups_api_operations_async import ManagementGroupsAPIOperationsMixin +from ._entity_operations_async import EntityOperations + +__all__ = [ + 'ManagementGroupOperations', + 'ManagementGroupSubscriptionOperations', + 'HierarchySettingOperations', + 'OperationOperations', + 'ManagementGroupsAPIOperationsMixin', + 'EntityOperations', +] diff --git a/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/aio/operations_async/_entity_operations_async.py b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/aio/operations_async/_entity_operations_async.py new file mode 100644 index 00000000000..27ca6687e38 --- /dev/null +++ b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/aio/operations_async/_entity_operations_async.py @@ -0,0 +1,160 @@ +# 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 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 EntityOperations: + """EntityOperations 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: ~management_groups_api.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, + select: Optional[str] = None, + search: Optional[Union[str, "models.Enum2"]] = None, + filter: Optional[str] = None, + view: Optional[Union[str, "models.Enum3"]] = None, + group_name: Optional[str] = None, + cache_control: Optional[str] = "no-cache", + **kwargs + ) -> AsyncIterable["models.EntityListResult"]: + """List all entities (Management Groups, Subscriptions, etc.) for the authenticated user. + + :param select: This parameter specifies the fields to include in the response. Can include any + combination of Name,DisplayName,Type,ParentDisplayNameChain,ParentChain, e.g. + '$select=Name,DisplayName,Type,ParentDisplayNameChain,ParentNameChain'. When specified the + $select parameter can override select in $skipToken. + :type select: str + :param search: The $search parameter is used in conjunction with the $filter parameter to + return three different outputs depending on the parameter passed in. + With $search=AllowedParents the API will return the entity info of all groups that the + requested entity will be able to reparent to as determined by the user's permissions. + With $search=AllowedChildren the API will return the entity info of all entities that can be + added as children of the requested entity. + With $search=ParentAndFirstLevelChildren the API will return the parent and first level of + children that the user has either direct access to or indirect access via one of their + descendants. + With $search=ParentOnly the API will return only the group if the user has access to at least + one of the descendants of the group. + With $search=ChildrenOnly the API will return only the first level of children of the group + entity info specified in $filter. The user must have direct access to the children entities or + one of it's descendants for it to show up in the results. + :type search: str or ~management_groups_api.models.Enum2 + :param filter: The filter parameter allows you to filter on the the name or display name + fields. You can check for equality on the name field (e.g. name eq '{entityName}') and you can + check for substrings on either the name or display name fields(e.g. contains(name, + '{substringToSearch}'), contains(displayName, '{substringToSearch')). Note that the + '{entityName}' and '{substringToSearch}' fields are checked case insensitively. + :type filter: str + :param view: The view parameter allows clients to filter the type of data that is returned by + the getEntities call. + :type view: str or ~management_groups_api.models.Enum3 + :param group_name: A filter which allows the get entities call to focus on a particular group + (i.e. "$filter=name eq 'groupName'"). + :type group_name: str + :param cache_control: Indicates that the request shouldn't utilize any caches. + :type cache_control: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EntityListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~management_groups_api.models.EntityListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.EntityListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + + def prepare_request(next_link=None): + 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') + if self._config.skiptoken is not None: + query_parameters['$skiptoken'] = self._serialize.query("self._config.skiptoken", self._config.skiptoken, 'str') + if self._config.skip is not None: + query_parameters['$skip'] = self._serialize.query("self._config.skip", self._config.skip, 'int') + if self._config.top is not None: + query_parameters['$top'] = self._serialize.query("self._config.top", self._config.top, 'int') + if select is not None: + query_parameters['$select'] = self._serialize.query("select", select, 'str') + if search is not None: + query_parameters['$search'] = self._serialize.query("search", search, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if view is not None: + query_parameters['$view'] = self._serialize.query("view", view, 'str') + if group_name is not None: + query_parameters['groupName'] = self._serialize.query("group_name", group_name, 'str') + + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if cache_control is not None: + header_parameters['Cache-Control'] = self._serialize.header("cache_control", cache_control, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('EntityListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.Management/getEntities'} # type: ignore diff --git a/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/aio/operations_async/_hierarchy_setting_operations_async.py b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/aio/operations_async/_hierarchy_setting_operations_async.py new file mode 100644 index 00000000000..e96723e1723 --- /dev/null +++ b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/aio/operations_async/_hierarchy_setting_operations_async.py @@ -0,0 +1,337 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import 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 HierarchySettingOperations: + """HierarchySettingOperations 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: ~management_groups_api.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 list( + self, + group_id: str, + **kwargs + ) -> "models.HierarchySettingsList": + """Gets all the hierarchy settings defined at the Management Group level. Settings can only be set on the root Management Group of the hierarchy. + + :param group_id: Management Group ID. + :type group_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HierarchySettingsList, or the result of cls(response) + :rtype: ~management_groups_api.models.HierarchySettingsList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HierarchySettingsList"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_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'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HierarchySettingsList', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/settings'} # type: ignore + + async def get( + self, + group_id: str, + **kwargs + ) -> "models.HierarchySettings": + """Gets the hierarchy settings defined at the Management Group level. Settings can only be set on the root Management Group of the hierarchy. + + :param group_id: Management Group ID. + :type group_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HierarchySettings, or the result of cls(response) + :rtype: ~management_groups_api.models.HierarchySettings + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HierarchySettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_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'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HierarchySettings', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/settings/default'} # type: ignore + + async def create_or_update( + self, + group_id: str, + require_authorization_for_group_creation: Optional[bool] = None, + default_management_group: Optional[str] = None, + **kwargs + ) -> "models.HierarchySettings": + """Creates or updates the hierarchy settings defined at the Management Group level. + + :param group_id: Management Group ID. + :type group_id: str + :param require_authorization_for_group_creation: Indicates whether RBAC access is required upon + group creation under the root Management Group. If set to true, user will require + Microsoft.Management/managementGroups/write action on the root Management Group scope in order + to create new Groups directly under the root. This will prevent new users from creating new + Management Groups, unless they are given access. + :type require_authorization_for_group_creation: bool + :param default_management_group: Settings that sets the default Management Group under which + new subscriptions get added in this tenant. For example, + /providers/Microsoft.Management/managementGroups/defaultGroup. + :type default_management_group: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HierarchySettings, or the result of cls(response) + :rtype: ~management_groups_api.models.HierarchySettings + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HierarchySettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _create_tenant_settings_request = models.CreateOrUpdateSettingsRequest(require_authorization_for_group_creation=require_authorization_for_group_creation, default_management_group=default_management_group) + api_version = "2020-05-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_create_tenant_settings_request, 'CreateOrUpdateSettingsRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HierarchySettings', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/settings/default'} # type: ignore + + async def update( + self, + group_id: str, + require_authorization_for_group_creation: Optional[bool] = None, + default_management_group: Optional[str] = None, + **kwargs + ) -> "models.HierarchySettings": + """Updates the hierarchy settings defined at the Management Group level. + + :param group_id: Management Group ID. + :type group_id: str + :param require_authorization_for_group_creation: Indicates whether RBAC access is required upon + group creation under the root Management Group. If set to true, user will require + Microsoft.Management/managementGroups/write action on the root Management Group scope in order + to create new Groups directly under the root. This will prevent new users from creating new + Management Groups, unless they are given access. + :type require_authorization_for_group_creation: bool + :param default_management_group: Settings that sets the default Management Group under which + new subscriptions get added in this tenant. For example, + /providers/Microsoft.Management/managementGroups/defaultGroup. + :type default_management_group: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HierarchySettings, or the result of cls(response) + :rtype: ~management_groups_api.models.HierarchySettings + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HierarchySettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _create_tenant_settings_request = models.CreateOrUpdateSettingsRequest(require_authorization_for_group_creation=require_authorization_for_group_creation, default_management_group=default_management_group) + api_version = "2020-05-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_create_tenant_settings_request, 'CreateOrUpdateSettingsRequest') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HierarchySettings', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/settings/default'} # type: ignore + + async def delete( + self, + group_id: str, + **kwargs + ) -> None: + """Deletes the hierarchy settings defined at the Management Group level. + + :param group_id: Management Group ID. + :type group_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_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] + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/settings/default'} # type: ignore diff --git a/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/aio/operations_async/_management_group_operations_async.py b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/aio/operations_async/_management_group_operations_async.py new file mode 100644 index 00000000000..369968644bd --- /dev/null +++ b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/aio/operations_async/_management_group_operations_async.py @@ -0,0 +1,568 @@ +# 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 HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncNoPolling, AsyncPollingMethod, async_poller +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ManagementGroupOperations: + """ManagementGroupOperations 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: ~management_groups_api.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, + cache_control: Optional[str] = "no-cache", + **kwargs + ) -> AsyncIterable["models.ManagementGroupListResult"]: + """List management groups for the authenticated user. + + :param cache_control: Indicates that the request shouldn't utilize any caches. + :type cache_control: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagementGroupListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~management_groups_api.models.ManagementGroupListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementGroupListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + + def prepare_request(next_link=None): + 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') + if self._config.skiptoken is not None: + query_parameters['$skiptoken'] = self._serialize.query("self._config.skiptoken", self._config.skiptoken, 'str') + + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if cache_control is not None: + header_parameters['Cache-Control'] = self._serialize.header("cache_control", cache_control, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ManagementGroupListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.Management/managementGroups'} # type: ignore + + async def get( + self, + group_id: str, + expand: Optional[Union[str, "models.Enum0"]] = None, + recurse: Optional[bool] = None, + filter: Optional[str] = None, + cache_control: Optional[str] = "no-cache", + **kwargs + ) -> "models.ManagementGroup": + """Get the details of the management group. + + :param group_id: Management Group ID. + :type group_id: str + :param expand: The $expand=children query string parameter allows clients to request inclusion + of children in the response payload. $expand=path includes the path from the root group to the + current group. + :type expand: str or ~management_groups_api.models.Enum0 + :param recurse: The $recurse=true query string parameter allows clients to request inclusion of + entire hierarchy in the response payload. Note that $expand=children must be passed up if + $recurse is set to true. + :type recurse: bool + :param filter: A filter which allows the exclusion of subscriptions from results (i.e. + '$filter=children.childType ne Subscription'). + :type filter: str + :param cache_control: Indicates that the request shouldn't utilize any caches. + :type cache_control: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagementGroup, or the result of cls(response) + :rtype: ~management_groups_api.models.ManagementGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementGroup"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_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') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + if recurse is not None: + query_parameters['$recurse'] = self._serialize.query("recurse", recurse, 'bool') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if cache_control is not None: + header_parameters['Cache-Control'] = self._serialize.header("cache_control", cache_control, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagementGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}'} # type: ignore + + async def _create_or_update_initial( + self, + group_id: str, + cache_control: Optional[str] = "no-cache", + name: Optional[str] = None, + display_name: Optional[str] = None, + id: Optional[str] = None, + **kwargs + ) -> Union["models.ManagementGroup", "models.AzureAsyncOperationResults"]: + cls = kwargs.pop('cls', None) # type: ClsType[Union["models.ManagementGroup", "models.AzureAsyncOperationResults"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _create_management_group_request = models.CreateManagementGroupRequest(name=name, display_name_properties_display_name=display_name, id_properties_details_parent_id=id) + api_version = "2020-05-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_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] + if cache_control is not None: + header_parameters['Cache-Control'] = self._serialize.header("cache_control", cache_control, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_create_management_group_request, 'CreateManagementGroupRequest') + 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ManagementGroup', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('AzureAsyncOperationResults', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _create_or_update_initial.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}'} # type: ignore + + async def create_or_update( + self, + group_id: str, + cache_control: Optional[str] = "no-cache", + name: Optional[str] = None, + display_name: Optional[str] = None, + id: Optional[str] = None, + **kwargs + ) -> Union["models.ManagementGroup", "models.AzureAsyncOperationResults"]: + """Create or update a management group. + If a management group is already created and a subsequent create request is issued with different properties, the management group properties will be updated. + + :param group_id: Management Group ID. + :type group_id: str + :param cache_control: Indicates that the request shouldn't utilize any caches. + :type cache_control: str + :param name: The name of the management group. For example, + 00000000-0000-0000-0000-000000000000. + :type name: str + :param display_name: The friendly name of the management group. If no value is passed then this + field will be set to the groupId. + :type display_name: str + :param id: The fully qualified ID for the parent management group. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + :type id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: ManagementGroup, or the result of cls(response) + :rtype: ~management_groups_api.models.ManagementGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[Union["models.ManagementGroup", "models.AzureAsyncOperationResults"]] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + raw_result = await self._create_or_update_initial( + group_id=group_id, + cache_control=cache_control, + name=name, + display_name=display_name, + id=id, + 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('ManagementGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + create_or_update.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}'} # type: ignore + + async def update( + self, + group_id: str, + cache_control: Optional[str] = "no-cache", + display_name: Optional[str] = None, + parent_group_id: Optional[str] = None, + **kwargs + ) -> "models.ManagementGroup": + """Update a management group. + + :param group_id: Management Group ID. + :type group_id: str + :param cache_control: Indicates that the request shouldn't utilize any caches. + :type cache_control: str + :param display_name: The friendly name of the management group. + :type display_name: str + :param parent_group_id: (Optional) The fully qualified ID for the parent management group. For + example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + :type parent_group_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagementGroup, or the result of cls(response) + :rtype: ~management_groups_api.models.ManagementGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementGroup"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _patch_group_request = models.PatchManagementGroupRequest(display_name=display_name, parent_group_id=parent_group_id) + api_version = "2020-05-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_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] + if cache_control is not None: + header_parameters['Cache-Control'] = self._serialize.header("cache_control", cache_control, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_patch_group_request, 'PatchManagementGroupRequest') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagementGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}'} # type: ignore + + async def _delete_initial( + self, + group_id: str, + cache_control: Optional[str] = "no-cache", + **kwargs + ) -> "models.AzureAsyncOperationResults": + cls = kwargs.pop('cls', None) # type: ClsType["models.AzureAsyncOperationResults"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_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] + if cache_control is not None: + header_parameters['Cache-Control'] = self._serialize.header("cache_control", cache_control, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('AzureAsyncOperationResults', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _delete_initial.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}'} # type: ignore + + async def delete( + self, + group_id: str, + cache_control: Optional[str] = "no-cache", + **kwargs + ) -> "models.AzureAsyncOperationResults": + """Delete management group. + If a management group contains child resources, the request will fail. + + :param group_id: Management Group ID. + :type group_id: str + :param cache_control: Indicates that the request shouldn't utilize any caches. + :type cache_control: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: AzureAsyncOperationResults, or the result of cls(response) + :rtype: ~management_groups_api.models.AzureAsyncOperationResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.AzureAsyncOperationResults"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + raw_result = await self._delete_initial( + group_id=group_id, + cache_control=cache_control, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('AzureAsyncOperationResults', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}'} # type: ignore + + def get_descendant( + self, + group_id: str, + **kwargs + ) -> AsyncIterable["models.DescendantListResult"]: + """List all entities that descend from a management group. + + :param group_id: Management Group ID. + :type group_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DescendantListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~management_groups_api.models.DescendantListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DescendantListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.get_descendant.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_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') + if self._config.skiptoken is not None: + query_parameters['$skiptoken'] = self._serialize.query("self._config.skiptoken", self._config.skiptoken, 'str') + if self._config.top is not None: + query_parameters['$top'] = self._serialize.query("self._config.top", self._config.top, 'int') + + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DescendantListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + get_descendant.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/descendants'} # type: ignore diff --git a/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/aio/operations_async/_management_group_subscription_operations_async.py b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/aio/operations_async/_management_group_subscription_operations_async.py new file mode 100644 index 00000000000..7f1e707a3dd --- /dev/null +++ b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/aio/operations_async/_management_group_subscription_operations_async.py @@ -0,0 +1,290 @@ +# 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 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 ManagementGroupSubscriptionOperations: + """ManagementGroupSubscriptionOperations 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: ~management_groups_api.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def create( + self, + group_id: str, + subscription_id: str, + cache_control: Optional[str] = "no-cache", + **kwargs + ) -> "models.SubscriptionUnderManagementGroup": + """Associates existing subscription with the management group. + + :param group_id: Management Group ID. + :type group_id: str + :param subscription_id: Subscription ID. + :type subscription_id: str + :param cache_control: Indicates that the request shouldn't utilize any caches. + :type cache_control: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SubscriptionUnderManagementGroup, or the result of cls(response) + :rtype: ~management_groups_api.models.SubscriptionUnderManagementGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SubscriptionUnderManagementGroup"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + + # Construct URL + url = self.create.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str'), + 'subscriptionId': self._serialize.url("subscription_id", 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] + if cache_control is not None: + header_parameters['Cache-Control'] = self._serialize.header("cache_control", cache_control, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SubscriptionUnderManagementGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/subscriptions/{subscriptionId}'} # type: ignore + + async def delete( + self, + group_id: str, + subscription_id: str, + cache_control: Optional[str] = "no-cache", + **kwargs + ) -> None: + """De-associates subscription from the management group. + + :param group_id: Management Group ID. + :type group_id: str + :param subscription_id: Subscription ID. + :type subscription_id: str + :param cache_control: Indicates that the request shouldn't utilize any caches. + :type cache_control: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str'), + 'subscriptionId': self._serialize.url("subscription_id", 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] + if cache_control is not None: + header_parameters['Cache-Control'] = self._serialize.header("cache_control", cache_control, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/subscriptions/{subscriptionId}'} # type: ignore + + async def get_subscription( + self, + group_id: str, + subscription_id: str, + cache_control: Optional[str] = "no-cache", + **kwargs + ) -> "models.SubscriptionUnderManagementGroup": + """Retrieves details about given subscription which is associated with the management group. + + :param group_id: Management Group ID. + :type group_id: str + :param subscription_id: Subscription ID. + :type subscription_id: str + :param cache_control: Indicates that the request shouldn't utilize any caches. + :type cache_control: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SubscriptionUnderManagementGroup, or the result of cls(response) + :rtype: ~management_groups_api.models.SubscriptionUnderManagementGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SubscriptionUnderManagementGroup"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + + # Construct URL + url = self.get_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str'), + 'subscriptionId': self._serialize.url("subscription_id", 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] + if cache_control is not None: + header_parameters['Cache-Control'] = self._serialize.header("cache_control", cache_control, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SubscriptionUnderManagementGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_subscription.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/subscriptions/{subscriptionId}'} # type: ignore + + def get_subscription_under_management_group( + self, + group_id: str, + **kwargs + ) -> AsyncIterable["models.ListSubscriptionUnderManagementGroup"]: + """Retrieves details about all subscriptions which are associated with the management group. + + :param group_id: Management Group ID. + :type group_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ListSubscriptionUnderManagementGroup or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~management_groups_api.models.ListSubscriptionUnderManagementGroup] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ListSubscriptionUnderManagementGroup"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.get_subscription_under_management_group.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_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') + if self._config.skiptoken is not None: + query_parameters['$skiptoken'] = self._serialize.query("self._config.skiptoken", self._config.skiptoken, 'str') + + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ListSubscriptionUnderManagementGroup', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + get_subscription_under_management_group.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/subscriptions'} # type: ignore diff --git a/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/aio/operations_async/_management_groups_api_operations_async.py b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/aio/operations_async/_management_groups_api_operations_async.py new file mode 100644 index 00000000000..40fee195248 --- /dev/null +++ b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/aio/operations_async/_management_groups_api_operations_async.py @@ -0,0 +1,167 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import 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 ManagementGroupsAPIOperationsMixin: + + async def check_name_availability( + self, + name: Optional[str] = None, + **kwargs + ) -> "models.CheckNameAvailabilityResult": + """Checks if the specified management group name is valid and unique. + + :param name: the name to check for availability. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult, or the result of cls(response) + :rtype: ~management_groups_api.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _check_name_availability_request = models.CheckNameAvailabilityRequest(name=name) + api_version = "2020-05-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_check_name_availability_request, 'CheckNameAvailabilityRequest') + 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) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/providers/Microsoft.Management/checkNameAvailability'} # type: ignore + + async def start_tenant_backfill( + self, + **kwargs + ) -> "models.TenantBackfillStatusResult": + """Starts backfilling subscriptions for the Tenant. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TenantBackfillStatusResult, or the result of cls(response) + :rtype: ~management_groups_api.models.TenantBackfillStatusResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TenantBackfillStatusResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + + # Construct URL + url = self.start_tenant_backfill.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TenantBackfillStatusResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + start_tenant_backfill.metadata = {'url': '/providers/Microsoft.Management/startTenantBackfill'} # type: ignore + + async def tenant_backfill_status( + self, + **kwargs + ) -> "models.TenantBackfillStatusResult": + """Gets tenant backfill status. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TenantBackfillStatusResult, or the result of cls(response) + :rtype: ~management_groups_api.models.TenantBackfillStatusResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TenantBackfillStatusResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + + # Construct URL + url = self.tenant_backfill_status.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TenantBackfillStatusResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + tenant_backfill_status.metadata = {'url': '/providers/Microsoft.Management/tenantBackfillStatus'} # type: ignore diff --git a/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/aio/operations_async/_operation_operations_async.py b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/aio/operations_async/_operation_operations_async.py new file mode 100644 index 00000000000..5abb1da7b3f --- /dev/null +++ b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/aio/operations_async/_operation_operations_async.py @@ -0,0 +1,102 @@ +# 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 HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class OperationOperations: + """OperationOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~management_groups_api.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs + ) -> AsyncIterable["models.OperationListResult"]: + """Lists all of the available Management REST API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~management_groups_api.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + + def prepare_request(next_link=None): + 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') + + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.Management/operations'} # type: ignore diff --git a/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/models/__init__.py b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/models/__init__.py new file mode 100644 index 00000000000..6c59112f914 --- /dev/null +++ b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/models/__init__.py @@ -0,0 +1,131 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import AzureAsyncOperationResults + from ._models_py3 import CheckNameAvailabilityRequest + from ._models_py3 import CheckNameAvailabilityResult + from ._models_py3 import CreateManagementGroupChildInfo + from ._models_py3 import CreateManagementGroupRequest + from ._models_py3 import CreateOrUpdateSettingsRequest + from ._models_py3 import DescendantInfo + from ._models_py3 import DescendantListResult + from ._models_py3 import DescendantParentGroupInfo + from ._models_py3 import EntityHierarchyItem + from ._models_py3 import EntityInfo + from ._models_py3 import EntityListResult + from ._models_py3 import EntityParentGroupInfo + from ._models_py3 import ErrorDetails + from ._models_py3 import ErrorResponse + from ._models_py3 import HierarchySettings + from ._models_py3 import HierarchySettingsInfo + from ._models_py3 import HierarchySettingsList + from ._models_py3 import ListSubscriptionUnderManagementGroup + from ._models_py3 import ManagementGroup + from ._models_py3 import ManagementGroupChildInfo + from ._models_py3 import ManagementGroupDetails + from ._models_py3 import ManagementGroupInfo + from ._models_py3 import ManagementGroupListResult + from ._models_py3 import ManagementGroupPathElement + from ._models_py3 import Operation + from ._models_py3 import OperationDisplayProperties + from ._models_py3 import OperationListResult + from ._models_py3 import OperationResults + from ._models_py3 import ParentGroupInfo + from ._models_py3 import PatchManagementGroupRequest + from ._models_py3 import SubscriptionUnderManagementGroup + from ._models_py3 import TenantBackfillStatusResult +except (SyntaxError, ImportError): + from ._models import AzureAsyncOperationResults # type: ignore + from ._models import CheckNameAvailabilityRequest # type: ignore + from ._models import CheckNameAvailabilityResult # type: ignore + from ._models import CreateManagementGroupChildInfo # type: ignore + from ._models import CreateManagementGroupRequest # type: ignore + from ._models import CreateOrUpdateSettingsRequest # type: ignore + from ._models import DescendantInfo # type: ignore + from ._models import DescendantListResult # type: ignore + from ._models import DescendantParentGroupInfo # type: ignore + from ._models import EntityHierarchyItem # type: ignore + from ._models import EntityInfo # type: ignore + from ._models import EntityListResult # type: ignore + from ._models import EntityParentGroupInfo # type: ignore + from ._models import ErrorDetails # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import HierarchySettings # type: ignore + from ._models import HierarchySettingsInfo # type: ignore + from ._models import HierarchySettingsList # type: ignore + from ._models import ListSubscriptionUnderManagementGroup # type: ignore + from ._models import ManagementGroup # type: ignore + from ._models import ManagementGroupChildInfo # type: ignore + from ._models import ManagementGroupDetails # type: ignore + from ._models import ManagementGroupInfo # type: ignore + from ._models import ManagementGroupListResult # type: ignore + from ._models import ManagementGroupPathElement # type: ignore + from ._models import Operation # type: ignore + from ._models import OperationDisplayProperties # type: ignore + from ._models import OperationListResult # type: ignore + from ._models import OperationResults # type: ignore + from ._models import ParentGroupInfo # type: ignore + from ._models import PatchManagementGroupRequest # type: ignore + from ._models import SubscriptionUnderManagementGroup # type: ignore + from ._models import TenantBackfillStatusResult # type: ignore + +from ._management_groups_api_enums import ( + Enum0, + Enum2, + Enum3, + Enum5, + ManagementGroupChildType, + Permissions, + Reason, + Status, +) + +__all__ = [ + 'AzureAsyncOperationResults', + 'CheckNameAvailabilityRequest', + 'CheckNameAvailabilityResult', + 'CreateManagementGroupChildInfo', + 'CreateManagementGroupRequest', + 'CreateOrUpdateSettingsRequest', + 'DescendantInfo', + 'DescendantListResult', + 'DescendantParentGroupInfo', + 'EntityHierarchyItem', + 'EntityInfo', + 'EntityListResult', + 'EntityParentGroupInfo', + 'ErrorDetails', + 'ErrorResponse', + 'HierarchySettings', + 'HierarchySettingsInfo', + 'HierarchySettingsList', + 'ListSubscriptionUnderManagementGroup', + 'ManagementGroup', + 'ManagementGroupChildInfo', + 'ManagementGroupDetails', + 'ManagementGroupInfo', + 'ManagementGroupListResult', + 'ManagementGroupPathElement', + 'Operation', + 'OperationDisplayProperties', + 'OperationListResult', + 'OperationResults', + 'ParentGroupInfo', + 'PatchManagementGroupRequest', + 'SubscriptionUnderManagementGroup', + 'TenantBackfillStatusResult', + 'Enum0', + 'Enum2', + 'Enum3', + 'Enum5', + 'ManagementGroupChildType', + 'Permissions', + 'Reason', + 'Status', +] diff --git a/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/models/_management_groups_api_enums.py b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/models/_management_groups_api_enums.py new file mode 100644 index 00000000000..81028f6b8a6 --- /dev/null +++ b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/models/_management_groups_api_enums.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 enum import Enum + +class Enum0(str, Enum): + + children = "children" + path = "path" + +class Enum2(str, Enum): + + allowed_parents = "AllowedParents" + allowed_children = "AllowedChildren" + parent_and_first_level_children = "ParentAndFirstLevelChildren" + parent_only = "ParentOnly" + children_only = "ChildrenOnly" + +class Enum3(str, Enum): + + full_hierarchy = "FullHierarchy" + groups_only = "GroupsOnly" + subscriptions_only = "SubscriptionsOnly" + audit = "Audit" + +class Enum5(str, Enum): + + create = "create" + delete = "delete" + +class ManagementGroupChildType(str, Enum): + """The type of child resource. + """ + + microsoft_management_management_groups = "Microsoft.Management/managementGroups" + __subscriptions = "/subscriptions" + +class Permissions(str, Enum): + """The users specific permissions to this item. + """ + + noaccess = "noaccess" + view = "view" + edit = "edit" + delete = "delete" + +class Reason(str, Enum): + """Required if nameAvailable == false. Invalid indicates the name provided does not match the + resource provider's naming requirements (incorrect length, unsupported characters, etc.) + AlreadyExists indicates that the name is already in use and is therefore unavailable. + """ + + invalid = "Invalid" + already_exists = "AlreadyExists" + +class Status(str, Enum): + """The status of the Tenant Backfill + """ + + not_started = "NotStarted" + not_started_but_groups_exist = "NotStartedButGroupsExist" + started = "Started" + failed = "Failed" + cancelled = "Cancelled" + completed = "Completed" diff --git a/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/models/_models.py b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/models/_models.py new file mode 100644 index 00000000000..a9f35c5de35 --- /dev/null +++ b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/models/_models.py @@ -0,0 +1,1304 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class AzureAsyncOperationResults(msrest.serialization.Model): + """The results of Azure-AsyncOperation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The fully qualified ID for the management group. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + :vartype id: str + :ivar type: The type of the resource. For example, Microsoft.Management/managementGroups. + :vartype type: str + :ivar name: The name of the management group. For example, + 00000000-0000-0000-0000-000000000000. + :vartype name: str + :ivar status: The current status of the asynchronous operation performed . For example, + Running, Succeeded, Failed. + :vartype status: str + :param tenant_id: The AAD Tenant ID associated with the management group. For example, + 00000000-0000-0000-0000-000000000000. + :type tenant_id: str + :param display_name: The friendly name of the management group. + :type display_name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AzureAsyncOperationResults, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.status = None + self.tenant_id = kwargs.get('tenant_id', None) + self.display_name = kwargs.get('display_name', None) + + +class CheckNameAvailabilityRequest(msrest.serialization.Model): + """Management group name availability check parameters. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param name: the name to check for availability. + :type name: str + :ivar type: fully qualified resource type which includes provider namespace. Default value: + "Microsoft.Management/managementGroups". + :vartype type: str + """ + + _validation = { + 'type': {'constant': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + type = "Microsoft.Management/managementGroups" + + def __init__( + self, + **kwargs + ): + super(CheckNameAvailabilityRequest, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + + +class CheckNameAvailabilityResult(msrest.serialization.Model): + """Describes the result of the request to check management group name availability. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name_available: Required. True indicates name is valid and available. False indicates the + name is invalid, unavailable, or both. + :vartype name_available: bool + :ivar reason: Required if nameAvailable == false. Invalid indicates the name provided does not + match the resource provider's naming requirements (incorrect length, unsupported characters, + etc.) AlreadyExists indicates that the name is already in use and is therefore unavailable. + Possible values include: "Invalid", "AlreadyExists". + :vartype reason: str or ~management_groups_api.models.Reason + :ivar message: Required if nameAvailable == false. Localized. If reason == invalid, provide the + user with the reason why the given name is invalid, and provide the resource naming + requirements so that the user can select a valid name. If reason == AlreadyExists, explain that + is already in use, and direct them to select a different name. + :vartype message: str + """ + + _validation = { + 'name_available': {'readonly': True}, + 'reason': {'readonly': True}, + 'message': {'readonly': True}, + } + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CheckNameAvailabilityResult, self).__init__(**kwargs) + self.name_available = None + self.reason = None + self.message = None + + +class CreateManagementGroupChildInfo(msrest.serialization.Model): + """The child information of a management group used during creation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The fully qualified resource type which includes provider namespace (e.g. + Microsoft.Management/managementGroups). Possible values include: + "Microsoft.Management/managementGroups", "/subscriptions". + :vartype type: str or ~management_groups_api.models.ManagementGroupChildType + :ivar id: The fully qualified ID for the child resource (management group or subscription). + For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + :vartype id: str + :ivar name: The name of the child entity. + :vartype name: str + :ivar display_name: The friendly name of the child resource. + :vartype display_name: str + :ivar children: The list of children. + :vartype children: list[~management_groups_api.models.CreateManagementGroupChildInfo] + """ + + _validation = { + 'type': {'readonly': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'display_name': {'readonly': True}, + 'children': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'children': {'key': 'children', 'type': '[CreateManagementGroupChildInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(CreateManagementGroupChildInfo, self).__init__(**kwargs) + self.type = None + self.id = None + self.name = None + self.display_name = None + self.children = None + + +class CreateManagementGroupRequest(msrest.serialization.Model): + """Management group creation parameters. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The fully qualified ID for the management group. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + :vartype id: str + :ivar type: The type of the resource. For example, Microsoft.Management/managementGroups. + :vartype type: str + :param name: The name of the management group. For example, + 00000000-0000-0000-0000-000000000000. + :type name: str + :ivar tenant_id: The AAD Tenant ID associated with the management group. For example, + 00000000-0000-0000-0000-000000000000. + :vartype tenant_id: str + :param display_name_properties_display_name: The friendly name of the management group. If no + value is passed then this field will be set to the groupId. + :type display_name_properties_display_name: str + :ivar children: The list of children. + :vartype children: list[~management_groups_api.models.CreateManagementGroupChildInfo] + :ivar version: The version number of the object. + :vartype version: int + :ivar updated_time: The date and time when this object was last updated. + :vartype updated_time: ~datetime.datetime + :ivar updated_by: The identity of the principal or process that updated the object. + :vartype updated_by: str + :param id_properties_details_parent_id: The fully qualified ID for the parent management group. + For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + :type id_properties_details_parent_id: str + :ivar name_properties_details_parent_name: The name of the parent management group. + :vartype name_properties_details_parent_name: str + :ivar display_name_properties_details_parent_display_name: The friendly name of the parent + management group. + :vartype display_name_properties_details_parent_display_name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'tenant_id': {'readonly': True}, + 'children': {'readonly': True}, + 'version': {'readonly': True}, + 'updated_time': {'readonly': True}, + 'updated_by': {'readonly': True}, + 'name_properties_details_parent_name': {'readonly': True}, + 'display_name_properties_details_parent_display_name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'display_name_properties_display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'children': {'key': 'properties.children', 'type': '[CreateManagementGroupChildInfo]'}, + 'version': {'key': 'properties.details.version', 'type': 'int'}, + 'updated_time': {'key': 'properties.details.updatedTime', 'type': 'iso-8601'}, + 'updated_by': {'key': 'properties.details.updatedBy', 'type': 'str'}, + 'id_properties_details_parent_id': {'key': 'properties.details.parent.id', 'type': 'str'}, + 'name_properties_details_parent_name': {'key': 'properties.details.parent.name', 'type': 'str'}, + 'display_name_properties_details_parent_display_name': {'key': 'properties.details.parent.displayName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CreateManagementGroupRequest, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = kwargs.get('name', None) + self.tenant_id = None + self.display_name_properties_display_name = kwargs.get('display_name_properties_display_name', None) + self.children = None + self.version = None + self.updated_time = None + self.updated_by = None + self.id_properties_details_parent_id = kwargs.get('id_properties_details_parent_id', None) + self.name_properties_details_parent_name = None + self.display_name_properties_details_parent_display_name = None + + +class CreateOrUpdateSettingsRequest(msrest.serialization.Model): + """Parameters for creating or updating Management Group settings. + + :param require_authorization_for_group_creation: Indicates whether RBAC access is required upon + group creation under the root Management Group. If set to true, user will require + Microsoft.Management/managementGroups/write action on the root Management Group scope in order + to create new Groups directly under the root. This will prevent new users from creating new + Management Groups, unless they are given access. + :type require_authorization_for_group_creation: bool + :param default_management_group: Settings that sets the default Management Group under which + new subscriptions get added in this tenant. For example, + /providers/Microsoft.Management/managementGroups/defaultGroup. + :type default_management_group: str + """ + + _attribute_map = { + 'require_authorization_for_group_creation': {'key': 'properties.requireAuthorizationForGroupCreation', 'type': 'bool'}, + 'default_management_group': {'key': 'properties.defaultManagementGroup', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CreateOrUpdateSettingsRequest, self).__init__(**kwargs) + self.require_authorization_for_group_creation = kwargs.get('require_authorization_for_group_creation', None) + self.default_management_group = kwargs.get('default_management_group', None) + + +class DescendantInfo(msrest.serialization.Model): + """The descendant. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The fully qualified ID for the descendant. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 or + /subscriptions/0000000-0000-0000-0000-000000000000. + :vartype id: str + :ivar type: The type of the resource. For example, Microsoft.Management/managementGroups or + /subscriptions. + :vartype type: str + :ivar name: The name of the descendant. For example, 00000000-0000-0000-0000-000000000000. + :vartype name: str + :param display_name: The friendly name of the management group. + :type display_name: str + :param parent: The ID of the parent management group. + :type parent: ~management_groups_api.models.DescendantParentGroupInfo + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'parent': {'key': 'properties.parent', 'type': 'DescendantParentGroupInfo'}, + } + + def __init__( + self, + **kwargs + ): + super(DescendantInfo, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.display_name = kwargs.get('display_name', None) + self.parent = kwargs.get('parent', None) + + +class DescendantListResult(msrest.serialization.Model): + """Describes the result of the request to view descendants. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of descendants. + :type value: list[~management_groups_api.models.DescendantInfo] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DescendantInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DescendantListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class DescendantParentGroupInfo(msrest.serialization.Model): + """The ID of the parent management group. + + :param id: The fully qualified ID for the parent management group. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DescendantParentGroupInfo, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + +class EntityHierarchyItem(msrest.serialization.Model): + """The management group details for the hierarchy view. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The fully qualified ID for the management group. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + :vartype id: str + :ivar type: The type of the resource. For example, Microsoft.Management/managementGroups. + :vartype type: str + :ivar name: The name of the management group. For example, + 00000000-0000-0000-0000-000000000000. + :vartype name: str + :param display_name: The friendly name of the management group. + :type display_name: str + :param permissions: The users specific permissions to this item. Possible values include: + "noaccess", "view", "edit", "delete". + :type permissions: str or ~management_groups_api.models.Permissions + :param children: The list of children. + :type children: list[~management_groups_api.models.EntityHierarchyItem] + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'permissions': {'key': 'properties.permissions', 'type': 'str'}, + 'children': {'key': 'properties.children', 'type': '[EntityHierarchyItem]'}, + } + + def __init__( + self, + **kwargs + ): + super(EntityHierarchyItem, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.display_name = kwargs.get('display_name', None) + self.permissions = kwargs.get('permissions', None) + self.children = kwargs.get('children', None) + + +class EntityInfo(msrest.serialization.Model): + """The entity. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The fully qualified ID for the entity. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + :vartype id: str + :ivar type: The type of the resource. For example, Microsoft.Management/managementGroups. + :vartype type: str + :ivar name: The name of the entity. For example, 00000000-0000-0000-0000-000000000000. + :vartype name: str + :param tenant_id: The AAD Tenant ID associated with the entity. For example, + 00000000-0000-0000-0000-000000000000. + :type tenant_id: str + :param display_name: The friendly name of the management group. + :type display_name: str + :param parent: (Optional) The ID of the parent management group. + :type parent: ~management_groups_api.models.EntityParentGroupInfo + :param permissions: The users specific permissions to this item. Possible values include: + "noaccess", "view", "edit", "delete". + :type permissions: str or ~management_groups_api.models.Permissions + :param inherited_permissions: The users specific permissions to this item. Possible values + include: "noaccess", "view", "edit", "delete". + :type inherited_permissions: str or ~management_groups_api.models.Permissions + :param number_of_descendants: Number of Descendants. + :type number_of_descendants: int + :param number_of_children: Number of children is the number of Groups and Subscriptions that + are exactly one level underneath the current Group. + :type number_of_children: int + :param number_of_child_groups: Number of children is the number of Groups that are exactly one + level underneath the current Group. + :type number_of_child_groups: int + :param parent_display_name_chain: The parent display name chain from the root group to the + immediate parent. + :type parent_display_name_chain: list[str] + :param parent_name_chain: The parent name chain from the root group to the immediate parent. + :type parent_name_chain: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'parent': {'key': 'properties.parent', 'type': 'EntityParentGroupInfo'}, + 'permissions': {'key': 'properties.permissions', 'type': 'str'}, + 'inherited_permissions': {'key': 'properties.inheritedPermissions', 'type': 'str'}, + 'number_of_descendants': {'key': 'properties.numberOfDescendants', 'type': 'int'}, + 'number_of_children': {'key': 'properties.numberOfChildren', 'type': 'int'}, + 'number_of_child_groups': {'key': 'properties.numberOfChildGroups', 'type': 'int'}, + 'parent_display_name_chain': {'key': 'properties.parentDisplayNameChain', 'type': '[str]'}, + 'parent_name_chain': {'key': 'properties.parentNameChain', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(EntityInfo, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.tenant_id = kwargs.get('tenant_id', None) + self.display_name = kwargs.get('display_name', None) + self.parent = kwargs.get('parent', None) + self.permissions = kwargs.get('permissions', None) + self.inherited_permissions = kwargs.get('inherited_permissions', None) + self.number_of_descendants = kwargs.get('number_of_descendants', None) + self.number_of_children = kwargs.get('number_of_children', None) + self.number_of_child_groups = kwargs.get('number_of_child_groups', None) + self.parent_display_name_chain = kwargs.get('parent_display_name_chain', None) + self.parent_name_chain = kwargs.get('parent_name_chain', None) + + +class EntityListResult(msrest.serialization.Model): + """Describes the result of the request to view entities. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of entities. + :type value: list[~management_groups_api.models.EntityInfo] + :ivar count: Total count of records that match the filter. + :vartype count: int + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'count': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[EntityInfo]'}, + 'count': {'key': 'count', 'type': 'int'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(EntityListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.count = None + self.next_link = None + + +class EntityParentGroupInfo(msrest.serialization.Model): + """(Optional) The ID of the parent management group. + + :param id: The fully qualified ID for the parent management group. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(EntityParentGroupInfo, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + +class ErrorDetails(msrest.serialization.Model): + """The details of the error. + + :param code: One of a server-defined set of error codes. + :type code: str + :param message: A human-readable representation of the error. + :type message: str + :param details: A human-readable representation of the error's details. + :type details: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'details': {'key': 'details', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDetails, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + self.details = kwargs.get('details', None) + + +class ErrorResponse(msrest.serialization.Model): + """The error object. + + :param error: The details of the error. + :type error: ~management_groups_api.models.ErrorDetails + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetails'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class HierarchySettings(msrest.serialization.Model): + """Settings defined at the Management Group scope. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The fully qualified ID for the settings object. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000/settings/default. + :vartype id: str + :ivar type: The type of the resource. For example, + Microsoft.Management/managementGroups/settings. + :vartype type: str + :ivar name: The name of the object. In this case, default. + :vartype name: str + :param tenant_id: The AAD Tenant ID associated with the hierarchy settings. For example, + 00000000-0000-0000-0000-000000000000. + :type tenant_id: str + :param require_authorization_for_group_creation: Indicates whether RBAC access is required upon + group creation under the root Management Group. If set to true, user will require + Microsoft.Management/managementGroups/write action on the root Management Group scope in order + to create new Groups directly under the root. This will prevent new users from creating new + Management Groups, unless they are given access. + :type require_authorization_for_group_creation: bool + :param default_management_group: Settings that sets the default Management Group under which + new subscriptions get added in this tenant. For example, + /providers/Microsoft.Management/managementGroups/defaultGroup. + :type default_management_group: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'require_authorization_for_group_creation': {'key': 'properties.requireAuthorizationForGroupCreation', 'type': 'bool'}, + 'default_management_group': {'key': 'properties.defaultManagementGroup', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(HierarchySettings, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.tenant_id = kwargs.get('tenant_id', None) + self.require_authorization_for_group_creation = kwargs.get('require_authorization_for_group_creation', None) + self.default_management_group = kwargs.get('default_management_group', None) + + +class HierarchySettingsInfo(msrest.serialization.Model): + """The hierarchy settings resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The fully qualified ID for the settings object. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000/settings/default. + :vartype id: str + :ivar type: The type of the resource. For example, + Microsoft.Management/managementGroups/settings. + :vartype type: str + :ivar name: The name of the object. In this case, default. + :vartype name: str + :param tenant_id: The AAD Tenant ID associated with the hierarchy settings. For example, + 00000000-0000-0000-0000-000000000000. + :type tenant_id: str + :param require_authorization_for_group_creation: Indicates whether RBAC access is required upon + group creation under the root Management Group. If set to true, user will require + Microsoft.Management/managementGroups/write action on the root Management Group scope in order + to create new Groups directly under the root. This will prevent new users from creating new + Management Groups, unless they are given access. + :type require_authorization_for_group_creation: bool + :param default_management_group: Settings that sets the default Management Group under which + new subscriptions get added in this tenant. For example, + /providers/Microsoft.Management/managementGroups/defaultGroup. + :type default_management_group: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'require_authorization_for_group_creation': {'key': 'properties.requireAuthorizationForGroupCreation', 'type': 'bool'}, + 'default_management_group': {'key': 'properties.defaultManagementGroup', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(HierarchySettingsInfo, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.tenant_id = kwargs.get('tenant_id', None) + self.require_authorization_for_group_creation = kwargs.get('require_authorization_for_group_creation', None) + self.default_management_group = kwargs.get('default_management_group', None) + + +class HierarchySettingsList(msrest.serialization.Model): + """Lists all hierarchy settings. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of hierarchy settings. + :type value: list[~management_groups_api.models.HierarchySettingsInfo] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[HierarchySettingsInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(HierarchySettingsList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class ListSubscriptionUnderManagementGroup(msrest.serialization.Model): + """The details of all subscriptions under management group. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of subscriptions. + :type value: list[~management_groups_api.models.SubscriptionUnderManagementGroup] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SubscriptionUnderManagementGroup]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ListSubscriptionUnderManagementGroup, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class ManagementGroup(msrest.serialization.Model): + """The management group details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The fully qualified ID for the management group. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + :vartype id: str + :ivar type: The type of the resource. For example, Microsoft.Management/managementGroups. + :vartype type: str + :ivar name: The name of the management group. For example, + 00000000-0000-0000-0000-000000000000. + :vartype name: str + :param tenant_id: The AAD Tenant ID associated with the management group. For example, + 00000000-0000-0000-0000-000000000000. + :type tenant_id: str + :param display_name: The friendly name of the management group. + :type display_name: str + :param details: The details of a management group. + :type details: ~management_groups_api.models.ManagementGroupDetails + :param children: The list of children. + :type children: list[~management_groups_api.models.ManagementGroupChildInfo] + :param path: The path from the root to the current group. + :type path: list[~management_groups_api.models.ManagementGroupPathElement] + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'details': {'key': 'properties.details', 'type': 'ManagementGroupDetails'}, + 'children': {'key': 'properties.children', 'type': '[ManagementGroupChildInfo]'}, + 'path': {'key': 'properties.path', 'type': '[ManagementGroupPathElement]'}, + } + + def __init__( + self, + **kwargs + ): + super(ManagementGroup, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.tenant_id = kwargs.get('tenant_id', None) + self.display_name = kwargs.get('display_name', None) + self.details = kwargs.get('details', None) + self.children = kwargs.get('children', None) + self.path = kwargs.get('path', None) + + +class ManagementGroupChildInfo(msrest.serialization.Model): + """The child information of a management group. + + :param type: The fully qualified resource type which includes provider namespace (e.g. + Microsoft.Management/managementGroups). Possible values include: + "Microsoft.Management/managementGroups", "/subscriptions". + :type type: str or ~management_groups_api.models.ManagementGroupChildType + :param id: The fully qualified ID for the child resource (management group or subscription). + For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + :type id: str + :param name: The name of the child entity. + :type name: str + :param display_name: The friendly name of the child resource. + :type display_name: str + :param children: The list of children. + :type children: list[~management_groups_api.models.ManagementGroupChildInfo] + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'children': {'key': 'children', 'type': '[ManagementGroupChildInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ManagementGroupChildInfo, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + self.id = kwargs.get('id', None) + self.name = kwargs.get('name', None) + self.display_name = kwargs.get('display_name', None) + self.children = kwargs.get('children', None) + + +class ManagementGroupDetails(msrest.serialization.Model): + """The details of a management group. + + :param version: The version number of the object. + :type version: int + :param updated_time: The date and time when this object was last updated. + :type updated_time: ~datetime.datetime + :param updated_by: The identity of the principal or process that updated the object. + :type updated_by: str + :param parent: (Optional) The ID of the parent management group. + :type parent: ~management_groups_api.models.ParentGroupInfo + """ + + _attribute_map = { + 'version': {'key': 'version', 'type': 'int'}, + 'updated_time': {'key': 'updatedTime', 'type': 'iso-8601'}, + 'updated_by': {'key': 'updatedBy', 'type': 'str'}, + 'parent': {'key': 'parent', 'type': 'ParentGroupInfo'}, + } + + def __init__( + self, + **kwargs + ): + super(ManagementGroupDetails, self).__init__(**kwargs) + self.version = kwargs.get('version', None) + self.updated_time = kwargs.get('updated_time', None) + self.updated_by = kwargs.get('updated_by', None) + self.parent = kwargs.get('parent', None) + + +class ManagementGroupInfo(msrest.serialization.Model): + """The management group resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The fully qualified ID for the management group. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + :vartype id: str + :ivar type: The type of the resource. For example, Microsoft.Management/managementGroups. + :vartype type: str + :ivar name: The name of the management group. For example, + 00000000-0000-0000-0000-000000000000. + :vartype name: str + :param tenant_id: The AAD Tenant ID associated with the management group. For example, + 00000000-0000-0000-0000-000000000000. + :type tenant_id: str + :param display_name: The friendly name of the management group. + :type display_name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ManagementGroupInfo, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.tenant_id = kwargs.get('tenant_id', None) + self.display_name = kwargs.get('display_name', None) + + +class ManagementGroupListResult(msrest.serialization.Model): + """Describes the result of the request to list management groups. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of management groups. + :type value: list[~management_groups_api.models.ManagementGroupInfo] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ManagementGroupInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ManagementGroupListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class ManagementGroupPathElement(msrest.serialization.Model): + """A path element of a management group ancestors. + + :param name: The name of the group. + :type name: str + :param display_name: The friendly name of the group. + :type display_name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ManagementGroupPathElement, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display_name = kwargs.get('display_name', None) + + +class Operation(msrest.serialization.Model): + """Operation supported by the Microsoft.Management resource provider. + + 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: ~management_groups_api.models.OperationDisplayProperties + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplayProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = kwargs.get('display', None) + + +class OperationDisplayProperties(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: The name of the provider. + :vartype provider: str + :ivar resource: The resource on which the operation is performed. + :vartype resource: str + :ivar operation: The operation that can be performed. + :vartype operation: str + :ivar description: Operation description. + :vartype description: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplayProperties, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None + + +class OperationListResult(msrest.serialization.Model): + """Describes the result of the request to list Microsoft.Management operations. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of operations supported by the Microsoft.Management resource provider. + :vartype value: list[~management_groups_api.models.Operation] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class OperationResults(msrest.serialization.Model): + """The results of an asynchronous operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The fully qualified ID for the management group. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + :vartype id: str + :ivar type: The type of the resource. For example, Microsoft.Management/managementGroups. + :vartype type: str + :ivar name: The name of the management group. For example, + 00000000-0000-0000-0000-000000000000. + :vartype name: str + :param tenant_id: The AAD Tenant ID associated with the management group. For example, + 00000000-0000-0000-0000-000000000000. + :type tenant_id: str + :param display_name: The friendly name of the management group. + :type display_name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationResults, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.tenant_id = kwargs.get('tenant_id', None) + self.display_name = kwargs.get('display_name', None) + + +class ParentGroupInfo(msrest.serialization.Model): + """(Optional) The ID of the parent management group. + + :param id: The fully qualified ID for the parent management group. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + :type id: str + :param name: The name of the parent management group. + :type name: str + :param display_name: The friendly name of the parent management group. + :type display_name: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ParentGroupInfo, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.name = kwargs.get('name', None) + self.display_name = kwargs.get('display_name', None) + + +class PatchManagementGroupRequest(msrest.serialization.Model): + """Management group patch parameters. + + :param display_name: The friendly name of the management group. + :type display_name: str + :param parent_group_id: (Optional) The fully qualified ID for the parent management group. For + example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + :type parent_group_id: str + """ + + _attribute_map = { + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'parent_group_id': {'key': 'parentGroupId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PatchManagementGroupRequest, self).__init__(**kwargs) + self.display_name = kwargs.get('display_name', None) + self.parent_group_id = kwargs.get('parent_group_id', None) + + +class SubscriptionUnderManagementGroup(msrest.serialization.Model): + """The details of subscription under management group. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The fully qualified ID for the subscription. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000/subscriptions/0000000-0000-0000-0000-000000000001. + :vartype id: str + :ivar type: The type of the resource. For example, + Microsoft.Management/managementGroups/subscriptions. + :vartype type: str + :ivar name: The stringified id of the subscription. For example, + 00000000-0000-0000-0000-000000000000. + :vartype name: str + :param tenant: The AAD Tenant ID associated with the subscription. For example, + 00000000-0000-0000-0000-000000000000. + :type tenant: str + :param display_name: The friendly name of the subscription. + :type display_name: str + :param parent: The ID of the parent management group. + :type parent: ~management_groups_api.models.DescendantParentGroupInfo + :param state: The state of the subscription. + :type state: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tenant': {'key': 'properties.tenant', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'parent': {'key': 'properties.parent', 'type': 'DescendantParentGroupInfo'}, + 'state': {'key': 'properties.state', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SubscriptionUnderManagementGroup, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.tenant = kwargs.get('tenant', None) + self.display_name = kwargs.get('display_name', None) + self.parent = kwargs.get('parent', None) + self.state = kwargs.get('state', None) + + +class TenantBackfillStatusResult(msrest.serialization.Model): + """The tenant backfill status. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar tenant_id: The AAD Tenant ID associated with the management group. For example, + 00000000-0000-0000-0000-000000000000. + :vartype tenant_id: str + :ivar status: The status of the Tenant Backfill. Possible values include: "NotStarted", + "NotStartedButGroupsExist", "Started", "Failed", "Cancelled", "Completed". + :vartype status: str or ~management_groups_api.models.Status + """ + + _validation = { + 'tenant_id': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TenantBackfillStatusResult, self).__init__(**kwargs) + self.tenant_id = None + self.status = None diff --git a/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/models/_models_py3.py b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/models/_models_py3.py new file mode 100644 index 00000000000..447f41e167d --- /dev/null +++ b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/models/_models_py3.py @@ -0,0 +1,1407 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +from typing import List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._management_groups_api_enums import * + + +class AzureAsyncOperationResults(msrest.serialization.Model): + """The results of Azure-AsyncOperation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The fully qualified ID for the management group. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + :vartype id: str + :ivar type: The type of the resource. For example, Microsoft.Management/managementGroups. + :vartype type: str + :ivar name: The name of the management group. For example, + 00000000-0000-0000-0000-000000000000. + :vartype name: str + :ivar status: The current status of the asynchronous operation performed . For example, + Running, Succeeded, Failed. + :vartype status: str + :param tenant_id: The AAD Tenant ID associated with the management group. For example, + 00000000-0000-0000-0000-000000000000. + :type tenant_id: str + :param display_name: The friendly name of the management group. + :type display_name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + } + + def __init__( + self, + *, + tenant_id: Optional[str] = None, + display_name: Optional[str] = None, + **kwargs + ): + super(AzureAsyncOperationResults, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.status = None + self.tenant_id = tenant_id + self.display_name = display_name + + +class CheckNameAvailabilityRequest(msrest.serialization.Model): + """Management group name availability check parameters. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param name: the name to check for availability. + :type name: str + :ivar type: fully qualified resource type which includes provider namespace. Default value: + "Microsoft.Management/managementGroups". + :vartype type: str + """ + + _validation = { + 'type': {'constant': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + type = "Microsoft.Management/managementGroups" + + def __init__( + self, + *, + name: Optional[str] = None, + **kwargs + ): + super(CheckNameAvailabilityRequest, self).__init__(**kwargs) + self.name = name + + +class CheckNameAvailabilityResult(msrest.serialization.Model): + """Describes the result of the request to check management group name availability. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name_available: Required. True indicates name is valid and available. False indicates the + name is invalid, unavailable, or both. + :vartype name_available: bool + :ivar reason: Required if nameAvailable == false. Invalid indicates the name provided does not + match the resource provider's naming requirements (incorrect length, unsupported characters, + etc.) AlreadyExists indicates that the name is already in use and is therefore unavailable. + Possible values include: "Invalid", "AlreadyExists". + :vartype reason: str or ~management_groups_api.models.Reason + :ivar message: Required if nameAvailable == false. Localized. If reason == invalid, provide the + user with the reason why the given name is invalid, and provide the resource naming + requirements so that the user can select a valid name. If reason == AlreadyExists, explain that + is already in use, and direct them to select a different name. + :vartype message: str + """ + + _validation = { + 'name_available': {'readonly': True}, + 'reason': {'readonly': True}, + 'message': {'readonly': True}, + } + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CheckNameAvailabilityResult, self).__init__(**kwargs) + self.name_available = None + self.reason = None + self.message = None + + +class CreateManagementGroupChildInfo(msrest.serialization.Model): + """The child information of a management group used during creation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The fully qualified resource type which includes provider namespace (e.g. + Microsoft.Management/managementGroups). Possible values include: + "Microsoft.Management/managementGroups", "/subscriptions". + :vartype type: str or ~management_groups_api.models.ManagementGroupChildType + :ivar id: The fully qualified ID for the child resource (management group or subscription). + For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + :vartype id: str + :ivar name: The name of the child entity. + :vartype name: str + :ivar display_name: The friendly name of the child resource. + :vartype display_name: str + :ivar children: The list of children. + :vartype children: list[~management_groups_api.models.CreateManagementGroupChildInfo] + """ + + _validation = { + 'type': {'readonly': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'display_name': {'readonly': True}, + 'children': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'children': {'key': 'children', 'type': '[CreateManagementGroupChildInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(CreateManagementGroupChildInfo, self).__init__(**kwargs) + self.type = None + self.id = None + self.name = None + self.display_name = None + self.children = None + + +class CreateManagementGroupRequest(msrest.serialization.Model): + """Management group creation parameters. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The fully qualified ID for the management group. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + :vartype id: str + :ivar type: The type of the resource. For example, Microsoft.Management/managementGroups. + :vartype type: str + :param name: The name of the management group. For example, + 00000000-0000-0000-0000-000000000000. + :type name: str + :ivar tenant_id: The AAD Tenant ID associated with the management group. For example, + 00000000-0000-0000-0000-000000000000. + :vartype tenant_id: str + :param display_name_properties_display_name: The friendly name of the management group. If no + value is passed then this field will be set to the groupId. + :type display_name_properties_display_name: str + :ivar children: The list of children. + :vartype children: list[~management_groups_api.models.CreateManagementGroupChildInfo] + :ivar version: The version number of the object. + :vartype version: int + :ivar updated_time: The date and time when this object was last updated. + :vartype updated_time: ~datetime.datetime + :ivar updated_by: The identity of the principal or process that updated the object. + :vartype updated_by: str + :param id_properties_details_parent_id: The fully qualified ID for the parent management group. + For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + :type id_properties_details_parent_id: str + :ivar name_properties_details_parent_name: The name of the parent management group. + :vartype name_properties_details_parent_name: str + :ivar display_name_properties_details_parent_display_name: The friendly name of the parent + management group. + :vartype display_name_properties_details_parent_display_name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'tenant_id': {'readonly': True}, + 'children': {'readonly': True}, + 'version': {'readonly': True}, + 'updated_time': {'readonly': True}, + 'updated_by': {'readonly': True}, + 'name_properties_details_parent_name': {'readonly': True}, + 'display_name_properties_details_parent_display_name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'display_name_properties_display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'children': {'key': 'properties.children', 'type': '[CreateManagementGroupChildInfo]'}, + 'version': {'key': 'properties.details.version', 'type': 'int'}, + 'updated_time': {'key': 'properties.details.updatedTime', 'type': 'iso-8601'}, + 'updated_by': {'key': 'properties.details.updatedBy', 'type': 'str'}, + 'id_properties_details_parent_id': {'key': 'properties.details.parent.id', 'type': 'str'}, + 'name_properties_details_parent_name': {'key': 'properties.details.parent.name', 'type': 'str'}, + 'display_name_properties_details_parent_display_name': {'key': 'properties.details.parent.displayName', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name_properties_display_name: Optional[str] = None, + id_properties_details_parent_id: Optional[str] = None, + **kwargs + ): + super(CreateManagementGroupRequest, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = name + self.tenant_id = None + self.display_name_properties_display_name = display_name_properties_display_name + self.children = None + self.version = None + self.updated_time = None + self.updated_by = None + self.id_properties_details_parent_id = id_properties_details_parent_id + self.name_properties_details_parent_name = None + self.display_name_properties_details_parent_display_name = None + + +class CreateOrUpdateSettingsRequest(msrest.serialization.Model): + """Parameters for creating or updating Management Group settings. + + :param require_authorization_for_group_creation: Indicates whether RBAC access is required upon + group creation under the root Management Group. If set to true, user will require + Microsoft.Management/managementGroups/write action on the root Management Group scope in order + to create new Groups directly under the root. This will prevent new users from creating new + Management Groups, unless they are given access. + :type require_authorization_for_group_creation: bool + :param default_management_group: Settings that sets the default Management Group under which + new subscriptions get added in this tenant. For example, + /providers/Microsoft.Management/managementGroups/defaultGroup. + :type default_management_group: str + """ + + _attribute_map = { + 'require_authorization_for_group_creation': {'key': 'properties.requireAuthorizationForGroupCreation', 'type': 'bool'}, + 'default_management_group': {'key': 'properties.defaultManagementGroup', 'type': 'str'}, + } + + def __init__( + self, + *, + require_authorization_for_group_creation: Optional[bool] = None, + default_management_group: Optional[str] = None, + **kwargs + ): + super(CreateOrUpdateSettingsRequest, self).__init__(**kwargs) + self.require_authorization_for_group_creation = require_authorization_for_group_creation + self.default_management_group = default_management_group + + +class DescendantInfo(msrest.serialization.Model): + """The descendant. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The fully qualified ID for the descendant. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 or + /subscriptions/0000000-0000-0000-0000-000000000000. + :vartype id: str + :ivar type: The type of the resource. For example, Microsoft.Management/managementGroups or + /subscriptions. + :vartype type: str + :ivar name: The name of the descendant. For example, 00000000-0000-0000-0000-000000000000. + :vartype name: str + :param display_name: The friendly name of the management group. + :type display_name: str + :param parent: The ID of the parent management group. + :type parent: ~management_groups_api.models.DescendantParentGroupInfo + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'parent': {'key': 'properties.parent', 'type': 'DescendantParentGroupInfo'}, + } + + def __init__( + self, + *, + display_name: Optional[str] = None, + parent: Optional["DescendantParentGroupInfo"] = None, + **kwargs + ): + super(DescendantInfo, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.display_name = display_name + self.parent = parent + + +class DescendantListResult(msrest.serialization.Model): + """Describes the result of the request to view descendants. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of descendants. + :type value: list[~management_groups_api.models.DescendantInfo] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DescendantInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["DescendantInfo"]] = None, + **kwargs + ): + super(DescendantListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class DescendantParentGroupInfo(msrest.serialization.Model): + """The ID of the parent management group. + + :param id: The fully qualified ID for the parent management group. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): + super(DescendantParentGroupInfo, self).__init__(**kwargs) + self.id = id + + +class EntityHierarchyItem(msrest.serialization.Model): + """The management group details for the hierarchy view. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The fully qualified ID for the management group. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + :vartype id: str + :ivar type: The type of the resource. For example, Microsoft.Management/managementGroups. + :vartype type: str + :ivar name: The name of the management group. For example, + 00000000-0000-0000-0000-000000000000. + :vartype name: str + :param display_name: The friendly name of the management group. + :type display_name: str + :param permissions: The users specific permissions to this item. Possible values include: + "noaccess", "view", "edit", "delete". + :type permissions: str or ~management_groups_api.models.Permissions + :param children: The list of children. + :type children: list[~management_groups_api.models.EntityHierarchyItem] + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'permissions': {'key': 'properties.permissions', 'type': 'str'}, + 'children': {'key': 'properties.children', 'type': '[EntityHierarchyItem]'}, + } + + def __init__( + self, + *, + display_name: Optional[str] = None, + permissions: Optional[Union[str, "Permissions"]] = None, + children: Optional[List["EntityHierarchyItem"]] = None, + **kwargs + ): + super(EntityHierarchyItem, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.display_name = display_name + self.permissions = permissions + self.children = children + + +class EntityInfo(msrest.serialization.Model): + """The entity. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The fully qualified ID for the entity. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + :vartype id: str + :ivar type: The type of the resource. For example, Microsoft.Management/managementGroups. + :vartype type: str + :ivar name: The name of the entity. For example, 00000000-0000-0000-0000-000000000000. + :vartype name: str + :param tenant_id: The AAD Tenant ID associated with the entity. For example, + 00000000-0000-0000-0000-000000000000. + :type tenant_id: str + :param display_name: The friendly name of the management group. + :type display_name: str + :param parent: (Optional) The ID of the parent management group. + :type parent: ~management_groups_api.models.EntityParentGroupInfo + :param permissions: The users specific permissions to this item. Possible values include: + "noaccess", "view", "edit", "delete". + :type permissions: str or ~management_groups_api.models.Permissions + :param inherited_permissions: The users specific permissions to this item. Possible values + include: "noaccess", "view", "edit", "delete". + :type inherited_permissions: str or ~management_groups_api.models.Permissions + :param number_of_descendants: Number of Descendants. + :type number_of_descendants: int + :param number_of_children: Number of children is the number of Groups and Subscriptions that + are exactly one level underneath the current Group. + :type number_of_children: int + :param number_of_child_groups: Number of children is the number of Groups that are exactly one + level underneath the current Group. + :type number_of_child_groups: int + :param parent_display_name_chain: The parent display name chain from the root group to the + immediate parent. + :type parent_display_name_chain: list[str] + :param parent_name_chain: The parent name chain from the root group to the immediate parent. + :type parent_name_chain: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'parent': {'key': 'properties.parent', 'type': 'EntityParentGroupInfo'}, + 'permissions': {'key': 'properties.permissions', 'type': 'str'}, + 'inherited_permissions': {'key': 'properties.inheritedPermissions', 'type': 'str'}, + 'number_of_descendants': {'key': 'properties.numberOfDescendants', 'type': 'int'}, + 'number_of_children': {'key': 'properties.numberOfChildren', 'type': 'int'}, + 'number_of_child_groups': {'key': 'properties.numberOfChildGroups', 'type': 'int'}, + 'parent_display_name_chain': {'key': 'properties.parentDisplayNameChain', 'type': '[str]'}, + 'parent_name_chain': {'key': 'properties.parentNameChain', 'type': '[str]'}, + } + + def __init__( + self, + *, + tenant_id: Optional[str] = None, + display_name: Optional[str] = None, + parent: Optional["EntityParentGroupInfo"] = None, + permissions: Optional[Union[str, "Permissions"]] = None, + inherited_permissions: Optional[Union[str, "Permissions"]] = None, + number_of_descendants: Optional[int] = None, + number_of_children: Optional[int] = None, + number_of_child_groups: Optional[int] = None, + parent_display_name_chain: Optional[List[str]] = None, + parent_name_chain: Optional[List[str]] = None, + **kwargs + ): + super(EntityInfo, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.tenant_id = tenant_id + self.display_name = display_name + self.parent = parent + self.permissions = permissions + self.inherited_permissions = inherited_permissions + self.number_of_descendants = number_of_descendants + self.number_of_children = number_of_children + self.number_of_child_groups = number_of_child_groups + self.parent_display_name_chain = parent_display_name_chain + self.parent_name_chain = parent_name_chain + + +class EntityListResult(msrest.serialization.Model): + """Describes the result of the request to view entities. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of entities. + :type value: list[~management_groups_api.models.EntityInfo] + :ivar count: Total count of records that match the filter. + :vartype count: int + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'count': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[EntityInfo]'}, + 'count': {'key': 'count', 'type': 'int'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["EntityInfo"]] = None, + **kwargs + ): + super(EntityListResult, self).__init__(**kwargs) + self.value = value + self.count = None + self.next_link = None + + +class EntityParentGroupInfo(msrest.serialization.Model): + """(Optional) The ID of the parent management group. + + :param id: The fully qualified ID for the parent management group. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): + super(EntityParentGroupInfo, self).__init__(**kwargs) + self.id = id + + +class ErrorDetails(msrest.serialization.Model): + """The details of the error. + + :param code: One of a server-defined set of error codes. + :type code: str + :param message: A human-readable representation of the error. + :type message: str + :param details: A human-readable representation of the error's details. + :type details: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'details': {'key': 'details', 'type': 'str'}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + details: Optional[str] = None, + **kwargs + ): + super(ErrorDetails, self).__init__(**kwargs) + self.code = code + self.message = message + self.details = details + + +class ErrorResponse(msrest.serialization.Model): + """The error object. + + :param error: The details of the error. + :type error: ~management_groups_api.models.ErrorDetails + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetails'}, + } + + def __init__( + self, + *, + error: Optional["ErrorDetails"] = None, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class HierarchySettings(msrest.serialization.Model): + """Settings defined at the Management Group scope. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The fully qualified ID for the settings object. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000/settings/default. + :vartype id: str + :ivar type: The type of the resource. For example, + Microsoft.Management/managementGroups/settings. + :vartype type: str + :ivar name: The name of the object. In this case, default. + :vartype name: str + :param tenant_id: The AAD Tenant ID associated with the hierarchy settings. For example, + 00000000-0000-0000-0000-000000000000. + :type tenant_id: str + :param require_authorization_for_group_creation: Indicates whether RBAC access is required upon + group creation under the root Management Group. If set to true, user will require + Microsoft.Management/managementGroups/write action on the root Management Group scope in order + to create new Groups directly under the root. This will prevent new users from creating new + Management Groups, unless they are given access. + :type require_authorization_for_group_creation: bool + :param default_management_group: Settings that sets the default Management Group under which + new subscriptions get added in this tenant. For example, + /providers/Microsoft.Management/managementGroups/defaultGroup. + :type default_management_group: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'require_authorization_for_group_creation': {'key': 'properties.requireAuthorizationForGroupCreation', 'type': 'bool'}, + 'default_management_group': {'key': 'properties.defaultManagementGroup', 'type': 'str'}, + } + + def __init__( + self, + *, + tenant_id: Optional[str] = None, + require_authorization_for_group_creation: Optional[bool] = None, + default_management_group: Optional[str] = None, + **kwargs + ): + super(HierarchySettings, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.tenant_id = tenant_id + self.require_authorization_for_group_creation = require_authorization_for_group_creation + self.default_management_group = default_management_group + + +class HierarchySettingsInfo(msrest.serialization.Model): + """The hierarchy settings resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The fully qualified ID for the settings object. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000/settings/default. + :vartype id: str + :ivar type: The type of the resource. For example, + Microsoft.Management/managementGroups/settings. + :vartype type: str + :ivar name: The name of the object. In this case, default. + :vartype name: str + :param tenant_id: The AAD Tenant ID associated with the hierarchy settings. For example, + 00000000-0000-0000-0000-000000000000. + :type tenant_id: str + :param require_authorization_for_group_creation: Indicates whether RBAC access is required upon + group creation under the root Management Group. If set to true, user will require + Microsoft.Management/managementGroups/write action on the root Management Group scope in order + to create new Groups directly under the root. This will prevent new users from creating new + Management Groups, unless they are given access. + :type require_authorization_for_group_creation: bool + :param default_management_group: Settings that sets the default Management Group under which + new subscriptions get added in this tenant. For example, + /providers/Microsoft.Management/managementGroups/defaultGroup. + :type default_management_group: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'require_authorization_for_group_creation': {'key': 'properties.requireAuthorizationForGroupCreation', 'type': 'bool'}, + 'default_management_group': {'key': 'properties.defaultManagementGroup', 'type': 'str'}, + } + + def __init__( + self, + *, + tenant_id: Optional[str] = None, + require_authorization_for_group_creation: Optional[bool] = None, + default_management_group: Optional[str] = None, + **kwargs + ): + super(HierarchySettingsInfo, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.tenant_id = tenant_id + self.require_authorization_for_group_creation = require_authorization_for_group_creation + self.default_management_group = default_management_group + + +class HierarchySettingsList(msrest.serialization.Model): + """Lists all hierarchy settings. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of hierarchy settings. + :type value: list[~management_groups_api.models.HierarchySettingsInfo] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[HierarchySettingsInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["HierarchySettingsInfo"]] = None, + **kwargs + ): + super(HierarchySettingsList, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ListSubscriptionUnderManagementGroup(msrest.serialization.Model): + """The details of all subscriptions under management group. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of subscriptions. + :type value: list[~management_groups_api.models.SubscriptionUnderManagementGroup] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SubscriptionUnderManagementGroup]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SubscriptionUnderManagementGroup"]] = None, + **kwargs + ): + super(ListSubscriptionUnderManagementGroup, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ManagementGroup(msrest.serialization.Model): + """The management group details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The fully qualified ID for the management group. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + :vartype id: str + :ivar type: The type of the resource. For example, Microsoft.Management/managementGroups. + :vartype type: str + :ivar name: The name of the management group. For example, + 00000000-0000-0000-0000-000000000000. + :vartype name: str + :param tenant_id: The AAD Tenant ID associated with the management group. For example, + 00000000-0000-0000-0000-000000000000. + :type tenant_id: str + :param display_name: The friendly name of the management group. + :type display_name: str + :param details: The details of a management group. + :type details: ~management_groups_api.models.ManagementGroupDetails + :param children: The list of children. + :type children: list[~management_groups_api.models.ManagementGroupChildInfo] + :param path: The path from the root to the current group. + :type path: list[~management_groups_api.models.ManagementGroupPathElement] + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'details': {'key': 'properties.details', 'type': 'ManagementGroupDetails'}, + 'children': {'key': 'properties.children', 'type': '[ManagementGroupChildInfo]'}, + 'path': {'key': 'properties.path', 'type': '[ManagementGroupPathElement]'}, + } + + def __init__( + self, + *, + tenant_id: Optional[str] = None, + display_name: Optional[str] = None, + details: Optional["ManagementGroupDetails"] = None, + children: Optional[List["ManagementGroupChildInfo"]] = None, + path: Optional[List["ManagementGroupPathElement"]] = None, + **kwargs + ): + super(ManagementGroup, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.tenant_id = tenant_id + self.display_name = display_name + self.details = details + self.children = children + self.path = path + + +class ManagementGroupChildInfo(msrest.serialization.Model): + """The child information of a management group. + + :param type: The fully qualified resource type which includes provider namespace (e.g. + Microsoft.Management/managementGroups). Possible values include: + "Microsoft.Management/managementGroups", "/subscriptions". + :type type: str or ~management_groups_api.models.ManagementGroupChildType + :param id: The fully qualified ID for the child resource (management group or subscription). + For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + :type id: str + :param name: The name of the child entity. + :type name: str + :param display_name: The friendly name of the child resource. + :type display_name: str + :param children: The list of children. + :type children: list[~management_groups_api.models.ManagementGroupChildInfo] + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'children': {'key': 'children', 'type': '[ManagementGroupChildInfo]'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "ManagementGroupChildType"]] = None, + id: Optional[str] = None, + name: Optional[str] = None, + display_name: Optional[str] = None, + children: Optional[List["ManagementGroupChildInfo"]] = None, + **kwargs + ): + super(ManagementGroupChildInfo, self).__init__(**kwargs) + self.type = type + self.id = id + self.name = name + self.display_name = display_name + self.children = children + + +class ManagementGroupDetails(msrest.serialization.Model): + """The details of a management group. + + :param version: The version number of the object. + :type version: int + :param updated_time: The date and time when this object was last updated. + :type updated_time: ~datetime.datetime + :param updated_by: The identity of the principal or process that updated the object. + :type updated_by: str + :param parent: (Optional) The ID of the parent management group. + :type parent: ~management_groups_api.models.ParentGroupInfo + """ + + _attribute_map = { + 'version': {'key': 'version', 'type': 'int'}, + 'updated_time': {'key': 'updatedTime', 'type': 'iso-8601'}, + 'updated_by': {'key': 'updatedBy', 'type': 'str'}, + 'parent': {'key': 'parent', 'type': 'ParentGroupInfo'}, + } + + def __init__( + self, + *, + version: Optional[int] = None, + updated_time: Optional[datetime.datetime] = None, + updated_by: Optional[str] = None, + parent: Optional["ParentGroupInfo"] = None, + **kwargs + ): + super(ManagementGroupDetails, self).__init__(**kwargs) + self.version = version + self.updated_time = updated_time + self.updated_by = updated_by + self.parent = parent + + +class ManagementGroupInfo(msrest.serialization.Model): + """The management group resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The fully qualified ID for the management group. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + :vartype id: str + :ivar type: The type of the resource. For example, Microsoft.Management/managementGroups. + :vartype type: str + :ivar name: The name of the management group. For example, + 00000000-0000-0000-0000-000000000000. + :vartype name: str + :param tenant_id: The AAD Tenant ID associated with the management group. For example, + 00000000-0000-0000-0000-000000000000. + :type tenant_id: str + :param display_name: The friendly name of the management group. + :type display_name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + } + + def __init__( + self, + *, + tenant_id: Optional[str] = None, + display_name: Optional[str] = None, + **kwargs + ): + super(ManagementGroupInfo, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.tenant_id = tenant_id + self.display_name = display_name + + +class ManagementGroupListResult(msrest.serialization.Model): + """Describes the result of the request to list management groups. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of management groups. + :type value: list[~management_groups_api.models.ManagementGroupInfo] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ManagementGroupInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ManagementGroupInfo"]] = None, + **kwargs + ): + super(ManagementGroupListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ManagementGroupPathElement(msrest.serialization.Model): + """A path element of a management group ancestors. + + :param name: The name of the group. + :type name: str + :param display_name: The friendly name of the group. + :type display_name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + **kwargs + ): + super(ManagementGroupPathElement, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + + +class Operation(msrest.serialization.Model): + """Operation supported by the Microsoft.Management resource provider. + + 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: ~management_groups_api.models.OperationDisplayProperties + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplayProperties'}, + } + + def __init__( + self, + *, + display: Optional["OperationDisplayProperties"] = None, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = display + + +class OperationDisplayProperties(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: The name of the provider. + :vartype provider: str + :ivar resource: The resource on which the operation is performed. + :vartype resource: str + :ivar operation: The operation that can be performed. + :vartype operation: str + :ivar description: Operation description. + :vartype description: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplayProperties, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None + + +class OperationListResult(msrest.serialization.Model): + """Describes the result of the request to list Microsoft.Management operations. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of operations supported by the Microsoft.Management resource provider. + :vartype value: list[~management_groups_api.models.Operation] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class OperationResults(msrest.serialization.Model): + """The results of an asynchronous operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The fully qualified ID for the management group. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + :vartype id: str + :ivar type: The type of the resource. For example, Microsoft.Management/managementGroups. + :vartype type: str + :ivar name: The name of the management group. For example, + 00000000-0000-0000-0000-000000000000. + :vartype name: str + :param tenant_id: The AAD Tenant ID associated with the management group. For example, + 00000000-0000-0000-0000-000000000000. + :type tenant_id: str + :param display_name: The friendly name of the management group. + :type display_name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + } + + def __init__( + self, + *, + tenant_id: Optional[str] = None, + display_name: Optional[str] = None, + **kwargs + ): + super(OperationResults, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.tenant_id = tenant_id + self.display_name = display_name + + +class ParentGroupInfo(msrest.serialization.Model): + """(Optional) The ID of the parent management group. + + :param id: The fully qualified ID for the parent management group. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + :type id: str + :param name: The name of the parent management group. + :type name: str + :param display_name: The friendly name of the parent management group. + :type display_name: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + name: Optional[str] = None, + display_name: Optional[str] = None, + **kwargs + ): + super(ParentGroupInfo, self).__init__(**kwargs) + self.id = id + self.name = name + self.display_name = display_name + + +class PatchManagementGroupRequest(msrest.serialization.Model): + """Management group patch parameters. + + :param display_name: The friendly name of the management group. + :type display_name: str + :param parent_group_id: (Optional) The fully qualified ID for the parent management group. For + example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + :type parent_group_id: str + """ + + _attribute_map = { + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'parent_group_id': {'key': 'parentGroupId', 'type': 'str'}, + } + + def __init__( + self, + *, + display_name: Optional[str] = None, + parent_group_id: Optional[str] = None, + **kwargs + ): + super(PatchManagementGroupRequest, self).__init__(**kwargs) + self.display_name = display_name + self.parent_group_id = parent_group_id + + +class SubscriptionUnderManagementGroup(msrest.serialization.Model): + """The details of subscription under management group. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The fully qualified ID for the subscription. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000/subscriptions/0000000-0000-0000-0000-000000000001. + :vartype id: str + :ivar type: The type of the resource. For example, + Microsoft.Management/managementGroups/subscriptions. + :vartype type: str + :ivar name: The stringified id of the subscription. For example, + 00000000-0000-0000-0000-000000000000. + :vartype name: str + :param tenant: The AAD Tenant ID associated with the subscription. For example, + 00000000-0000-0000-0000-000000000000. + :type tenant: str + :param display_name: The friendly name of the subscription. + :type display_name: str + :param parent: The ID of the parent management group. + :type parent: ~management_groups_api.models.DescendantParentGroupInfo + :param state: The state of the subscription. + :type state: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tenant': {'key': 'properties.tenant', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'parent': {'key': 'properties.parent', 'type': 'DescendantParentGroupInfo'}, + 'state': {'key': 'properties.state', 'type': 'str'}, + } + + def __init__( + self, + *, + tenant: Optional[str] = None, + display_name: Optional[str] = None, + parent: Optional["DescendantParentGroupInfo"] = None, + state: Optional[str] = None, + **kwargs + ): + super(SubscriptionUnderManagementGroup, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.tenant = tenant + self.display_name = display_name + self.parent = parent + self.state = state + + +class TenantBackfillStatusResult(msrest.serialization.Model): + """The tenant backfill status. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar tenant_id: The AAD Tenant ID associated with the management group. For example, + 00000000-0000-0000-0000-000000000000. + :vartype tenant_id: str + :ivar status: The status of the Tenant Backfill. Possible values include: "NotStarted", + "NotStartedButGroupsExist", "Started", "Failed", "Cancelled", "Completed". + :vartype status: str or ~management_groups_api.models.Status + """ + + _validation = { + 'tenant_id': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TenantBackfillStatusResult, self).__init__(**kwargs) + self.tenant_id = None + self.status = None diff --git a/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/operations/__init__.py b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/operations/__init__.py new file mode 100644 index 00000000000..87268e4e9d8 --- /dev/null +++ b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/operations/__init__.py @@ -0,0 +1,23 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._management_group_operations import ManagementGroupOperations +from ._management_group_subscription_operations import ManagementGroupSubscriptionOperations +from ._hierarchy_setting_operations import HierarchySettingOperations +from ._operation_operations import OperationOperations +from ._management_groups_api_operations import ManagementGroupsAPIOperationsMixin +from ._entity_operations import EntityOperations + +__all__ = [ + 'ManagementGroupOperations', + 'ManagementGroupSubscriptionOperations', + 'HierarchySettingOperations', + 'OperationOperations', + 'ManagementGroupsAPIOperationsMixin', + 'EntityOperations', +] diff --git a/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/operations/_entity_operations.py b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/operations/_entity_operations.py new file mode 100644 index 00000000000..4ae0ff8e04c --- /dev/null +++ b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/operations/_entity_operations.py @@ -0,0 +1,165 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class EntityOperations(object): + """EntityOperations 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: ~management_groups_api.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, + select=None, # type: Optional[str] + search=None, # type: Optional[Union[str, "models.Enum2"]] + filter=None, # type: Optional[str] + view=None, # type: Optional[Union[str, "models.Enum3"]] + group_name=None, # type: Optional[str] + cache_control="no-cache", # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.EntityListResult"] + """List all entities (Management Groups, Subscriptions, etc.) for the authenticated user. + + :param select: This parameter specifies the fields to include in the response. Can include any + combination of Name,DisplayName,Type,ParentDisplayNameChain,ParentChain, e.g. + '$select=Name,DisplayName,Type,ParentDisplayNameChain,ParentNameChain'. When specified the + $select parameter can override select in $skipToken. + :type select: str + :param search: The $search parameter is used in conjunction with the $filter parameter to + return three different outputs depending on the parameter passed in. + With $search=AllowedParents the API will return the entity info of all groups that the + requested entity will be able to reparent to as determined by the user's permissions. + With $search=AllowedChildren the API will return the entity info of all entities that can be + added as children of the requested entity. + With $search=ParentAndFirstLevelChildren the API will return the parent and first level of + children that the user has either direct access to or indirect access via one of their + descendants. + With $search=ParentOnly the API will return only the group if the user has access to at least + one of the descendants of the group. + With $search=ChildrenOnly the API will return only the first level of children of the group + entity info specified in $filter. The user must have direct access to the children entities or + one of it's descendants for it to show up in the results. + :type search: str or ~management_groups_api.models.Enum2 + :param filter: The filter parameter allows you to filter on the the name or display name + fields. You can check for equality on the name field (e.g. name eq '{entityName}') and you can + check for substrings on either the name or display name fields(e.g. contains(name, + '{substringToSearch}'), contains(displayName, '{substringToSearch')). Note that the + '{entityName}' and '{substringToSearch}' fields are checked case insensitively. + :type filter: str + :param view: The view parameter allows clients to filter the type of data that is returned by + the getEntities call. + :type view: str or ~management_groups_api.models.Enum3 + :param group_name: A filter which allows the get entities call to focus on a particular group + (i.e. "$filter=name eq 'groupName'"). + :type group_name: str + :param cache_control: Indicates that the request shouldn't utilize any caches. + :type cache_control: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EntityListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~management_groups_api.models.EntityListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.EntityListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + + def prepare_request(next_link=None): + 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') + if self._config.skiptoken is not None: + query_parameters['$skiptoken'] = self._serialize.query("self._config.skiptoken", self._config.skiptoken, 'str') + if self._config.skip is not None: + query_parameters['$skip'] = self._serialize.query("self._config.skip", self._config.skip, 'int') + if self._config.top is not None: + query_parameters['$top'] = self._serialize.query("self._config.top", self._config.top, 'int') + if select is not None: + query_parameters['$select'] = self._serialize.query("select", select, 'str') + if search is not None: + query_parameters['$search'] = self._serialize.query("search", search, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if view is not None: + query_parameters['$view'] = self._serialize.query("view", view, 'str') + if group_name is not None: + query_parameters['groupName'] = self._serialize.query("group_name", group_name, 'str') + + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if cache_control is not None: + header_parameters['Cache-Control'] = self._serialize.header("cache_control", cache_control, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('EntityListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.Management/getEntities'} # type: ignore diff --git a/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/operations/_hierarchy_setting_operations.py b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/operations/_hierarchy_setting_operations.py new file mode 100644 index 00000000000..38f770e962a --- /dev/null +++ b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/operations/_hierarchy_setting_operations.py @@ -0,0 +1,346 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class HierarchySettingOperations(object): + """HierarchySettingOperations 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: ~management_groups_api.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, + group_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.HierarchySettingsList" + """Gets all the hierarchy settings defined at the Management Group level. Settings can only be set on the root Management Group of the hierarchy. + + :param group_id: Management Group ID. + :type group_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HierarchySettingsList, or the result of cls(response) + :rtype: ~management_groups_api.models.HierarchySettingsList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HierarchySettingsList"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_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'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HierarchySettingsList', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/settings'} # type: ignore + + def get( + self, + group_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.HierarchySettings" + """Gets the hierarchy settings defined at the Management Group level. Settings can only be set on the root Management Group of the hierarchy. + + :param group_id: Management Group ID. + :type group_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HierarchySettings, or the result of cls(response) + :rtype: ~management_groups_api.models.HierarchySettings + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HierarchySettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_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'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HierarchySettings', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/settings/default'} # type: ignore + + def create_or_update( + self, + group_id, # type: str + require_authorization_for_group_creation=None, # type: Optional[bool] + default_management_group=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.HierarchySettings" + """Creates or updates the hierarchy settings defined at the Management Group level. + + :param group_id: Management Group ID. + :type group_id: str + :param require_authorization_for_group_creation: Indicates whether RBAC access is required upon + group creation under the root Management Group. If set to true, user will require + Microsoft.Management/managementGroups/write action on the root Management Group scope in order + to create new Groups directly under the root. This will prevent new users from creating new + Management Groups, unless they are given access. + :type require_authorization_for_group_creation: bool + :param default_management_group: Settings that sets the default Management Group under which + new subscriptions get added in this tenant. For example, + /providers/Microsoft.Management/managementGroups/defaultGroup. + :type default_management_group: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HierarchySettings, or the result of cls(response) + :rtype: ~management_groups_api.models.HierarchySettings + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HierarchySettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _create_tenant_settings_request = models.CreateOrUpdateSettingsRequest(require_authorization_for_group_creation=require_authorization_for_group_creation, default_management_group=default_management_group) + api_version = "2020-05-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_create_tenant_settings_request, 'CreateOrUpdateSettingsRequest') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HierarchySettings', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/settings/default'} # type: ignore + + def update( + self, + group_id, # type: str + require_authorization_for_group_creation=None, # type: Optional[bool] + default_management_group=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.HierarchySettings" + """Updates the hierarchy settings defined at the Management Group level. + + :param group_id: Management Group ID. + :type group_id: str + :param require_authorization_for_group_creation: Indicates whether RBAC access is required upon + group creation under the root Management Group. If set to true, user will require + Microsoft.Management/managementGroups/write action on the root Management Group scope in order + to create new Groups directly under the root. This will prevent new users from creating new + Management Groups, unless they are given access. + :type require_authorization_for_group_creation: bool + :param default_management_group: Settings that sets the default Management Group under which + new subscriptions get added in this tenant. For example, + /providers/Microsoft.Management/managementGroups/defaultGroup. + :type default_management_group: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HierarchySettings, or the result of cls(response) + :rtype: ~management_groups_api.models.HierarchySettings + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HierarchySettings"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _create_tenant_settings_request = models.CreateOrUpdateSettingsRequest(require_authorization_for_group_creation=require_authorization_for_group_creation, default_management_group=default_management_group) + api_version = "2020-05-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_create_tenant_settings_request, 'CreateOrUpdateSettingsRequest') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HierarchySettings', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/settings/default'} # type: ignore + + def delete( + self, + group_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes the hierarchy settings defined at the Management Group level. + + :param group_id: Management Group ID. + :type group_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_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] + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/settings/default'} # type: ignore diff --git a/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/operations/_management_group_operations.py b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/operations/_management_group_operations.py new file mode 100644 index 00000000000..f38b6486927 --- /dev/null +++ b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/operations/_management_group_operations.py @@ -0,0 +1,580 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ManagementGroupOperations(object): + """ManagementGroupOperations 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: ~management_groups_api.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, + cache_control="no-cache", # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ManagementGroupListResult"] + """List management groups for the authenticated user. + + :param cache_control: Indicates that the request shouldn't utilize any caches. + :type cache_control: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagementGroupListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~management_groups_api.models.ManagementGroupListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementGroupListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + + def prepare_request(next_link=None): + 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') + if self._config.skiptoken is not None: + query_parameters['$skiptoken'] = self._serialize.query("self._config.skiptoken", self._config.skiptoken, 'str') + + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if cache_control is not None: + header_parameters['Cache-Control'] = self._serialize.header("cache_control", cache_control, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ManagementGroupListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.Management/managementGroups'} # type: ignore + + def get( + self, + group_id, # type: str + expand=None, # type: Optional[Union[str, "models.Enum0"]] + recurse=None, # type: Optional[bool] + filter=None, # type: Optional[str] + cache_control="no-cache", # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.ManagementGroup" + """Get the details of the management group. + + :param group_id: Management Group ID. + :type group_id: str + :param expand: The $expand=children query string parameter allows clients to request inclusion + of children in the response payload. $expand=path includes the path from the root group to the + current group. + :type expand: str or ~management_groups_api.models.Enum0 + :param recurse: The $recurse=true query string parameter allows clients to request inclusion of + entire hierarchy in the response payload. Note that $expand=children must be passed up if + $recurse is set to true. + :type recurse: bool + :param filter: A filter which allows the exclusion of subscriptions from results (i.e. + '$filter=children.childType ne Subscription'). + :type filter: str + :param cache_control: Indicates that the request shouldn't utilize any caches. + :type cache_control: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagementGroup, or the result of cls(response) + :rtype: ~management_groups_api.models.ManagementGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementGroup"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_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') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + if recurse is not None: + query_parameters['$recurse'] = self._serialize.query("recurse", recurse, 'bool') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if cache_control is not None: + header_parameters['Cache-Control'] = self._serialize.header("cache_control", cache_control, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagementGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}'} # type: ignore + + def _create_or_update_initial( + self, + group_id, # type: str + cache_control="no-cache", # type: Optional[str] + name=None, # type: Optional[str] + display_name=None, # type: Optional[str] + id=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Union["models.ManagementGroup", "models.AzureAsyncOperationResults"] + cls = kwargs.pop('cls', None) # type: ClsType[Union["models.ManagementGroup", "models.AzureAsyncOperationResults"]] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _create_management_group_request = models.CreateManagementGroupRequest(name=name, display_name_properties_display_name=display_name, id_properties_details_parent_id=id) + api_version = "2020-05-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_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] + if cache_control is not None: + header_parameters['Cache-Control'] = self._serialize.header("cache_control", cache_control, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_create_management_group_request, 'CreateManagementGroupRequest') + 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ManagementGroup', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('AzureAsyncOperationResults', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _create_or_update_initial.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}'} # type: ignore + + def begin_create_or_update( + self, + group_id, # type: str + cache_control="no-cache", # type: Optional[str] + name=None, # type: Optional[str] + display_name=None, # type: Optional[str] + id=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> LROPoller + """Create or update a management group. + If a management group is already created and a subsequent create request is issued with different properties, the management group properties will be updated. + + :param group_id: Management Group ID. + :type group_id: str + :param cache_control: Indicates that the request shouldn't utilize any caches. + :type cache_control: str + :param name: The name of the management group. For example, + 00000000-0000-0000-0000-000000000000. + :type name: str + :param display_name: The friendly name of the management group. If no value is passed then this + field will be set to the groupId. + :type display_name: str + :param id: The fully qualified ID for the parent management group. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + :type id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :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 ManagementGroup or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~management_groups_api.models.ManagementGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[Union["models.ManagementGroup", "models.AzureAsyncOperationResults"]] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + raw_result = self._create_or_update_initial( + group_id=group_id, + cache_control=cache_control, + name=name, + display_name=display_name, + id=id, + 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('ManagementGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}'} # type: ignore + + def update( + self, + group_id, # type: str + cache_control="no-cache", # type: Optional[str] + display_name=None, # type: Optional[str] + parent_group_id=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.ManagementGroup" + """Update a management group. + + :param group_id: Management Group ID. + :type group_id: str + :param cache_control: Indicates that the request shouldn't utilize any caches. + :type cache_control: str + :param display_name: The friendly name of the management group. + :type display_name: str + :param parent_group_id: (Optional) The fully qualified ID for the parent management group. For + example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + :type parent_group_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagementGroup, or the result of cls(response) + :rtype: ~management_groups_api.models.ManagementGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementGroup"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _patch_group_request = models.PatchManagementGroupRequest(display_name=display_name, parent_group_id=parent_group_id) + api_version = "2020-05-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_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] + if cache_control is not None: + header_parameters['Cache-Control'] = self._serialize.header("cache_control", cache_control, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_patch_group_request, 'PatchManagementGroupRequest') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagementGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}'} # type: ignore + + def _delete_initial( + self, + group_id, # type: str + cache_control="no-cache", # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.AzureAsyncOperationResults" + cls = kwargs.pop('cls', None) # type: ClsType["models.AzureAsyncOperationResults"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_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] + if cache_control is not None: + header_parameters['Cache-Control'] = self._serialize.header("cache_control", cache_control, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('AzureAsyncOperationResults', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _delete_initial.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}'} # type: ignore + + def begin_delete( + self, + group_id, # type: str + cache_control="no-cache", # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> LROPoller + """Delete management group. + If a management group contains child resources, the request will fail. + + :param group_id: Management Group ID. + :type group_id: str + :param cache_control: Indicates that the request shouldn't utilize any caches. + :type cache_control: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :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 AzureAsyncOperationResults or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~management_groups_api.models.AzureAsyncOperationResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.AzureAsyncOperationResults"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + raw_result = self._delete_initial( + group_id=group_id, + cache_control=cache_control, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('AzureAsyncOperationResults', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}'} # type: ignore + + def get_descendant( + self, + group_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DescendantListResult"] + """List all entities that descend from a management group. + + :param group_id: Management Group ID. + :type group_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DescendantListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~management_groups_api.models.DescendantListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DescendantListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.get_descendant.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_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') + if self._config.skiptoken is not None: + query_parameters['$skiptoken'] = self._serialize.query("self._config.skiptoken", self._config.skiptoken, 'str') + if self._config.top is not None: + query_parameters['$top'] = self._serialize.query("self._config.top", self._config.top, 'int') + + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DescendantListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + get_descendant.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/descendants'} # type: ignore diff --git a/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/operations/_management_group_subscription_operations.py b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/operations/_management_group_subscription_operations.py new file mode 100644 index 00000000000..b41a6fda04d --- /dev/null +++ b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/operations/_management_group_subscription_operations.py @@ -0,0 +1,298 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ManagementGroupSubscriptionOperations(object): + """ManagementGroupSubscriptionOperations 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: ~management_groups_api.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def create( + self, + group_id, # type: str + subscription_id, # type: str + cache_control="no-cache", # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.SubscriptionUnderManagementGroup" + """Associates existing subscription with the management group. + + :param group_id: Management Group ID. + :type group_id: str + :param subscription_id: Subscription ID. + :type subscription_id: str + :param cache_control: Indicates that the request shouldn't utilize any caches. + :type cache_control: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SubscriptionUnderManagementGroup, or the result of cls(response) + :rtype: ~management_groups_api.models.SubscriptionUnderManagementGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SubscriptionUnderManagementGroup"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + + # Construct URL + url = self.create.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str'), + 'subscriptionId': self._serialize.url("subscription_id", 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] + if cache_control is not None: + header_parameters['Cache-Control'] = self._serialize.header("cache_control", cache_control, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SubscriptionUnderManagementGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/subscriptions/{subscriptionId}'} # type: ignore + + def delete( + self, + group_id, # type: str + subscription_id, # type: str + cache_control="no-cache", # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + """De-associates subscription from the management group. + + :param group_id: Management Group ID. + :type group_id: str + :param subscription_id: Subscription ID. + :type subscription_id: str + :param cache_control: Indicates that the request shouldn't utilize any caches. + :type cache_control: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str'), + 'subscriptionId': self._serialize.url("subscription_id", 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] + if cache_control is not None: + header_parameters['Cache-Control'] = self._serialize.header("cache_control", cache_control, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/subscriptions/{subscriptionId}'} # type: ignore + + def get_subscription( + self, + group_id, # type: str + subscription_id, # type: str + cache_control="no-cache", # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.SubscriptionUnderManagementGroup" + """Retrieves details about given subscription which is associated with the management group. + + :param group_id: Management Group ID. + :type group_id: str + :param subscription_id: Subscription ID. + :type subscription_id: str + :param cache_control: Indicates that the request shouldn't utilize any caches. + :type cache_control: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SubscriptionUnderManagementGroup, or the result of cls(response) + :rtype: ~management_groups_api.models.SubscriptionUnderManagementGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SubscriptionUnderManagementGroup"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + + # Construct URL + url = self.get_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str'), + 'subscriptionId': self._serialize.url("subscription_id", 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] + if cache_control is not None: + header_parameters['Cache-Control'] = self._serialize.header("cache_control", cache_control, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SubscriptionUnderManagementGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_subscription.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/subscriptions/{subscriptionId}'} # type: ignore + + def get_subscription_under_management_group( + self, + group_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ListSubscriptionUnderManagementGroup"] + """Retrieves details about all subscriptions which are associated with the management group. + + :param group_id: Management Group ID. + :type group_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ListSubscriptionUnderManagementGroup or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~management_groups_api.models.ListSubscriptionUnderManagementGroup] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ListSubscriptionUnderManagementGroup"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.get_subscription_under_management_group.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_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') + if self._config.skiptoken is not None: + query_parameters['$skiptoken'] = self._serialize.query("self._config.skiptoken", self._config.skiptoken, 'str') + + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ListSubscriptionUnderManagementGroup', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + get_subscription_under_management_group.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/subscriptions'} # type: ignore diff --git a/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/operations/_management_groups_api_operations.py b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/operations/_management_groups_api_operations.py new file mode 100644 index 00000000000..9c38d3d8aa6 --- /dev/null +++ b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/operations/_management_groups_api_operations.py @@ -0,0 +1,174 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ManagementGroupsAPIOperationsMixin(object): + + def check_name_availability( + self, + name=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.CheckNameAvailabilityResult" + """Checks if the specified management group name is valid and unique. + + :param name: the name to check for availability. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult, or the result of cls(response) + :rtype: ~management_groups_api.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _check_name_availability_request = models.CheckNameAvailabilityRequest(name=name) + api_version = "2020-05-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_check_name_availability_request, 'CheckNameAvailabilityRequest') + 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) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/providers/Microsoft.Management/checkNameAvailability'} # type: ignore + + def start_tenant_backfill( + self, + **kwargs # type: Any + ): + # type: (...) -> "models.TenantBackfillStatusResult" + """Starts backfilling subscriptions for the Tenant. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TenantBackfillStatusResult, or the result of cls(response) + :rtype: ~management_groups_api.models.TenantBackfillStatusResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TenantBackfillStatusResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + + # Construct URL + url = self.start_tenant_backfill.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TenantBackfillStatusResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + start_tenant_backfill.metadata = {'url': '/providers/Microsoft.Management/startTenantBackfill'} # type: ignore + + def tenant_backfill_status( + self, + **kwargs # type: Any + ): + # type: (...) -> "models.TenantBackfillStatusResult" + """Gets tenant backfill status. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TenantBackfillStatusResult, or the result of cls(response) + :rtype: ~management_groups_api.models.TenantBackfillStatusResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TenantBackfillStatusResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + + # Construct URL + url = self.tenant_backfill_status.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TenantBackfillStatusResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + tenant_backfill_status.metadata = {'url': '/providers/Microsoft.Management/tenantBackfillStatus'} # type: ignore diff --git a/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/operations/_operation_operations.py b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/operations/_operation_operations.py new file mode 100644 index 00000000000..9fcd842f599 --- /dev/null +++ b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/operations/_operation_operations.py @@ -0,0 +1,107 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class OperationOperations(object): + """OperationOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~management_groups_api.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.OperationListResult"] + """Lists all of the available Management REST API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~management_groups_api.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + + def prepare_request(next_link=None): + 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') + + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.Management/operations'} # type: ignore diff --git a/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/py.typed b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/py.typed new file mode 100644 index 00000000000..e5aff4f83af --- /dev/null +++ b/src/managementgroup/azext_managementgroup/vendored_sdks/managementgroup/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/src/managementgroup/report.md b/src/managementgroup/report.md new file mode 100644 index 00000000000..03c231f66af --- /dev/null +++ b/src/managementgroup/report.md @@ -0,0 +1,158 @@ +# Azure CLI Module Creation Report + +### managementgroup start-tenant-backfill + +start-tenant-backfill a managementgroup . + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +### managementgroup tenant-backfill-status + +tenant-backfill-status a managementgroup . + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +### managementgroup entity list + +list a managementgroup entity. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--select**|string|This parameter specifies the fields to include in the response. Can include any combination of Name,DisplayName,Type,ParentDisplayNameChain,ParentChain, e.g. '$select=Name,DisplayName,Type,ParentDisplayNameChain,ParentNameChain'. When specified the $select parameter can override select in $skipToken.|select| +|**--search**|choice|The $search parameter is used in conjunction with the $filter parameter to return three different outputs depending on the parameter passed in. +With $search=AllowedParents the API will return the entity info of all groups that the requested entity will be able to reparent to as determined by the user's permissions. +With $search=AllowedChildren the API will return the entity info of all entities that can be added as children of the requested entity. +With $search=ParentAndFirstLevelChildren the API will return the parent and first level of children that the user has either direct access to or indirect access via one of their descendants. +With $search=ParentOnly the API will return only the group if the user has access to at least one of the descendants of the group. +With $search=ChildrenOnly the API will return only the first level of children of the group entity info specified in $filter. The user must have direct access to the children entities or one of it's descendants for it to show up in the results.|search| +|**--filter**|string|The filter parameter allows you to filter on the the name or display name fields. You can check for equality on the name field (e.g. name eq '{entityName}') and you can check for substrings on either the name or display name fields(e.g. contains(name, '{substringToSearch}'), contains(displayName, '{substringToSearch')). Note that the '{entityName}' and '{substringToSearch}' fields are checked case insensitively.|filter| +|**--view**|choice|The view parameter allows clients to filter the type of data that is returned by the getEntities call.|view| +|**--group-name**|string|A filter which allows the get entities call to focus on a particular group (i.e. "$filter=name eq 'groupName'")|group_name| +|**--cache-control**|string|Indicates that the request shouldn't utilize any caches.|cache_control| +### managementgroup hierarchy-setting create + +create a managementgroup hierarchy-setting. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--group-id**|string|Management Group ID.|group_id| +|**--require-authorization-for-group-creation**|boolean|Indicates whether RBAC access is required upon group creation under the root Management Group. If set to true, user will require Microsoft.Management/managementGroups/write action on the root Management Group scope in order to create new Groups directly under the root. This will prevent new users from creating new Management Groups, unless they are given access.|require_authorization_for_group_creation| +|**--default-management-group**|string|Settings that sets the default Management Group under which new subscriptions get added in this tenant. For example, /providers/Microsoft.Management/managementGroups/defaultGroup|default_management_group| +### managementgroup hierarchy-setting delete + +delete a managementgroup hierarchy-setting. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--group-id**|string|Management Group ID.|group_id| +### managementgroup hierarchy-setting list + +list a managementgroup hierarchy-setting. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--group-id**|string|Management Group ID.|group_id| +### managementgroup hierarchy-setting show + +show a managementgroup hierarchy-setting. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--group-id**|string|Management Group ID.|group_id| +### managementgroup hierarchy-setting update + +update a managementgroup hierarchy-setting. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--group-id**|string|Management Group ID.|group_id| +|**--require-authorization-for-group-creation**|boolean|Indicates whether RBAC access is required upon group creation under the root Management Group. If set to true, user will require Microsoft.Management/managementGroups/write action on the root Management Group scope in order to create new Groups directly under the root. This will prevent new users from creating new Management Groups, unless they are given access.|require_authorization_for_group_creation| +|**--default-management-group**|string|Settings that sets the default Management Group under which new subscriptions get added in this tenant. For example, /providers/Microsoft.Management/managementGroups/defaultGroup|default_management_group| +### managementgroup management-group create + +create a managementgroup management-group. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--group-id**|string|Management Group ID.|group_id| +|**--cache-control**|string|Indicates that the request shouldn't utilize any caches.|cache_control| +|**--name**|string|The name of the management group. For example, 00000000-0000-0000-0000-000000000000|name| +|**--display-name**|string|The friendly name of the management group. If no value is passed then this field will be set to the groupId.|display_name_properties_display_name| +|**--details-parent-id**|string|The fully qualified ID for the parent management group. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000|id_properties_details_parent_id| +### managementgroup management-group delete + +delete a managementgroup management-group. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--group-id**|string|Management Group ID.|group_id| +|**--cache-control**|string|Indicates that the request shouldn't utilize any caches.|cache_control| +### managementgroup management-group get-descendant + +get-descendant a managementgroup management-group. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--group-id**|string|Management Group ID.|group_id| +### managementgroup management-group list + +list a managementgroup management-group. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--cache-control**|string|Indicates that the request shouldn't utilize any caches.|cache_control| +### managementgroup management-group show + +show a managementgroup management-group. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--group-id**|string|Management Group ID.|group_id| +|**--expand**|choice|The $expand=children query string parameter allows clients to request inclusion of children in the response payload. $expand=path includes the path from the root group to the current group.|expand| +|**--recurse**|boolean|The $recurse=true query string parameter allows clients to request inclusion of entire hierarchy in the response payload. Note that $expand=children must be passed up if $recurse is set to true.|recurse| +|**--filter**|string|A filter which allows the exclusion of subscriptions from results (i.e. '$filter=children.childType ne Subscription')|filter| +|**--cache-control**|string|Indicates that the request shouldn't utilize any caches.|cache_control| +### managementgroup management-group update + +update a managementgroup management-group. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--group-id**|string|Management Group ID.|group_id| +|**--cache-control**|string|Indicates that the request shouldn't utilize any caches.|cache_control| +|**--display-name**|string|The friendly name of the management group.|display_name| +|**--parent-group-id**|string|(Optional) The fully qualified ID for the parent management group. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000|parent_group_id| +### managementgroup management-group-subscription create + +create a managementgroup management-group-subscription. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--group-id**|string|Management Group ID.|group_id| +|**--subscription-id**|string|Subscription ID.|subscription_id| +|**--cache-control**|string|Indicates that the request shouldn't utilize any caches.|cache_control| +### managementgroup management-group-subscription delete + +delete a managementgroup management-group-subscription. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--group-id**|string|Management Group ID.|group_id| +|**--subscription-id**|string|Subscription ID.|subscription_id| +|**--cache-control**|string|Indicates that the request shouldn't utilize any caches.|cache_control| +### managementgroup management-group-subscription get-subscription + +get-subscription a managementgroup management-group-subscription. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--group-id**|string|Management Group ID.|group_id| +|**--subscription-id**|string|Subscription ID.|subscription_id| +|**--cache-control**|string|Indicates that the request shouldn't utilize any caches.|cache_control| +### managementgroup management-group-subscription get-subscription-under-management-group + +get-subscription-under-management-group a managementgroup management-group-subscription. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--group-id**|string|Management Group ID.|group_id| \ No newline at end of file diff --git a/src/managementgroup/setup.cfg b/src/managementgroup/setup.cfg new file mode 100644 index 00000000000..2fdd96e5d39 --- /dev/null +++ b/src/managementgroup/setup.cfg @@ -0,0 +1 @@ +#setup.cfg \ No newline at end of file diff --git a/src/managementgroup/setup.py b/src/managementgroup/setup.py new file mode 100644 index 00000000000..d543dc48dd1 --- /dev/null +++ b/src/managementgroup/setup.py @@ -0,0 +1,57 @@ +#!/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 .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 .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='managementgroup', + version=VERSION, + description='Microsoft Azure Command-Line Tools ManagementGroupsAPI Extension', + author='Microsoft Corporation', + author_email='azpycli@microsoft.com', + url='https://github.com/Azure/azure-cli-extensions/tree/master/src/managementgroup', + long_description=README + '\n\n' + HISTORY, + license='MIT', + classifiers=CLASSIFIERS, + packages=find_packages(), + install_requires=DEPENDENCIES, + package_data={'azext_managementgroup': ['azext_metadata.json']}, +)