Skip to content

Commit abce081

Browse files
[SQL] az sql elastic-pool create: Add support for HighAvailabilityReplica count for HS Elastic pools (#22213)
* Add support for HighAvailabilityReplica count for HS Elastic pools * Fixed error on update command * Added tests for HSEP replica count feature * Minor fix for style concistency * retrigger checks * retrigger checks * retrigger checks * Updated test recording * Updated test recording for test_sql_elastic_pool_maintenance * Updated test recordings * Fixed small style error * Update src/azure-cli/azure/cli/command_modules/sql/custom.py Co-authored-by: Yishi Wang <[email protected]> * Updated EP hyperscale tests ran in production * Deleted changes to help_py * added back changes to help_py * Added missing help messages for commands * Added back some lines removed by accident on _params.py * Added missing comma * Fixed small typo * Removed trailing white space * Added help for storage_uri and storage_key * Removed 'Allowed values' from help messages Co-authored-by: Christian Valencia <[email protected]> Co-authored-by: Yishi Wang <[email protected]>
1 parent fde406f commit abce081

17 files changed

+8820
-5439
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,8 @@
520520
text: az sql elastic-pool create -g mygroup -s myserver -n mydb -e Standard -c 100
521521
- name: Create an elastic pool with GeneralPurpose edition, Gen4 hardware and 1 vcore.
522522
text: az sql elastic-pool create -g mygroup -s myserver -n mydb -e GeneralPurpose -f Gen4 -c 1
523+
- name: Create an elastic pool with Hyperscale edition, Gen5 hardware, 4 vcore and 2 high availability replicas.
524+
text: az sql elastic-pool create -g mygroup -s myserver -n mydb -e Hyperscale -f Gen5 -c 4 --ha-replicas 2
523525
"""
524526

525527
helps['sql elastic-pool list-editions'] = """
@@ -557,6 +559,8 @@
557559
text: az sql elastic-pool update -g mygroup -s myserver -n mypool -z
558560
- name: Update elastic pool with zone redundancy explicitly disabled
559561
text: az sql elastic-pool update -g mygroup -s myserver -n mypool -z false
562+
- name: Update elastic pool with 2 high availability replicas
563+
text: az sql elastic-pool update -g mygroup -s myserver -n mypool --ha-replicas 2
560564
"""
561565

562566
helps['sql failover-group'] = """

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

Lines changed: 62 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -374,20 +374,28 @@ def _configure_db_dw_params(arg_ctx):
374374
creation_arg_group = 'Creation'
375375

376376
arg_ctx.argument('collation',
377-
arg_group=creation_arg_group)
377+
arg_group=creation_arg_group,
378+
help='The collation of the database.')
378379

379380
arg_ctx.argument('catalog_collation',
380381
arg_group=creation_arg_group,
381-
arg_type=get_enum_type(CatalogCollationType))
382+
arg_type=get_enum_type(CatalogCollationType),
383+
help='Collation of the metadata catalog.')
382384

383385
# WideWorldImportersStd and WideWorldImportersFull cannot be successfully created.
384386
# AdventureWorksLT is the only sample name that is actually supported.
385387
arg_ctx.argument('sample_name',
386388
arg_group=creation_arg_group,
387-
arg_type=get_enum_type([SampleName.adventure_works_lt]))
389+
arg_type=get_enum_type([SampleName.adventure_works_lt]),
390+
help='The name of the sample schema to apply when creating this'
391+
'database.')
388392

389393
arg_ctx.argument('license_type',
390-
arg_type=get_enum_type(DatabaseLicenseType))
394+
arg_type=get_enum_type(DatabaseLicenseType),
395+
help='The license type to apply for this database.'
396+
'``LicenseIncluded`` if you need a license, or ``BasePrice``'
397+
'if you have a license and are eligible for the Azure Hybrid'
398+
'Benefit.')
391399

392400
arg_ctx.argument('zone_redundant',
393401
arg_type=zone_redundant_param_type)
@@ -739,17 +747,27 @@ def load_arguments(self, _):
739747
])
740748

741749
c.argument('administrator_login',
742-
options_list=['--admin-user', '-u'])
750+
options_list=['--admin-user', '-u'],
751+
help='Required. Administrator login name.')
743752

744753
c.argument('administrator_login_password',
745-
options_list=['--admin-password', '-p'])
754+
options_list=['--admin-password', '-p'],
755+
help='Required. Administrator login password.')
746756

747757
c.argument('authentication_type',
748758
options_list=['--auth-type', '-a'],
749-
arg_type=get_enum_type(AuthenticationType))
759+
arg_type=get_enum_type(AuthenticationType),
760+
help='Authentication type.')
761+
762+
c.argument('storage_key',
763+
help='Required. Storage key.')
750764

751765
c.argument('storage_key_type',
752-
arg_type=get_enum_type(StorageKeyType))
766+
arg_type=get_enum_type(StorageKeyType),
767+
help='Required. Storage key type.')
768+
769+
c.argument('storage_uri',
770+
help='Required. Storage Uri.')
753771

754772
with self.argument_context('sql db import') as c:
755773
# Create args that will be used to build up the ImportExistingDatabaseDefinition object
@@ -763,17 +781,27 @@ def load_arguments(self, _):
763781
])
764782

765783
c.argument('administrator_login',
766-
options_list=['--admin-user', '-u'])
784+
options_list=['--admin-user', '-u'],
785+
help='Required. Administrator login name.')
767786

768787
c.argument('administrator_login_password',
769-
options_list=['--admin-password', '-p'])
788+
options_list=['--admin-password', '-p'],
789+
help='Required. Administrator login password.')
770790

771791
c.argument('authentication_type',
772792
options_list=['--auth-type', '-a'],
773-
arg_type=get_enum_type(AuthenticationType))
793+
arg_type=get_enum_type(AuthenticationType),
794+
help='Authentication type.')
795+
796+
c.argument('storage_key',
797+
help='Required. Storage key.')
774798

775799
c.argument('storage_key_type',
776-
arg_type=get_enum_type(StorageKeyType))
800+
arg_type=get_enum_type(StorageKeyType),
801+
help='Required. Storage key type.')
802+
803+
c.argument('storage_uri',
804+
help='Required. Storage Uri.')
777805

778806
# The parameter name '--name' is used for 'database_name', so we need to give a different name
779807
# for the import extension 'name' parameter to avoid conflicts. This parameter is actually not
@@ -1174,7 +1202,8 @@ def _configure_security_policy_storage_params(arg_ctx):
11741202
options_list=['--max-size', '--storage'])
11751203

11761204
c.argument('license_type',
1177-
arg_type=get_enum_type(ElasticPoolLicenseType))
1205+
arg_type=get_enum_type(ElasticPoolLicenseType),
1206+
help='The license type to apply for this elastic pool.')
11781207

11791208
c.argument('zone_redundant',
11801209
arg_type=zone_redundant_param_type)
@@ -1196,6 +1225,9 @@ def _configure_security_policy_storage_params(arg_ctx):
11961225
c.argument('maintenance_configuration_id',
11971226
arg_type=maintenance_configuration_id_param_type)
11981227

1228+
c.argument('high_availability_replica_count',
1229+
arg_type=read_replicas_param_type)
1230+
11991231
with self.argument_context('sql elastic-pool create') as c:
12001232
# Create args that will be used to build up the ElasticPool object
12011233
create_args_for_complex_type(
@@ -1207,6 +1239,7 @@ def _configure_security_policy_storage_params(arg_ctx):
12071239
'tags',
12081240
'zone_redundant',
12091241
'maintenance_configuration_id',
1242+
'high_availability_replica_count',
12101243
])
12111244

12121245
# Create args that will be used to build up the ElasticPoolPerDatabaseSettings object
@@ -1371,10 +1404,14 @@ def _configure_security_policy_storage_params(arg_ctx):
13711404
options_list=['--name', '-n'])
13721405

13731406
c.argument('administrator_login',
1374-
options_list=['--admin-user', '-u'])
1407+
options_list=['--admin-user', '-u'],
1408+
help='Administrator username for the server. Once'
1409+
'created it cannot be changed.')
13751410

13761411
c.argument('administrator_login_password',
1377-
options_list=['--admin-password', '-p'])
1412+
options_list=['--admin-password', '-p'],
1413+
help='The administrator login password (required for'
1414+
'server creation).')
13781415

13791416
c.argument('assign_identity',
13801417
options_list=['--assign_identity', '-i'],
@@ -1899,11 +1936,16 @@ def _configure_security_policy_storage_params(arg_ctx):
18991936

19001937
c.argument('administrator_login',
19011938
options_list=['--admin-user', '-u'],
1902-
required=False)
1939+
required=False,
1940+
help='Administrator username for the managed instance. Can'
1941+
'only be specified when the managed instance is being'
1942+
'created (and is required for creation).')
19031943

19041944
c.argument('administrator_login_password',
19051945
options_list=['--admin-password', '-p'],
1906-
required=False)
1946+
required=False,
1947+
help='The administrator login password (required for'
1948+
'managed instance creation).')
19071949

19081950
c.extra('vnet_name',
19091951
options_list=['--vnet-name'],
@@ -1964,7 +2006,9 @@ def _configure_security_policy_storage_params(arg_ctx):
19642006
])
19652007

19662008
c.argument('administrator_login_password',
1967-
options_list=['--admin-password', '-p'])
2009+
options_list=['--admin-password', '-p'],
2010+
help='The administrator login password (required for'
2011+
'managed instance creation).')
19682012

19692013
c.argument('assign_identity',
19702014
options_list=['--assign-identity', '-i'],

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3327,7 +3327,8 @@ def elastic_pool_update(
33273327
tier=None,
33283328
family=None,
33293329
capacity=None,
3330-
maintenance_configuration_id=None):
3330+
maintenance_configuration_id=None,
3331+
high_availability_replica_count=None):
33313332
'''
33323333
Updates an elastic pool. Custom update function to apply parameters to instance.
33333334
'''
@@ -3366,6 +3367,9 @@ def elastic_pool_update(
33663367
cmd.cli_ctx,
33673368
maintenance_configuration_id)
33683369

3370+
if high_availability_replica_count is not None:
3371+
instance.high_availability_replica_count = high_availability_replica_count
3372+
33693373
return instance
33703374

33713375

0 commit comments

Comments
 (0)