SearchIndexerDataSourceConnection.java

  1. // Copyright (c) Microsoft Corporation. All rights reserved.
  2. // Licensed under the MIT License.

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

  4. import com.azure.core.annotation.Fluent;
  5. import com.fasterxml.jackson.annotation.JsonCreator;
  6. import com.fasterxml.jackson.annotation.JsonProperty;

  7. /**
  8.  * Represents a datasource definition, which can be used to configure an
  9.  * indexer.
  10.  */
  11. @Fluent
  12. public final class SearchIndexerDataSourceConnection {
  13.     /*
  14.      * The name of the datasource.
  15.      */
  16.     @JsonProperty(value = "name", required = true)
  17.     private String name;

  18.     /*
  19.      * The description of the datasource.
  20.      */
  21.     @JsonProperty(value = "description")
  22.     private String description;

  23.     /*
  24.      * The type of the datasource. Possible values include: 'AzureSql',
  25.      * 'CosmosDb', 'AzureBlob', 'AzureTable', 'MySql'
  26.      */
  27.     @JsonProperty(value = "type", required = true)
  28.     private SearchIndexerDataSourceType type;

  29.     /*
  30.      * The connection string for the datasource.
  31.      */
  32.     @JsonProperty(value = "connectionString")
  33.     private String connectionString;

  34.     /*
  35.      * The data container for the datasource.
  36.      */
  37.     @JsonProperty(value = "container", required = true)
  38.     private SearchIndexerDataContainer container;

  39.     /*
  40.      * The data change detection policy for the datasource.
  41.      */
  42.     @JsonProperty(value = "dataChangeDetectionPolicy")
  43.     private DataChangeDetectionPolicy dataChangeDetectionPolicy;

  44.     /*
  45.      * The data deletion detection policy for the datasource.
  46.      */
  47.     @JsonProperty(value = "dataDeletionDetectionPolicy")
  48.     private DataDeletionDetectionPolicy dataDeletionDetectionPolicy;

  49.     /*
  50.      * The ETag of the data source.
  51.      */
  52.     @JsonProperty(value = "@odata.etag")
  53.     private String eTag;

  54.     /*
  55.      * A description of an encryption key that you create in Azure Key Vault.
  56.      * This key is used to provide an additional level of encryption-at-rest
  57.      * for your datasource definition when you want full assurance that no one,
  58.      * not even Microsoft, can decrypt your data source definition in Azure
  59.      * Cognitive Search. Once you have encrypted your data source definition,
  60.      * it will always remain encrypted. Azure Cognitive Search will ignore
  61.      * attempts to set this property to null. You can change this property as
  62.      * needed if you want to rotate your encryption key; Your datasource
  63.      * definition will be unaffected. Encryption with customer-managed keys is
  64.      * not available for free search services, and is only available for paid
  65.      * services created on or after January 1, 2019.
  66.      */
  67.     @JsonProperty(value = "encryptionKey")
  68.     private SearchResourceEncryptionKey encryptionKey;

  69.     /*
  70.      * An explicit managed identity to use for this datasource. If not
  71.      * specified and the connection string is a managed identity, the
  72.      * system-assigned managed identity is used. If not specified, the value
  73.      * remains unchanged. If "none" is specified, the value of this property is
  74.      * cleared.
  75.      */
  76.     @JsonProperty(value = "identity")
  77.     private SearchIndexerDataIdentity identity;

  78.     /**
  79.      * Constructor of {@link SearchIndexerDataSourceConnection}.
  80.      *
  81.      * @param name The name of the datasource.
  82.      */
  83.     public SearchIndexerDataSourceConnection(String name) {
  84.         this.name = name;
  85.     }

  86.     /**
  87.      * Constructor of {@link SearchIndexerDataSourceConnection}.
  88.      *
  89.      * @param name The name of the datasource.
  90.      * @param type The type of the datasource. Possible values include: 'AzureSql',
  91.      * 'CosmosDb', 'AzureBlob', 'AzureTable', 'MySql'
  92.      * @param connectionString The connection string for the datasource.
  93.      * @param container The data container for the datasource.
  94.      */
  95.     @JsonCreator
  96.     public SearchIndexerDataSourceConnection(
  97.         @JsonProperty(value = "name") String name,
  98.         @JsonProperty(value = "type") SearchIndexerDataSourceType type,
  99.         @JsonProperty(value = "credentials") String connectionString,
  100.         @JsonProperty(value = "container") SearchIndexerDataContainer container) {
  101.         this.name = name;
  102.         this.type = type;
  103.         this.connectionString = connectionString;
  104.         this.container = container;
  105.     }

  106.     /**
  107.      * Get the name property: The name of the datasource.
  108.      *
  109.      * @return the name value.
  110.      */
  111.     public String getName() {
  112.         return this.name;
  113.     }

  114.     /**
  115.      * Get the description property: The description of the datasource.
  116.      *
  117.      * @return the description value.
  118.      */
  119.     public String getDescription() {
  120.         return this.description;
  121.     }

  122.     /**
  123.      * Set the description property: The description of the datasource.
  124.      *
  125.      * @param description the description value to set.
  126.      * @return the SearchIndexerDataSource object itself.
  127.      */
  128.     public SearchIndexerDataSourceConnection setDescription(String description) {
  129.         this.description = description;
  130.         return this;
  131.     }

  132.     /**
  133.      * Get the type property: The type of the datasource. Possible values
  134.      * include: 'AzureSql', 'CosmosDb', 'AzureBlob', 'AzureTable', 'MySql'.
  135.      *
  136.      * @return the type value.
  137.      */
  138.     public SearchIndexerDataSourceType getType() {
  139.         return this.type;
  140.     }

  141.     /**
  142.      * Set the type property: The type of the datasource. Possible values
  143.      * include: 'AzureSql', 'CosmosDb', 'AzureBlob', 'AzureTable', 'MySql'.
  144.      *
  145.      * @param type the type value to set.
  146.      * @return the SearchIndexerDataSource object itself.
  147.      */
  148.     public SearchIndexerDataSourceConnection setType(SearchIndexerDataSourceType type) {
  149.         this.type = type;
  150.         return this;
  151.     }

  152.     /**
  153.      * Get the connectionString property: The connection string for the
  154.      * datasource.
  155.      *
  156.      * @return the connectionString value.
  157.      */
  158.     public String getConnectionString() {
  159.         return this.connectionString;
  160.     }

  161.     /**
  162.      * Set the connectionString property: The connection string for the
  163.      * datasource.
  164.      *
  165.      * @param connectionString the connectionString value to set.
  166.      * @return the SearchIndexerDataSource object itself.
  167.      */
  168.     public SearchIndexerDataSourceConnection setConnectionString(String connectionString) {
  169.         this.connectionString = connectionString;
  170.         return this;
  171.     }

  172.     /**
  173.      * Get the container property: The data container for the datasource.
  174.      *
  175.      * @return the container value.
  176.      */
  177.     public SearchIndexerDataContainer getContainer() {
  178.         return this.container;
  179.     }

  180.     /**
  181.      * Set the container property: The data container for the datasource.
  182.      *
  183.      * @param container the container value to set.
  184.      * @return the SearchIndexerDataSource object itself.
  185.      */
  186.     public SearchIndexerDataSourceConnection setContainer(SearchIndexerDataContainer container) {
  187.         this.container = container;
  188.         return this;
  189.     }

  190.     /**
  191.      * Get the dataChangeDetectionPolicy property: The data change detection
  192.      * policy for the datasource.
  193.      *
  194.      * @return the dataChangeDetectionPolicy value.
  195.      */
  196.     public DataChangeDetectionPolicy getDataChangeDetectionPolicy() {
  197.         return this.dataChangeDetectionPolicy;
  198.     }

  199.     /**
  200.      * Set the dataChangeDetectionPolicy property: The data change detection
  201.      * policy for the datasource.
  202.      *
  203.      * @param dataChangeDetectionPolicy the dataChangeDetectionPolicy value to
  204.      * set.
  205.      * @return the SearchIndexerDataSource object itself.
  206.      */
  207.     public SearchIndexerDataSourceConnection setDataChangeDetectionPolicy(
  208.         DataChangeDetectionPolicy dataChangeDetectionPolicy) {
  209.         this.dataChangeDetectionPolicy = dataChangeDetectionPolicy;
  210.         return this;
  211.     }

  212.     /**
  213.      * Get the dataDeletionDetectionPolicy property: The data deletion
  214.      * detection policy for the datasource.
  215.      *
  216.      * @return the dataDeletionDetectionPolicy value.
  217.      */
  218.     public DataDeletionDetectionPolicy getDataDeletionDetectionPolicy() {
  219.         return this.dataDeletionDetectionPolicy;
  220.     }

  221.     /**
  222.      * Set the dataDeletionDetectionPolicy property: The data deletion
  223.      * detection policy for the datasource.
  224.      *
  225.      * @param dataDeletionDetectionPolicy the dataDeletionDetectionPolicy value
  226.      * to set.
  227.      * @return the SearchIndexerDataSource object itself.
  228.      */
  229.     public SearchIndexerDataSourceConnection setDataDeletionDetectionPolicy(
  230.         DataDeletionDetectionPolicy dataDeletionDetectionPolicy) {
  231.         this.dataDeletionDetectionPolicy = dataDeletionDetectionPolicy;
  232.         return this;
  233.     }

  234.     /**
  235.      * Get the eTag property: The ETag of the data source.
  236.      *
  237.      * @return the eTag value.
  238.      */
  239.     public String getETag() {
  240.         return this.eTag;
  241.     }

  242.     /**
  243.      * Set the eTag property: The ETag of the data source.
  244.      *
  245.      * @param eTag the eTag value to set.
  246.      * @return the SearchIndexerDataSource object itself.
  247.      */
  248.     public SearchIndexerDataSourceConnection setETag(String eTag) {
  249.         this.eTag = eTag;
  250.         return this;
  251.     }

  252.     /**
  253.      * Get the encryptionKey property: A description of an encryption key that you create in Azure Key Vault. This key
  254.      * is used to provide an additional level of encryption-at-rest for your datasource definition when you want full
  255.      * assurance that no one, not even Microsoft, can decrypt your data source definition in Azure Cognitive Search.
  256.      * Once you have encrypted your data source definition, it will always remain encrypted. Azure Cognitive Search will
  257.      * ignore attempts to set this property to null. You can change this property as needed if you want to rotate your
  258.      * encryption key; Your datasource definition will be unaffected. Encryption with customer-managed keys is not
  259.      * available for free search services, and is only available for paid services created on or after January 1, 2019.
  260.      *
  261.      * @return the encryptionKey value.
  262.      */
  263.     public SearchResourceEncryptionKey getEncryptionKey() {
  264.         return this.encryptionKey;
  265.     }

  266.     /**
  267.      * Set the encryptionKey property: A description of an encryption key that you create in Azure Key Vault. This key
  268.      * is used to provide an additional level of encryption-at-rest for your datasource definition when you want full
  269.      * assurance that no one, not even Microsoft, can decrypt your data source definition in Azure Cognitive Search.
  270.      * Once you have encrypted your data source definition, it will always remain encrypted. Azure Cognitive Search will
  271.      * ignore attempts to set this property to null. You can change this property as needed if you want to rotate your
  272.      * encryption key; Your datasource definition will be unaffected. Encryption with customer-managed keys is not
  273.      * available for free search services, and is only available for paid services created on or after January 1, 2019.
  274.      *
  275.      * @param encryptionKey the encryptionKey value to set.
  276.      * @return the SearchIndexerDataSource object itself.
  277.      */
  278.     public SearchIndexerDataSourceConnection setEncryptionKey(SearchResourceEncryptionKey encryptionKey) {
  279.         this.encryptionKey = encryptionKey;
  280.         return this;
  281.     }

  282.     /**
  283.      * Get the identity property: An explicit managed identity to use for this datasource. If not specified and the
  284.      * connection string is a managed identity, the system-assigned managed identity is used. If not specified, the
  285.      * value remains unchanged. If "none" is specified, the value of this property is cleared.
  286.      *
  287.      * @return the identity value.
  288.      */
  289.     public SearchIndexerDataIdentity getIdentity() {
  290.         return this.identity;
  291.     }

  292.     /**
  293.      * Set the identity property: An explicit managed identity to use for this datasource. If not specified and the
  294.      * connection string is a managed identity, the system-assigned managed identity is used. If not specified, the
  295.      * value remains unchanged. If "none" is specified, the value of this property is cleared.
  296.      *
  297.      * @param identity the identity value to set.
  298.      * @return the SearchIndexerDataSourceConnection object itself.
  299.      */
  300.     public SearchIndexerDataSourceConnection setIdentity(SearchIndexerDataIdentity identity) {
  301.         this.identity = identity;
  302.         return this;
  303.     }
  304. }