From c5227c81f1656b6e1024516cddda057d659eb3d6 Mon Sep 17 00:00:00 2001 From: Shoumik Chakravarty Date: Wed, 8 Jul 2026 22:11:47 -0500 Subject: [PATCH] DOC: add Example sections to snapshot and list_labels methods in AzureAppConfigurationClient --- .../_azure_appconfiguration_client.py | 46 +++++++++++++++++++ .../_azure_appconfiguration_client_async.py | 46 +++++++++++++++++++ 2 files changed, 92 insertions(+) diff --git a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_azure_appconfiguration_client.py b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_azure_appconfiguration_client.py index 89d0ebcf9151..edbfd61fafcf 100644 --- a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_azure_appconfiguration_client.py +++ b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_azure_appconfiguration_client.py @@ -656,6 +656,13 @@ def list_labels( :return: An iterator of labels. :rtype: ~azure.core.paging.ItemPaged[~azure.appconfiguration.ConfigurationSettingLabel] :raises: :class:`~azure.core.exceptions.HttpResponseError` + + Example + + .. code-block:: python + + for label in client.list_labels(): + print(label) """ if isinstance(accept_datetime, datetime): accept_datetime = str(accept_datetime) @@ -705,6 +712,17 @@ def begin_create_snapshot( operation to complete and get the created snapshot. :rtype: ~azure.core.polling.LROPoller[~azure.appconfiguration.ConfigurationSnapshot] :raises: :class:`~azure.core.exceptions.HttpResponseError` + + Example + + .. code-block:: python + + from azure.appconfiguration import ConfigurationSettingsFilter + + filters = [ConfigurationSettingsFilter(key="my_key", label="my_label")] + response = client.begin_create_snapshot(name="my_snapshot", filters=filters) + created_snapshot = response.result() + print(created_snapshot) """ snapshot = ConfigurationSnapshot( filters=filters, @@ -741,6 +759,13 @@ def archive_snapshot( :return: The ConfigurationSnapshot returned from the service. :rtype: ~azure.appconfiguration.ConfigurationSnapshot :raises: :class:`~azure.core.exceptions.HttpResponseError` + + Example + + .. code-block:: python + + archived_snapshot = client.archive_snapshot(name="my_snapshot") + print(archived_snapshot.status) """ generated_snapshot = self._impl._update_snapshot( name=name, @@ -771,6 +796,13 @@ def recover_snapshot( :return: The ConfigurationSnapshot returned from the service. :rtype: ~azure.appconfiguration.ConfigurationSnapshot :raises: :class:`~azure.core.exceptions.HttpResponseError` + + Example + + .. code-block:: python + + recovered_snapshot = client.recover_snapshot(name="my_snapshot") + print(recovered_snapshot.status) """ generated_snapshot = self._impl._update_snapshot( name=name, @@ -795,6 +827,13 @@ def get_snapshot( :return: The ConfigurationSnapshot returned from the service. :rtype: ~azure.appconfiguration.ConfigurationSnapshot :raises: :class:`~azure.core.exceptions.HttpResponseError` + + Example + + .. code-block:: python + + received_snapshot = client.get_snapshot(name="my_snapshot") + print(received_snapshot) """ generated_snapshot = self._impl.get_snapshot(name=name, select=fields, **kwargs) return ConfigurationSnapshot._from_generated(generated_snapshot) @@ -822,6 +861,13 @@ def list_snapshots( :return: An iterator of :class:`~azure.appconfiguration.ConfigurationSnapshot` :rtype: ~azure.core.paging.ItemPaged[~azure.appconfiguration.ConfigurationSnapshot] :raises: :class:`~azure.core.exceptions.HttpResponseError` + + Example + + .. code-block:: python + + for snapshot in client.list_snapshots(): + print(snapshot) """ return self._impl.get_snapshots( # type: ignore[return-value] name=name, diff --git a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/aio/_azure_appconfiguration_client_async.py b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/aio/_azure_appconfiguration_client_async.py index 66040aa9f80a..0f100064396e 100644 --- a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/aio/_azure_appconfiguration_client_async.py +++ b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/aio/_azure_appconfiguration_client_async.py @@ -669,6 +669,13 @@ def list_labels( :return: An async iterator of labels. :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.appconfiguration.ConfigurationSettingLabel] :raises: :class:`~azure.core.exceptions.HttpResponseError` + + Example + + .. code-block:: python + + async for label in client.list_labels(): + print(label) """ if isinstance(accept_datetime, datetime): accept_datetime = str(accept_datetime) @@ -718,6 +725,17 @@ async def begin_create_snapshot( operation to complete and get the created snapshot. :rtype: ~azure.core.polling.LROPoller[~azure.appconfiguration.ConfigurationSnapshot] :raises: :class:`~azure.core.exceptions.HttpResponseError` + + Example + + .. code-block:: python + + from azure.appconfiguration import ConfigurationSettingsFilter + + filters = [ConfigurationSettingsFilter(key="my_key", label="my_label")] + response = await client.begin_create_snapshot(name="my_snapshot", filters=filters) + created_snapshot = await response.result() + print(created_snapshot) """ snapshot = ConfigurationSnapshot( filters=filters, @@ -754,6 +772,13 @@ async def archive_snapshot( :return: The ConfigurationSnapshot returned from the service. :rtype: ~azure.appconfiguration.ConfigurationSnapshot :raises: :class:`~azure.core.exceptions.HttpResponseError` + + Example + + .. code-block:: python + + archived_snapshot = await client.archive_snapshot(name="my_snapshot") + print(archived_snapshot.status) """ generated_snapshot = await self._impl._update_snapshot( name=name, @@ -784,6 +809,13 @@ async def recover_snapshot( :return: The ConfigurationSnapshot returned from the service. :rtype: ~azure.appconfiguration.ConfigurationSnapshot :raises: :class:`~azure.core.exceptions.HttpResponseError` + + Example + + .. code-block:: python + + recovered_snapshot = await client.recover_snapshot(name="my_snapshot") + print(recovered_snapshot.status) """ generated_snapshot = await self._impl._update_snapshot( name=name, @@ -808,6 +840,13 @@ async def get_snapshot( :return: The ConfigurationSnapshot returned from the service. :rtype: ~azure.appconfiguration.ConfigurationSnapshot :raises: :class:`~azure.core.exceptions.HttpResponseError` + + Example + + .. code-block:: python + + received_snapshot = await client.get_snapshot(name="my_snapshot") + print(received_snapshot) """ generated_snapshot = await self._impl.get_snapshot(name=name, select=fields, **kwargs) return ConfigurationSnapshot._from_generated(generated_snapshot) @@ -835,6 +874,13 @@ def list_snapshots( :return: An iterator of :class:`~azure.appconfiguration.ConfigurationSnapshot` :rtype: ~azure.core.paging.ItemPaged[~azure.appconfiguration.ConfigurationSnapshot] :raises: :class:`~azure.core.exceptions.HttpResponseError` + + Example + + .. code-block:: python + + async for snapshot in client.list_snapshots(): + print(snapshot) """ return self._impl.get_snapshots( # type: ignore[return-value] name=name,