Class KeyVaultSettingsClient

java.lang.Object
com.azure.security.keyvault.administration.KeyVaultSettingsClient

public final class KeyVaultSettingsClient extends Object
The 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 Details

    • updateSetting

      public KeyVaultSetting updateSetting(KeyVaultSetting setting)
      Updates a given account setting.

      Code Samples

      Updates a given setting. Prints out the details of the updated setting.

       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 - The account setting to update.
      Returns:
      The updated account setting.
      Throws:
      NullPointerException - if setting is null.
      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 given account setting.

      Code Samples

      Updates a given setting. Prints out the details of the HTTP response and the updated setting.

       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 - The account setting to update.
      context - Additional Context that is passed through the HTTP pipeline during the service call.
      Returns:
      A Response whose value contains the updated account setting.
      Throws:
      NullPointerException - if setting is null.
      com.azure.security.keyvault.administration.implementation.models.KeyVaultErrorException - thrown if the request is rejected by the server.
    • getSetting

      public KeyVaultSetting getSetting(String name)
      Get the value of a specific account setting.

      Code Samples

      Retrieves a specific setting. Prints out the details of the retrieved setting.

       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 the HTTP response and the retrieved setting.

       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 - Additional Context that is passed through the HTTP pipeline during the service call.
      Returns:
      A Response whose value contains 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.
    • getSettings

      public KeyVaultGetSettingsResult getSettings()
      Get the account's settings.

      Code Samples

      Retrieves all the settings for an account. Prints out the details of the retrieved settings.

       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 object wrapping the list of account 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 the HTTP response and the retrieved settings.

       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 - Additional Context that is passed through the HTTP pipeline during the service call.
      Returns:
      A Response whose value contains a result object wrapping the list of account 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.