public final class ConfigurationAsyncClient
This class provides a client that contains all the operations for ConfigurationSetting, FeatureFlagConfigurationSetting or SecretReferenceConfigurationSetting in Azure App Configuration Store. Operations allowed by the client are adding, retrieving, deleting, set read-only status ConfigurationSettings, and listing settings or revision of a setting based on a SettingSelector.
Additionally, this class allows to add an external synchronization token to ensure service requests receive up-to-date values. Use the updateSyncToken(String token) method.
Getting StartedIn order to interact with the App Configuration service you'll need to create an instance of the ConfigurationAsyncClient class. To make this possible you'll need the connection string of the configuration store. Alternatively, you can use Entra authentication via Azure Identity to connect to the service.
Instantiating an asynchronous Configuration Client
ConfigurationAsyncClient configurationAsyncClient = new ConfigurationClientBuilder()
.connectionString(connectionString)
.buildAsyncClient();
View ConfigurationClientBuilder for additional ways to construct the client.
App Configuration support multiple operations, such as create, update, retrieve, and delete a configuration setting. See methods in client level class below to explore all capabilities that library provides.
For more configuration setting types, see FeatureFlagConfigurationSetting and SecretReferenceConfigurationSetting.
Add Configuration SettingThe addConfigurationSetting(ConfigurationSetting setting) method can be used to add a configuration setting in the Azure App Configuration.
The sample below shows how to add a setting with the key "prodDBConnection", label "westUS" and value "db_connection" using ConfigurationAsyncClient.
client.addConfigurationSetting(new ConfigurationSetting()
.setKey("prodDBConnection")
.setLabel("westUS")
.setValue("db_connection"))
.subscribe(response -> System.out.printf("Key: %s, Label: %s, Value: %s",
response.getKey(), response.getLabel(), response.getValue()));
Note: For synchronous sample, refer to ConfigurationClient.
Update Configuration SettingThe setConfigurationSetting(ConfigurationSetting setting) method can be used to update a configuration setting in the Azure App Configuration.
The sample below shows how to update setting's value "db_connection" to "updated_db_connection"
client.setConfigurationSetting(new ConfigurationSetting()
.setKey("prodDBConnection")
.setLabel("westUS"))
.subscribe(response -> System.out.printf("Key: %s, Label: %s, Value: %s",
response.getKey(), response.getLabel(), response.getValue()));
// Update the value of the setting to "updated_db_connection"
client.setConfigurationSetting(new ConfigurationSetting()
.setKey("prodDBConnection")
.setLabel("westUS")
.setValue("updated_db_connection"))
.subscribe(response -> System.out.printf("Key: %s, Label: %s, Value: %s",
response.getKey(), response.getLabel(), response.getValue()));
Note: For synchronous sample, refer to ConfigurationClient.
Get Configuration SettingThe getConfigurationSetting(ConfigurationSetting setting) method can be used to get a configuration setting in the Azure App Configuration.
The sample below shows how to retrieve the setting with the key "prodDBConnection".
client.getConfigurationSetting(new ConfigurationSetting()
.setKey("prodDBConnection")
.setLabel("westUS"))
.subscribe(response -> System.out.printf("Key: %s, Label: %s, Value: %s",
response.getKey(), response.getLabel(), response.getValue()));
Note: For synchronous sample, refer to ConfigurationClient.
Delete Configuration SettingThe deleteConfigurationSetting(ConfigurationSetting setting) method can be used to delete a configuration setting in the Azure App Configuration.
The sample below shows how to delete the setting with the key "prodDBConnection".
client.deleteConfigurationSetting(new ConfigurationSetting()
.setKey("prodDBConnection")
.setLabel("westUS"))
.subscribe(response -> System.out.printf("Key: %s, Label: %s, Value: %s",
response.getKey(), response.getValue()));
Note: For synchronous sample, refer to ConfigurationClient.
Set the Configuration Setting to read-onlyThe setReadOnly(ConfigurationSetting setting, boolean isReadOnly) method can be used to conditionally set a configuration setting to read-only in the Azure App Configuration.
The sample below shows how to conditionally set the setting to read-only with the key "prodDBConnection".
client.setReadOnly(new ConfigurationSetting()
.setKey("prodDBConnection")
.setLabel("westUS"),
true)
.subscribe(response -> System.out.printf("Key: %s, Label: %s, Value: %s",
response.getKey(), response.getLabel(), response.getValue()));
Note: For synchronous sample, refer to ConfigurationClient.
Clear read-only of the Configuration SettingThe setReadOnly(ConfigurationSetting setting, boolean isReadOnly) method can be used to conditionally clear read-only of the setting in the Azure App Configuration.
The sample below shows how to conditionally clear read-only of the setting with the key "prodDBConnection".
client.setReadOnly(new ConfigurationSetting()
.setKey("prodDBConnection")
.setLabel("westUS"),
false)
.subscribe(response -> System.out.printf("Key: %s, Value: %s", response.getKey(), response.getValue()));
Note: For synchronous sample, refer to ConfigurationClient.
List Configuration SettingsThe listConfigurationSettings(SettingSelector selector) method can be used to list configuration settings in the Azure App Configuration.
The sample below shows how to list all settings that use the key "prodDBConnection".
client.listConfigurationSettings(new SettingSelector().setKeyFilter("prodDBConnection"))
.contextWrite(Context.of(key1, value1, key2, value2))
.subscribe(setting ->
System.out.printf("Key: %s, Value: %s", setting.getKey(), setting.getValue()));
Note: For synchronous sample, refer to ConfigurationClient.
List revisions of a Configuration SettingThe listRevisions(SettingSelector selector) method can be used to list all revisions of a configuration setting in the Azure App Configuration.
The sample below shows how to list all revision of a setting that use the key "prodDBConnection".
client.listRevisions(new SettingSelector().setKeyFilter("prodDBConnection"))
.contextWrite(Context.of(key1, value1, key2, value2))
.subscribe(setting ->
System.out.printf("Key: %s, Value: %s", setting.getKey(), setting.getValue()));
Note: For synchronous sample, refer to ConfigurationClient.
Method Summary Modifier and Type Method and Description Mono<ConfigurationSetting> addConfigurationSetting(ConfigurationSetting setting)Adds a configuration value in the service if that key and label does not exist.
Mono<ConfigurationSetting> addConfigurationSetting(String key, String label, String value)Adds a configuration value in the service if that key does not exist.
Mono<Response<ConfigurationSetting>> addConfigurationSettingWithResponse(ConfigurationSetting setting)Adds a configuration value in the service if that key and label does not exist.
Mono<ConfigurationSnapshot> archiveSnapshot(String snapshotName)Update a snapshot status from READY to ARCHIVED.
Mono<Response<ConfigurationSnapshot>> archiveSnapshotWithResponse(String snapshotName, MatchConditions matchConditions)Update a snapshot status from READY to ARCHIVED.
PollerFlux<PollOperationDetails,ConfigurationSnapshot> beginCreateSnapshot(String snapshotName, ConfigurationSnapshot snapshot)Create a ConfigurationSnapshot by providing a snapshot name and a ConfigurationSnapshot.
Mono<ConfigurationSetting> deleteConfigurationSetting(ConfigurationSetting setting)Deletes the ConfigurationSetting with a matching getKey(), and optional getLabel() and optional ETag combination from the service.
Mono<ConfigurationSetting> deleteConfigurationSetting(String key, String label)Deletes the ConfigurationSetting with a matching key
and optional label
combination.
Deletes the ConfigurationSetting with a matching getKey(), and optional getLabel() and optional ETag combination from the service.
Mono<ConfigurationSetting> getConfigurationSetting(ConfigurationSetting setting)Attempts to get the ConfigurationSetting with a matching getKey(), and optional getLabel(), optional acceptDateTime
and optional ETag combination.
Attempts to get a ConfigurationSetting that matches the key
, and the optional label
combination.
Attempts to get a ConfigurationSetting that matches the key
, the optional label
, and the optional acceptDateTime
combination.
Attempts to get the ConfigurationSetting with a matching getKey(), and optional getLabel(), optional acceptDateTime
and optional ETag combination.
Gets the service endpoint for the Azure App Configuration instance.
Mono<ConfigurationSnapshot> getSnapshot(String snapshotName)Get a ConfigurationSnapshot by given the snapshot name.
Mono<Response<ConfigurationSnapshot>> getSnapshotWithResponse(String snapshotName, List<SnapshotFields> fields)Get a ConfigurationSnapshot by given the snapshot name.
PagedFlux<ConfigurationSetting> listConfigurationSettings(SettingSelector selector)Fetches the configuration settings that match the selector
.
Fetches the configuration settings in a snapshot that matches the snapshotName
.
Fetches the configuration settings in a snapshot that matches the snapshotName
.
Gets all labels.
PagedFlux<SettingLabel> listLabels(SettingLabelSelector selector)Gets a list of labels by given SettingLabelSelector
PagedFlux<ConfigurationSetting> listRevisions(SettingSelector selector)Lists chronological/historical representation of ConfigurationSetting resource(s).
PagedFlux<ConfigurationSnapshot> listSnapshots(SnapshotSelector selector)List snapshots by given SnapshotSelector.
Mono<ConfigurationSnapshot> recoverSnapshot(String snapshotName)Update a snapshot status from ARCHIVED to READY.
Mono<Response<ConfigurationSnapshot>> recoverSnapshotWithResponse(String snapshotName, MatchConditions matchConditions)Update a snapshot status from ARCHIVED to READY.
Mono<ConfigurationSetting> setConfigurationSetting(ConfigurationSetting setting)Creates or updates a configuration value in the service.
Mono<ConfigurationSetting> setConfigurationSetting(String key, String label, String value)Creates or updates a configuration value in the service with the given key.
Mono<Response<ConfigurationSetting>> setConfigurationSettingWithResponse(ConfigurationSetting setting, boolean ifUnchanged)Creates or updates a configuration value in the service.
Mono<ConfigurationSetting> setReadOnly(ConfigurationSetting setting, boolean isReadOnly)Sets the read-only status for the ConfigurationSetting.
Mono<ConfigurationSetting> setReadOnly(String key, String label, boolean isReadOnly)Sets the read-only status for the ConfigurationSetting that matches the key
, the optional label
.
Sets the read-only status for the ConfigurationSetting.
void updateSyncToken(String token)Adds an external synchronization token to ensure service requests receive up-to-date values.
Methods inherited from java.lang.Object Method Details addConfigurationSettingpublic Mono<ConfigurationSetting> addConfigurationSetting(ConfigurationSetting setting)
Adds a configuration value in the service if that key and label does not exist. The label value of the ConfigurationSetting is optional.
For more configuration setting types, see FeatureFlagConfigurationSetting and SecretReferenceConfigurationSetting.
Code Samples
Add a setting with the key "prodDBConnection", label "westUS", and value "db_connection".
client.addConfigurationSetting(new ConfigurationSetting()
.setKey("prodDBConnection")
.setLabel("westUS")
.setValue("db_connection"))
.subscribe(response -> System.out.printf("Key: %s, Label: %s, Value: %s",
response.getKey(), response.getLabel(), response.getValue()));
Parameters:
setting - The setting to add based on its key and optional label combination.
Returns:
The
ConfigurationSettingthat was created, or
null
if a key collision occurs or the key is an invalid value (which will also throw HttpResponseException described below).
addConfigurationSettingpublic Mono<ConfigurationSetting> addConfigurationSetting(String key, String label, String value)
Adds a configuration value in the service if that key does not exist. The label
is optional.
Code Samples
Add a setting with the key "prodDBConnection", label "westUS" and value "db_connection".
client.addConfigurationSetting("prodDBConnection", "westUS", "db_connection")
.subscribe(response -> System.out.printf("Key: %s, Label: %s, Value: %s",
response.getKey(), response.getLabel(), response.getValue()));
Parameters:
key - The key of the configuration setting to add.
label - The label of the configuration setting to add. If null
no label will be used.
value - The value associated with this configuration setting key.
Returns:
The
ConfigurationSettingthat was created, or
null
if a key collision occurs or the key is an invalid value (which will also throw HttpResponseException described below).
addConfigurationSettingWithResponsepublic Mono<Response<ConfigurationSetting>> addConfigurationSettingWithResponse(ConfigurationSetting setting)
Adds a configuration value in the service if that key and label does not exist. The label value of the ConfigurationSetting is optional.
For more configuration setting types, see FeatureFlagConfigurationSetting and SecretReferenceConfigurationSetting.
Code Samples
Add a setting with the key "prodDBConnection", label "westUS", and value "db_connection".
client.addConfigurationSettingWithResponse(new ConfigurationSetting()
.setKey("prodDBConnection")
.setLabel("westUS")
.setValue("db_connection"))
.subscribe(response -> {
ConfigurationSetting responseSetting = response.getValue();
System.out.printf("Key: %s, Label: %s, Value: %s",
responseSetting.getKey(), responseSetting.getLabel(), responseSetting.getValue());
});
Parameters:
setting - The setting to add based on its key and optional label combination.
Returns:
A REST response containing the
ConfigurationSettingthat was created, if a key collision occurs or the key is an invalid value (which will also throw HttpResponseException described below).
archiveSnapshotpublic Mono<ConfigurationSnapshot> archiveSnapshot(String snapshotName)
Update a snapshot status from READY to ARCHIVED.
Code Samples
String snapshotName = "{snapshotName}";
client.archiveSnapshot(snapshotName).subscribe(
archivedSnapshot -> {
System.out.printf("Archived snapshot name=%s is created at %s, snapshot status is %s.%n",
archivedSnapshot.getName(), archivedSnapshot.getCreatedAt(), archivedSnapshot.getStatus());
}
);
Parameters:
snapshotName - The snapshot name.
Returns:
archiveSnapshotWithResponsepublic Mono<Response<ConfigurationSnapshot>> archiveSnapshotWithResponse(String snapshotName, MatchConditions matchConditions)
Update a snapshot status from READY to ARCHIVED.
To turn on using 'if-match' header, set the second parameter 'ifUnchanged' to true. It used to perform an operation only if the targeted resource's ETag matches the value provided. Otherwise, it will throw an exception '412 Precondition Failed'.
Code Samples
String snapshotName = "{snapshotName}";
MatchConditions matchConditions = new MatchConditions().setIfMatch("{etag}");
client.archiveSnapshotWithResponse(snapshotName, matchConditions)
.subscribe(
response -> {
ConfigurationSnapshot archivedSnapshot = response.getValue();
System.out.printf("Archived snapshot name=%s is created at %s, snapshot status is %s.%n",
archivedSnapshot.getName(), archivedSnapshot.getCreatedAt(), archivedSnapshot.getStatus());
}
);
Parameters:
snapshotName - The snapshot name.
matchConditions - Specifies HTTP options for conditional requests.
Returns:
beginCreateSnapshotpublic PollerFlux<PollOperationDetails,ConfigurationSnapshot> beginCreateSnapshot(String snapshotName, ConfigurationSnapshot snapshot)
Create a ConfigurationSnapshot by providing a snapshot name and a ConfigurationSnapshot.
Code Samples
List<ConfigurationSettingsFilter> filters = new ArrayList<>();
// Key Name also supports RegExp but only support prefix end with "*", such as "k*" and is case-sensitive.
filters.add(new ConfigurationSettingsFilter("{keyName}"));
String snapshotName = "{snapshotName}";
client.beginCreateSnapshot(snapshotName, new ConfigurationSnapshot(filters)
.setRetentionPeriod(Duration.ofHours(1)))
.flatMap(result -> result.getFinalResult())
.subscribe(
snapshot -> System.out.printf("Snapshot name=%s is created at %s%n",
snapshot.getName(), snapshot.getCreatedAt()),
ex -> System.out.printf("Error on creating a snapshot=%s, with error=%s.%n", snapshotName,
ex.getMessage()),
() -> System.out.println("Successfully created a snapshot."));
Parameters:
Returns:
deleteConfigurationSettingpublic Mono<ConfigurationSetting> deleteConfigurationSetting(ConfigurationSetting setting)
Deletes the ConfigurationSetting with a matching getKey(), and optional getLabel() and optional ETag combination from the service. For more configuration setting types, see FeatureFlagConfigurationSetting and SecretReferenceConfigurationSetting.
If getETag() is specified and is not the wildcard character ("*"
), then the setting is only deleted if the ETag matches the current ETag; this means that no one has updated the ConfigurationSetting yet.
Code Samples
Delete the setting with the key "prodDBConnection".
client.deleteConfigurationSetting(new ConfigurationSetting()
.setKey("prodDBConnection")
.setLabel("westUS"))
.subscribe(response -> System.out.printf("Key: %s, Label: %s, Value: %s",
response.getKey(), response.getValue()));
Parameters:
setting - The setting to delete based on its key, optional label and optional ETag combination.
Returns:
The deleted ConfigurationSetting or an empty Mono is also returned if the key
is an invalid value (which will also throw HttpResponseException described below).
public Mono<ConfigurationSetting> deleteConfigurationSetting(String key, String label)
Deletes the ConfigurationSetting with a matching key
and optional label
combination.
Code Samples
Delete the setting with the key "prodDBConnection".
client.deleteConfigurationSetting("prodDBConnection", "westUS")
.subscribe(response -> System.out.printf("Key: %s, Label: %s, Value: %s",
response.getKey(), response.getLabel(), response.getValue()));
Parameters:
key - The key of configuration setting to delete.
label - The label of configuration setting to delete. If null
no label will be used.
Returns:
The deleted ConfigurationSetting or an empty Mono is also returned if the key
is an invalid value (which will also throw HttpResponseException described below).
public Mono<Response<ConfigurationSetting>> deleteConfigurationSettingWithResponse(ConfigurationSetting setting, boolean ifUnchanged)
Deletes the ConfigurationSetting with a matching getKey(), and optional getLabel() and optional ETag combination from the service.
For more configuration setting types, see FeatureFlagConfigurationSetting and SecretReferenceConfigurationSetting.
If getETag() is specified and is not the wildcard character ("*"
), then the setting is only deleted if the ETag matches the current ETag; this means that no one has updated the ConfigurationSetting yet.
Code Samples
Delete the setting with the key-label "prodDBConnection"-"westUS"
client.deleteConfigurationSettingWithResponse(new ConfigurationSetting()
.setKey("prodDBConnection")
.setLabel("westUS"),
false)
.contextWrite(Context.of(key1, value1, key2, value2))
.subscribe(response -> {
ConfigurationSetting responseSetting = response.getValue();
System.out.printf("Key: %s, Label: %s, Value: %s",
responseSetting.getKey(), responseSetting.getLabel(), responseSetting.getValue());
});
Parameters:
setting - The setting to delete based on its key, optional label and optional ETag combination.
ifUnchanged - Flag indicating if the setting
ETag is used as a IF-MATCH header.
Returns:
A REST response containing the deleted ConfigurationSetting or
null
if didn't exist.
null
is also returned if the
getKey()is an invalid value or
getETag()is set but does not match the current ETag (which will also throw HttpResponseException described below).
getConfigurationSettingpublic Mono<ConfigurationSetting> getConfigurationSetting(ConfigurationSetting setting)
Attempts to get the ConfigurationSetting with a matching getKey(), and optional getLabel(), optional acceptDateTime
and optional ETag combination. For more configuration setting types, see FeatureFlagConfigurationSetting and SecretReferenceConfigurationSetting.
Code Samples
Retrieve the setting with the key "prodDBConnection" and a time that one minute before now at UTC-Zone
client.getConfigurationSetting(new ConfigurationSetting()
.setKey("prodDBConnection")
.setLabel("westUS"))
.subscribe(response -> System.out.printf("Key: %s, Label: %s, Value: %s",
response.getKey(), response.getLabel(), response.getValue()));
Parameters:
setting - The setting to retrieve.
Returns:
The
ConfigurationSettingstored in the service, or an empty Mono if the configuration value does not exist or the key is an invalid value (which will also throw HttpResponseException described below).
getConfigurationSettingpublic Mono<ConfigurationSetting> getConfigurationSetting(String key, String label)
Attempts to get a ConfigurationSetting that matches the key
, and the optional label
combination.
Code Samples
Retrieve the setting with the key "prodDBConnection".
client.getConfigurationSetting("prodDBConnection", "westUS")
.subscribe(response -> System.out.printf("Key: %s, Label: %s, Value: %s",
response.getKey(), response.getLabel(), response.getValue()));
Parameters:
key - The key of the setting to retrieve.
label - The label of the configuration setting to retrieve. If null
no label will be used.
Returns:
The
ConfigurationSettingstored in the service, or an empty Mono if the configuration value does not exist or the key is an invalid value (which will also throw HttpResponseException described below).
getConfigurationSettingpublic Mono<ConfigurationSetting> getConfigurationSetting(String key, String label, OffsetDateTime acceptDateTime)
Attempts to get a ConfigurationSetting that matches the key
, the optional label
, and the optional acceptDateTime
combination.
Code Samples
Retrieve the setting with the key "prodDBConnection" and a time that one minute before now at UTC-Zone
client.getConfigurationSetting(
"prodDBConnection", "westUS", OffsetDateTime.now(ZoneOffset.UTC).minusMinutes(1))
.subscribe(response -> System.out.printf("Key: %s, Label: %s, Value: %s",
response.getKey(), response.getLabel(), response.getValue()));
Parameters:
key - The key of the setting to retrieve.
label - The label of the configuration setting to retrieve. If null
no label will be used.
acceptDateTime - Datetime to access a past state of the configuration setting. If null
then the current state of the configuration setting will be returned.
Returns:
The
ConfigurationSettingstored in the service, or an empty Mono if the configuration value does not exist or the key is an invalid value (which will also throw HttpResponseException described below).
getConfigurationSettingWithResponsepublic Mono<Response<ConfigurationSetting>> getConfigurationSettingWithResponse(ConfigurationSetting setting, OffsetDateTime acceptDateTime, boolean ifChanged)
Attempts to get the ConfigurationSetting with a matching getKey(), and optional getLabel(), optional acceptDateTime
and optional ETag combination. For more configuration setting types, see FeatureFlagConfigurationSetting and SecretReferenceConfigurationSetting.
Code Samples
Retrieve the setting with the key-label "prodDBConnection"-"westUS".
client.getConfigurationSettingWithResponse(new ConfigurationSetting()
.setKey("prodDBConnection")
.setLabel("westUS"),
null,
false)
.contextWrite(Context.of(key1, value1, key2, value2))
.subscribe(response -> {
ConfigurationSetting result = response.getValue();
System.out.printf("Key: %s, Label: %s, Value: %s",
result.getKey(), result.getLabel(), result.getValue());
});
Parameters:
setting - The setting to retrieve.
acceptDateTime - Datetime to access a past state of the configuration setting. If null
then the current state of the configuration setting will be returned.
ifChanged - Flag indicating if the setting
ETag is used as a If-None-Match header.
Returns:
A REST response containing the
ConfigurationSettingstored in the service, or
null
if didn't exist.
null
is also returned if the configuration value does not exist or the key is an invalid value (which will also throw HttpResponseException described below).
getEndpointpublic String getEndpoint()
Gets the service endpoint for the Azure App Configuration instance.
Returns:
the service endpoint for the Azure App Configuration instance.
getSnapshotpublic Mono<ConfigurationSnapshot> getSnapshot(String snapshotName)
Get a ConfigurationSnapshot by given the snapshot name.
Code Samples
String snapshotName = "{snapshotName}";
client.getSnapshot(snapshotName).subscribe(
getSnapshot -> {
System.out.printf("Snapshot name=%s is created at %s, snapshot status is %s.%n",
getSnapshot.getName(), getSnapshot.getCreatedAt(), getSnapshot.getStatus());
}
);
Parameters:
snapshotName - the snapshot name.
Returns:
getSnapshotWithResponsepublic Mono<Response<ConfigurationSnapshot>> getSnapshotWithResponse(String snapshotName, List<SnapshotFields> fields)
Get a ConfigurationSnapshot by given the snapshot name.
Code Samples
String snapshotName = "{snapshotName}";
client.getSnapshotWithResponse(snapshotName, Arrays.asList(SnapshotFields.NAME, SnapshotFields.CREATED_AT,
SnapshotFields.STATUS, SnapshotFields.FILTERS))
.subscribe(
response -> {
ConfigurationSnapshot getSnapshot = response.getValue();
// Only properties `name`, `createAt`, `status` and `filters` have value, and expect null or
// empty value other than the `fields` specified in the request.
System.out.printf("Snapshot name=%s is created at %s, snapshot status is %s.%n",
getSnapshot.getName(), getSnapshot.getCreatedAt(), getSnapshot.getStatus());
List<ConfigurationSettingsFilter> filters = getSnapshot.getFilters();
for (ConfigurationSettingsFilter filter : filters) {
System.out.printf("Snapshot filter key=%s, label=%s.%n", filter.getKey(), filter.getLabel());
}
});
Parameters:
snapshotName - The snapshot name.
fields - Used to select what fields are present in the returned resource(s).
Returns:
listConfigurationSettingspublic PagedFlux<ConfigurationSetting> listConfigurationSettings(SettingSelector selector)
Fetches the configuration settings that match the selector
. If selector
is null
, then all the ConfigurationSetting are fetched with their current values.
Code Samples
Retrieve all settings that use the key "prodDBConnection".
client.listConfigurationSettings(new SettingSelector().setKeyFilter("prodDBConnection"))
.contextWrite(Context.of(key1, value1, key2, value2))
.subscribe(setting ->
System.out.printf("Key: %s, Value: %s", setting.getKey(), setting.getValue()));
Parameters:
selector - Optional. Selector to filter configuration setting results from the service.
Returns:
A Flux of ConfigurationSettings that matches the selector
. If no options were provided, the Flux contains all the current settings in the service.
public PagedFlux<ConfigurationSetting> listConfigurationSettingsForSnapshot(String snapshotName)
Fetches the configuration settings in a snapshot that matches the snapshotName
. If snapshotName
is null
, then all the ConfigurationSetting are fetched with their current values.
Code Samples
String snapshotName = "{snapshotName}";
client.listConfigurationSettingsForSnapshot(snapshotName)
.subscribe(setting ->
System.out.printf("Key: %s, Value: %s", setting.getKey(), setting.getValue()));
Parameters:
snapshotName- Optional. A filter used get
ConfigurationSettings for a snapshot. The value should be the name of the snapshot.
Returns:
A Flux of ConfigurationSettings that matches the selector
. If no options were provided, the Flux contains all the current settings in the service.
public PagedFlux<ConfigurationSetting> listConfigurationSettingsForSnapshot(String snapshotName, List<SettingFields> fields)
Fetches the configuration settings in a snapshot that matches the snapshotName
. If snapshotName
is null
, then all the ConfigurationSetting are fetched with their current values.
Code Samples
String snapshotName = "{snapshotName}";
List<SettingFields> fields = Arrays.asList(SettingFields.KEY);
client.listConfigurationSettingsForSnapshot(snapshotName, fields)
.subscribe(setting ->
System.out.printf("Key: %s, Value: %s", setting.getKey(), setting.getValue()));
Parameters:
snapshotName- Optional. A filter used get
ConfigurationSettings for a snapshot. The value should be the name of the snapshot.
fields - Optional. The fields to select for the query response. If none are set, the service will return the ConfigurationSettings with a default set of properties.
Returns:
A Flux of ConfigurationSettings that matches the selector
. If no options were provided, the Flux contains all the current settings in the service.
public PagedFlux<SettingLabel> listLabels()
Gets all labels.
Code Samples
client.listLabels()
.subscribe(label -> {
System.out.println("label name = " + label);
});
Returns:
listLabelspublic PagedFlux<SettingLabel> listLabels(SettingLabelSelector selector)
Gets a list of labels by given SettingLabelSelector
Code Samples
String labelNameFilter = "{labelNamePrefix}*";
client.listLabels(new SettingLabelSelector().setNameFilter(labelNameFilter))
.subscribe(label -> {
System.out.println("label name = " + label);
});
Parameters:
selector - Optional. Selector to filter labels from the service.
Returns:
listRevisionspublic PagedFlux<ConfigurationSetting> listRevisions(SettingSelector selector)
Lists chronological/historical representation of ConfigurationSetting resource(s). Revisions are provided in descending order from their getLastModified() date. Revisions expire after a period of time, see Pricing for more information.
If selector
is null
, then all the ConfigurationSetting are fetched in their current state. Otherwise, the results returned match the parameters given in selector
.
Code Samples
Retrieve all revisions of the setting that has the key "prodDBConnection".
client.listRevisions(new SettingSelector().setKeyFilter("prodDBConnection"))
.contextWrite(Context.of(key1, value1, key2, value2))
.subscribe(setting ->
System.out.printf("Key: %s, Value: %s", setting.getKey(), setting.getValue()));
Parameters:
selector - Optional. Used to filter configuration setting revisions from the service.
Returns:
Revisions of the ConfigurationSetting
listSnapshotspublic PagedFlux<ConfigurationSnapshot> listSnapshots(SnapshotSelector selector)
List snapshots by given SnapshotSelector.
Code Samples
String snapshotNameFilter = "{snapshotNamePrefix}*";
client.listSnapshots(new SnapshotSelector().setNameFilter(snapshotNameFilter))
.subscribe(recoveredSnapshot -> {
System.out.printf("Recovered snapshot name=%s is created at %s, snapshot status is %s.%n",
recoveredSnapshot.getName(), recoveredSnapshot.getCreatedAt(), recoveredSnapshot.getStatus());
});
Parameters:
Returns:
recoverSnapshotpublic Mono<ConfigurationSnapshot> recoverSnapshot(String snapshotName)
Update a snapshot status from ARCHIVED to READY.
Code Samples
String snapshotName = "{snapshotName}";
client.recoverSnapshot(snapshotName).subscribe(
recoveredSnapshot -> {
System.out.printf("Recovered snapshot name=%s is created at %s, snapshot status is %s.%n",
recoveredSnapshot.getName(), recoveredSnapshot.getCreatedAt(), recoveredSnapshot.getStatus());
}
);
Parameters:
snapshotName - The snapshot name.
Returns:
recoverSnapshotWithResponsepublic Mono<Response<ConfigurationSnapshot>> recoverSnapshotWithResponse(String snapshotName, MatchConditions matchConditions)
Update a snapshot status from ARCHIVED to READY.
To turn on using 'if-match' header, set the second parameter 'ifUnchanged' to true. It used to perform an operation only if the targeted resource's ETag matches the value provided. Otherwise, it will throw an exception '412 Precondition Failed'.
Code Samples
String snapshotName = "{snapshotName}";
MatchConditions matchConditions = new MatchConditions().setIfMatch("{etag}");
client.recoverSnapshotWithResponse(snapshotName, matchConditions).subscribe(
response -> {
ConfigurationSnapshot recoveredSnapshot = response.getValue();
System.out.printf("Recovered snapshot name=%s is created at %s, snapshot status is %s.%n",
recoveredSnapshot.getName(), recoveredSnapshot.getCreatedAt(), recoveredSnapshot.getStatus());
}
);
Parameters:
snapshotName - The snapshot name.
matchConditions - Specifies HTTP options for conditional requests.
Returns:
setConfigurationSettingpublic Mono<ConfigurationSetting> setConfigurationSetting(ConfigurationSetting setting)
Creates or updates a configuration value in the service. Partial updates are not supported and the entire configuration setting is updated.
For more configuration setting types, see FeatureFlagConfigurationSetting and SecretReferenceConfigurationSetting.
Code Samples
Add a setting with the key "prodDBConnection", "westUS" and value "db_connection"
Update setting's value "db_connection" to "updated_db_connection"
client.setConfigurationSetting(new ConfigurationSetting()
.setKey("prodDBConnection")
.setLabel("westUS"))
.subscribe(response -> System.out.printf("Key: %s, Label: %s, Value: %s",
response.getKey(), response.getLabel(), response.getValue()));
// Update the value of the setting to "updated_db_connection"
client.setConfigurationSetting(new ConfigurationSetting()
.setKey("prodDBConnection")
.setLabel("westUS")
.setValue("updated_db_connection"))
.subscribe(response -> System.out.printf("Key: %s, Label: %s, Value: %s",
response.getKey(), response.getLabel(), response.getValue()));
Parameters:
setting - The setting to add based on its key and optional label combination.
Returns:
The
ConfigurationSettingthat was created or updated, or an empty Mono if the key is an invalid value (which will also throw HttpResponseException described below).
setConfigurationSettingpublic Mono<ConfigurationSetting> setConfigurationSetting(String key, String label, String value)
Creates or updates a configuration value in the service with the given key. the label
is optional.
Code Samples
Add a setting with the key "prodDBConnection", "westUS" and value "db_connection"
Update setting's value "db_connection" to "updated_db_connection"
client.setConfigurationSetting("prodDBConnection", "westUS", "db_connection")
.subscribe(response -> System.out.printf("Key: %s, Label: %s, Value: %s",
response.getKey(), response.getLabel(), response.getValue()));
// Update the value of the setting to "updated_db_connection"
client.setConfigurationSetting("prodDBConnection", "westUS", "updated_db_connection")
.subscribe(response -> System.out.printf("Key: %s, Label: %s, Value: %s",
response.getKey(), response.getLabel(), response.getValue()));
Parameters:
key - The key of the configuration setting to create or update.
label - The label of the configuration setting to create or update, If null
no label will be used.
value - The value of this configuration setting.
Returns:
The
ConfigurationSettingthat was created or updated, or an empty Mono if the key is an invalid value (which will also throw HttpResponseException described below).
setConfigurationSettingWithResponsepublic Mono<Response<ConfigurationSetting>> setConfigurationSettingWithResponse(ConfigurationSetting setting, boolean ifUnchanged)
Creates or updates a configuration value in the service. Partial updates are not supported and the entire configuration setting is updated.
For more configuration setting types, see FeatureFlagConfigurationSetting and SecretReferenceConfigurationSetting.
If getETag() is specified, the configuration value is updated if the current setting's ETag matches. If the ETag's value is equal to the wildcard character ("*"
), the setting will always be updated.
Code Samples
Add a setting with the key "prodDBConnection", label "westUS", and value "db_connection".
Update setting's value "db_connection" to "updated_db_connection"
client.setConfigurationSettingWithResponse(new ConfigurationSetting()
.setKey("prodDBConnection")
.setLabel("westUS")
.setValue("db_connection"),
false)
.subscribe(response -> {
final ConfigurationSetting result = response.getValue();
System.out.printf("Key: %s, Label: %s, Value: %s",
result.getKey(), result.getLabel(), result.getValue());
});
// Update the value of the setting to "updated_db_connection"
client.setConfigurationSettingWithResponse(new ConfigurationSetting()
.setKey("prodDBConnection")
.setLabel("westUS")
.setValue("updated_db_connection"),
false)
.subscribe(response -> {
final ConfigurationSetting responseSetting = response.getValue();
System.out.printf("Key: %s, Label: %s, Value: %s",
responseSetting.getKey(), responseSetting.getLabel(), responseSetting.getValue());
});
Parameters:
setting - The setting to create or update based on its key, optional label and optional ETag combination.
ifUnchanged - Flag indicating if the setting
ETag is used as a IF-MATCH header.
Returns:
A REST response containing the
ConfigurationSettingthat was created or updated, if the key is an invalid value, the setting is read-only, or an ETag was provided but does not match the service's current ETag value (which will also throw HttpResponseException described below).
setReadOnlypublic Mono<ConfigurationSetting> setReadOnly(ConfigurationSetting setting, boolean isReadOnly)
Sets the read-only status for the ConfigurationSetting.
For more configuration setting types, see FeatureFlagConfigurationSetting and SecretReferenceConfigurationSetting.
Code Samples
Set the setting to read-only with the key-label "prodDBConnection"-"westUS".
client.setReadOnly(new ConfigurationSetting()
.setKey("prodDBConnection")
.setLabel("westUS"),
true)
.subscribe(response -> System.out.printf("Key: %s, Label: %s, Value: %s",
response.getKey(), response.getLabel(), response.getValue()));
Clear read-only of the setting with the key-label "prodDBConnection"-"westUS".
client.setReadOnly(new ConfigurationSetting()
.setKey("prodDBConnection")
.setLabel("westUS"),
false)
.subscribe(response -> System.out.printf("Key: %s, Value: %s", response.getKey(), response.getValue()));
Parameters:
setting - The configuration setting to set to read-only or not read-only based on the isReadOnly
.
isReadOnly - Flag used to set the read-only status of the configuration. true
will put the configuration into a read-only state, false
will clear the state.
Returns:
The
ConfigurationSettingthat is read-only, or an empty Mono if a key collision occurs or the key is an invalid value (which will also throw HttpResponseException described below).
setReadOnlypublic Mono<ConfigurationSetting> setReadOnly(String key, String label, boolean isReadOnly)
Sets the read-only status for the ConfigurationSetting that matches the key
, the optional label
.
Code Samples
Set the setting to read-only with the key-label "prodDBConnection"-"westUS".
client.setReadOnly("prodDBConnection", "westUS", true)
.subscribe(response -> System.out.printf("Key: %s, Label: %s, Value: %s",
response.getKey(), response.getLabel(), response.getValue()));
Clear read-only of the setting with the key-label "prodDBConnection"-"westUS".
client.setReadOnly("prodDBConnection", "westUS", false)
.contextWrite(Context.of(key1, value1, key2, value2))
.subscribe(response -> System.out.printf("Key: %s, Value: %s", response.getKey(), response.getValue()));
Parameters:
key - The key of configuration setting to set to be read-only.
label - The label of configuration setting to read-only. If null
no label will be used.
isReadOnly - Flag used to set the read-only status of the configuration. true
will put the configuration into a read-only state, false
will clear the state.
Returns:
The
ConfigurationSettingthat is read-only, or an empty Mono if a key collision occurs or the key is an invalid value (which will also throw HttpResponseException described below).
setReadOnlyWithResponsepublic Mono<Response<ConfigurationSetting>> setReadOnlyWithResponse(ConfigurationSetting setting, boolean isReadOnly)
Sets the read-only status for the ConfigurationSetting.
For more configuration setting types, see FeatureFlagConfigurationSetting and SecretReferenceConfigurationSetting.
Code Samples
Set the setting to read-only with the key-label "prodDBConnection"-"westUS".
client.setReadOnlyWithResponse(new ConfigurationSetting()
.setKey("prodDBConnection")
.setLabel("westUS"),
true)
.subscribe(response -> {
ConfigurationSetting result = response.getValue();
System.out.printf("Key: %s, Label: %s, Value: %s",
result.getKey(), result.getLabel(), result.getValue());
});
Clear read-only of the setting with the key-label "prodDBConnection"-"westUS".
client.setReadOnlyWithResponse(new ConfigurationSetting()
.setKey("prodDBConnection")
.setLabel("westUS"),
false)
.contextWrite(Context.of(key1, value1, key2, value2))
.subscribe(response -> {
ConfigurationSetting result = response.getValue();
System.out.printf("Key: %s, Value: %s", result.getKey(), result.getValue());
});
Parameters:
setting - The configuration setting to set to read-only or not read-only based on the isReadOnly
.
isReadOnly - Flag used to set the read-only status of the configuration. true
will put the configuration into a read-only state, false
will clear the state.
Returns:
A REST response containing the read-only or not read-only ConfigurationSetting if
isReadOnly
is true or null, or false respectively. Or return
null
if the setting didn't exist.
null
is also returned if the
getKey()is an invalid value. (which will also throw HttpResponseException described below).
updateSyncTokenpublic void updateSyncToken(String token)
Adds an external synchronization token to ensure service requests receive up-to-date values.
Parameters:
token - an external synchronization token to ensure service requests receive up-to-date values.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4