Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions sdk/appconfiguration/azure-appconfiguration/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

### Features Added

- Added `check_configuration_settings()` method to efficiently check for configuration changes using HEAD requests, returning only headers (ETags) without response bodies.

### Breaking Changes

### Bugs Fixed
Expand Down
2 changes: 1 addition & 1 deletion sdk/appconfiguration/azure-appconfiguration/assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "python",
"TagPrefix": "python/appconfiguration/azure-appconfiguration",
"Tag": "python/appconfiguration/azure-appconfiguration_64742b5702"
"Tag": "python/appconfiguration/azure-appconfiguration_ea09ae1741"
}
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,65 @@ def list_configuration_settings(self, *args: Optional[str], **kwargs: Any) -> It
page_iterator_class=ConfigurationSettingPropertiesPaged,
)

@distributed_trace
def check_configuration_settings(
self,
*,
key_filter: Optional[str] = None,
label_filter: Optional[str] = None,
tags_filter: Optional[List[str]] = None,
accept_datetime: Optional[Union[datetime, str]] = None,
fields: Optional[List[Union[str, ConfigurationSettingFields]]] = None,
Comment thread
mrm9084 marked this conversation as resolved.
Outdated
**kwargs: Any,
) -> ConfigurationSettingPaged:
Comment thread
mrm9084 marked this conversation as resolved.
"""Check configuration settings using a HEAD request, returning only headers without the
response body. This is useful for efficiently checking if settings have changed by comparing ETags.

:keyword key_filter: Filter results based on their keys. '*' can be used as wildcard in the beginning or end
of the filter.
:paramtype key_filter: str or None
:keyword label_filter: Filter results based on their label. '*' can be used as wildcard in the beginning or end
of the filter.
:paramtype label_filter: str or None
:keyword tags_filter: Filter results based on their tags.
:paramtype tags_filter: list[str] or None
:keyword accept_datetime: Retrieve ConfigurationSetting that existed at this datetime
:paramtype accept_datetime: ~datetime.datetime or str or None
:keyword fields: Specify which fields to include in the results. If not specified, will include all fields.
Available fields see :class:`~azure.appconfiguration.ConfigurationSettingFields`.
:paramtype fields: list[str] or list[~azure.appconfiguration.ConfigurationSettingFields] or None
:return: A pager intended for :meth:`by_page` iteration to inspect page headers (for example, ``etag``)
and detect changed pages. This operation issues HEAD requests and does not return full
:class:`~azure.appconfiguration.ConfigurationSetting` bodies when iterated item by item.
:rtype: ~azure.appconfiguration.ConfigurationSettingPaged
:raises: :class:`~azure.core.exceptions.HttpResponseError`, \
Comment thread
mrm9084 marked this conversation as resolved.
:class:`~azure.core.exceptions.ClientAuthenticationError`

Example

.. code-block:: python

items = client.check_configuration_settings(key_filter="my_key*")
for page in items.by_page():
print(page.etag) # etag for this page
"""
if isinstance(accept_datetime, datetime):
accept_datetime = str(accept_datetime)
select = fields
Comment thread
mrm9084 marked this conversation as resolved.
Outdated
if select:
select = ["locked" if x == "read_only" else x for x in select]
tags = tags_filter
command = functools.partial(self._impl.check_key_values_in_one_page, **kwargs) # type: ignore[attr-defined]
return ConfigurationSettingPaged(
command,
key=key_filter,
label=label_filter,
accept_datetime=accept_datetime,
select=select,
tags=tags,
page_iterator_class=ConfigurationSettingPropertiesPaged,
)

@distributed_trace
def get_configuration_setting(
self,
Expand Down
Loading