Skip to content

Commit 99533ed

Browse files
authored
{ACR} az acr replication create/update: Add --global-endpoint-routing flag and deprecate --region-endpoint-enabled flag (#32954)
1 parent b9e1e2d commit 99533ed

4 files changed

Lines changed: 28 additions & 6 deletions

File tree

linter_exclusions.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,17 @@ acr pack build:
100100
- no_positional_parameters
101101
acr replication create:
102102
parameters:
103+
global_endpoint_routing:
104+
rule_exclusions:
105+
- option_length_too_long
103106
region_endpoint_enabled:
104107
rule_exclusions:
105108
- option_length_too_long
106109
acr replication update:
107110
parameters:
111+
global_endpoint_routing:
112+
rule_exclusions:
113+
- option_length_too_long
108114
region_endpoint_enabled:
109115
rule_exclusions:
110116
- option_length_too_long

src/azure-cli/azure/cli/command_modules/acr/_breaking_change.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# --------------------------------------------------------------------------------------------
55

66
from azure.cli.core.breaking_change import (
7+
register_argument_deprecate,
78
register_command_group_deprecate,
89
register_logic_breaking_change
910
)
@@ -41,3 +42,8 @@
4142
detail='The `--status enabled` parameter will no longer be accepted and will result in '
4243
'an error due to Docker Content Trust deprecation.',
4344
doc_link='https://aka.ms/acr/dctdeprecation')
45+
46+
register_argument_deprecate('acr replication create', '--region-endpoint-enabled',
47+
redirect='--global-endpoint-routing')
48+
register_argument_deprecate('acr replication update', '--region-endpoint-enabled',
49+
redirect='--global-endpoint-routing')

src/azure-cli/azure/cli/command_modules/acr/_params.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,12 +299,14 @@ def load_arguments(self, _): # pylint: disable=too-many-statements
299299
c.argument('replication_name', help='The name of the replication. Default to the location name.', completer=None)
300300

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

306307
with self.argument_context(scope) as c:
307-
c.argument('region_endpoint_enabled', arg_type=get_three_state_flag(), help=help_str, is_preview=True)
308+
c.argument('region_endpoint_enabled', arg_type=get_three_state_flag(), help=help_str)
309+
c.argument('global_endpoint_routing', arg_type=get_three_state_flag(), help=help_str)
308310

309311
with self.argument_context('acr run') as c:
310312
c.argument('registry_name', options_list=['--registry', '-r'])

src/azure-cli/azure/cli/command_modules/acr/replication.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,16 @@ def acr_replication_create(cmd,
3030
resource_group_name=None,
3131
replication_name=None,
3232
region_endpoint_enabled=None,
33+
global_endpoint_routing=None,
3334
zone_redundancy=None,
3435
tags=None):
3536
registry, resource_group_name = validate_premium_registry(
3637
cmd, registry_name, resource_group_name, REPLICATIONS_NOT_SUPPORTED)
3738

39+
# --global-endpoint-routing takes precedence over deprecated --region-endpoint-enabled
40+
if global_endpoint_routing is not None:
41+
region_endpoint_enabled = global_endpoint_routing
42+
3843
normalized_location = "".join(location.split()).lower()
3944
if registry.location == normalized_location:
4045
raise CLIError('Replication could not be created in the same location as the registry.')
@@ -80,12 +85,15 @@ def acr_replication_show(cmd,
8085
return client.get(resource_group_name, registry_name, replication_name)
8186

8287

83-
def acr_replication_update_custom(instance, region_endpoint_enabled=None, tags=None):
88+
def acr_replication_update_custom(instance, region_endpoint_enabled=None, global_endpoint_routing=None, tags=None):
8489
if tags is not None:
8590
instance.tags = tags
8691

87-
if region_endpoint_enabled is not None:
88-
instance.region_endpoint_enabled = region_endpoint_enabled
92+
# --global-endpoint-routing takes precedence over deprecated --region-endpoint-enabled
93+
effective_value = global_endpoint_routing if global_endpoint_routing is not None \
94+
else region_endpoint_enabled
95+
if effective_value is not None:
96+
instance.region_endpoint_enabled = effective_value
8997

9098
return instance
9199

0 commit comments

Comments
 (0)