software.amazon.awssdk.services.databasemigration.model.ElasticsearchSettings 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.databasemigration.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.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;
/**
*
* Provides information that defines an OpenSearch endpoint.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ElasticsearchSettings implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField SERVICE_ACCESS_ROLE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ServiceAccessRoleArn").getter(getter(ElasticsearchSettings::serviceAccessRoleArn))
.setter(setter(Builder::serviceAccessRoleArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ServiceAccessRoleArn").build())
.build();
private static final SdkField ENDPOINT_URI_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("EndpointUri").getter(getter(ElasticsearchSettings::endpointUri)).setter(setter(Builder::endpointUri))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EndpointUri").build()).build();
private static final SdkField FULL_LOAD_ERROR_PERCENTAGE_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("FullLoadErrorPercentage").getter(getter(ElasticsearchSettings::fullLoadErrorPercentage))
.setter(setter(Builder::fullLoadErrorPercentage))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FullLoadErrorPercentage").build())
.build();
private static final SdkField ERROR_RETRY_DURATION_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("ErrorRetryDuration").getter(getter(ElasticsearchSettings::errorRetryDuration))
.setter(setter(Builder::errorRetryDuration))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ErrorRetryDuration").build())
.build();
private static final SdkField USE_NEW_MAPPING_TYPE_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("UseNewMappingType").getter(getter(ElasticsearchSettings::useNewMappingType))
.setter(setter(Builder::useNewMappingType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UseNewMappingType").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(SERVICE_ACCESS_ROLE_ARN_FIELD,
ENDPOINT_URI_FIELD, FULL_LOAD_ERROR_PERCENTAGE_FIELD, ERROR_RETRY_DURATION_FIELD, USE_NEW_MAPPING_TYPE_FIELD));
private static final long serialVersionUID = 1L;
private final String serviceAccessRoleArn;
private final String endpointUri;
private final Integer fullLoadErrorPercentage;
private final Integer errorRetryDuration;
private final Boolean useNewMappingType;
private ElasticsearchSettings(BuilderImpl builder) {
this.serviceAccessRoleArn = builder.serviceAccessRoleArn;
this.endpointUri = builder.endpointUri;
this.fullLoadErrorPercentage = builder.fullLoadErrorPercentage;
this.errorRetryDuration = builder.errorRetryDuration;
this.useNewMappingType = builder.useNewMappingType;
}
/**
*
* The Amazon Resource Name (ARN) used by the service to access the IAM role. The role must allow the
* iam:PassRole
action.
*
*
* @return The Amazon Resource Name (ARN) used by the service to access the IAM role. The role must allow the
* iam:PassRole
action.
*/
public final String serviceAccessRoleArn() {
return serviceAccessRoleArn;
}
/**
*
* The endpoint for the OpenSearch cluster. DMS uses HTTPS if a transport protocol (http/https) is not specified.
*
*
* @return The endpoint for the OpenSearch cluster. DMS uses HTTPS if a transport protocol (http/https) is not
* specified.
*/
public final String endpointUri() {
return endpointUri;
}
/**
*
* The maximum percentage of records that can fail to be written before a full load operation stops.
*
*
* To avoid early failure, this counter is only effective after 1000 records are transferred. OpenSearch also has
* the concept of error monitoring during the last 10 minutes of an Observation Window. If transfer of all records
* fail in the last 10 minutes, the full load operation stops.
*
*
* @return The maximum percentage of records that can fail to be written before a full load operation stops.
*
* To avoid early failure, this counter is only effective after 1000 records are transferred. OpenSearch
* also has the concept of error monitoring during the last 10 minutes of an Observation Window. If transfer
* of all records fail in the last 10 minutes, the full load operation stops.
*/
public final Integer fullLoadErrorPercentage() {
return fullLoadErrorPercentage;
}
/**
*
* The maximum number of seconds for which DMS retries failed API requests to the OpenSearch cluster.
*
*
* @return The maximum number of seconds for which DMS retries failed API requests to the OpenSearch cluster.
*/
public final Integer errorRetryDuration() {
return errorRetryDuration;
}
/**
*
* Set this option to true
for DMS to migrate documentation using the documentation type
* _doc
. OpenSearch and an Elasticsearch cluster only support the _doc documentation type in versions
* 7. x and later. The default value is false
.
*
*
* @return Set this option to true
for DMS to migrate documentation using the documentation type
* _doc
. OpenSearch and an Elasticsearch cluster only support the _doc documentation type in
* versions 7. x and later. The default value is false
.
*/
public final Boolean useNewMappingType() {
return useNewMappingType;
}
@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(serviceAccessRoleArn());
hashCode = 31 * hashCode + Objects.hashCode(endpointUri());
hashCode = 31 * hashCode + Objects.hashCode(fullLoadErrorPercentage());
hashCode = 31 * hashCode + Objects.hashCode(errorRetryDuration());
hashCode = 31 * hashCode + Objects.hashCode(useNewMappingType());
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 ElasticsearchSettings)) {
return false;
}
ElasticsearchSettings other = (ElasticsearchSettings) obj;
return Objects.equals(serviceAccessRoleArn(), other.serviceAccessRoleArn())
&& Objects.equals(endpointUri(), other.endpointUri())
&& Objects.equals(fullLoadErrorPercentage(), other.fullLoadErrorPercentage())
&& Objects.equals(errorRetryDuration(), other.errorRetryDuration())
&& Objects.equals(useNewMappingType(), other.useNewMappingType());
}
/**
* 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("ElasticsearchSettings").add("ServiceAccessRoleArn", serviceAccessRoleArn())
.add("EndpointUri", endpointUri()).add("FullLoadErrorPercentage", fullLoadErrorPercentage())
.add("ErrorRetryDuration", errorRetryDuration()).add("UseNewMappingType", useNewMappingType()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ServiceAccessRoleArn":
return Optional.ofNullable(clazz.cast(serviceAccessRoleArn()));
case "EndpointUri":
return Optional.ofNullable(clazz.cast(endpointUri()));
case "FullLoadErrorPercentage":
return Optional.ofNullable(clazz.cast(fullLoadErrorPercentage()));
case "ErrorRetryDuration":
return Optional.ofNullable(clazz.cast(errorRetryDuration()));
case "UseNewMappingType":
return Optional.ofNullable(clazz.cast(useNewMappingType()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function