AppConfigurationClient class
Client for the Azure App Configuration service.
Constructors
App |
Initializes a new instance of the AppConfigurationClient class. |
App |
Initializes a new instance of the AppConfigurationClient class using a TokenCredential. |
Methods
add |
Add a setting into the Azure App Configuration service, failing if it already exists. Example usage:
|
archive |
Archive a ready snapshot Example usage:
|
begin |
Begins creating a snapshot for Azure App Configuration service, fails if it already exists. |
begin |
Begins creating a snapshot for Azure App Configuration service, waits until it is done, fails if it already exists. |
delete |
Delete a setting from the Azure App Configuration service Example usage:
|
get |
Gets a setting from the Azure App Configuration service. Example code:
|
get |
Get a snapshot from Azure App Configuration service Example usage:
|
list |
Lists settings from the Azure App Configuration service, optionally filtered by key names, labels and accept datetime. Example code:
|
list |
Lists settings from the Azure App Configuration service for snapshots based on name, optionally filtered by key names, labels and accept datetime. Example code:
|
list |
Get a list of labels from the Azure App Configuration service Example code:
|
list |
Lists revisions of a set of keys, optionally filtered by key names, labels and accept datetime. Example code:
|
list |
List all snapshots from Azure App Configuration service Example usage:
|
recover |
Recover an archived snapshot back to ready status Example usage:
|
set |
Sets the value of a key in the Azure App Configuration service, allowing for an optional etag. |
set |
Sets or clears a key's read-only status. |
update |
Adds an external synchronization token to ensure service requests receive up-to-date values. |
Constructor Details
AppConfigurationClient(string, AppConfigurationClientOptions)
Initializes a new instance of the AppConfigurationClient class.
new AppConfigurationClient(connectionString: string, options?: AppConfigurationClientOptions)
Parameters
- connectionString
-
string
Connection string needed for a client to connect to Azure.
- options
- AppConfigurationClientOptions
Options for the AppConfigurationClient.
AppConfigurationClient(string, TokenCredential, AppConfigurationClientOptions)
Initializes a new instance of the AppConfigurationClient class using a TokenCredential.
new AppConfigurationClient(endpoint: string, tokenCredential: TokenCredential, options?: AppConfigurationClientOptions)
Parameters
- endpoint
-
string
The endpoint of the App Configuration service (ex: https://sample.azconfig.io).
- tokenCredential
- TokenCredential
An object that implements the TokenCredential
interface used to authenticate requests to the service. Use the @azure/identity package to create a credential that suits your needs.
- options
- AppConfigurationClientOptions
Options for the AppConfigurationClient.
Method Details
addConfigurationSetting(AddConfigurationSettingParam<string> | AddConfigurationSettingParam<FeatureFlagValue> | AddConfigurationSettingParam<SecretReferenceValue>, AddConfigurationSettingOptions)
Add a setting into the Azure App Configuration service, failing if it already exists.
Example usage:
const result = await client.addConfigurationSetting({ key: "MyKey", label: "MyLabel", value: "MyValue" });
function addConfigurationSetting(configurationSetting: AddConfigurationSettingParam<string> | AddConfigurationSettingParam<FeatureFlagValue> | AddConfigurationSettingParam<SecretReferenceValue>, options?: AddConfigurationSettingOptions): Promise<AddConfigurationSettingResponse>
Parameters
- configurationSetting
-
AddConfigurationSettingParam<string> | AddConfigurationSettingParam<FeatureFlagValue> | AddConfigurationSettingParam<SecretReferenceValue>
A configuration setting.
- options
- AddConfigurationSettingOptions
Optional parameters for the request.
Returns
Promise<AddConfigurationSettingResponse>
archiveSnapshot(string, UpdateSnapshotOptions)
Archive a ready snapshot
Example usage:
const result = await client.archiveSnapshot({name: "MySnapshot"});
function archiveSnapshot(name: string, options?: UpdateSnapshotOptions): Promise<UpdateSnapshotResponse>
Parameters
- name
-
string
The name of the snapshot.
- options
- UpdateSnapshotOptions
Optional parameters for the request.
Returns
Promise<UpdateSnapshotResponse>
beginCreateSnapshot(SnapshotInfo, CreateSnapshotOptions)
Begins creating a snapshot for Azure App Configuration service, fails if it already exists.
function beginCreateSnapshot(snapshot: SnapshotInfo, options?: CreateSnapshotOptions): Promise<SimplePollerLike<OperationState<CreateSnapshotResponse>, CreateSnapshotResponse>>
Parameters
- snapshot
- SnapshotInfo
- options
- CreateSnapshotOptions
Returns
Promise<@azure/core-lro.SimplePollerLike<OperationState<CreateSnapshotResponse>, CreateSnapshotResponse>>
beginCreateSnapshotAndWait(SnapshotInfo, CreateSnapshotOptions)
Begins creating a snapshot for Azure App Configuration service, waits until it is done, fails if it already exists.
function beginCreateSnapshotAndWait(snapshot: SnapshotInfo, options?: CreateSnapshotOptions): Promise<CreateSnapshotResponse>
Parameters
- snapshot
- SnapshotInfo
- options
- CreateSnapshotOptions
Returns
Promise<CreateSnapshotResponse>
deleteConfigurationSetting(ConfigurationSettingId, DeleteConfigurationSettingOptions)
Delete a setting from the Azure App Configuration service
Example usage:
const deletedSetting = await client.deleteConfigurationSetting({ key: "MyKey", label: "MyLabel" });
function deleteConfigurationSetting(id: ConfigurationSettingId, options?: DeleteConfigurationSettingOptions): Promise<DeleteConfigurationSettingResponse>
Parameters
The id of the configuration setting to delete.
Optional parameters for the request (ex: etag, label)
Returns
Promise<DeleteConfigurationSettingResponse>
getConfigurationSetting(ConfigurationSettingId, GetConfigurationSettingOptions)
Gets a setting from the Azure App Configuration service.
Example code:
const setting = await client.getConfigurationSetting({ key: "MyKey", label: "MyLabel" });
function getConfigurationSetting(id: ConfigurationSettingId, options?: GetConfigurationSettingOptions): Promise<GetConfigurationSettingResponse>
Parameters
The id of the configuration setting to get.
- options
- GetConfigurationSettingOptions
Optional parameters for the request.
Returns
Promise<GetConfigurationSettingResponse>
getSnapshot(string, GetSnapshotOptions)
Get a snapshot from Azure App Configuration service
Example usage:
const result = await client.getSnapshot("MySnapshot");
function getSnapshot(name: string, options?: GetSnapshotOptions): Promise<GetSnapshotResponse>
Parameters
- name
-
string
The name of the snapshot.
- options
- GetSnapshotOptions
Optional parameters for the request.
Returns
Promise<GetSnapshotResponse>
listConfigurationSettings(ListConfigurationSettingsOptions)
Lists settings from the Azure App Configuration service, optionally filtered by key names, labels and accept datetime.
Example code:
const allSettingsWithLabel = client.listConfigurationSettings({ labelFilter: "MyLabel" });
function listConfigurationSettings(options?: ListConfigurationSettingsOptions): PagedAsyncIterableIterator<ConfigurationSetting<string>, ListConfigurationSettingPage, PageSettings>
Parameters
- options
- ListConfigurationSettingsOptions
Optional parameters for the request.
Returns
listConfigurationSettingsForSnapshot(string, ListConfigurationSettingsForSnapshotOptions)
Lists settings from the Azure App Configuration service for snapshots based on name, optionally filtered by key names, labels and accept datetime.
Example code:
const allSettingsWithLabel = client.listConfigurationSettingsForSnashots({ snapshotName: "MySnapshot" });
function listConfigurationSettingsForSnapshot(snapshotName: string, options?: ListConfigurationSettingsForSnapshotOptions): PagedAsyncIterableIterator<ConfigurationSetting<string>, ListConfigurationSettingPage, PageSettings>
Parameters
- snapshotName
-
string
Optional parameters for the request.
Returns
listLabels(ListLabelsOptions)
Get a list of labels from the Azure App Configuration service
Example code:
const allSettingsWithLabel = client.listLabels({ nameFilter: "prod*" });
function listLabels(options?: ListLabelsOptions): PagedAsyncIterableIterator<SettingLabel, ListLabelsPage, PageSettings>
Parameters
- options
- ListLabelsOptions
Optional parameters for the request.
Returns
listRevisions(ListRevisionsOptions)
Lists revisions of a set of keys, optionally filtered by key names, labels and accept datetime.
Example code:
const revisionsIterator = client.listRevisions({ keys: ["MyKey"] });
function listRevisions(options?: ListRevisionsOptions): PagedAsyncIterableIterator<ConfigurationSetting<string>, ListRevisionsPage, PageSettings>
Parameters
- options
- ListRevisionsOptions
Optional parameters for the request.
Returns
listSnapshots(ListSnapshotsOptions)
List all snapshots from Azure App Configuration service
Example usage:
const result = await client.listSnapshots();
function listSnapshots(options?: ListSnapshotsOptions): PagedAsyncIterableIterator<ConfigurationSnapshot, ListSnapshotsPage, PageSettings>
Parameters
- options
- ListSnapshotsOptions
Optional parameters for the request.
Returns
recoverSnapshot(string, UpdateSnapshotOptions)
Recover an archived snapshot back to ready status
Example usage:
const result = await client.recoverSnapshot("MySnapshot");
function recoverSnapshot(name: string, options?: UpdateSnapshotOptions): Promise<UpdateSnapshotResponse>
Parameters
- name
-
string
The name of the snapshot.
- options
- UpdateSnapshotOptions
Optional parameters for the request.
Returns
Promise<UpdateSnapshotResponse>
setConfigurationSetting(SetConfigurationSettingParam<string> | SetConfigurationSettingParam<FeatureFlagValue> | SetConfigurationSettingParam<SecretReferenceValue>, SetConfigurationSettingOptions)
Sets the value of a key in the Azure App Configuration service, allowing for an optional etag.
function setConfigurationSetting(configurationSetting: SetConfigurationSettingParam<string> | SetConfigurationSettingParam<FeatureFlagValue> | SetConfigurationSettingParam<SecretReferenceValue>, options?: SetConfigurationSettingOptions): Promise<SetConfigurationSettingResponse>
Parameters
- configurationSetting
-
SetConfigurationSettingParam<string> | SetConfigurationSettingParam<FeatureFlagValue> | SetConfigurationSettingParam<SecretReferenceValue>
A configuration value.
- options
- SetConfigurationSettingOptions
Optional parameters for the request.
Example code:
await client.setConfigurationSetting({ key: "MyKey", value: "MyValue" });
Returns
Promise<SetConfigurationSettingResponse>
setReadOnly(ConfigurationSettingId, boolean, SetReadOnlyOptions)
Sets or clears a key's read-only status.
function setReadOnly(id: ConfigurationSettingId, readOnly: boolean, options?: SetReadOnlyOptions): Promise<SetReadOnlyResponse>
Parameters
The id of the configuration setting to modify.
- readOnly
-
boolean
- options
- SetReadOnlyOptions
Returns
Promise<SetReadOnlyResponse>
updateSyncToken(string)
Adds an external synchronization token to ensure service requests receive up-to-date values.
function updateSyncToken(syncToken: string)
Parameters
- syncToken
-
string
The synchronization token value.