Skip to content

Commit

Permalink
based on Azure#18850
Browse files Browse the repository at this point in the history
  • Loading branch information
00Kai0 committed Jul 14, 2021
1 parent 6467bf6 commit ef2eb38
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,7 @@ def acr_connected_registry_create(cmd, # pylint: disable=too-many-locals, too-m
)

try:
return client.begin_create(subscription_id=subscription_id,
resource_group_name=resource_group_name,
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)
Expand Down Expand Up @@ -264,12 +263,10 @@ 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.begin_deactivate(subscription_id=subscription_id,
resource_group_name=resource_group_name,
return client.begin_deactivate(resource_group_name=resource_group_name,
registry_name=registry_name,
connected_registry_name=connected_registry_name)

Expand Down Expand Up @@ -520,12 +517,16 @@ def _update_repo_permissions(cmd,
return None
current_actions = list(final_actions_set)
logger.warning(msg)
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
)


Expand Down
22 changes: 14 additions & 8 deletions src/azure-cli/azure/cli/command_modules/acr/scope_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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
)


Expand Down

0 comments on commit ef2eb38

Please sign in to comment.