Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 6 additions & 0 deletions linter_exclusions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,17 @@ acr pack build:
- no_positional_parameters
acr replication create:
parameters:
global_endpoint_routing:
rule_exclusions:
- option_length_too_long
region_endpoint_enabled:
rule_exclusions:
- option_length_too_long
acr replication update:
parameters:
global_endpoint_routing:
rule_exclusions:
- option_length_too_long
region_endpoint_enabled:
rule_exclusions:
- option_length_too_long
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# --------------------------------------------------------------------------------------------

from azure.cli.core.breaking_change import (
register_argument_deprecate,
register_command_group_deprecate,
register_logic_breaking_change
)
Expand Down Expand Up @@ -41,3 +42,8 @@
detail='The `--status enabled` parameter will no longer be accepted and will result in '
'an error due to Docker Content Trust deprecation.',
doc_link='https://aka.ms/acr/dctdeprecation')

register_argument_deprecate('acr replication create', '--region-endpoint-enabled',
redirect='--global-endpoint-routing')
register_argument_deprecate('acr replication update', '--region-endpoint-enabled',
redirect='--global-endpoint-routing')
Comment thread
lizMSFT marked this conversation as resolved.
8 changes: 5 additions & 3 deletions src/azure-cli/azure/cli/command_modules/acr/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,12 +299,14 @@ def load_arguments(self, _): # pylint: disable=too-many-statements
c.argument('replication_name', help='The name of the replication. Default to the location name.', completer=None)

for scope in ['acr replication create', 'acr replication update']:
help_str = "Allow routing to this replication. Requests will not be routed to a disabled replication." \
" Data syncing will continue regardless of the region endpoint status."
help_str = "Allow routing to this replication via the registry global endpoint. If disabled, requests" \
" to the global endpoint will not be routed to the replica. Data syncing to the replica" \
" will continue regardless of the global endpoint routing status."
help_str += ' Default: true.' if 'create' in scope else '' # suffix help with default if command is for create

with self.argument_context(scope) as c:
c.argument('region_endpoint_enabled', arg_type=get_three_state_flag(), help=help_str, is_preview=True)
c.argument('region_endpoint_enabled', arg_type=get_three_state_flag(), help=help_str)
c.argument('global_endpoint_routing', arg_type=get_three_state_flag(), help=help_str)

with self.argument_context('acr run') as c:
c.argument('registry_name', options_list=['--registry', '-r'])
Expand Down
14 changes: 11 additions & 3 deletions src/azure-cli/azure/cli/command_modules/acr/replication.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,16 @@ def acr_replication_create(cmd,
resource_group_name=None,
replication_name=None,
region_endpoint_enabled=None,
global_endpoint_routing=None,
zone_redundancy=None,
tags=None):
registry, resource_group_name = validate_premium_registry(
cmd, registry_name, resource_group_name, REPLICATIONS_NOT_SUPPORTED)

# --global-endpoint-routing takes precedence over deprecated --region-endpoint-enabled
if global_endpoint_routing is not None:
region_endpoint_enabled = global_endpoint_routing

normalized_location = "".join(location.split()).lower()
if registry.location == normalized_location:
raise CLIError('Replication could not be created in the same location as the registry.')
Expand Down Expand Up @@ -80,12 +85,15 @@ def acr_replication_show(cmd,
return client.get(resource_group_name, registry_name, replication_name)


def acr_replication_update_custom(instance, region_endpoint_enabled=None, tags=None):
def acr_replication_update_custom(instance, region_endpoint_enabled=None, global_endpoint_routing=None, tags=None):
if tags is not None:
instance.tags = tags

if region_endpoint_enabled is not None:
instance.region_endpoint_enabled = region_endpoint_enabled
# --global-endpoint-routing takes precedence over deprecated --region-endpoint-enabled
effective_value = global_endpoint_routing if global_endpoint_routing is not None \
else region_endpoint_enabled
if effective_value is not None:
instance.region_endpoint_enabled = effective_value

return instance

Expand Down
Loading