Skip to content

Commit 7e7e029

Browse files
carjackson-msftkushalwarke1niteshvijay-msniteshvijay1995minhokang242
authored
[cosmosdb-preview] Add support for new api version 2024-02-15-preview (#7271)
* add new sdk * update version * update sdk * cli changes for PRPP * variable name fix, added test case * Add mode in copy job (cherry picked from commit a28144517ad4022098561e83d8607c93933dd36c) * Add complete job API (cherry picked from commit 3d721cb) (cherry picked from commit f4e6f01f99eb1299e8c536423f074e9832b71e16) * Add test * history.rst changes * Add history * Introduce disable_ttl parameter * Syntax error fixes * Update tests * Fix syntax error * Change test location to WestCentralUS where 0201 batch1 is completed, add remaining asserts, rerecordings * Update history file * Changed cluster deallocate force input to string * add missing changes from stable Azure/azure-cli#26226 * add stable changes https://github.com/Azure/azure-cli/pull/27175/files * https://github.com/Azure/azure-cli/pull/27322/files * add missing stable changes from https://github.com/Azure/azure-cli/pull/26392/files * Revert "https://github.com/Azure/azure-cli/pull/27322/files" This reverts commit f779e16. * add missing stable changes for minimal tls version from Azure/azure-cli#27322 * nit * Revert "nit" This reverts commit d4f4abe. * Revert "add missing stable changes for minimal tls version from Azure/azure-cli#27322" This reverts commit be4709e. * fix style checl * Address multi character short flag issue * Add missing parameters * Fix syntax issue * Remove short flag * fix test * poc for test changes * inital changes in custom.py * removing recordings * changes in params as well as test and recording for sql ntbr flow * fixing imports * fixing test * fixing recordings * config name change from --enable-per-region-per-partition-autoscale to --enable-prpp-autoscale * re-record tests * nit style * Revert "fixing recordings" This reverts commit ea5c847. * Revert "removing recordings" This reverts commit 583371c. * fixing incorrect merge * Added test * 6 out of 8 test failures * fixing remaining 2 tests * fixing style issues * Update HISTORY.rst to reflect changes ported from stable CLI * re-record cassandra tests * Update version to 1.0.0 due to breaking changes * azdev style fixes * azdev style fixes * azdev style fixes * azdev style fixes * azdev style fixes * azdev style fixes * Update HISTORY.rst version to 1.0.0 --------- Co-authored-by: Kushal Warke <kuwarke@microsoft.com> Co-authored-by: Nitesh Vijay <niteshvijay@microsoft.com> Co-authored-by: Nitesh Vijay <niteshvijay1995@gmail.com> Co-authored-by: Min Ho Kang <minhokang@microsoft.com> Co-authored-by: drewkaufmann <drewkaufmann@microsoft.com> Co-authored-by: Vivek Agarwal (from Dev Box) <agarwalvivek@microsoft.com> Co-authored-by: AgarwalVivek <vagarwal1@hawk.iit.edu>
1 parent 76dd266 commit 7e7e029

File tree

130 files changed

+93574
-53018
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

130 files changed

+93574
-53018
lines changed

src/cosmosdb-preview/HISTORY.rst

+10
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,22 @@
22
33
Release History
44
===============
5+
1.0.0
6+
* Add support for Per-Region Per-Partition Autoscale. '--enable-prpp-autoscale' parameter can be used during account create/update.
7+
* Add support for Restore with Time-To-Live Disabled. '--disable-ttl' parameter can be used during restore.
8+
* Add support for online mode in container copy job.
9+
* Add support for minimum allowed TLS version configuration
10+
* BREAKING CHANGE: az cosmosdb create/update: Rename --enable-public-network true/false to --public-network-access ENABLED/DISABLED/SECUREDBYPERIMETER
11+
* BREAKING CHANGE: az cosmosdb restore: Rename --enable-public-network true/false to --public-network-access ENABLED/DISABLED
12+
13+
++++++
514
0.26.0
615
* Add '--enable-priority-based-execution' and '--default-priority-level' parameter for create/update database account.
716
* Add support for cross account container copy
817
* Add Non-CMK to CMK support
918
* Removed preview tag from CMK related properties
1019

20+
++++++
1121
0.25.0
1222
* Add support for performing database merge for Sql and MongoDB database account.
1323

src/cosmosdb-preview/azext_cosmosdb_preview/_help.py

+10
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# pylint: disable=too-many-lines
12
# coding=utf-8
23
# --------------------------------------------------------------------------------------------
34
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -884,6 +885,15 @@
884885
az cosmosdb copy cancel -g "rg1" --account-name "acc1" --job-name "j1"
885886
"""
886887

888+
helps['cosmosdb copy complete'] = """
889+
type: command
890+
short-summary: "Completes an online container copy job."
891+
examples:
892+
- name: Complete job j1
893+
text: |-
894+
az cosmosdb copy complete -g "rg1" --account-name "acc1" --job-name "j1"
895+
"""
896+
887897
helps['cosmosdb sql container merge'] = """
888898
type: command
889899
short-summary: "Merges the partitions of a sql container."

src/cosmosdb-preview/azext_cosmosdb_preview/_params.py

+25-11
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ def load_arguments(self, _):
307307
c.argument('databases_to_restore', nargs='+', action=CreateDatabaseRestoreResource, is_preview=True, arg_group='Restore')
308308
c.argument('gremlin_databases_to_restore', nargs='+', action=CreateGremlinDatabaseRestoreResource, is_preview=True, arg_group='Restore')
309309
c.argument('tables_to_restore', nargs='+', action=CreateTableRestoreResource, is_preview=True, arg_group='Restore')
310+
c.argument('enable_partition_merge', arg_type=get_three_state_flag(), help="Flag to enable partition merge on the account.")
310311

311312
for scope in ['cosmosdb create', 'cosmosdb update']:
312313
with self.argument_context(scope) as c:
@@ -324,7 +325,7 @@ def load_arguments(self, _):
324325
c.argument('virtual_network_rules', nargs='+', validator=validate_virtual_network_rules, help='ACL\'s for virtual network')
325326
c.argument('enable_multiple_write_locations', arg_type=get_three_state_flag(), help="Enable Multiple Write Locations")
326327
c.argument('disable_key_based_metadata_write_access', arg_type=get_three_state_flag(), help="Disable write operations on metadata resources (databases, containers, throughput) via account keys")
327-
c.argument('enable_public_network', options_list=['--enable-public-network', '-e'], arg_type=get_three_state_flag(), help="Enable or disable public network access to server.")
328+
c.argument('public_network_access', options_list=['--public-network-access', '-p'], arg_type=get_enum_type(['ENABLED', 'DISABLED', 'SECUREDBYPERIMETER']), help="Sets public network access in server to either Enabled, Disabled, or SecuredByPerimeter.")
328329
c.argument('enable_analytical_storage', arg_type=get_three_state_flag(), help="Flag to enable log storage on the account.")
329330
c.argument('network_acl_bypass', arg_type=get_enum_type(NetworkAclBypass), options_list=['--network-acl-bypass'], help="Flag to enable or disable Network Acl Bypass.")
330331
c.argument('network_acl_bypass_resource_ids', nargs='+', options_list=['--network-acl-bypass-resource-ids', '-i'], help="List of Resource Ids to allow Network Acl Bypass.")
@@ -340,6 +341,8 @@ def load_arguments(self, _):
340341
c.argument('enable_burst_capacity', arg_type=get_three_state_flag(), help="Flag to enable burst capacity on the account.", is_preview=True)
341342
c.argument('enable_priority_based_execution', options_list=['--enable-priority-based-execution', '--enable-pbe'], arg_type=get_three_state_flag(), help="Flag to enable priority based execution on the account.", is_preview=True)
342343
c.argument('default_priority_level', arg_type=get_enum_type(DefaultPriorityLevel), help="Default Priority Level of Request if not specified.", is_preview=True)
344+
c.argument('enable_prpp_autoscale', arg_type=get_three_state_flag(), help="Enable or disable PerRegionPerPartitionAutoscale.", is_preview=True)
345+
c.argument('enable_partition_merge', arg_type=get_three_state_flag(), help="Flag to enable partition merge on the account.")
343346

344347
with self.argument_context('cosmosdb update') as c:
345348
c.argument('key_uri', help="The URI of the key vault", is_preview=True)
@@ -354,8 +357,9 @@ def load_arguments(self, _):
354357
c.argument('tables_to_restore', nargs='+', action=CreateTableRestoreResource, is_preview=True)
355358
c.argument('assign_identity', nargs='*', help="Assign system or user assigned identities separated by spaces. Use '[system]' to refer system assigned identity.")
356359
c.argument('default_identity', help="The primary identity to access key vault in CMK related features. e.g. 'FirstPartyIdentity', 'SystemAssignedIdentity' and more.")
357-
c.argument('enable_public_network', options_list=['--enable-public-network', '-e'], arg_type=get_three_state_flag(), help="Enable or disable public network access to server.", is_preview=True)
360+
c.argument('public_network_access', options_list=['--public-network-access', '-p'], arg_type=get_enum_type(['ENABLED', 'DISABLED']), help="Sets public network access in server to either Enabled or Disabled.")
358361
c.argument('source_backup_location', help="This is the location of the source account where backups are located. Provide this value if the source and target are in different locations.", is_preview=True)
362+
c.argument('disable_ttl', options_list=['--disable-ttl'], arg_type=get_three_state_flag(), help="Enable or disable restoring with ttl disabled.", is_preview=True)
359363

360364
# Restorable Database Accounts
361365
with self.argument_context('cosmosdb restorable-database-account show') as c:
@@ -464,21 +468,24 @@ def load_arguments(self, _):
464468
c.argument('dest_nosql', nargs='+', arg_group='Azure Cosmos DB API for NoSQL container copy', action=AddSqlContainerAction, help='Destination NoSql container details')
465469
c.argument('host_copy_on_src', arg_type=get_three_state_flag(), help=argparse.SUPPRESS)
466470
c.argument('worker_count', type=int, help=argparse.SUPPRESS)
471+
c.argument('mode', help='Copy Mode (Online / Offline)')
467472

468473
for scope in [
469474
'cosmosdb copy list',
470475
'cosmosdb copy show',
471476
'cosmosdb copy pause',
472477
'cosmosdb copy resume',
473-
'cosmosdb copy cancel']:
478+
'cosmosdb copy cancel',
479+
'cosmosdb copy complete']:
474480
with self.argument_context(scope) as c:
475481
c.argument('account_name', options_list=["--account-name", "-a"], id_part=None, required=True, help='Azure Cosmos DB account name where the job is created. Use --dest-account value from create job command.')
476482

