3131 JsonDiff , ImportMode )
3232from ._featuremodels import map_keyvalue_to_featureflag
3333from ._models import (convert_configurationsetting_to_keyvalue , convert_keyvalue_to_configurationsetting )
34- from ._utils import get_appconfig_data_client , prep_label_filter_for_url_encoding , resolve_store_metadata , get_store_endpoint_from_connection_string , is_json_content_type
34+ from ._utils import format_tags_filter , get_appconfig_data_client , prep_label_filter_for_url_encoding , resolve_store_metadata , get_store_endpoint_from_connection_string , is_json_content_type
3535
3636from ._kv_helpers import (__read_kv_from_file , __read_features_from_file ,
3737 __write_kv_and_features_to_file , __read_kv_from_config_store ,
@@ -51,6 +51,7 @@ def import_config(cmd,
5151 name = None ,
5252 connection_string = None ,
5353 label = None ,
54+ tags = None , # tags to add
5455 prefix = "" , # prefix to add
5556 yes = False ,
5657 skip_features = False ,
@@ -74,6 +75,7 @@ def import_config(cmd,
7475 preserve_labels = False ,
7576 src_auth_mode = "key" ,
7677 src_endpoint = None ,
78+ src_tags = None , # tags to filter
7779 # from-appservice parameters
7880 appservice_account = None ):
7981
@@ -133,6 +135,7 @@ def import_config(cmd,
133135 key = src_key ,
134136 snapshot = src_snapshot ,
135137 label = src_label if src_label else SearchFilterOptions .EMPTY_LABEL ,
138+ tags = src_tags ,
136139 prefix_to_add = prefix ,
137140 correlation_request_id = correlation_request_id )
138141
@@ -144,6 +147,7 @@ def import_config(cmd,
144147 all_features = __read_kv_from_config_store (src_azconfig_client ,
145148 key = FeatureFlagConstants .FEATURE_FLAG_PREFIX + '*' ,
146149 label = src_label if src_label else SearchFilterOptions .EMPTY_LABEL ,
150+ tags = src_tags ,
147151 correlation_request_id = correlation_request_id )
148152
149153 for feature in all_features :
@@ -162,6 +166,7 @@ def import_config(cmd,
162166 dest_kvs = __read_kv_from_config_store (azconfig_client ,
163167 key = prefix + SearchFilterOptions .ANY_KEY if prefix else SearchFilterOptions .ANY_KEY ,
164168 label = label if label else SearchFilterOptions .EMPTY_LABEL ,
169+ tags = src_tags ,
165170 correlation_request_id = correlation_request_id )
166171 __discard_features_from_retrieved_kv (dest_kvs )
167172
@@ -186,6 +191,7 @@ def import_config(cmd,
186191 all_features = __read_kv_from_config_store (azconfig_client ,
187192 key = FeatureFlagConstants .FEATURE_FLAG_PREFIX + SearchFilterOptions .ANY_KEY ,
188193 label = label if label else SearchFilterOptions .EMPTY_LABEL ,
194+ tags = src_tags ,
189195 correlation_request_id = correlation_request_id )
190196
191197 # Append all features to dest_features list
@@ -235,6 +241,7 @@ def import_config(cmd,
235241 __write_kv_and_features_to_config_store (azconfig_client ,
236242 key_values = kvs_to_write ,
237243 label = label ,
244+ tags = tags , # should we have preserve tags? like preserve-labels
238245 preserve_labels = preserve_labels ,
239246 content_type = content_type ,
240247 correlation_request_id = correlation_request_id )
@@ -246,6 +253,7 @@ def export_config(cmd,
246253 connection_string = None ,
247254 label = None ,
248255 key = None ,
256+ tags = None , # tags to filter
249257 prefix = "" , # prefix to remove
250258 yes = False ,
251259 skip_features = False ,
@@ -267,6 +275,7 @@ def export_config(cmd,
267275 preserve_labels = False ,
268276 dest_auth_mode = "key" ,
269277 dest_endpoint = None ,
278+ dest_tags = None , # tags to add
270279 # to-app-service parameters
271280 appservice_account = None ,
272281 export_as_reference = False ):
@@ -279,6 +288,8 @@ def export_config(cmd,
279288 format_ = format_ .lower () if format_ else None
280289 naming_convention = naming_convention .lower ()
281290
291+ logger .warning (tags )
292+ logger .warning (dest_tags )
282293 azconfig_client = get_appconfig_data_client (cmd , name , connection_string , auth_mode , endpoint )
283294
284295 # generate correlation_request_id for bulk operation
@@ -299,6 +310,7 @@ def export_config(cmd,
299310 src_kvs = __read_kv_from_config_store (azconfig_client ,
300311 key = key ,
301312 label = label if label else SearchFilterOptions .EMPTY_LABEL ,
313+ tags = tags ,
302314 prefix_to_remove = prefix if not export_as_reference else "" ,
303315 snapshot = snapshot ,
304316 cli_ctx = cmd .cli_ctx if resolve_keyvault else None ,
@@ -323,6 +335,7 @@ def export_config(cmd,
323335 cmd ,
324336 feature = "*" ,
325337 label = label if label else SearchFilterOptions .EMPTY_LABEL ,
338+ tags = tags ,
326339 name = name ,
327340 connection_string = connection_string ,
328341 all_ = True ,
@@ -352,6 +365,7 @@ def export_config(cmd,
352365 dest_kvs = __read_kv_from_config_store (dest_azconfig_client ,
353366 key = SearchFilterOptions .ANY_KEY ,
354367 label = dest_label if dest_label else SearchFilterOptions .EMPTY_LABEL ,
368+ tags = tags ,
355369 correlation_request_id = correlation_request_id )
356370 __discard_features_from_retrieved_kv (dest_kvs )
357371
@@ -361,6 +375,7 @@ def export_config(cmd,
361375 cmd ,
362376 feature = "*" ,
363377 label = dest_label if dest_label else SearchFilterOptions .EMPTY_LABEL ,
378+ tags = tags ,
364379 name = dest_name ,
365380 connection_string = dest_connection_string ,
366381 all_ = True ,
@@ -409,7 +424,7 @@ def export_config(cmd,
409424 naming_convention = naming_convention )
410425 elif destination == 'appconfig' :
411426 __write_kv_and_features_to_config_store (dest_azconfig_client , key_values = src_kvs , features = src_features ,
412- label = dest_label , preserve_labels = preserve_labels ,
427+ label = dest_label , tags = dest_tags , preserve_labels = preserve_labels ,
413428 correlation_request_id = correlation_request_id )
414429 elif destination == 'appservice' :
415430 __write_kv_to_app_service (cmd , key_values = src_kvs , appservice_account = appservice_account )
@@ -895,6 +910,7 @@ def list_revision(cmd,
895910 key = key if key else SearchFilterOptions .ANY_KEY
896911 label = label if label else SearchFilterOptions .ANY_LABEL
897912 label = prep_label_filter_for_url_encoding (label )
913+ tags = format_tags_filter (tags )
898914
899915 try :
900916 query_fields = None
0 commit comments