
software.amazon.awssdk.services.firehose.model.ElasticsearchDestinationConfiguration Maven / Gradle / Ivy
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package software.amazon.awssdk.services.firehose.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Describes the configuration of a destination in Amazon ES.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ElasticsearchDestinationConfiguration implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField ROLE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("RoleARN").getter(getter(ElasticsearchDestinationConfiguration::roleARN))
.setter(setter(Builder::roleARN))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RoleARN").build()).build();
private static final SdkField DOMAIN_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DomainARN").getter(getter(ElasticsearchDestinationConfiguration::domainARN))
.setter(setter(Builder::domainARN))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DomainARN").build()).build();
private static final SdkField CLUSTER_ENDPOINT_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ClusterEndpoint").getter(getter(ElasticsearchDestinationConfiguration::clusterEndpoint))
.setter(setter(Builder::clusterEndpoint))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ClusterEndpoint").build()).build();
private static final SdkField INDEX_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("IndexName").getter(getter(ElasticsearchDestinationConfiguration::indexName))
.setter(setter(Builder::indexName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IndexName").build()).build();
private static final SdkField TYPE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("TypeName").getter(getter(ElasticsearchDestinationConfiguration::typeName))
.setter(setter(Builder::typeName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TypeName").build()).build();
private static final SdkField INDEX_ROTATION_PERIOD_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("IndexRotationPeriod").getter(getter(ElasticsearchDestinationConfiguration::indexRotationPeriodAsString))
.setter(setter(Builder::indexRotationPeriod))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IndexRotationPeriod").build())
.build();
private static final SdkField BUFFERING_HINTS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("BufferingHints")
.getter(getter(ElasticsearchDestinationConfiguration::bufferingHints)).setter(setter(Builder::bufferingHints))
.constructor(ElasticsearchBufferingHints::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BufferingHints").build()).build();
private static final SdkField RETRY_OPTIONS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("RetryOptions")
.getter(getter(ElasticsearchDestinationConfiguration::retryOptions)).setter(setter(Builder::retryOptions))
.constructor(ElasticsearchRetryOptions::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RetryOptions").build()).build();
private static final SdkField S3_BACKUP_MODE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("S3BackupMode").getter(getter(ElasticsearchDestinationConfiguration::s3BackupModeAsString))
.setter(setter(Builder::s3BackupMode))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("S3BackupMode").build()).build();
private static final SdkField S3_CONFIGURATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("S3Configuration")
.getter(getter(ElasticsearchDestinationConfiguration::s3Configuration)).setter(setter(Builder::s3Configuration))
.constructor(S3DestinationConfiguration::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("S3Configuration").build()).build();
private static final SdkField PROCESSING_CONFIGURATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("ProcessingConfiguration")
.getter(getter(ElasticsearchDestinationConfiguration::processingConfiguration))
.setter(setter(Builder::processingConfiguration)).constructor(ProcessingConfiguration::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ProcessingConfiguration").build())
.build();
private static final SdkField CLOUD_WATCH_LOGGING_OPTIONS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("CloudWatchLoggingOptions")
.getter(getter(ElasticsearchDestinationConfiguration::cloudWatchLoggingOptions))
.setter(setter(Builder::cloudWatchLoggingOptions)).constructor(CloudWatchLoggingOptions::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CloudWatchLoggingOptions").build())
.build();
private static final SdkField VPC_CONFIGURATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("VpcConfiguration")
.getter(getter(ElasticsearchDestinationConfiguration::vpcConfiguration)).setter(setter(Builder::vpcConfiguration))
.constructor(VpcConfiguration::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VpcConfiguration").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ROLE_ARN_FIELD,
DOMAIN_ARN_FIELD, CLUSTER_ENDPOINT_FIELD, INDEX_NAME_FIELD, TYPE_NAME_FIELD, INDEX_ROTATION_PERIOD_FIELD,
BUFFERING_HINTS_FIELD, RETRY_OPTIONS_FIELD, S3_BACKUP_MODE_FIELD, S3_CONFIGURATION_FIELD,
PROCESSING_CONFIGURATION_FIELD, CLOUD_WATCH_LOGGING_OPTIONS_FIELD, VPC_CONFIGURATION_FIELD));
private static final long serialVersionUID = 1L;
private final String roleARN;
private final String domainARN;
private final String clusterEndpoint;
private final String indexName;
private final String typeName;
private final String indexRotationPeriod;
private final ElasticsearchBufferingHints bufferingHints;
private final ElasticsearchRetryOptions retryOptions;
private final String s3BackupMode;
private final S3DestinationConfiguration s3Configuration;
private final ProcessingConfiguration processingConfiguration;
private final CloudWatchLoggingOptions cloudWatchLoggingOptions;
private final VpcConfiguration vpcConfiguration;
private ElasticsearchDestinationConfiguration(BuilderImpl builder) {
this.roleARN = builder.roleARN;
this.domainARN = builder.domainARN;
this.clusterEndpoint = builder.clusterEndpoint;
this.indexName = builder.indexName;
this.typeName = builder.typeName;
this.indexRotationPeriod = builder.indexRotationPeriod;
this.bufferingHints = builder.bufferingHints;
this.retryOptions = builder.retryOptions;
this.s3BackupMode = builder.s3BackupMode;
this.s3Configuration = builder.s3Configuration;
this.processingConfiguration = builder.processingConfiguration;
this.cloudWatchLoggingOptions = builder.cloudWatchLoggingOptions;
this.vpcConfiguration = builder.vpcConfiguration;
}
/**
*
* The Amazon Resource Name (ARN) of the IAM role to be assumed by Kinesis Data Firehose for calling the Amazon ES
* Configuration API and for indexing documents. For more information, see Grant Kinesis Data
* Firehose Access to an Amazon S3 Destination and Amazon Resource Names (ARNs)
* and AWS Service Namespaces.
*
*
* @return The Amazon Resource Name (ARN) of the IAM role to be assumed by Kinesis Data Firehose for calling the
* Amazon ES Configuration API and for indexing documents. For more information, see Grant Kinesis
* Data Firehose Access to an Amazon S3 Destination and Amazon Resource Names
* (ARNs) and AWS Service Namespaces.
*/
public final String roleARN() {
return roleARN;
}
/**
*
* The ARN of the Amazon ES domain. The IAM role must have permissions for DescribeElasticsearchDomain
,
* DescribeElasticsearchDomains
, and DescribeElasticsearchDomainConfig
after assuming the
* role specified in RoleARN. For more information, see Amazon Resource Names (ARNs)
* and AWS Service Namespaces.
*
*
* Specify either ClusterEndpoint
or DomainARN
.
*
*
* @return The ARN of the Amazon ES domain. The IAM role must have permissions for
* DescribeElasticsearchDomain
, DescribeElasticsearchDomains
, and
* DescribeElasticsearchDomainConfig
after assuming the role specified in RoleARN. For
* more information, see Amazon Resource Names
* (ARNs) and AWS Service Namespaces.
*
* Specify either ClusterEndpoint
or DomainARN
.
*/
public final String domainARN() {
return domainARN;
}
/**
*
* The endpoint to use when communicating with the cluster. Specify either this ClusterEndpoint
or the
* DomainARN
field.
*
*
* @return The endpoint to use when communicating with the cluster. Specify either this ClusterEndpoint
* or the DomainARN
field.
*/
public final String clusterEndpoint() {
return clusterEndpoint;
}
/**
*
* The Elasticsearch index name.
*
*
* @return The Elasticsearch index name.
*/
public final String indexName() {
return indexName;
}
/**
*
* The Elasticsearch type name. For Elasticsearch 6.x, there can be only one type per index. If you try to specify a
* new type for an existing index that already has another type, Kinesis Data Firehose returns an error during run
* time.
*
*
* For Elasticsearch 7.x, don't specify a TypeName
.
*
*
* @return The Elasticsearch type name. For Elasticsearch 6.x, there can be only one type per index. If you try to
* specify a new type for an existing index that already has another type, Kinesis Data Firehose returns an
* error during run time.
*
* For Elasticsearch 7.x, don't specify a TypeName
.
*/
public final String typeName() {
return typeName;
}
/**
*
* The Elasticsearch index rotation period. Index rotation appends a timestamp to the IndexName
to
* facilitate the expiration of old data. For more information, see Index Rotation for
* the Amazon ES Destination. The default value is OneDay
.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #indexRotationPeriod} will return {@link ElasticsearchIndexRotationPeriod#UNKNOWN_TO_SDK_VERSION}. The raw
* value returned by the service is available from {@link #indexRotationPeriodAsString}.
*
*
* @return The Elasticsearch index rotation period. Index rotation appends a timestamp to the IndexName
* to facilitate the expiration of old data. For more information, see Index
* Rotation for the Amazon ES Destination. The default value is OneDay
.
* @see ElasticsearchIndexRotationPeriod
*/
public final ElasticsearchIndexRotationPeriod indexRotationPeriod() {
return ElasticsearchIndexRotationPeriod.fromValue(indexRotationPeriod);
}
/**
*
* The Elasticsearch index rotation period. Index rotation appends a timestamp to the IndexName
to
* facilitate the expiration of old data. For more information, see Index Rotation for
* the Amazon ES Destination. The default value is OneDay
.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #indexRotationPeriod} will return {@link ElasticsearchIndexRotationPeriod#UNKNOWN_TO_SDK_VERSION}. The raw
* value returned by the service is available from {@link #indexRotationPeriodAsString}.
*
*
* @return The Elasticsearch index rotation period. Index rotation appends a timestamp to the IndexName
* to facilitate the expiration of old data. For more information, see Index
* Rotation for the Amazon ES Destination. The default value is OneDay
.
* @see ElasticsearchIndexRotationPeriod
*/
public final String indexRotationPeriodAsString() {
return indexRotationPeriod;
}
/**
*
* The buffering options. If no value is specified, the default values for ElasticsearchBufferingHints
* are used.
*
*
* @return The buffering options. If no value is specified, the default values for
* ElasticsearchBufferingHints
are used.
*/
public final ElasticsearchBufferingHints bufferingHints() {
return bufferingHints;
}
/**
*
* The retry behavior in case Kinesis Data Firehose is unable to deliver documents to Amazon ES. The default value
* is 300 (5 minutes).
*
*
* @return The retry behavior in case Kinesis Data Firehose is unable to deliver documents to Amazon ES. The default
* value is 300 (5 minutes).
*/
public final ElasticsearchRetryOptions retryOptions() {
return retryOptions;
}
/**
*
* Defines how documents should be delivered to Amazon S3. When it is set to FailedDocumentsOnly
,
* Kinesis Data Firehose writes any documents that could not be indexed to the configured Amazon S3 destination,
* with elasticsearch-failed/
appended to the key prefix. When set to AllDocuments
,
* Kinesis Data Firehose delivers all incoming records to Amazon S3, and also writes failed documents with
* elasticsearch-failed/
appended to the prefix. For more information, see Amazon S3 Backup for the
* Amazon ES Destination. Default value is FailedDocumentsOnly
.
*
*
* You can't change this backup mode after you create the delivery stream.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #s3BackupMode} will
* return {@link ElasticsearchS3BackupMode#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #s3BackupModeAsString}.
*
*
* @return Defines how documents should be delivered to Amazon S3. When it is set to
* FailedDocumentsOnly
, Kinesis Data Firehose writes any documents that could not be indexed to
* the configured Amazon S3 destination, with elasticsearch-failed/
appended to the key prefix.
* When set to AllDocuments
, Kinesis Data Firehose delivers all incoming records to Amazon S3,
* and also writes failed documents with elasticsearch-failed/
appended to the prefix. For more
* information, see Amazon S3 Backup
* for the Amazon ES Destination. Default value is FailedDocumentsOnly
.
*
* You can't change this backup mode after you create the delivery stream.
* @see ElasticsearchS3BackupMode
*/
public final ElasticsearchS3BackupMode s3BackupMode() {
return ElasticsearchS3BackupMode.fromValue(s3BackupMode);
}
/**
*
* Defines how documents should be delivered to Amazon S3. When it is set to FailedDocumentsOnly
,
* Kinesis Data Firehose writes any documents that could not be indexed to the configured Amazon S3 destination,
* with elasticsearch-failed/
appended to the key prefix. When set to AllDocuments
,
* Kinesis Data Firehose delivers all incoming records to Amazon S3, and also writes failed documents with
* elasticsearch-failed/
appended to the prefix. For more information, see Amazon S3 Backup for the
* Amazon ES Destination. Default value is FailedDocumentsOnly
.
*
*
* You can't change this backup mode after you create the delivery stream.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #s3BackupMode} will
* return {@link ElasticsearchS3BackupMode#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #s3BackupModeAsString}.
*
*
* @return Defines how documents should be delivered to Amazon S3. When it is set to
* FailedDocumentsOnly
, Kinesis Data Firehose writes any documents that could not be indexed to
* the configured Amazon S3 destination, with elasticsearch-failed/
appended to the key prefix.
* When set to AllDocuments
, Kinesis Data Firehose delivers all incoming records to Amazon S3,
* and also writes failed documents with elasticsearch-failed/
appended to the prefix. For more
* information, see Amazon S3 Backup
* for the Amazon ES Destination. Default value is FailedDocumentsOnly
.
*
* You can't change this backup mode after you create the delivery stream.
* @see ElasticsearchS3BackupMode
*/
public final String s3BackupModeAsString() {
return s3BackupMode;
}
/**
*
* The configuration for the backup Amazon S3 location.
*
*
* @return The configuration for the backup Amazon S3 location.
*/
public final S3DestinationConfiguration s3Configuration() {
return s3Configuration;
}
/**
*
* The data processing configuration.
*
*
* @return The data processing configuration.
*/
public final ProcessingConfiguration processingConfiguration() {
return processingConfiguration;
}
/**
*
* The Amazon CloudWatch logging options for your delivery stream.
*
*
* @return The Amazon CloudWatch logging options for your delivery stream.
*/
public final CloudWatchLoggingOptions cloudWatchLoggingOptions() {
return cloudWatchLoggingOptions;
}
/**
*
* The details of the VPC of the Amazon ES destination.
*
*
* @return The details of the VPC of the Amazon ES destination.
*/
public final VpcConfiguration vpcConfiguration() {
return vpcConfiguration;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(roleARN());
hashCode = 31 * hashCode + Objects.hashCode(domainARN());
hashCode = 31 * hashCode + Objects.hashCode(clusterEndpoint());
hashCode = 31 * hashCode + Objects.hashCode(indexName());
hashCode = 31 * hashCode + Objects.hashCode(typeName());
hashCode = 31 * hashCode + Objects.hashCode(indexRotationPeriodAsString());
hashCode = 31 * hashCode + Objects.hashCode(bufferingHints());
hashCode = 31 * hashCode + Objects.hashCode(retryOptions());
hashCode = 31 * hashCode + Objects.hashCode(s3BackupModeAsString());
hashCode = 31 * hashCode + Objects.hashCode(s3Configuration());
hashCode = 31 * hashCode + Objects.hashCode(processingConfiguration());
hashCode = 31 * hashCode + Objects.hashCode(cloudWatchLoggingOptions());
hashCode = 31 * hashCode + Objects.hashCode(vpcConfiguration());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof ElasticsearchDestinationConfiguration)) {
return false;
}
ElasticsearchDestinationConfiguration other = (ElasticsearchDestinationConfiguration) obj;
return Objects.equals(roleARN(), other.roleARN()) && Objects.equals(domainARN(), other.domainARN())
&& Objects.equals(clusterEndpoint(), other.clusterEndpoint()) && Objects.equals(indexName(), other.indexName())
&& Objects.equals(typeName(), other.typeName())
&& Objects.equals(indexRotationPeriodAsString(), other.indexRotationPeriodAsString())
&& Objects.equals(bufferingHints(), other.bufferingHints())
&& Objects.equals(retryOptions(), other.retryOptions())
&& Objects.equals(s3BackupModeAsString(), other.s3BackupModeAsString())
&& Objects.equals(s3Configuration(), other.s3Configuration())
&& Objects.equals(processingConfiguration(), other.processingConfiguration())
&& Objects.equals(cloudWatchLoggingOptions(), other.cloudWatchLoggingOptions())
&& Objects.equals(vpcConfiguration(), other.vpcConfiguration());
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*/
@Override
public final String toString() {
return ToString.builder("ElasticsearchDestinationConfiguration").add("RoleARN", roleARN()).add("DomainARN", domainARN())
.add("ClusterEndpoint", clusterEndpoint()).add("IndexName", indexName()).add("TypeName", typeName())
.add("IndexRotationPeriod", indexRotationPeriodAsString()).add("BufferingHints", bufferingHints())
.add("RetryOptions", retryOptions()).add("S3BackupMode", s3BackupModeAsString())
.add("S3Configuration", s3Configuration()).add("ProcessingConfiguration", processingConfiguration())
.add("CloudWatchLoggingOptions", cloudWatchLoggingOptions()).add("VpcConfiguration", vpcConfiguration()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "RoleARN":
return Optional.ofNullable(clazz.cast(roleARN()));
case "DomainARN":
return Optional.ofNullable(clazz.cast(domainARN()));
case "ClusterEndpoint":
return Optional.ofNullable(clazz.cast(clusterEndpoint()));
case "IndexName":
return Optional.ofNullable(clazz.cast(indexName()));
case "TypeName":
return Optional.ofNullable(clazz.cast(typeName()));
case "IndexRotationPeriod":
return Optional.ofNullable(clazz.cast(indexRotationPeriodAsString()));
case "BufferingHints":
return Optional.ofNullable(clazz.cast(bufferingHints()));
case "RetryOptions":
return Optional.ofNullable(clazz.cast(retryOptions()));
case "S3BackupMode":
return Optional.ofNullable(clazz.cast(s3BackupModeAsString()));
case "S3Configuration":
return Optional.ofNullable(clazz.cast(s3Configuration()));
case "ProcessingConfiguration":
return Optional.ofNullable(clazz.cast(processingConfiguration()));
case "CloudWatchLoggingOptions":
return Optional.ofNullable(clazz.cast(cloudWatchLoggingOptions()));
case "VpcConfiguration":
return Optional.ofNullable(clazz.cast(vpcConfiguration()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function