477483
for scope in [
478484
'cosmosdb copy show',
479485
'cosmosdb copy pause',
480486
'cosmosdb copy resume',
481-
'cosmosdb copy cancel']:
487+
'cosmosdb copy cancel',
488+
'cosmosdb copy complete']:
482489
with self.argument_context(scope) as c:
483490
c.argument('job_name', options_list=['--job-name', '-n'], help='Name of the container copy job.', required=True)
484491

@@ -563,43 +570,50 @@ def load_arguments(self, _):
563570
with self.argument_context('cosmosdb sql database restore') as c:
564571
c.argument('account_name', account_name_type, id_part=None, required=True)
565572
c.argument('database_name', options_list=['--name', '-n'], help="Database name", required=True)
566-
c.argument('restore_timestamp', options_list=['--restore-timestamp', '-t'], action=UtcDatetimeAction, help="The timestamp to which the database needs to be restored to.", required=True)
573+
c.argument('restore_timestamp', options_list=['--restore-timestamp', '-t'], action=UtcDatetimeAction, help="The timestamp to which the database needs to be restored to.", required=False)
574+
c.argument('disable_ttl', options_list=['--disable-ttl'], arg_type=get_three_state_flag(), help="Enable or disable restoring with ttl disabled.", is_preview=True, required=False)
567575

