Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CosmosDB] az cosmosdb create/update: Enable Partition Merge feature for CosmosDB #26392

Merged
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
2 changes: 2 additions & 0 deletions src/azure-cli/azure/cli/command_modules/cosmosdb/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def load_arguments(self, _):
c.argument('databases_to_restore', nargs='+', action=CreateDatabaseRestoreResource, arg_group='Restore')
c.argument('gremlin_databases_to_restore', nargs='+', action=CreateGremlinDatabaseRestoreResource, arg_group='Restore')
c.argument('tables_to_restore', nargs='+', action=CreateTableRestoreResource, arg_group='Restore')
c.argument('enable_partition_merge', arg_type=get_three_state_flag(), help="Flag to enable partition merge on the account.")

for scope in ['cosmosdb create', 'cosmosdb update']:
with self.argument_context(scope) as c:
Expand Down Expand Up @@ -117,6 +118,7 @@ def load_arguments(self, _):
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)
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')
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')
c.argument('enable_partition_merge', arg_type=get_three_state_flag(), help="Flag to enable partition merge on the account.")
c.argument('continuous_tier', arg_type=get_enum_type(ContinuousTier), help="The tier of Continuous backup", arg_group='Backup Policy')

for scope in ['cosmosdb regenerate-key', 'cosmosdb keys regenerate']:
Expand Down
18 changes: 12 additions & 6 deletions src/azure-cli/azure/cli/command_modules/cosmosdb/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ def cli_cosmosdb_create(cmd,
tables_to_restore=None,
is_restore_request=None,
restore_source=None,
restore_timestamp=None):
restore_timestamp=None,
enable_partition_merge=None):
"""Create a new Azure Cosmos DB database account."""

from azure.cli.core.commands.client_factory import get_mgmt_service_client
Expand Down Expand Up @@ -186,7 +187,8 @@ def cli_cosmosdb_create(cmd,
databases_to_restore=databases_to_restore,
gremlin_databases_to_restore=gremlin_databases_to_restore,
tables_to_restore=tables_to_restore,
arm_location=resource_group_location)
arm_location=resource_group_location,
enable_partition_merge=enable_partition_merge)


# pylint: disable=too-many-statements
Expand Down Expand Up @@ -228,7 +230,8 @@ def _create_database_account(client,
is_restore_request=None,
restore_source=None,
restore_timestamp=None,
arm_location=None):
arm_location=None,
enable_partition_merge=None):

consistency_policy = None
if default_consistency_level is not None:
Expand Down Expand Up @@ -359,7 +362,8 @@ def _create_database_account(client,
default_identity=default_identity,
analytical_storage_configuration=analytical_storage_configuration,
create_mode=create_mode,
restore_parameters=restore_parameters
restore_parameters=restore_parameters,
enable_partition_merge=enable_partition_merge
)

async_docdb_create = client.begin_create_or_update(resource_group_name, account_name, params)
Expand Down Expand Up @@ -396,7 +400,8 @@ def cli_cosmosdb_update(client,
default_identity=None,
analytical_storage_schema_type=None,
backup_policy_type=None,
continuous_tier=None):
continuous_tier=None,
enable_partition_merge=None):
"""Update an existing Azure Cosmos DB database account. """
existing = client.get(resource_group_name, account_name)

Expand Down Expand Up @@ -490,7 +495,8 @@ def cli_cosmosdb_update(client,
api_properties=api_properties,
backup_policy=backup_policy,
default_identity=default_identity,
analytical_storage_configuration=analytical_storage_configuration)
analytical_storage_configuration=analytical_storage_configuration,
enable_partition_merge=enable_partition_merge)

async_docdb_update = client.begin_update(resource_group_name, account_name, params)
docdb_account = async_docdb_update.result()
Expand Down