Skip to content

Commit 953fd4b

Browse files
[CosmosDB] az cosmosdb create/update: Enable Partition Merge feature for CosmosDB (#26392)
* CosmosDB: Adds changes to handle enabling partition merge on CosmosDB account. * CosmosDB: Adds changes to handle enabling partition merge on CosmosDB account.
1 parent 0c35ea8 commit 953fd4b

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ def load_arguments(self, _):
8888
c.argument('databases_to_restore', nargs='+', action=CreateDatabaseRestoreResource, arg_group='Restore')
8989
c.argument('gremlin_databases_to_restore', nargs='+', action=CreateGremlinDatabaseRestoreResource, arg_group='Restore')
9090
c.argument('tables_to_restore', nargs='+', action=CreateTableRestoreResource, arg_group='Restore')
91+
c.argument('enable_partition_merge', arg_type=get_three_state_flag(), help="Flag to enable partition merge on the account.")
9192

9293
for scope in ['cosmosdb create', 'cosmosdb update']:
9394
with self.argument_context(scope) as c:
@@ -117,6 +118,7 @@ def load_arguments(self, _):
117118
c.argument('default_identity', help="The primary identity to access key vault in CMK related features. e.g. 'FirstPartyIdentity', 'SystemAssignedIdentity' and more. User-assigned identities are specified in format 'UserAssignedIdentity=<resource ID of the user-assigned identity>'.", is_preview=True)
118119
c.argument('analytical_storage_schema_type', options_list=['--analytical-storage-schema-type', '--as-schema'], arg_type=get_enum_type(AnalyticalStorageSchemaType), help="Schema type for analytical storage.", arg_group='Analytical Storage Configuration')
119120
c.argument('backup_policy_type', arg_type=get_enum_type(BackupPolicyType), help="The type of backup policy of the account to create", arg_group='Backup Policy')
121+
c.argument('enable_partition_merge', arg_type=get_three_state_flag(), help="Flag to enable partition merge on the account.")
120122
c.argument('continuous_tier', arg_type=get_enum_type(ContinuousTier), help="The tier of Continuous backup", arg_group='Backup Policy')
121123

122124
for scope in ['cosmosdb regenerate-key', 'cosmosdb keys regenerate']:

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

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ def cli_cosmosdb_create(cmd,
134134
tables_to_restore=None,
135135
is_restore_request=None,
136136
restore_source=None,
137-
restore_timestamp=None):
137+
restore_timestamp=None,
138+
enable_partition_merge=None):
138139
"""Create a new Azure Cosmos DB database account."""
139140

140141
from azure.cli.core.commands.client_factory import get_mgmt_service_client
@@ -186,7 +187,8 @@ def cli_cosmosdb_create(cmd,
186187
databases_to_restore=databases_to_restore,
187188
gremlin_databases_to_restore=gremlin_databases_to_restore,
188189
tables_to_restore=tables_to_restore,
189-
arm_location=resource_group_location)
190+
arm_location=resource_group_location,
191+
enable_partition_merge=enable_partition_merge)
190192

191193

192194
# pylint: disable=too-many-statements
@@ -228,7 +230,8 @@ def _create_database_account(client,
228230
is_restore_request=None,
229231
restore_source=None,
230232
restore_timestamp=None,
231-
arm_location=None):
233+
arm_location=None,
234+
enable_partition_merge=None):
232235

233236
consistency_policy = None
234237
if default_consistency_level is not None:
@@ -359,7 +362,8 @@ def _create_database_account(client,
359362
default_identity=default_identity,
360363
analytical_storage_configuration=analytical_storage_configuration,
361364
create_mode=create_mode,
362-
restore_parameters=restore_parameters
365+
restore_parameters=restore_parameters,
366+
enable_partition_merge=enable_partition_merge
363367
)
364368

365369
async_docdb_create = client.begin_create_or_update(resource_group_name, account_name, params)
@@ -396,7 +400,8 @@ def cli_cosmosdb_update(client,
396400
default_identity=None,
397401
analytical_storage_schema_type=None,
398402
backup_policy_type=None,
399-
continuous_tier=None):
403+
continuous_tier=None,
404+
enable_partition_merge=None):
400405
"""Update an existing Azure Cosmos DB database account. """
401406
existing = client.get(resource_group_name, account_name)
402407

@@ -490,7 +495,8 @@ def cli_cosmosdb_update(client,
490495
api_properties=api_properties,
491496
backup_policy=backup_policy,
492497
default_identity=default_identity,
493-
analytical_storage_configuration=analytical_storage_configuration)
498+
analytical_storage_configuration=analytical_storage_configuration,
499+
enable_partition_merge=enable_partition_merge)
494500

495501
async_docdb_update = client.begin_update(resource_group_name, account_name, params)
496502
docdb_account = async_docdb_update.result()

0 commit comments

Comments
 (0)