568576
# SQL collection restore
569577
with self.argument_context('cosmosdb sql container restore') as c:
570578
c.argument('account_name', account_name_type, id_part=None, required=True)
571579
c.argument('database_name', database_name_type, required=True)
572580
c.argument('container_name', options_list=['--name', '-n'], help="Container name", required=True)
573-
c.argument('restore_timestamp', options_list=['--restore-timestamp', '-t'], action=UtcDatetimeAction, help="The timestamp to which the container needs to be restored to.", required=True)
581+
c.argument('restore_timestamp', options_list=['--restore-timestamp', '-t'], action=UtcDatetimeAction, help="The timestamp to which the container needs to be restored to.", required=False)
582+
c.argument('disable_ttl', options_list=['--disable-ttl'], arg_type=get_three_state_flag(), help="Enable or disable restoring with ttl disabled.", is_preview=True, required=False)
574583

575584
# MongoDB database restore
576585
with self.argument_context('cosmosdb mongodb database restore') as c:
577586
c.argument('account_name', account_name_type, id_part=None, required=True)
578587
c.argument('database_name', options_list=['--name', '-n'], help="Database name", required=True)
579-
c.argument('restore_timestamp', options_list=['--restore-timestamp', '-t'], action=UtcDatetimeAction, help="The timestamp to which the database needs to be restored to.", required=True)
588+
c.argument('restore_timestamp', options_list=['--restore-timestamp', '-t'], action=UtcDatetimeAction, help="The timestamp to which the database needs to be restored to.", required=False)
589+
c.argument('disable_ttl', options_list=['--disable-ttl'], arg_type=get_three_state_flag(), help="Enable or disable restoring with ttl disabled.", is_preview=True, required=False)
580590

