SearchResourceEncryptionKey.java

  1. // Copyright (c) Microsoft Corporation. All rights reserved.
  2. // Licensed under the MIT License.
  3. //
  4. // Code generated by Microsoft (R) AutoRest Code Generator.
  5. // Changes may cause incorrect behavior and will be lost if the code is
  6. // regenerated.

  7. package com.azure.search.documents.indexes.models;

  8. import com.azure.core.annotation.Fluent;
  9. import com.azure.search.documents.indexes.implementation.models.AzureActiveDirectoryApplicationCredentials;
  10. import com.fasterxml.jackson.annotation.JsonCreator;
  11. import com.fasterxml.jackson.annotation.JsonProperty;

  12. /**
  13.  * A customer-managed encryption key in Azure Key Vault. Keys that you create and manage can be used to encrypt or
  14.  * decrypt data-at-rest in Azure Cognitive Search, such as indexes and synonym maps.
  15.  */
  16. @Fluent
  17. public final class SearchResourceEncryptionKey {
  18.     /*
  19.      * The name of your Azure Key Vault key to be used to encrypt your data at
  20.      * rest.
  21.      */
  22.     @JsonProperty(value = "keyVaultKeyName", required = true)
  23.     private String keyName;

  24.     /*
  25.      * The version of your Azure Key Vault key to be used to encrypt your data
  26.      * at rest.
  27.      */
  28.     @JsonProperty(value = "keyVaultKeyVersion", required = true)
  29.     private String keyVersion;

  30.     /*
  31.      * The URI of your Azure Key Vault, also referred to as DNS name, that
  32.      * contains the key to be used to encrypt your data at rest. An example URI
  33.      * might be https://my-keyvault-name.vault.azure.net.
  34.      */
  35.     @JsonProperty(value = "keyVaultUri", required = true)
  36.     private String vaultUrl;

  37.     /*
  38.      * Optional Azure Active Directory credentials used for accessing your
  39.      * Azure Key Vault. Not required if using managed identity instead.
  40.      */
  41.     @JsonProperty(value = "accessCredentials")
  42.     private AzureActiveDirectoryApplicationCredentials accessCredentials;

  43.     /*
  44.      * An explicit managed identity to use for this encryption key. If not
  45.      * specified and the access credentials property is null, the
  46.      * system-assigned managed identity is used. On update to the resource, if
  47.      * the explicit identity is unspecified, it remains unchanged. If "none" is
  48.      * specified, the value of this property is cleared.
  49.      */
  50.     @JsonProperty(value = "identity")
  51.     private SearchIndexerDataIdentity identity;

  52.     /**
  53.      * Creates an instance of SearchResourceEncryptionKey class.
  54.      *
  55.      * @param keyName the keyName value to set.
  56.      * @param keyVersion the keyVersion value to set.
  57.      * @param vaultUrl the vaultUrl value to set.
  58.      */
  59.     @JsonCreator
  60.     public SearchResourceEncryptionKey(
  61.             @JsonProperty(value = "keyVaultKeyName", required = true) String keyName,
  62.             @JsonProperty(value = "keyVaultKeyVersion", required = true) String keyVersion,
  63.             @JsonProperty(value = "keyVaultUri", required = true) String vaultUrl) {
  64.         this.keyName = keyName;
  65.         this.keyVersion = keyVersion;
  66.         this.vaultUrl = vaultUrl;
  67.     }

  68.     /**
  69.      * Get the keyName property: The name of your Azure Key Vault key to be used to encrypt your data at rest.
  70.      *
  71.      * @return the keyName value.
  72.      */
  73.     public String getKeyName() {
  74.         return this.keyName;
  75.     }

  76.     /**
  77.      * Get the keyVersion property: The version of your Azure Key Vault key to be used to encrypt your data at rest.
  78.      *
  79.      * @return the keyVersion value.
  80.      */
  81.     public String getKeyVersion() {
  82.         return this.keyVersion;
  83.     }

  84.     /**
  85.      * Get the vaultUrl property: The URI of your Azure Key Vault, also referred to as DNS name, that contains the key
  86.      * to be used to encrypt your data at rest. An example URI might be https://my-keyvault-name.vault.azure.net.
  87.      *
  88.      * @return the vaultUrl value.
  89.      */
  90.     public String getVaultUrl() {
  91.         return this.vaultUrl;
  92.     }

  93.     /**
  94.      * Get the identity property: An explicit managed identity to use for this encryption key. If not specified and the
  95.      * access credentials property is null, the system-assigned managed identity is used. On update to the resource, if
  96.      * the explicit identity is unspecified, it remains unchanged. If "none" is specified, the value of this property is
  97.      * cleared.
  98.      *
  99.      * @return the identity value.
  100.      */
  101.     public SearchIndexerDataIdentity getIdentity() {
  102.         return this.identity;
  103.     }

  104.     /**
  105.      * Set the identity property: An explicit managed identity to use for this encryption key. If not specified and the
  106.      * access credentials property is null, the system-assigned managed identity is used. On update to the resource, if
  107.      * the explicit identity is unspecified, it remains unchanged. If "none" is specified, the value of this property is
  108.      * cleared.
  109.      *
  110.      * @param identity the identity value to set.
  111.      * @return the SearchResourceEncryptionKey object itself.
  112.      */
  113.     public SearchResourceEncryptionKey setIdentity(SearchIndexerDataIdentity identity) {
  114.         this.identity = identity;
  115.         return this;
  116.     }

  117.     /**
  118.      * Get the applicationId property: An AAD Application ID that was granted the required access permissions to the
  119.      * Azure Key Vault that is to be used when encrypting your data at rest. The Application ID should not be confused
  120.      * with the Object ID for your AAD Application.
  121.      *
  122.      * @return the applicationId value.
  123.      */
  124.     public String getApplicationId() {
  125.         return (this.accessCredentials == null) ? null : this.accessCredentials.getApplicationId();
  126.     }

  127.     /**
  128.      * Set the applicationId property: An AAD Application ID that was granted the required access permissions to the
  129.      * Azure Key Vault that is to be used when encrypting your data at rest. The Application ID should not be confused
  130.      * with the Object ID for your AAD Application.
  131.      *
  132.      * @param applicationId the applicationId value to set.
  133.      * @return the SearchResourceEncryptionKey object itself.
  134.      */
  135.     public SearchResourceEncryptionKey setApplicationId(String applicationId) {
  136.         if (this.accessCredentials == null) {
  137.             this.accessCredentials = new AzureActiveDirectoryApplicationCredentials();
  138.         }

  139.         this.accessCredentials.setApplicationId(applicationId);
  140.         return this;
  141.     }

  142.     /**
  143.      * Get the applicationSecret property: The authentication key of the specified AAD application.
  144.      *
  145.      * @return the applicationSecret value.
  146.      */
  147.     public String getApplicationSecret() {
  148.         return (this.accessCredentials == null) ? null : this.accessCredentials.getApplicationSecret();
  149.     }

  150.     /**
  151.      * Set the applicationSecret property: The authentication key of the specified AAD application.
  152.      *
  153.      * @param applicationSecret the applicationSecret value to set.
  154.      * @return the SearchResourceEncryptionKey object itself.
  155.      */
  156.     public SearchResourceEncryptionKey setApplicationSecret(String applicationSecret) {
  157.         if (this.accessCredentials == null) {
  158.             this.accessCredentials = new AzureActiveDirectoryApplicationCredentials();
  159.         }

  160.         this.accessCredentials.setApplicationSecret(applicationSecret);
  161.         return this;
  162.     }
  163. }