From e5a86ecf0763845c2cd81216fe413aac1749f46b Mon Sep 17 00:00:00 2001 From: Min Ho Kang Date: Fri, 1 Mar 2024 10:27:57 -0800 Subject: [PATCH 1/4] Address multi character short flag issue --- src/cosmosdb-preview/azext_cosmosdb_preview/_params.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cosmosdb-preview/azext_cosmosdb_preview/_params.py b/src/cosmosdb-preview/azext_cosmosdb_preview/_params.py index 86adf89643c..b944e468bff 100644 --- a/src/cosmosdb-preview/azext_cosmosdb_preview/_params.py +++ b/src/cosmosdb-preview/azext_cosmosdb_preview/_params.py @@ -359,7 +359,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.") 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.") 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) - c.argument('disable_ttl', options_list=['--disable-ttl', '-dt'], arg_type=get_three_state_flag(), help="Enable or disable restoring with ttl disabled.", is_preview=True) + c.argument('disable_ttl', options_list=['--disable-ttl', '-d'], arg_type=get_three_state_flag(), help="Enable or disable restoring with ttl disabled.", is_preview=True) # Restorable Database Accounts with self.argument_context('cosmosdb restorable-database-account show') as c: From 24a9ef5ff939d0734950e8931ffb132b79b29919 Mon Sep 17 00:00:00 2001 From: Min Ho Kang Date: Fri, 1 Mar 2024 11:27:29 -0800 Subject: [PATCH 2/4] Add missing parameters --- src/cosmosdb-preview/azext_cosmosdb_preview/_params.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/cosmosdb-preview/azext_cosmosdb_preview/_params.py b/src/cosmosdb-preview/azext_cosmosdb_preview/_params.py index b944e468bff..2e6f660b573 100644 --- a/src/cosmosdb-preview/azext_cosmosdb_preview/_params.py +++ b/src/cosmosdb-preview/azext_cosmosdb_preview/_params.py @@ -571,6 +571,7 @@ def load_arguments(self, _): c.argument('account_name', account_name_type, id_part=None, required=True) c.argument('database_name', options_list=['--name', '-n'], help="Database name", required=True) 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) + c.argument('disable_ttl', options_list=['--disable-ttl', 'd', arg_type=get_three_state_flag(), help="Enable or disable restoring with ttl disabled.", is_preview= True, required=False]) # SQL collection restore with self.argument_context('cosmosdb sql container restore') as c: @@ -578,12 +579,14 @@ def load_arguments(self, _): c.argument('database_name', database_name_type, required=True) c.argument('container_name', options_list=['--name', '-n'], help="Container name", required=True) 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) + c.argument('disable_ttl', options_list=['--disable-ttl', 'd', arg_type=get_three_state_flag(), help="Enable or disable restoring with ttl disabled.", is_preview= True, required=False]) # MongoDB database restore with self.argument_context('cosmosdb mongodb database restore') as c: c.argument('account_name', account_name_type, id_part=None, required=True) c.argument('database_name', options_list=['--name', '-n'], help="Database name", required=True) 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) + c.argument('disable_ttl', options_list=['--disable-ttl', 'd', arg_type=get_three_state_flag(), help="Enable or disable restoring with ttl disabled.", is_preview= True, required=False]) # MongoDB collection restore with self.argument_context('cosmosdb mongodb collection restore') as c: @@ -591,12 +594,14 @@ def load_arguments(self, _): c.argument('database_name', database_name_type, required=True) c.argument('collection_name', options_list=['--name', '-n'], help="Collection name", required=True) 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) + c.argument('disable_ttl', options_list=['--disable-ttl', 'd', arg_type=get_three_state_flag(), help="Enable or disable restoring with ttl disabled.", is_preview= True, required=False]) # Gremlin database restore with self.argument_context('cosmosdb gremlin database restore') as c: c.argument('account_name', account_name_type, id_part=None, required=True) c.argument('database_name', options_list=['--name', '-n'], help="Name of the CosmosDB Gremlin database name", required=True) 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) + c.argument('disable_ttl', options_list=['--disable-ttl', 'd', arg_type=get_three_state_flag(), help="Enable or disable restoring with ttl disabled.", is_preview= True, required=False]) # Gremlin Graph restore with self.argument_context('cosmosdb gremlin graph restore') as c: @@ -604,9 +609,11 @@ def load_arguments(self, _): c.argument('database_name', database_name_type, required=True, help='Name of the CosmosDB Gremlin database name') c.argument('graph_name', options_list=['--name', '-n'], help="Name of the CosmosDB Gremlin graph name", required=True) 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) + c.argument('disable_ttl', options_list=['--disable-ttl', 'd', arg_type=get_three_state_flag(), help="Enable or disable restoring with ttl disabled.", is_preview= True, required=False]) # Table restore with self.argument_context('cosmosdb table restore') as c: c.argument('account_name', account_name_type, id_part=None, required=True) c.argument('table_name', options_list=['--table-name', '-n'], required=True, help='Name of the CosmosDB Table name') 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) + c.argument('disable_ttl', options_list=['--disable-ttl', 'd', arg_type=get_three_state_flag(), help="Enable or disable restoring with ttl disabled.", is_preview= True, required=False]) From ea6e462454a24829710b5f3ce95c360d838ff244 Mon Sep 17 00:00:00 2001 From: Min Ho Kang Date: Fri, 1 Mar 2024 13:49:02 -0800 Subject: [PATCH 3/4] Fix syntax issue --- .../azext_cosmosdb_preview/_params.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/cosmosdb-preview/azext_cosmosdb_preview/_params.py b/src/cosmosdb-preview/azext_cosmosdb_preview/_params.py index 2e6f660b573..dc271eaeb2c 100644 --- a/src/cosmosdb-preview/azext_cosmosdb_preview/_params.py +++ b/src/cosmosdb-preview/azext_cosmosdb_preview/_params.py @@ -571,7 +571,7 @@ def load_arguments(self, _): c.argument('account_name', account_name_type, id_part=None, required=True) c.argument('database_name', options_list=['--name', '-n'], help="Database name", required=True) 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) - c.argument('disable_ttl', options_list=['--disable-ttl', 'd', arg_type=get_three_state_flag(), help="Enable or disable restoring with ttl disabled.", is_preview= True, required=False]) + c.argument('disable_ttl', options_list=['--disable-ttl', 'd'], arg_type=get_three_state_flag(), help="Enable or disable restoring with ttl disabled.", is_preview= True, required=False]) # SQL collection restore with self.argument_context('cosmosdb sql container restore') as c: @@ -579,14 +579,14 @@ def load_arguments(self, _): c.argument('database_name', database_name_type, required=True) c.argument('container_name', options_list=['--name', '-n'], help="Container name", required=True) 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) - c.argument('disable_ttl', options_list=['--disable-ttl', 'd', arg_type=get_three_state_flag(), help="Enable or disable restoring with ttl disabled.", is_preview= True, required=False]) + c.argument('disable_ttl', options_list=['--disable-ttl', 'd'], arg_type=get_three_state_flag(), help="Enable or disable restoring with ttl disabled.", is_preview= True, required=False]) # MongoDB database restore with self.argument_context('cosmosdb mongodb database restore') as c: c.argument('account_name', account_name_type, id_part=None, required=True) c.argument('database_name', options_list=['--name', '-n'], help="Database name", required=True) 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) - c.argument('disable_ttl', options_list=['--disable-ttl', 'd', arg_type=get_three_state_flag(), help="Enable or disable restoring with ttl disabled.", is_preview= True, required=False]) + c.argument('disable_ttl', options_list=['--disable-ttl', 'd'], arg_type=get_three_state_flag(), help="Enable or disable restoring with ttl disabled.", is_preview= True, required=False]) # MongoDB collection restore with self.argument_context('cosmosdb mongodb collection restore') as c: @@ -594,14 +594,14 @@ def load_arguments(self, _): c.argument('database_name', database_name_type, required=True) c.argument('collection_name', options_list=['--name', '-n'], help="Collection name", required=True) 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) - c.argument('disable_ttl', options_list=['--disable-ttl', 'd', arg_type=get_three_state_flag(), help="Enable or disable restoring with ttl disabled.", is_preview= True, required=False]) + c.argument('disable_ttl', options_list=['--disable-ttl', 'd'], arg_type=get_three_state_flag(), help="Enable or disable restoring with ttl disabled.", is_preview= True, required=False]) # Gremlin database restore with self.argument_context('cosmosdb gremlin database restore') as c: c.argument('account_name', account_name_type, id_part=None, required=True) c.argument('database_name', options_list=['--name', '-n'], help="Name of the CosmosDB Gremlin database name", required=True) 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) - c.argument('disable_ttl', options_list=['--disable-ttl', 'd', arg_type=get_three_state_flag(), help="Enable or disable restoring with ttl disabled.", is_preview= True, required=False]) + c.argument('disable_ttl', options_list=['--disable-ttl', 'd'], arg_type=get_three_state_flag(), help="Enable or disable restoring with ttl disabled.", is_preview= True, required=False]) # Gremlin Graph restore with self.argument_context('cosmosdb gremlin graph restore') as c: @@ -609,11 +609,11 @@ def load_arguments(self, _): c.argument('database_name', database_name_type, required=True, help='Name of the CosmosDB Gremlin database name') c.argument('graph_name', options_list=['--name', '-n'], help="Name of the CosmosDB Gremlin graph name", required=True) 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) - c.argument('disable_ttl', options_list=['--disable-ttl', 'd', arg_type=get_three_state_flag(), help="Enable or disable restoring with ttl disabled.", is_preview= True, required=False]) + c.argument('disable_ttl', options_list=['--disable-ttl', 'd'], arg_type=get_three_state_flag(), help="Enable or disable restoring with ttl disabled.", is_preview= True, required=False]) # Table restore with self.argument_context('cosmosdb table restore') as c: c.argument('account_name', account_name_type, id_part=None, required=True) c.argument('table_name', options_list=['--table-name', '-n'], required=True, help='Name of the CosmosDB Table name') 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) - c.argument('disable_ttl', options_list=['--disable-ttl', 'd', arg_type=get_three_state_flag(), help="Enable or disable restoring with ttl disabled.", is_preview= True, required=False]) + c.argument('disable_ttl', options_list=['--disable-ttl', 'd'], arg_type=get_three_state_flag(), help="Enable or disable restoring with ttl disabled.", is_preview= True, required=False]) From eccd1f19796d8e76e76580ea8e0e8e6ac30b0df7 Mon Sep 17 00:00:00 2001 From: Min Ho Kang Date: Fri, 1 Mar 2024 14:07:37 -0800 Subject: [PATCH 4/4] Remove short flag --- .../azext_cosmosdb_preview/_params.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/cosmosdb-preview/azext_cosmosdb_preview/_params.py b/src/cosmosdb-preview/azext_cosmosdb_preview/_params.py index dc271eaeb2c..834a0fc49b8 100644 --- a/src/cosmosdb-preview/azext_cosmosdb_preview/_params.py +++ b/src/cosmosdb-preview/azext_cosmosdb_preview/_params.py @@ -359,7 +359,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.") 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.") 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) - c.argument('disable_ttl', options_list=['--disable-ttl', '-d'], arg_type=get_three_state_flag(), help="Enable or disable restoring with ttl disabled.", is_preview=True) + 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) # Restorable Database Accounts with self.argument_context('cosmosdb restorable-database-account show') as c: @@ -571,7 +571,7 @@ def load_arguments(self, _): c.argument('account_name', account_name_type, id_part=None, required=True) c.argument('database_name', options_list=['--name', '-n'], help="Database name", required=True) 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) - c.argument('disable_ttl', options_list=['--disable-ttl', 'd'], arg_type=get_three_state_flag(), help="Enable or disable restoring with ttl disabled.", is_preview= True, required=False]) + 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) # SQL collection restore with self.argument_context('cosmosdb sql container restore') as c: @@ -579,14 +579,14 @@ def load_arguments(self, _): c.argument('database_name', database_name_type, required=True) c.argument('container_name', options_list=['--name', '-n'], help="Container name", required=True) 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) - c.argument('disable_ttl', options_list=['--disable-ttl', 'd'], arg_type=get_three_state_flag(), help="Enable or disable restoring with ttl disabled.", is_preview= True, required=False]) + 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) # MongoDB database restore with self.argument_context('cosmosdb mongodb database restore') as c: c.argument('account_name', account_name_type, id_part=None, required=True) c.argument('database_name', options_list=['--name', '-n'], help="Database name", required=True) 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) - c.argument('disable_ttl', options_list=['--disable-ttl', 'd'], arg_type=get_three_state_flag(), help="Enable or disable restoring with ttl disabled.", is_preview= True, required=False]) + 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) # MongoDB collection restore with self.argument_context('cosmosdb mongodb collection restore') as c: @@ -594,14 +594,14 @@ def load_arguments(self, _): c.argument('database_name', database_name_type, required=True) c.argument('collection_name', options_list=['--name', '-n'], help="Collection name", required=True) 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) - c.argument('disable_ttl', options_list=['--disable-ttl', 'd'], arg_type=get_three_state_flag(), help="Enable or disable restoring with ttl disabled.", is_preview= True, required=False]) + 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) # Gremlin database restore with self.argument_context('cosmosdb gremlin database restore') as c: c.argument('account_name', account_name_type, id_part=None, required=True) c.argument('database_name', options_list=['--name', '-n'], help="Name of the CosmosDB Gremlin database name", required=True) 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) - c.argument('disable_ttl', options_list=['--disable-ttl', 'd'], arg_type=get_three_state_flag(), help="Enable or disable restoring with ttl disabled.", is_preview= True, required=False]) + 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) # Gremlin Graph restore with self.argument_context('cosmosdb gremlin graph restore') as c: @@ -609,11 +609,11 @@ def load_arguments(self, _): c.argument('database_name', database_name_type, required=True, help='Name of the CosmosDB Gremlin database name') c.argument('graph_name', options_list=['--name', '-n'], help="Name of the CosmosDB Gremlin graph name", required=True) 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) - c.argument('disable_ttl', options_list=['--disable-ttl', 'd'], arg_type=get_three_state_flag(), help="Enable or disable restoring with ttl disabled.", is_preview= True, required=False]) + 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) # Table restore with self.argument_context('cosmosdb table restore') as c: c.argument('account_name', account_name_type, id_part=None, required=True) c.argument('table_name', options_list=['--table-name', '-n'], required=True, help='Name of the CosmosDB Table name') 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) - c.argument('disable_ttl', options_list=['--disable-ttl', 'd'], arg_type=get_three_state_flag(), help="Enable or disable restoring with ttl disabled.", is_preview= True, required=False]) + 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)