581591
# MongoDB collection restore
582592
with self.argument_context('cosmosdb mongodb collection restore') as c:
583593
c.argument('account_name', account_name_type, id_part=None, required=True)
584594
c.argument('database_name', database_name_type, required=True)
585595
c.argument('collection_name', options_list=['--name', '-n'], help="Collection name", required=True)
586-
c.argument('restore_timestamp', options_list=['--restore-timestamp', '-t'], action=UtcDatetimeAction, help="The timestamp to which the collection needs to be restored to.", required=True)
596+
c.argument('restore_timestamp', options_list=['--restore-timestamp', '-t'], action=UtcDatetimeAction, help="The timestamp to which the collection needs to be restored to.", required=False)
597+
c.argument('disable_ttl', options_list=['--disable-ttl'], arg_type=get_three_state_flag(), help="Enable or disable restoring with ttl disabled.", is_preview=True, required=False)
587598

588599
# Gremlin database restore
589600
with self.argument_context('cosmosdb gremlin database restore') as c:
590601
c.argument('account_name', account_name_type, id_part=None, required=True)
591602
c.argument('database_name', options_list=['--name', '-n'], help="Name of the CosmosDB Gremlin database name", required=True)
592-
c.argument('restore_timestamp', options_list=['--restore-timestamp', '-t'], action=UtcDatetimeAction, help="The timestamp to which the database needs to be restored to.", required=True)
603+
c.argument('restore_timestamp', options_list=['--restore-timestamp', '-t'], action=UtcDatetimeAction, help="The timestamp to which the database needs to be restored to.", required=False)
604+
c.argument('disable_ttl', options_list=['--disable-ttl'], arg_type=get_three_state_flag(), help="Enable or disable restoring with ttl disabled.", is_preview=True, required=False)
593605

594606
# Gremlin Graph restore
595607
with self.argument_context('cosmosdb gremlin graph restore') as c:
596608
c.argument('account_name', account_name_type, id_part=None, required=True)
597609
c.argument('database_name', database_name_type, required=True, help='Name of the CosmosDB Gremlin database name')
598610
c.argument('graph_name', options_list=['--name', '-n'], help="Name of the CosmosDB Gremlin graph name", required=True)
599-
c.argument('restore_timestamp', options_list=['--restore-timestamp', '-t'], action=UtcDatetimeAction, help="The timestamp to which the graph needs to be restored to.", required=True)
611+
c.argument('restore_timestamp', options_list=['--restore-timestamp', '-t'], action=UtcDatetimeAction, help="The timestamp to which the graph needs to be restored to.", required=False)
612+
c.argument('disable_ttl', options_list=['--disable-ttl'], arg_type=get_three_state_flag(), help="Enable or disable restoring with ttl disabled.", is_preview=True, required=False)
600613

601614
# Table restore
602615
with self.argument_context('cosmosdb table restore') as c:
603616
c.argument('account_name', account_name_type, id_part=None, required=True)
604617
c.argument('table_name', options_list=['--table-name', '-n'], required=True, help='Name of the CosmosDB Table name')
605-
c.argument('restore_timestamp', options_list=['--restore-timestamp', '-t'], action=UtcDatetimeAction, help="The timestamp to which the Table needs to be restored to.", required=True)
618+
c.argument('restore_timestamp', options_list=['--restore-timestamp', '-t'], action=UtcDatetimeAction, help="The timestamp to which the Table needs to be restored to.", required=False)
619+
c.argument('disable_ttl', options_list=['--disable-ttl'], arg_type=get_three_state_flag(), help="Enable or disable restoring with ttl disabled.", is_preview=True, required=False)

src/cosmosdb-preview/azext_cosmosdb_preview/commands.py

+1
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ def load_command_table(self, _):
211211
g.command('pause', 'pause')
212212
g.command('resume', 'resume')
213213
g.command('cancel', 'cancel')
214+
g.command('complete', 'complete')
214215

215216
# Merge partitions for Sql containers
216217
cosmosdb_sql_sdk = CliCommandType(

0 commit comments

Comments
 (0)