Class KeyVaultSettingsAsyncClient

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

public final class KeyVaultSettingsAsyncClient extends Object
The KeyVaultSettingsAsyncClient 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.buildAsyncClient() method on a KeyVaultSettingsClientBuilder object.

See Also:
  • Method Details

    • updateSetting

      public Mono<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);
      
       keyVaultSettingsAsyncClient.updateSetting(settingToUpdate)
           .subscribe(updatedSetting ->
               System.out.printf("Updated setting '%s' to '%s'.%n", updatedSetting.getName(),
                   updatedSetting.asBoolean()));
       
      Parameters:
      setting - The account setting to update.
      Returns:
      A Mono containing 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 Mono<com.azure.core.http.rest.Response<KeyVaultSetting>> updateSettingWithResponse(KeyVaultSetting setting)
      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);
      
       keyVaultSettingsAsyncClient.updateSettingWithResponse(mySettingToUpdate)
           .subscribe(response ->
               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.
      Returns:
      A Mono containing 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 Mono<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.

       keyVaultSettingsAsyncClient.getSetting(settingName)
           .subscribe(setting ->
               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:
      A Mono containing 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 Mono<com.azure.core.http.rest.Response<KeyVaultSetting>> getSettingWithResponse(String name)
      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.

       keyVaultSettingsAsyncClient.getSettingWithResponse(settingName)
           .subscribe(response ->
               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.
      Returns:
      A Mono containing 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 Mono<KeyVaultGetSettingsResult> getSettings()
      Get the account's settings.

      Code Samples

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

       keyVaultSettingsAsyncClient.getSettings().subscribe(getSettingsResult ->
           getSettingsResult.getSettings().forEach(setting ->
               System.out.printf("Retrieved setting with name '%s' and value %s'.%n", setting.getName(),
                   setting.asBoolean())));
       
      Returns:
      A Mono containing 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 Mono<com.azure.core.http.rest.Response<KeyVaultGetSettingsResult>> getSettingsWithResponse()
      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.

       keyVaultSettingsAsyncClient.getSettingsWithResponse()
           .subscribe(response -> {
               System.out.printf("Response successful with status code: %d.", response.getStatusCode());
      
               KeyVaultGetSettingsResult getSettingsResult = response.getValue();
               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 Mono containing 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.