Skip to content

Commit fbf136c

Browse files
authored
[Redis] az redis create/update: Add --zonal-allocation-policy to support the way of selecting zones for cache instance (#30705)
* update redis module with 2024-11-01 api version * resolve linter error * update redis module with 2024-11-01 api version * resolve linter error * remove unused import * remove unused import * resolve integration test failures * update redis module with 2024-11-01 api version * resolve linter error * remove unused import * update redis module with 2024-11-01 api version * resolve linter error * remove unused import * resolve integration test failures
1 parent 5bca10b commit fbf136c

30 files changed

+18774
-11761
lines changed

src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_private_endpoint_connection_acfr.yaml

Lines changed: 883 additions & 888 deletions
Large diffs are not rendered by default.

src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_private_link_resource_acfr.yaml

Lines changed: 363 additions & 289 deletions
Large diffs are not rendered by default.

src/azure-cli/azure/cli/command_modules/redis/_help.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@
5858
crafted: true
5959
- name: Configure the multiple zones for new Premium Azure Cache for Redis
6060
text: az redis create --location westus2 --name MyRedisCache --resource-group MyResourceGroup --sku Premium --vm-size p1 --zones 1 2
61+
- name: Deploying a Premium Azure Cache for Redis with zones automatically allocated
62+
text: az redis create --location westus2 --name MyRedisCache --resource-group MyResourceGroup --sku Premium --vm-size p1 --zonal-allocation-policy Automatic
6163
crafted: true
6264
- name: Configure the memory policies for the cache.
6365
text: az redis create --resource-group resourceGroupName --name cacheName --location westus2 --sku Standard --vm-size c0 --redis-configuration @"config_max-memory.json"
@@ -179,6 +181,8 @@
179181
crafted: true
180182
- name: Disable access keys authentication for Redis.
181183
text: az redis update --name MyRedisCache --resource-group MyResourceGroup --set "disableAccessKeyAuthentication=true"
184+
- name: Updating a non zone redundant cache to zone redundant cache using automatic zonal allocation policy.
185+
text: az redis update --name MyRedisCache --resource-group MyResourceGroup --set "zonalAllocationPolicy=Automatic"
182186
"""
183187

184188
helps['redis force-reboot'] = """

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
def load_arguments(self, _): # pylint: disable=too-many-statements
13-
from azure.mgmt.redis.models import RebootType, RedisKeyType, SkuName, TlsVersion, ReplicationRole, UpdateChannel
13+
from azure.mgmt.redis.models import RebootType, RedisKeyType, SkuName, TlsVersion, ReplicationRole, UpdateChannel, ZonalAllocationPolicy
1414
from azure.cli.command_modules.redis._validators import JsonString, ScheduleEntryList
1515
from azure.cli.command_modules.redis.custom import allowed_c_family_sizes, allowed_p_family_sizes, allowed_auth_methods
1616
from azure.cli.core.commands.parameters import get_enum_type, tags_type, zones_type
@@ -54,6 +54,7 @@ def load_arguments(self, _): # pylint: disable=too-many-statements
5454
c.argument('update_channel', arg_type=get_enum_type(UpdateChannel), help='Specifies the update channel for the monthly Redis updates your Redis Cache will receive. Caches using "Preview" update channel get latest Redis updates at least 4 weeks ahead of "Stable" channel caches. Default value is "Stable".')
5555
c.argument('storage_subscription_id', options_list=['--storage-subscription-id', '--storage-sub-id'], help='SubscriptionId of the storage account')
5656
c.argument('disable_access_key_authentication', arg_type=get_three_state_flag(), options_list=['--disable-access-keys'], help='Authentication to Redis through access keys is disabled when set as true')
57+
c.argument('zonal_allocation_policy', options_list=['--zonal-allocation-policy', '--zonal-allocation'], arg_type=get_enum_type(ZonalAllocationPolicy), help='Specifies how availability zones are allocated to the Redis cache. "Automatic" enables zone redundancy and Azure will automatically select zones based on regional availability and capacity. "UserDefined" will select availability zones passed in by you using the "zones" parameter. "NoZones" will produce a non-zonal cache. If "zonal-allocation-policy" is not passed, it will be set to "UserDefined" when zones are passed in, otherwise, it will be set to "Automatic in regions where zones are supported and "NoZones" in regions where zones are not supported.')
5758

5859
with self.argument_context('redis firewall-rules list') as c:
5960
c.argument('cache_name', arg_type=cache_name, id_part=None)

src/azure-cli/azure/cli/command_modules/redis/custom.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ def cli_redis_update(cmd, instance, sku=None, vm_size=None):
7676
sku=instance.sku,
7777
tags=instance.tags,
7878
update_channel=instance.update_channel,
79-
disable_access_key_authentication=instance.disable_access_key_authentication
79+
disable_access_key_authentication=instance.disable_access_key_authentication,
80+
zonal_allocation_policy=instance.zonal_allocation_policy
8081
)
8182
return update_params
8283

@@ -95,7 +96,8 @@ def cli_redis_create(cmd, client,
9596
redis_configuration=None, enable_non_ssl_port=None, tenant_settings=None,
9697
shard_count=None, minimum_tls_version=None, subnet_id=None, static_ip=None,
9798
zones=None, replicas_per_master=None, redis_version=None, mi_system_assigned=None,
98-
mi_user_assigned=None, update_channel=None, disable_access_key_authentication=None):
99+
mi_user_assigned=None, update_channel=None, disable_access_key_authentication=None,
100+
zonal_allocation_policy=None):
99101
# pylint:disable=line-too-long
100102
if ((sku.lower() in ['standard', 'basic'] and vm_size.lower() not in allowed_c_family_sizes) or (
101103
sku.lower() in ['premium'] and vm_size.lower() not in allowed_p_family_sizes)):
@@ -126,7 +128,8 @@ def cli_redis_create(cmd, client,
126128
public_network_access=None,
127129
tags=tags,
128130
update_channel=update_channel,
129-
disable_access_key_authentication=disable_access_key_authentication
131+
disable_access_key_authentication=disable_access_key_authentication,
132+
zonal_allocation_policy=zonal_allocation_policy
130133
)
131134
return client.begin_create(resource_group_name, name, params)
132135

0 commit comments

Comments
 (0)