AzureAppConfigurationClient Class
Represents a client that calls restful API of Azure App Configuration service.
param str base_url: base url of the service
param credential: An object which can provide secrets for the app configuration service
type credential: <xref:azure.appconfiguration.AppConfigConnectionStringCredential> or AsyncTokenCredential
This is the async version of AzureAppConfigurationClient
- Inheritance
-
builtins.objectAzureAppConfigurationClient
Constructor
AzureAppConfigurationClient(base_url: str, credential: Union[azure.appconfiguration._azure_appconfiguration_credential.AppConfigConnectionStringCredential, AsyncTokenCredential], **kwargs: Any)
Parameters
- base_url
- credential
Methods
| add_configuration_setting |
Add a ConfigurationSetting instance into the Azure App Configuration service. Example
|
| close |
Close all connections made by the client |
| delete_configuration_setting |
Delete a ConfigurationSetting if it exists Example
|
| from_connection_string |
Create AzureAppConfigurationClient from a Connection String. This is the async version of AzureAppConfigurationClient Example
|
| get_configuration_setting |
Get the matched ConfigurationSetting from Azure App Configuration service Example
|
| list_configuration_settings |
List the configuration settings stored in the configuration service, optionally filtered by label and accept_datetime Example
|
| list_revisions |
Find the ConfigurationSetting revision history. Example
|
| set_configuration_setting |
Add or update a ConfigurationSetting. If the configuration setting identified by key and label does not exist, this is a create. Otherwise this is an update. Example
|
| set_read_only |
Set a configuration setting read only Example
|
| update_sync_token |
Add a sync token to the internal list of tokens. |
add_configuration_setting
Add a ConfigurationSetting instance into the Azure App Configuration service.
Example
# in async fuction
config_setting = ConfigurationSetting(
key="MyKey",
label="MyLabel",
value="my value",
content_type="my content type",
tags={"my tag": "my tag value"}
)
added_config_setting = await async_client.add_configuration_setting(config_setting)
async add_configuration_setting(configuration_setting: azure.appconfiguration._models.ConfigurationSetting, **kwargs: Any) -> azure.appconfiguration._models.ConfigurationSetting
Parameters
Returns
The ConfigurationSetting object returned from the App Configuration service
Return type
Exceptions
close
Close all connections made by the client
async close() -> None
Exceptions
delete_configuration_setting
Delete a ConfigurationSetting if it exists
Example
# in async function
deleted_config_setting = await async_client.delete_configuration_setting(
key="MyKey", label="MyLabel"
)
async delete_configuration_setting(key: str, label: Optional[str] = None, **kwargs: Any) -> azure.appconfiguration._models.ConfigurationSetting
Parameters
- etag
- str
check if the ConfigurationSetting is changed. Set None to skip checking etag
- match_condition
- MatchConditions
The match condition to use upon the etag
Returns
The deleted ConfigurationSetting returned from the service, or None if it doesn't exist.
Return type
Exceptions
from_connection_string
Create AzureAppConfigurationClient from a Connection String. This is the async version of AzureAppConfigurationClient
Example
from azure.appconfiguration.aio import AzureAppConfigurationClient
connection_str = "<my connection string>"
async_client = AzureAppConfigurationClient.from_connection_string(connection_str)
from_connection_string(connection_string: str, **kwargs: Any) -> azure.appconfiguration.aio._azure_configuration_client_async.AzureAppConfigurationClient
Parameters
- connection_string
- str
Connection String (one of the access keys of the Azure App Configuration resource) used to access the Azure App Configuration.
- connection_string
Returns
An AzureAppConfigurationClient authenticated with the connection string
Return type
Exceptions
get_configuration_setting
Get the matched ConfigurationSetting from Azure App Configuration service
Example
# in async function
fetched_config_setting = await async_client.get_configuration_setting(
key="MyKey", label="MyLabel"
)
async get_configuration_setting(key: str, label: Optional[str] = None, etag: Optional[str] = '*', match_condition: Optional[azure.core._match_conditions.MatchConditions] = <MatchConditions.Unconditionally: 1>, **kwargs: Any) -> Union[None, azure.appconfiguration._models.ConfigurationSetting]
Parameters
check if the ConfigurationSetting is changed. Set None to skip checking etag
- accept_datetime
- datetime
the retrieved ConfigurationSetting that created no later than this datetime
Returns
The matched ConfigurationSetting object
Return type
Exceptions
list_configuration_settings
List the configuration settings stored in the configuration service, optionally filtered by label and accept_datetime
Example
from datetime import datetime, timedelta
accept_datetime = datetime.today() + timedelta(days=-1)
all_listed = async_client.list_configuration_settings()
async for item in all_listed:
pass # do something
filtered_listed = async_client.list_configuration_settings(
label_filter="Labe*", key_filter="Ke*", accept_datetime=accept_datetime
)
async for item in filtered_listed:
pass # do something
list_configuration_settings(key_filter: Optional[str] = None, label_filter: Optional[str] = None, **kwargs: Any) -> azure.core.async_paging.AsyncItemPaged[azure.appconfiguration._models.ConfigurationSetting]
Parameters
- key_filter
- str
filter results based on their keys. '*' can be used as wildcard in the beginning or end of the filter
- label_filter
- str
filter results based on their label. '*' can be used as wildcard in the beginning or end of the filter
- accept_datetime
- datetime
filter out ConfigurationSetting created after this datetime
Returns
An iterator of <xref:azure.appconfiguration.aio.ConfigurationSetting>
Return type
Exceptions
list_revisions
Find the ConfigurationSetting revision history.
Example
# in async function
from datetime import datetime, timedelta
accept_datetime = datetime.today() + timedelta(days=-1)
all_revisions = async_client.list_revisions()
async for item in all_revisions:
pass # do something
filtered_revisions = async_client.list_revisions(
label_filter="Labe*", key_filter="Ke*", accept_datetime=accept_datetime
)
async for item in filtered_revisions:
pass # do something
list_revisions(key_filter: Optional[str] = None, label_filter: Optional[str] = None, **kwargs: Any) -> azure.core.async_paging.AsyncItemPaged[azure.appconfiguration._models.ConfigurationSetting]
Parameters
- key_filter
- str
filter results based on their keys. '*' can be used as wildcard in the beginning or end of the filter
- label_filter
- str
filter results based on their label. '*' can be used as wildcard in the beginning or end of the filter
- accept_datetime
- datetime
filter out ConfigurationSetting created after this datetime
Returns
An iterator of <xref:azure.appconfiguration.aio.ConfigurationSetting>
Return type
Exceptions
set_configuration_setting
Add or update a ConfigurationSetting. If the configuration setting identified by key and label does not exist, this is a create. Otherwise this is an update.
Example
# in async function
config_setting = ConfigurationSetting(
key="MyKey",
label="MyLabel",
value="my set value",
content_type="my set content type",
tags={"my set tag": "my set tag value"}
)
returned_config_setting = await async_client.set_configuration_setting(config_setting)
async set_configuration_setting(configuration_setting: azure.appconfiguration._models.ConfigurationSetting, match_condition: azure.core._match_conditions.MatchConditions = <MatchConditions.Unconditionally: 1>, **kwargs: Any) -> azure.appconfiguration._models.ConfigurationSetting
Parameters
- configuration_setting
- <xref:azure.appconfiguration.aio.ConfigurationSetting>
the ConfigurationSetting to be added (if not exists) or updated (if exists) to the service
- etag
- str
check if the ConfigurationSetting is changed. Set None to skip checking etag
Returns
The ConfigurationSetting returned from the service
Return type
Exceptions
set_read_only
Set a configuration setting read only
Example
config_setting = await async_client.get_configuration_setting(
key="MyKey", label="MyLabel"
)
read_only_config_setting = await async_client.set_read_only(config_setting)
read_only_config_setting = await client.set_read_only(config_setting, read_only=False)
set_read_only(configuration_setting: azure.appconfiguration._models.ConfigurationSetting, read_only: Optional[bool] = True, **kwargs: Any) -> azure.appconfiguration._models.ConfigurationSetting
Parameters
- configuration_setting
- <xref:azure.appconfiguration.aio.ConfigurationSetting>
the ConfigurationSetting to be set read only
- match_condition
- MatchConditions
The match condition to use upon the etag
- etag
- str
check if the ConfigurationSetting is changed. Set None to skip checking etag
Returns
The ConfigurationSetting returned from the service
Return type
Exceptions
update_sync_token
Add a sync token to the internal list of tokens.
update_sync_token(token: str) -> None
Parameters
Exceptions
Feedback
Submit and view feedback for