Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@


def managementgroups_exception_handler(ex):
from azure.mgmt.managementgroups.models import ErrorResponseException
if isinstance(ex, ErrorResponseException):
from azure.core.exceptions import HttpResponseError
if isinstance(ex, HttpResponseError):
if ex.error.error:
raise CLIError(ex.error.error)
raise CLIError(ex.error)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ def load_arguments(self, _):

with self.argument_context('account management-group update') as c:
c.argument('display_name', options_list=['--display-name', '-d'])
c.argument('parent_id', options_list=['--parent', '-p'])
c.argument('parent', options_list=['--parent', '-p'])

with self.argument_context('ts') as c:
c.argument('name', options_list=['--name', '-n'], help='The name of the template spec.')
Expand Down
16 changes: 1 addition & 15 deletions src/azure-cli/azure/cli/command_modules/resource/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,6 @@ def load_command_table(self, _):
exception_handler=managementgroups_exception_handler
)

resource_managementgroups_update_type = CliCommandType(
operations_tmpl='azure.cli.command_modules.resource.custom#{}',
client_factory=cf_management_groups,
exception_handler=managementgroups_exception_handler
)

resource_templatespecs_sdk = CliCommandType(
operations_tmpl='azure.mgmt.resource.templatespecs.operations#ResourceLinksOperations.{}',
client_factory=cf_resource_templatespecs,
Expand Down Expand Up @@ -459,15 +453,7 @@ def load_command_table(self, _):
g.custom_show_command('show', 'cli_managementgroups_group_show')
g.custom_command('create', 'cli_managementgroups_group_create')
g.custom_command('delete', 'cli_managementgroups_group_delete')
g.generic_update_command(
'update',
getter_name='cli_managementgroups_group_update_get',
getter_type=resource_managementgroups_update_type,
setter_name='cli_managementgroups_group_update_set',
setter_type=resource_managementgroups_update_type,
custom_func_name='cli_managementgroups_group_update_custom_func',
custom_func_type=resource_managementgroups_update_type,
exception_handler=managementgroups_exception_handler)
g.custom_command('update', 'cli_managementgroups_group_create')

with self.command_group('account management-group subscription', resource_managementgroups_subscriptions_sdk, client_factory=cf_management_group_subscriptions) as g:
g.custom_command('add', 'cli_managementgroups_subscription_add')
Expand Down
14 changes: 7 additions & 7 deletions src/azure-cli/azure/cli/command_modules/resource/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -2882,22 +2882,22 @@ def cli_managementgroups_group_create(
name=group_name,
display_name=display_name,
details=create_mgmt_grp_details)
return client.create_or_update(group_name, create_mgmt_grp_request)
return client.begin_create_or_update(group_name, create_mgmt_grp_request)


def cli_managementgroups_group_update_custom_func(
instance,
display_name=None,
parent_id=None):
parent_id = _get_parent_id_from_parent(parent_id)
parent_group_id = _get_parent_id_from_parent(parent_id)
instance.display_name = display_name
instance.parent_id = parent_id
instance.parent_group_id = parent_group_id
return instance


def cli_managementgroups_group_update_get():
from azure.mgmt.managementgroups.models import PatchManagementGroupRequest
update_parameters = PatchManagementGroupRequest(display_name=None, parent_id=None)
update_parameters = PatchManagementGroupRequest(display_name=None, parent_group_id=None)
return update_parameters


Expand All @@ -2909,21 +2909,21 @@ def cli_managementgroups_group_update_set(
def cli_managementgroups_group_delete(cmd, client, group_name, no_register=False):
if not no_register:
_register_rp(cmd.cli_ctx)
return client.delete(group_name)
return client.begin_delete(group_name)


def cli_managementgroups_subscription_add(
cmd, client, group_name, subscription):
subscription_id = _get_subscription_id_from_subscription(
cmd.cli_ctx, subscription)
return client.create(group_name, subscription_id)
return client.begin_create(group_name, subscription_id)


def cli_managementgroups_subscription_remove(
cmd, client, group_name, subscription):
subscription_id = _get_subscription_id_from_subscription(
cmd.cli_ctx, subscription)
return client.delete(group_name, subscription_id)
return client.begin_delete(group_name, subscription_id)


# region Locks
Expand Down
Loading