From 807c92ea5fa2fc9c35a09933e9380baef33555e2 Mon Sep 17 00:00:00 2001 From: Rodrigo Mendoza <43052640+rosanch@users.noreply.github.com> Date: Wed, 28 Jul 2021 19:20:50 -0700 Subject: [PATCH] {ACR} Migrate to Track 2 (#19006) * trackV2 fix * trackv2 fix * pylint fix --- .../cli/command_modules/acr/scope_map.py | 10 +++---- .../azure/cli/command_modules/acr/task.py | 30 +++++++++---------- .../azure/cli/command_modules/acr/token.py | 6 ++-- 3 files changed, 22 insertions(+), 24 deletions(-) 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 96d903690eb..6228989a61a 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 @@ -113,12 +113,10 @@ def acr_scope_map_update(cmd, description=description, actions=current_actions ) - return client.begin_update( - resource_group_name, - registry_name, - scope_map_name, - scope_map_update_parameters - ) + return client.begin_update(resource_group_name, + registry_name, + scope_map_name, + scope_map_update_parameters) def acr_scope_map_show(cmd, diff --git a/src/azure-cli/azure/cli/command_modules/acr/task.py b/src/azure-cli/azure/cli/command_modules/acr/task.py index 0ecc2832d7b..8b65375c480 100644 --- a/src/azure-cli/azure/cli/command_modules/acr/task.py +++ b/src/azure-cli/azure/cli/command_modules/acr/task.py @@ -104,10 +104,10 @@ def acr_task_create(cmd, # pylint: disable=too-many-locals log_template=log_template, is_system_task=is_system_task) try: - return client.create(resource_group_name=resource_group_name, - registry_name=registry_name, - task_name=task_name, - task_create_parameters=task_create_parameters) + return client.begin_create(resource_group_name=resource_group_name, + registry_name=registry_name, + task_name=task_name, + task_create_parameters=task_create_parameters) except ValidationError as e: raise CLIError(e) @@ -548,7 +548,7 @@ def acr_task_identity_assign(cmd, identity=identity ) - return client.update(resource_group_name, registry_name, task_name, taskUpdateParameters) + return client.begin_update(resource_group_name, registry_name, task_name, taskUpdateParameters) def acr_task_identity_remove(cmd, @@ -583,7 +583,7 @@ def acr_task_identity_remove(cmd, identity=identity ) - return client.update(resource_group_name, registry_name, task_name, taskUpdateParameters) + return client.begin_update(resource_group_name, registry_name, task_name, taskUpdateParameters) def acr_task_identity_show(cmd, @@ -632,7 +632,7 @@ def acr_task_credential_add(cmd, ) resp = LongRunningOperation(cmd.cli_ctx)( - client.update(resource_group_name, registry_name, task_name, taskUpdateParameters) + client.begin_update(resource_group_name, registry_name, task_name, taskUpdateParameters) ) resp = resp.credentials return {} if not resp else resp.custom_registries @@ -671,7 +671,7 @@ def acr_task_credential_update(cmd, ) resp = LongRunningOperation(cmd.cli_ctx)( - client.update(resource_group_name, registry_name, task_name, taskUpdateParameters) + client.begin_update(resource_group_name, registry_name, task_name, taskUpdateParameters) ) resp = resp.credentials return {} if not resp else resp.custom_registries @@ -696,7 +696,7 @@ def acr_task_credential_remove(cmd, ) resp = LongRunningOperation(cmd.cli_ctx)( - client.update(resource_group_name, registry_name, task_name, taskUpdateParameters) + client.begin_update(resource_group_name, registry_name, task_name, taskUpdateParameters) ) resp = resp.credentials return {} if not resp else resp.custom_registries @@ -743,7 +743,7 @@ def acr_task_timer_add(cmd, ) ) - return client.update(resource_group_name, registry_name, task_name, taskUpdateParameters) + return client.begin_update(resource_group_name, registry_name, task_name, taskUpdateParameters) def acr_task_timer_update(cmd, @@ -779,7 +779,7 @@ def acr_task_timer_update(cmd, ) ) - return client.update(resource_group_name, registry_name, task_name, taskUpdateParameters) + return client.begin_update(resource_group_name, registry_name, task_name, taskUpdateParameters) def acr_task_timer_remove(cmd, @@ -801,10 +801,10 @@ def acr_task_timer_remove(cmd, existingTask.trigger.timer_triggers = trimmed_timer_triggers try: - return client.create(resource_group_name=resource_group_name, - registry_name=registry_name, - task_name=task_name, - task_create_parameters=existingTask) + return client.begin_create(resource_group_name=resource_group_name, + registry_name=registry_name, + task_name=task_name, + task_create_parameters=existingTask) except ValidationError as e: raise CLIError(e) diff --git a/src/azure-cli/azure/cli/command_modules/acr/token.py b/src/azure-cli/azure/cli/command_modules/acr/token.py index 8b462664d7c..f110af1dc92 100644 --- a/src/azure-cli/azure/cli/command_modules/acr/token.py +++ b/src/azure-cli/azure/cli/command_modules/acr/token.py @@ -100,7 +100,7 @@ def acr_token_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, token_name) + return client.begin_delete(resource_group_name, registry_name, token_name) def acr_token_update(cmd, @@ -122,7 +122,7 @@ def acr_token_update(cmd, arm_resource_id = get_resource_id_by_registry_name(cmd.cli_ctx, registry_name) scope_map_id = '{}/{}/{}'.format(arm_resource_id, SCOPE_MAPS, scope_map_name) - return client.update( + return client.begin_update( resource_group_name, registry_name, token_name, @@ -239,7 +239,7 @@ def acr_token_credential_delete(cmd, TokenUpdateParameters = cmd.get_models('TokenUpdateParameters') TokenCredentialsProperties = cmd.get_models('TokenCredentialsProperties') - return client.update( + return client.begin_update( resource_group_name, registry_name, token_name,