Skip to content

Commit 570a354

Browse files
authored
{AppConfig} az appconfig: Update azure appconfiguration sdk to version 1.7.0 (#29749)
1 parent a6e5075 commit 570a354

34 files changed

+29576
-28588
lines changed

src/azure-cli/azure/cli/command_modules/appconfig/_constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class FeatureFlagConstants:
2020
CONDITIONS = "conditions"
2121
CLIENT_FILTERS = "client_filters"
2222
REQUIREMENT_TYPE = "requirement_type"
23+
DISPLAY_NAME = "display_name"
2324
FILTER_NAME = "name"
2425
FILTER_PARAMETERS = "parameters"
2526

src/azure-cli/azure/cli/command_modules/appconfig/_featuremodels.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,20 +56,23 @@ def __init__(self,
5656
id_,
5757
description=None,
5858
enabled=None,
59-
conditions=None):
59+
conditions=None,
60+
display_name=None):
6061
default_conditions = {FeatureFlagConstants.CLIENT_FILTERS: []}
6162

6263
self.id = id_
6364
self.description = "" if description is None else description
6465
self.enabled = enabled if enabled else False
6566
self.conditions = conditions if conditions else default_conditions
67+
self.display_name = display_name
6668

6769
def __repr__(self):
6870
featureflagvalue = {
6971
FeatureFlagConstants.ID: self.id,
7072
FeatureFlagConstants.DESCRIPTION: self.description,
7173
FeatureFlagConstants.ENABLED: self.enabled,
72-
FeatureFlagConstants.CONDITIONS: custom_serialize_conditions(self.conditions)
74+
FeatureFlagConstants.CONDITIONS: custom_serialize_conditions(self.conditions),
75+
FeatureFlagConstants.DISPLAY_NAME: self.display_name
7376
}
7477

7578
return json.dumps(featureflagvalue, indent=2, ensure_ascii=False)

src/azure-cli/azure/cli/command_modules/appconfig/_kv_helpers.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ def __read_kv_from_app_service(cmd, appservice_account, prefix_to_add="", conten
444444
# this throws an exception for invalid format of secret identifier
445445
parse_key_vault_id(source_id=secret_identifier)
446446
kv = KeyValue(key=key,
447-
value=json.dumps({"uri": secret_identifier}, ensure_ascii=False, separators=(',', ':')),
447+
value=json.dumps({"uri": secret_identifier}, ensure_ascii=False),
448448
tags=tags,
449449
content_type=KeyVaultConstants.KEYVAULT_CONTENT_TYPE)
450450
key_values.append(kv)
@@ -909,12 +909,12 @@ def __validate_import_feature_flag(kv):
909909
if kv and validate_import_feature_key(kv.key):
910910
try:
911911
ff = json.loads(kv.value)
912-
if FEATURE_FLAG_PROPERTIES == ff.keys():
912+
if FEATURE_FLAG_PROPERTIES.intersection(ff.keys()) == FEATURE_FLAG_PROPERTIES:
913913
return validate_import_feature(ff[FeatureFlagConstants.ID])
914914

915-
logger.warning("The feature flag with key '{%s}' is not a valid feature flag. It will not be imported.", kv.key)
915+
logger.warning("The feature flag with key '%s' is not a valid feature flag. It will not be imported.", kv.key)
916916
except JSONDecodeError as exception:
917-
logger.warning("The feature flag with key '{%s}' is not in a valid JSON format. It will not be imported.\n{%s}", kv.id, str(exception))
917+
logger.warning("The feature flag with key '%s' is not in a valid JSON format. It will not be imported.\n%s", kv.key, str(exception))
918918
return False
919919

920920

src/azure-cli/azure/cli/command_modules/appconfig/_models.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ def convert_keyvalue_to_configurationsetting(keyvalue=None):
9797
label=keyvalue.label,
9898
content_type=keyvalue.content_type,
9999
value=keyvalue.value,
100-
last_modified=keyvalue.last_modified,
101100
tags=keyvalue.tags,
102101
read_only=keyvalue.locked,
103102
etag=keyvalue.etag)

src/azure-cli/azure/cli/command_modules/appconfig/keyvalue.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ def set_keyvault(cmd,
529529
endpoint=None):
530530
azconfig_client = get_appconfig_data_client(cmd, name, connection_string, auth_mode, endpoint)
531531

