Skip to content

Commit 3a129a8

Browse files
committed
init
1 parent ec666ca commit 3a129a8

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

src/azure-cli/azure/cli/command_modules/rdbms/_helptext_pg.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@
223223
- name: >
224224
Create elastic cluster with node count of 5. Default node count is 2 when --cluster-option is "ElasticCluster".
225225
text: >
226-
az postgres flexible-server create -g testGroup -n testServer --location testLocation --cluster-option ElasticCluster --node-count 5
226+
az postgres flexible-server create -g testGroup -n testCluster --location testLocation --cluster-option ElasticCluster --node-count 5
227227
"""
228228

229229
helps['postgres flexible-server show'] = """
@@ -282,6 +282,8 @@
282282
text: az postgres flexible-server update --resource-group testGroup --name testserver --iops 3000
283283
- name: Update a flexible server's storage to set Throughput (MB/sec). Server must be using Premium SSD v2 Disks.
284284
text: az postgres flexible-server update --resource-group testGroup --name testserver --throughput 125
285+
- name: Update a flexible server's cluster size by scaling up node count. Must be an Elastic Cluster.
286+
text: az postgres flexible-server update --resource-group testGroup --name testcluster --node-count 6
285287
"""
286288

287289
helps['postgres flexible-server restore'] = """

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,13 @@ def _flexible_server_params(command_group):
346346
validator=node_count_validator
347347
)
348348

349+
update_node_count_arg_type = CLIArgumentType(
350+
type=int,
351+
options_list=['--node-count'],
352+
help='The number of nodes for elastic cluster. Range of 1 to 10.',
353+
validator=node_count_validator
354+
)
355+
349356
auto_grow_arg_type = CLIArgumentType(
350357
arg_type=get_enum_type(['Enabled', 'Disabled']),
351358
options_list=['--storage-auto-grow'],
@@ -733,6 +740,7 @@ def _flexible_server_params(command_group):
733740
c.argument('active_directory_auth', arg_type=active_directory_auth_arg_type)
734741
c.argument('password_auth', arg_type=password_auth_arg_type)
735742
c.argument('private_dns_zone_arguments', private_dns_zone_arguments_arg_type)
743+
c.argument('cluster_size', default=None, arg_type=update_node_count_arg_type)
736744
c.argument('yes', arg_type=yes_arg_type)
737745

738746
with self.argument_context('{} flexible-server upgrade'.format(command_group)) as c:

src/azure-cli/azure/cli/command_modules/rdbms/flexible_server_custom_postgres.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ def flexible_server_update_custom_func(cmd, client, instance,
296296
auto_grow=None,
297297
performance_tier=None,
298298
iops=None, throughput=None,
299-
yes=False):
299+
cluster_size=None, yes=False):
300300

301301
# validator
302302
location = ''.join(instance.location.lower().split())
@@ -322,7 +322,7 @@ def flexible_server_update_custom_func(cmd, client, instance,
322322
backup_byok_identity=backup_byok_identity,
323323
backup_byok_key=backup_byok_key,
324324
performance_tier=performance_tier,
325-
instance=instance)
325+
cluster_size=cluster_size, instance=instance)
326326

327327
server_module_path = instance.__module__
328328
module = import_module(server_module_path)
@@ -403,6 +403,9 @@ def flexible_server_update_custom_func(cmd, client, instance,
403403
password_auth, administrator_login, administrator_login_password)
404404
auth_config.password_auth = password_auth
405405

406+
if cluster_size:
407+
instance.cluster.cluster_size = cluster_size
408+
406409
params = ServerForUpdate(sku=instance.sku,
407410
storage=instance.storage,
408411
backup=instance.backup,
@@ -413,6 +416,7 @@ def flexible_server_update_custom_func(cmd, client, instance,
413416
identity=identity,
414417
data_encryption=data_encryption,
415418
auth_config=auth_config,
419+
cluster=instance.cluster,
416420
tags=tags)
417421

418422
# High availability can't be updated with existing properties

0 commit comments

Comments
 (0)