Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@
- name: >
Create elastic cluster with node count of 5. Default node count is 2 when --cluster-option is "ElasticCluster".
text: >
az postgres flexible-server create -g testGroup -n testServer --location testLocation --cluster-option ElasticCluster --node-count 5
az postgres flexible-server create -g testGroup -n testCluster --location testLocation --cluster-option ElasticCluster --node-count 5
"""

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

helps['postgres flexible-server restore'] = """
Expand Down
8 changes: 8 additions & 0 deletions src/azure-cli/azure/cli/command_modules/rdbms/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,13 @@ def _flexible_server_params(command_group):
validator=node_count_validator
)

update_node_count_arg_type = CLIArgumentType(
type=int,
options_list=['--node-count'],
help='The number of nodes for elastic cluster. Range of 1 to 10.',
validator=node_count_validator
)

auto_grow_arg_type = CLIArgumentType(
arg_type=get_enum_type(['Enabled', 'Disabled']),
options_list=['--storage-auto-grow'],
Expand Down Expand Up @@ -733,6 +740,7 @@ def _flexible_server_params(command_group):
c.argument('active_directory_auth', arg_type=active_directory_auth_arg_type)
c.argument('password_auth', arg_type=password_auth_arg_type)
c.argument('private_dns_zone_arguments', private_dns_zone_arguments_arg_type)
c.argument('cluster_size', default=None, arg_type=update_node_count_arg_type)
c.argument('yes', arg_type=yes_arg_type)

with self.argument_context('{} flexible-server upgrade'.format(command_group)) as c:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def flexible_server_update_custom_func(cmd, client, instance,
auto_grow=None,
performance_tier=None,
iops=None, throughput=None,
yes=False):
cluster_size=None, yes=False):

# validator
location = ''.join(instance.location.lower().split())
Expand All @@ -322,7 +322,7 @@ def flexible_server_update_custom_func(cmd, client, instance,
backup_byok_identity=backup_byok_identity,
backup_byok_key=backup_byok_key,
performance_tier=performance_tier,
instance=instance)
cluster_size=cluster_size, instance=instance)

server_module_path = instance.__module__
module = import_module(server_module_path)
Expand Down Expand Up @@ -403,6 +403,9 @@ def flexible_server_update_custom_func(cmd, client, instance,
password_auth, administrator_login, administrator_login_password)
auth_config.password_auth = password_auth

if cluster_size:
instance.cluster.cluster_size = cluster_size

params = ServerForUpdate(sku=instance.sku,
storage=instance.storage,
backup=instance.backup,
Expand All @@ -413,6 +416,7 @@ def flexible_server_update_custom_func(cmd, client, instance,
identity=identity,
data_encryption=data_encryption,
auth_config=auth_config,
cluster=instance.cluster,
tags=tags)

# High availability can't be updated with existing properties
Expand Down
Loading
Loading