Class KeyVaultSettingsClient
KeyVaultSettingsClient provides asynchronous methods to create, update, get and list
settings for the Azure Key Vault.
Instances of this client are obtained by calling the KeyVaultSettingsClientBuilder.buildClient()
method on a KeyVaultSettingsClientBuilder object.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiongetSetting(String name) Get the value of a specific account setting.Get the account's settings.com.azure.core.http.rest.Response<KeyVaultGetSettingsResult>getSettingsWithResponse(com.azure.core.util.Context context) Get the account's settings.com.azure.core.http.rest.Response<KeyVaultSetting>getSettingWithResponse(String name, com.azure.core.util.Context context) Get the value of a specific account setting.updateSetting(KeyVaultSetting setting) Updates a givenaccount setting.com.azure.core.http.rest.Response<KeyVaultSetting>updateSettingWithResponse(KeyVaultSetting setting, com.azure.core.util.Context context) Updates a givenaccount setting.
-
Method Details
-
updateSetting
Updates a givenaccount setting.Code Samples
Updates a given
setting. Prints out the details of the updatedsetting.KeyVaultSetting settingToUpdate = new KeyVaultSetting(settingName, true); KeyVaultSetting updatedSetting = keyVaultSettingsClient.updateSetting(settingToUpdate); System.out.printf("Updated setting '%s' to '%s'.%n", updatedSetting.getName(), updatedSetting.asBoolean());- Parameters:
setting- Theaccount settingto update.- Returns:
- The updated
account setting. - Throws:
NullPointerException- ifsettingisnull.com.azure.security.keyvault.administration.implementation.models.KeyVaultErrorException- thrown if the request is rejected by the server.
-
updateSettingWithResponse
public com.azure.core.http.rest.Response<KeyVaultSetting> updateSettingWithResponse(KeyVaultSetting setting, com.azure.core.util.Context context) Updates a givenaccount setting.Code Samples
Updates a given
setting. Prints out the details of theHTTP responseand the updatedsetting.KeyVaultSetting mySettingToUpdate = new KeyVaultSetting(settingName, true); Response<KeyVaultSetting> response = keyVaultSettingsClient.updateSettingWithResponse(mySettingToUpdate, new Context("key1", "value1")); System.out.printf("Response successful with status code: %d. Updated setting '%s' to '%s'.%n", response.getStatusCode(), response.getValue().getName(), response.getValue().asBoolean());- Parameters:
setting- Theaccount settingto update.context- AdditionalContextthat is passed through the HTTP pipeline during the service call.- Returns:
- A
Responsewhosevaluecontains the updatedaccount setting. - Throws:
NullPointerException- ifsettingisnull.com.azure.security.keyvault.administration.implementation.models.KeyVaultErrorException- thrown if the request is rejected by the server.
-
getSetting
Get the value of a specific account setting.Code Samples
Retrieves a specific
setting. Prints out the details of the retrievedsetting.KeyVaultSetting setting = keyVaultSettingsClient.getSetting(settingName); System.out.printf("Retrieved setting '%s' with value '%s'.%n", setting.getName(), setting.asBoolean());- Parameters:
name- The name of setting to retrieve the value of.- Returns:
- The
account setting. - Throws:
IllegalArgumentException- thrown if the setting type is not supported.com.azure.security.keyvault.administration.implementation.models.KeyVaultErrorException- thrown if the request is rejected by the server.
-
getSettingWithResponse
public com.azure.core.http.rest.Response<KeyVaultSetting> getSettingWithResponse(String name, com.azure.core.util.Context context) Get the value of a specific account setting.Code Samples
Retrieves a specific
setting. Prints out the details of theHTTP responseand the retrievedsetting.Response<KeyVaultSetting> response = keyVaultSettingsClient.getSettingWithResponse(settingName, new Context("key1", "value1")); System.out.printf("Response successful with status code: %d. Retrieved setting '%s' with value '%s'.%n", response.getStatusCode(), response.getValue().getName(), response.getValue().asBoolean());- Parameters:
name- The name of setting to retrieve the value of.context- AdditionalContextthat is passed through the HTTP pipeline during the service call.- Returns:
- A
Responsewhosevaluecontains theaccount setting. - Throws:
IllegalArgumentException- thrown if the setting type is not supported.com.azure.security.keyvault.administration.implementation.models.KeyVaultErrorException- thrown if the request is rejected by the server.
-
getSettings
Get the account's settings.Code Samples
Retrieves all the
settingsfor an account. Prints out the details of the retrievedsettings.KeyVaultGetSettingsResult getSettingsResult = keyVaultSettingsClient.getSettings(); List<KeyVaultSetting> settings = getSettingsResult.getSettings(); settings.forEach(setting -> System.out.printf("Retrieved setting with name '%s' and value %s'.%n", setting.getName(), setting.asBoolean()));- Returns:
- A
result objectwrapping the list ofaccount settings. - Throws:
IllegalArgumentException- thrown if a setting type in the list is not supported.com.azure.security.keyvault.administration.implementation.models.KeyVaultErrorException- thrown if the request is rejected by the server.
-
getSettingsWithResponse
public com.azure.core.http.rest.Response<KeyVaultGetSettingsResult> getSettingsWithResponse(com.azure.core.util.Context context) Get the account's settings.Code Samples
Retrieves all
settings for an account. Prints out the details of theHTTP responseand the retrievedsettings.Response<KeyVaultGetSettingsResult> response = keyVaultSettingsClient.getSettingsWithResponse(new Context("key1", "value1")); System.out.printf("Response successful with status code: %d.", response.getStatusCode()); KeyVaultGetSettingsResult myGetSettingsResult = response.getValue(); List<KeyVaultSetting> mySettings = myGetSettingsResult.getSettings(); mySettings.forEach(setting -> System.out.printf("Retrieved setting with name '%s' and value %s'.%n", setting.getName(), setting.asBoolean()));- Parameters:
context- AdditionalContextthat is passed through the HTTP pipeline during the service call.- Returns:
- A
Responsewhosevaluecontains aresult objectwrapping the list ofaccount settings. - Throws:
IllegalArgumentException- thrown if a setting type in the list is not supported.com.azure.security.keyvault.administration.implementation.models.KeyVaultErrorException- thrown if the request is rejected by the server.
-