532-
keyvault_ref_value = json.dumps({"uri": secret_identifier}, ensure_ascii=False, separators=(',', ':'))
532+
keyvault_ref_value = json.dumps({"uri": secret_identifier}, ensure_ascii=False)
533533
retry_times = 3
534534
retry_interval = 1
535535

src/azure-cli/azure/cli/command_modules/appconfig/tests/latest/kvset_import.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22
"items": [
33
{
44
"key": ".appconfig.featureflag/beta-enabled",
5-
"value": "{\"id\":\"custom-feature-beta-enabled\",\"description\":\"The flag indicates whether the beta feature is enabled for the user.\",\"enabled\":true,\"conditions\":{\"client_filters\":[]}}",
5+
"value": "{\"id\": \"custom-feature-beta-enabled\", \"description\": \"The flag indicates whether the beta feature is enabled for the user.\", \"enabled\": true, \"conditions\": {\"client_filters\": []}, \"display_name\": null}",
66
"label": "beta-feature",
77
"content_type": "application/vnd.microsoft.appconfig.ff+json;charset=utf-8",
88
"tags": {}
99
},
1010
{
1111
"key": ".appconfig.featureflag/bool-feature",
12-
"value": "{\"id\":\"bool-feature\",\"description\":\"It is a boolean feature\",\"enabled\":true,\"conditions\":{\"client_filters\":[]}}",
12+
"value": "{\"id\": \"bool-feature\", \"description\": \"It is a boolean feature\", \"enabled\": true, \"conditions\": {\"client_filters\": []}, \"display_name\": null}",
1313
"label": null,
1414
"content_type": "application/vnd.microsoft.appconfig.ff+json;charset=utf-8",
1515
"tags": {}
1616
},
1717
{
1818
"key": ".appconfig.featureflag/theta-enabled",
19-
"value": "{\"id\":\"customer-theta-enabled\",\"description\":\"This feature describes whether a theta feature is enabled for the customers.\",\"enabled\":true,\"conditions\":{\"client_filters\":[{\"name\":\"Microsoft.Targeting\",\"parameters\":{\"Audience\":{\"Users\":[],\"Groups\":[],\"DefaultRolloutPercentage\":90}}}]}}",
19+
"value": "{\"id\": \"customer-theta-enabled\", \"description\": \"This feature describes whether a theta feature is enabled for the customers.\", \"enabled\": true, \"conditions\": {\"client_filters\": [{\"name\": \"Microsoft.Targeting\", \"parameters\": {\"Audience\": {\"Users\": [], \"Groups\": [], \"DefaultRolloutPercentage\": 90}}}]}, \"display_name\": null}",
2020
"label": "theta-enabled-label",
2121
"content_type": "application/vnd.microsoft.appconfig.ff+json;charset=utf-8",
2222
"tags": {}
@@ -59,7 +59,7 @@
5959
},
6060
{
6161
"key": "pratik-top-secret",
62-
"value": "{\"uri\":\"https://prsangli-appc-keyvault.vault.azure.net/secrets/appc-keyvault-secret/977e940850eb42628b7719a7431f6c27\"}",
62+
"value": "{\"uri\": \"https://prsangli-appc-keyvault.vault.azure.net/secrets/appc-keyvault-secret/977e940850eb42628b7719a7431f6c27\"}",
6363
"label": null,
6464
"content_type": "application/vnd.microsoft.appconfig.keyvaultref+json;charset=utf-8",
6565
"tags": {}

src/azure-cli/azure/cli/command_modules/appconfig/tests/latest/kvset_no_features.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
},
3939
{
4040
"key": "pratik-top-secret",
41-
"value": "{\"uri\":\"https://prsangli-appc-keyvault.vault.azure.net/secrets/appc-keyvault-secret/977e940850eb42628b7719a7431f6c27\"}",
41+
"value": "{\"uri\": \"https://prsangli-appc-keyvault.vault.azure.net/secrets/appc-keyvault-secret/977e940850eb42628b7719a7431f6c27\"}",
4242
"label": null,
4343
"content_type": "application/vnd.microsoft.appconfig.keyvaultref+json;charset=utf-8",
4444
"tags": {}

0 commit comments

Comments
 (0)