Skip to content

Commit 14bc999

Browse files
authored
{AppConfig} az appconfig snapshot/kv list: Refactor to remove snapshot custom code (#29993)
1 parent 250d6db commit 14bc999

File tree

7 files changed

+1438
-1910
lines changed

7 files changed

+1438
-1910
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,10 @@ class ImportExportProfiles:
9090
DEFAULT = "appconfig/default"
9191

9292

93-
class SnapshotConstants:
94-
API_VERSION = "2023-10-01"
93+
class SnapshotFilterFields:
94+
KEY = "key"
95+
LABEL = "label"
96+
TAGS = "tags"
9597

9698

9799
class JsonDiff:

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
from itertools import chain
1111
from json import JSONDecodeError
1212
from urllib.parse import urlparse
13-
from ._snapshot_custom_client import AppConfigSnapshotClient
1413
from ._constants import HttpHeaders
1514

1615
import chardet
@@ -293,10 +292,8 @@ def __read_kv_from_config_store(azconfig_client,
293292

294293
if snapshot:
295294
try:
296-
configsetting_iterable = AppConfigSnapshotClient(
297-
azconfig_client
298-
).list_snapshot_kv(
299-
name=snapshot,
295+
configsetting_iterable = azconfig_client.list_configuration_settings(
296+
snapshot_name=snapshot,
300297
fields=query_fields,
301298
headers={HttpHeaders.CORRELATION_REQUEST_ID: correlation_request_id}
302299
)
@@ -356,7 +353,7 @@ def __read_kv_from_config_store(azconfig_client,
356353
# We first check if the snapshot exists before returning an empty result.
357354
if snapshot and len(retrieved_kvs) == 0:
358355
try:
359-
_ = AppConfigSnapshotClient(azconfig_client).get_snapshot(name=snapshot, headers={HttpHeaders.CORRELATION_REQUEST_ID: correlation_request_id})
356+
_ = azconfig_client.get_snapshot(name=snapshot, headers={HttpHeaders.CORRELATION_REQUEST_ID: correlation_request_id})
360357

361358
except HttpResponseError as exception:
362359
if exception.status_code == StatusCodes.NOT_FOUND:

0 commit comments

Comments
 (0)