Skip to content

Commit

Permalink
resolving comments
Browse files Browse the repository at this point in the history
  • Loading branch information
avanigupta committed Jan 7, 2020
1 parent 590a319 commit ae369fe
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 23 deletions.
12 changes: 2 additions & 10 deletions src/azure-cli/azure/cli/command_modules/appconfig/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@
examples:
- name: Export all keys and feature flags with label test to a json file.
text: az appconfig kv export -n MyAppConfiguration --label test -d file --path D:/abc.json --format json
- name: Export all keys and feature flags with null label to another App Configuration.
text: az appconfig kv export -n MyAppConfiguration -d appconfig --dest-name AnotherAppConfiguration
- name: Export all keys with null label to an App Service application.
text: az appconfig kv export -n MyAppConfiguration -d appservice --appservice-account MyAppService
- name: Export all keys with label test excluding feature flags to a json file.
Expand All @@ -80,8 +78,6 @@
text: az appconfig kv export -n MyAppConfiguration -d appconfig --dest-name AnotherAppConfiguration --key * --label * --preserve-labels
- name: Export all keys and feature flags with all labels to another App Configuration and overwrite destination labels.
text: az appconfig kv export -n MyAppConfiguration -d appconfig --dest-name AnotherAppConfiguration --key * --label * --dest-label ExportedKeys
- name: Export all keys and feature flags with all labels to another App Configuration and assign null label in destination AppConfig.
text: az appconfig kv export -n MyAppConfiguration -d appconfig --dest-name AnotherAppConfiguration --key * --label *
"""

helps['appconfig kv import'] = """
Expand All @@ -90,18 +86,14 @@
examples:
- name: Import all keys and feature flags from a file and apply test label.
text: az appconfig kv import -n MyAppConfiguration --label test -s file --path D:/abc.json --format json
- name: Import all keys and feature flags with null label and apply null label from an App Configuration.
text: az appconfig kv import -n MyAppConfiguration -s appconfig --src-name AnotherAppConfiguration
- name: Import all keys and feature flags with null label and apply new label from an App Configuration.
text: az appconfig kv import -n MyAppConfiguration -s appconfig --src-name AnotherAppConfiguration --label ImportedKeys
- name: Import all keys and apply null label from an App Service appliaction.
text: az appconfig kv import -n MyAppConfiguration -s appservice --appservice-account MyAppService
- name: Import all keys with label test and apply test2 label excluding feature flags from an App Configuration.
text: az appconfig kv import -n MyAppConfiguration -s appconfig --src-label test --label test2 --src-name AnotherAppConfiguration --skip-features
- name: Import all keys and feature flags with all labels to another App Configuration.
text: az appconfig kv import -n MyAppConfiguration -s appconfig --src-name AnotherAppConfiguration --src-key * --src-label * --preserve-labels
- name: Import all keys and feature flags with all labels to another App Configuration and overwrite labels.
text: az appconfig kv import -n MyAppConfiguration -s appconfig --src-name AnotherAppConfiguration --src-key * --src-label * --label ImportedKeys
- name: Import all keys and feature flags with all labels to another App Configuration and assign null label.
text: az appconfig kv import -n MyAppConfiguration -s appconfig --src-name AnotherAppConfiguration --src-key * --src-label *
"""

helps['appconfig kv list'] = """
Expand Down
10 changes: 5 additions & 5 deletions src/azure-cli/azure/cli/command_modules/appconfig/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def load_arguments(self, _):
c.argument('id_', options_list=['--id'], help='Id of the key to be regenerated. Can be found using az appconfig credential list command.')

