From e0c5867101a272a5cdd151550614e34c746e3918 Mon Sep 17 00:00:00 2001 From: Rodrigo Mendoza <43052640+rosanch@users.noreply.github.com> Date: Tue, 13 Jul 2021 14:34:37 -0700 Subject: [PATCH] TrackV2 none Fixxed issues --- .../command_modules/acr/connected_registry.py | 27 ++++++++++--------- .../cli/command_modules/acr/scope_map.py | 22 +++++++++------ 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/acr/connected_registry.py b/src/azure-cli/azure/cli/command_modules/acr/connected_registry.py index 56694acfb80..1ad2f4432b9 100644 --- a/src/azure-cli/azure/cli/command_modules/acr/connected_registry.py +++ b/src/azure-cli/azure/cli/command_modules/acr/connected_registry.py @@ -129,11 +129,10 @@ def acr_connected_registry_create(cmd, # pylint: disable=too-many-locals, too-m ) try: - return client.create(subscription_id=subscription_id, - resource_group_name=resource_group_name, - registry_name=registry_name, - connected_registry_name=connected_registry_name, - connected_registry_create_parameters=connected_registry_create_parameters) + return client.begin_create(resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + connected_registry_create_parameters=connected_registry_create_parameters) except ValidationError as e: raise CLIError(e) @@ -264,14 +263,12 @@ def acr_connected_registry_deactivate(cmd, resource_group_name=None): _, resource_group_name = validate_managed_registry( cmd, registry_name, resource_group_name) - subscription_id = get_subscription_id(cmd.cli_ctx) user_confirmation("Are you sure you want to deactivate the connected registry '{}' in '{}'?".format( connected_registry_name, registry_name), yes) - return client.deactivate(subscription_id=subscription_id, - resource_group_name=resource_group_name, - registry_name=registry_name, - connected_registry_name=connected_registry_name) + return client.begin_deactivate(resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name) def acr_connected_registry_list(cmd, @@ -520,12 +517,16 @@ def _update_repo_permissions(cmd, return None current_actions = list(final_actions_set) logger.warning(msg) - return scope_map_client.update( + ScopeMapUpdateParameters = cmd.get_models('ScopeMapUpdateParameters') + scope_map_update_parameters = ScopeMapUpdateParameters( + description=description, + actions=current_actions + ) + return scope_map_client.begin_update( resource_group_name, registry_name, sync_scope_map_name, - description, - current_actions + scope_map_update_parameters ) diff --git a/src/azure-cli/azure/cli/command_modules/acr/scope_map.py b/src/azure-cli/azure/cli/command_modules/acr/scope_map.py index e7505dd2cde..3eb56f15d6a 100644 --- a/src/azure-cli/azure/cli/command_modules/acr/scope_map.py +++ b/src/azure-cli/azure/cli/command_modules/acr/scope_map.py @@ -39,10 +39,12 @@ def acr_scope_map_create(cmd, actions = parse_scope_map_actions(repository_actions_list, gateway_actions_list) - scope_map = { - 'actions': actions, - 'description': description - } + ScopeMap = cmd.get_models('ScopeMap') + + scope_map = ScopeMap( + actions = actions, + description = description + ) return client.begin_create( resource_group_name, @@ -68,7 +70,7 @@ def acr_scope_map_delete(cmd, return None resource_group_name = get_resource_group_name_by_registry_name(cmd.cli_ctx, registry_name, resource_group_name) - return client.delete(resource_group_name, registry_name, scope_map_name) + return client.begin_delete(resource_group_name, registry_name, scope_map_name) def acr_scope_map_update(cmd, @@ -106,12 +108,16 @@ def acr_scope_map_update(cmd, final_actions_set = set(current_scope_map.actions).union(add_actions_set).difference(remove_actions_set) current_actions = list(final_actions_set) - return client.update( + ScopeMapUpdateParameters = cmd.get_models('ScopeMapUpdateParameters') + scope_map_update_parameters = ScopeMapUpdateParameters( + description=description, + actions=current_actions + ) + return client.begin_update( resource_group_name, registry_name, scope_map_name, - description, - current_actions + scope_map_update_parameters )