15
15
resource_group_name_type ,
16
16
get_three_state_flag )
17
17
from azure .cli .command_modules .rdbms .validators import configuration_value_validator , validate_subnet , \
18
- tls_validator , public_access_validator , maintenance_window_validator , ip_address_validator , retention_validator
18
+ tls_validator , public_access_validator , maintenance_window_validator , ip_address_validator , \
19
+ retention_validator , firewall_rule_name_validator
19
20
from azure .cli .core .local_context import LocalContextAttribute , LocalContextAction
20
21
21
22
from .randomname .generate import generate_username
@@ -399,6 +400,12 @@ def _flexible_server_params(command_group):
399
400
help = 'The name or resource ID of the source server to restore from.'
400
401
)
401
402
403
+ geo_redundant_backup_arg_type = CLIArgumentType (
404
+ options_list = ['--geo-redundant-backup' ],
405
+ arg_type = get_enum_type (['Enabled' , 'Disabled' ]),
406
+ help = 'Whether or not geo redundant backup is enabled.'
407
+ )
408
+
402
409
with self .argument_context ('{} flexible-server' .format (command_group )) as c :
403
410
c .argument ('resource_group_name' , arg_type = resource_group_name_type )
404
411
c .argument ('server_name' , arg_type = server_name_arg_type )
@@ -421,6 +428,7 @@ def _flexible_server_params(command_group):
421
428
c .argument ('auto_grow' , default = 'Enabled' , arg_type = auto_grow_arg_type )
422
429
c .argument ('high_availability' , arg_type = mysql_high_availability_arg_type , default = "Disabled" )
423
430
c .argument ('backup_retention' , default = 7 , arg_type = mysql_backup_retention_arg_type )
431
+ c .argument ('geo_redundant_backup' , default = 'Disabled' , arg_type = geo_redundant_backup_arg_type )
424
432
c .argument ('location' , arg_type = get_location_type (self .cli_ctx ))
425
433
c .argument ('administrator_login' , default = generate_username (), arg_type = administrator_login_arg_type )
426
434
c .argument ('administrator_login_password' , arg_type = administrator_login_password_arg_type )
@@ -453,6 +461,21 @@ def _flexible_server_params(command_group):
453
461
c .argument ('public_access' , options_list = ['--public-access' ], arg_type = get_enum_type (['Enabled' , 'Disabled' ]),
454
462
help = 'Determines the public access. ' )
455
463
464
+ with self .argument_context ('{} flexible-server geo-restore' . format (command_group )) as c :
465
+ c .argument ('location' , arg_type = get_location_type (self .cli_ctx ), required = True )
466
+ c .argument ('sku_name' , arg_type = sku_name_arg_type )
467
+ c .argument ('source_server' , arg_type = source_server_arg_type )
468
+ c .argument ('vnet' , arg_type = vnet_arg_type )
469
+ c .argument ('vnet_address_prefix' , arg_type = vnet_address_prefix_arg_type )
470
+ c .argument ('subnet' , arg_type = subnet_arg_type )
471
+ c .argument ('subnet_address_prefix' , arg_type = subnet_address_prefix_arg_type )
472
+ c .argument ('private_dns_zone_arguments' , private_dns_zone_arguments_arg_type )
473
+ c .argument ('zone' , arg_type = zone_arg_type )
474
+ c .argument ('yes' , arg_type = yes_arg_type )
475
+ if command_group == 'mysql' :
476
+ c .argument ('public_access' , options_list = ['--public-access' ], arg_type = get_enum_type (['Enabled' , 'Disabled' ]),
477
+ help = 'Determines the public access. ' )
478
+
456
479
with self .argument_context ('{} flexible-server update' .format (command_group )) as c :
457
480
c .argument ('administrator_login_password' , arg_type = administrator_login_password_arg_type )
458
481
c .argument ('maintenance_window' , options_list = ['--maintenance-window' ], validator = maintenance_window_validator ,
@@ -518,7 +541,7 @@ def _flexible_server_params(command_group):
518
541
for scope in ['create' , 'delete' , 'show' , 'update' ]:
519
542
argument_context_string = '{} flexible-server firewall-rule {}' .format (command_group , scope )
520
543
with self .argument_context (argument_context_string ) as c :
521
- c .argument ('firewall_rule_name' , id_part = 'child_name_1' , options_list = ['--rule-name' , '-r' ],
544
+ c .argument ('firewall_rule_name' , id_part = 'child_name_1' , options_list = ['--rule-name' , '-r' ], validator = firewall_rule_name_validator ,
522
545
help = 'The name of the firewall rule. If name is omitted, default name will be chosen for firewall name. The firewall rule name can only contain 0-9, a-z, A-Z, \' -\' and \' _\' . Additionally, the firewall rule name cannot exceed 128 characters. ' )
523
546
c .argument ('end_ip_address' , options_list = ['--end-ip-address' ], validator = ip_address_validator ,
524
547
help = 'The end IP address of the firewall rule. Must be IPv4 format. Use value \' 0.0.0.0\' to represent all Azure-internal IP addresses. ' )
@@ -537,7 +560,6 @@ def _flexible_server_params(command_group):
537
560
538
561
with self .argument_context ('{} flexible-server db list' .format (command_group )) as c :
539
562
c .argument ('server_name' , id_part = None , options_list = ['--server-name' , '-s' ], arg_type = server_name_arg_type )
540
- c .argument ('database_name' , id_part = None , arg_type = database_name_arg_type )
541
563
542
564
with self .argument_context ('{} flexible-server db create' .format (command_group )) as c :
543
565
c .argument ('charset' , help = 'The charset of the database. The default value is UTF8' )
0 commit comments