with self.argument_context('appconfig kv import') as c:
c.argument('label', help="Imported KVs and feature flags will be assigned with this label. If omitted, for file and appservice source, will assign null label by default. For AppConfig source, if neither --label nor --preserve-labels is specified, will assign null label by default. If there are duplicate keys in source AppConfig, only the last key will be imported with this label.")
c.argument('label', help="Imported KVs and feature flags will be assigned with this label. If no label specified, will assign null label.")
c.argument('prefix', help="This prefix will be appended to the front of imported keys. Prefix will be ignored for feature flags.")
c.argument('source', options_list=['--source', '-s'], arg_type=get_enum_type(['file', 'appconfig', 'appservice']), validator=validate_import, help="The source of importing. Note that importing feature flags from appservice is not supported.")
c.argument('yes', help="Do not prompt for preview.")
Expand All @@ -92,8 +92,8 @@ def load_arguments(self, _):
c.argument('src_name', help='The name of the source App Configuration.')
c.argument('src_connection_string', validator=validate_connection_string, help="Combination of access key and endpoint of the source store.")
c.argument('src_key', help='If no key specified, import all keys by default. Support star sign as filters, for instance abc* means keys with abc as prefix. Similarly, *abc and *abc* are also supported. Key filtering not applicable for feature flags. By default, all feature flags with specified label will be imported.')
c.argument('src_label', help="Only keys with this label in source AppConfig will be imported. If no src-label specified, import keys with null label by default. Support star sign as filters, for instance * means all labels, abc* means labels with abc as prefix. Similarly, *abc and *abc* are also supported.")
c.argument('preserve_labels', arg_type=get_three_state_flag(), help="Original labels from source AppConfig will be preserved for all KVs. This argument should only be specified when --label is NOT provided.")
c.argument('src_label', help="Only keys with this label in source AppConfig will be imported. If no value specified, import keys with null label by default. Support star sign as filters, for instance * means all labels, abc* means labels with abc as prefix. Similarly, *abc and *abc* are also supported.")
c.argument('preserve_labels', arg_type=get_three_state_flag(), help="Flag to preserve labels from source AppConfig. This argument should NOT be specified along with --label.")

with self.argument_context('appconfig kv import', arg_group='AppService') as c:
c.argument('appservice_account', validator=validate_appservice_name_or_id, help='ARM ID for AppService OR the name of the AppService, assuming it is in the same subscription and resource group as the App Configuration. Required for AppService arguments')
Expand All @@ -117,8 +117,8 @@ def load_arguments(self, _):
with self.argument_context('appconfig kv export', arg_group='AppConfig') as c:
c.argument('dest_name', help='The name of the destination App Configuration.')
c.argument('dest_connection_string', validator=validate_connection_string, help="Combination of access key and endpoint of the destination store.")
c.argument('dest_label', help="Exported KVs will be labeled with this destination label. If neither --dest-label nor --preserve-labels is specified, will assign null label. If there are duplicate keys in source AppConfig, only the last key will be exported with dest-label.")
c.argument('preserve_labels', arg_type=get_three_state_flag(), help="Original labels from source AppConfig will be preserved for all KVs. This argument should only be specified when --dest-label is NOT provided.")
c.argument('dest_label', help="Exported KVs will be labeled with this destination label. If neither --dest-label nor --preserve-labels is specified, will assign null label.")
c.argument('preserve_labels', arg_type=get_three_state_flag(), help="Flag to preserve labels from source AppConfig. This argument should NOT be specified along with --dest-label.")

with self.argument_context('appconfig kv export', arg_group='AppService') as c:
c.argument('appservice_account', validator=validate_appservice_name_or_id, help='ARM ID for AppService OR the name of the AppService, assuming it is in the same subscription and resource group as the App Configuration. Required for AppService arguments')
Expand Down
15 changes: 8 additions & 7 deletions src/azure-cli/azure/cli/command_modules/appconfig/keyvalue.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,14 @@ def export_config(cmd,
format_ = format_.lower() if format_ else None
naming_convention = naming_convention.lower()

if destination == 'appconfig' and dest_label is not None and preserve_labels:
raise CLIError("Export failed! Please provide only one of these arguments: 'dest-label' or 'preserve-labels'. See 'az appconfig kv export -h' for examples.")
if destination == 'appconfig' and preserve_labels:
# We need dest_label to be the same as label for preview later.
# This will have no effect on label while writing to config store
# as we check preserve_labels again before labelling KVs.
dest_label = label
if destination == 'appconfig':
if dest_label is not None and preserve_labels:
raise CLIError("Export failed! Please provide only one of these arguments: 'dest-label' or 'preserve-labels'. See 'az appconfig kv export -h' for examples.")
if preserve_labels:
# We need dest_label to be the same as label for preview later.
# This will have no effect on label while writing to config store
# as we check preserve_labels again before labelling KVs.
dest_label = label

# fetch key values from user's configstore
src_kvs = __read_kv_from_config_store(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Mon Dec 30 11:27:28 Pacific Standard Time 2019
#Tue Jan 07 13:12:22 Pacific Standard Time 2020
Color=Red
Region=West US
feature-management.FalseFeature=false
Expand Down

0 comments on commit ae369fe

Please sign in to comment.