Skip to content

Commit

Permalink
{AppConfig} az appconfig snapshot/kv list: Refactor to remove snaps…
Browse files Browse the repository at this point in the history
…hot custom code (#29993)
  • Loading branch information
albertofori authored Oct 29, 2024
1 parent 250d6db commit 14bc999
Show file tree
Hide file tree
Showing 7 changed files with 1,438 additions and 1,910 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,10 @@ class ImportExportProfiles:
DEFAULT = "appconfig/default"


class SnapshotConstants:
API_VERSION = "2023-10-01"
class SnapshotFilterFields:
KEY = "key"
LABEL = "label"
TAGS = "tags"


class JsonDiff:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from itertools import chain
from json import JSONDecodeError
from urllib.parse import urlparse
from ._snapshot_custom_client import AppConfigSnapshotClient
from ._constants import HttpHeaders

import chardet
Expand Down Expand Up @@ -293,10 +292,8 @@ def __read_kv_from_config_store(azconfig_client,

if snapshot:
try:
configsetting_iterable = AppConfigSnapshotClient(
azconfig_client
).list_snapshot_kv(
name=snapshot,
configsetting_iterable = azconfig_client.list_configuration_settings(
snapshot_name=snapshot,
fields=query_fields,
headers={HttpHeaders.CORRELATION_REQUEST_ID: correlation_request_id}
)
Expand Down Expand Up @@ -356,7 +353,7 @@ def __read_kv_from_config_store(azconfig_client,
# We first check if the snapshot exists before returning an empty result.
if snapshot and len(retrieved_kvs) == 0:
try:
_ = AppConfigSnapshotClient(azconfig_client).get_snapshot(name=snapshot, headers={HttpHeaders.CORRELATION_REQUEST_ID: correlation_request_id})
_ = azconfig_client.get_snapshot(name=snapshot, headers={HttpHeaders.CORRELATION_REQUEST_ID: correlation_request_id})

except HttpResponseError as exception:
if exception.status_code == StatusCodes.NOT_FOUND:
Expand Down
Loading

0 comments on commit 14bc999

Please sign in to comment.