ConfigurationAsyncClient Class
- java.
lang. Object - com.
azure. data. appconfiguration. ConfigurationAsyncClient
- com.
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 Started
In 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 AAD authentication via Azure Identity to connect to the service.
- Connection string, see connectionString(String connectionString).
- Azure Active Directory, see credential(TokenCredential tokenCredential).
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 Setting
The 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 Setting
The 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 Setting
The 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 Setting
The 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-only
The 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 Setting
The 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 Settings
The 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 Setting
The 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
Methods inherited from java.lang.Object
Method Details
addConfigurationSetting
public Mono
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:
Returns:
null
if a key collision occurs or the key
is an invalid value (which will also throw HttpResponseException described below).addConfigurationSetting
public Mono
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:
null
no label will be used.
Returns:
null
if a key collision occurs or the key
is an invalid value (which will also throw HttpResponseException described below).addConfigurationSettingWithResponse
public Mono
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:
Returns:
archiveSnapshot
public Mono
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:
Returns:
archiveSnapshotWithResponse
public Mono
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:
Returns:
beginCreateSnapshot
public PollerFlux
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:
deleteConfigurationSetting
public Mono
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:
Returns:
key
is an invalid value
(which will also throw HttpResponseException described below).deleteConfigurationSetting
public Mono
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:
null
no label will be used.
Returns:
key
is an invalid value
(which will also throw HttpResponseException described below).deleteConfigurationSettingWithResponse
public Mono
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
ETag is used as a
IF-MATCH header.
Returns:
getConfigurationSetting
public Mono
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:
Returns:
getConfigurationSetting
public Mono
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:
null
no label will be used.
Returns:
getConfigurationSetting
public Mono
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:
null
no label will be used.
null
then the current state of the configuration setting will be returned.
Returns:
getConfigurationSettingWithResponse
public Mono
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:
null
then the current state of the configuration setting will be returned.
setting
ETag is used as a
If-None-Match header.
Returns:
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).getEndpoint
public String getEndpoint()
Gets the service endpoint for the Azure App Configuration instance.
Returns:
getSnapshot
public Mono
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:
Returns:
getSnapshotWithResponse
public Mono
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:
Returns:
listConfigurationSettings
public PagedFlux
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:
Returns:
selector
. If no options were provided, the Flux
contains all of the current settings in the service.listConfigurationSettingsForSnapshot
public PagedFlux
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:
Returns:
selector
. If no options were provided, the Flux
contains all of the current settings in the service.listConfigurationSettingsForSnapshot
public PagedFlux
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:
Returns:
selector
. If no options were provided, the Flux
contains all of the current settings in the service.listLabels
public PagedFlux
Gets all labels.
Code Samples
client.listLabels()
.subscribe(label -> {
System.out.println("label name = " + label);
});
Returns:
listLabels
public PagedFlux
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:
Returns:
listRevisions
public PagedFlux
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:
Returns:
listSnapshots
public PagedFlux
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:
recoverSnapshot
public Mono
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:
Returns:
recoverSnapshotWithResponse
public Mono
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:
Returns:
setConfigurationSetting
public Mono
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:
Returns:
setConfigurationSetting
public Mono
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:
null
no label will be used.
Returns:
setConfigurationSettingWithResponse
public Mono
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
ETag is used as a
IF-MATCH header.
Returns:
setReadOnly
public Mono
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:
isReadOnly
.
true
will put the
configuration into a read-only state, false
will clear the state.
Returns:
setReadOnly
public Mono
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:
null
no label will be used.
true
will put the
configuration into a read-only state, false
will clear the state.
Returns:
setReadOnlyWithResponse
public Mono
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:
isReadOnly
.
true
will put the
configuration into a read-only state, false
will clear the state.
Returns:
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).updateSyncToken
public void updateSyncToken(String token)
Adds an external synchronization token to ensure service requests receive up-to-date values.
Parameters: