software.amazon.awssdk.services.databasemigration.model.ReplicationTask Maven / Gradle / Ivy
Show all versions of dms Show documentation
/*
* Copyright 2013-2018 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.time.Instant;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Consumer;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.core.protocol.ProtocolMarshaller;
import software.amazon.awssdk.core.protocol.StructuredPojo;
import software.amazon.awssdk.services.databasemigration.transform.ReplicationTaskMarshaller;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ReplicationTask implements StructuredPojo, ToCopyableBuilder {
private final String replicationTaskIdentifier;
private final String sourceEndpointArn;
private final String targetEndpointArn;
private final String replicationInstanceArn;
private final String migrationType;
private final String tableMappings;
private final String replicationTaskSettings;
private final String status;
private final String lastFailureMessage;
private final String stopReason;
private final Instant replicationTaskCreationDate;
private final Instant replicationTaskStartDate;
private final String replicationTaskArn;
private final ReplicationTaskStats replicationTaskStats;
private ReplicationTask(BuilderImpl builder) {
this.replicationTaskIdentifier = builder.replicationTaskIdentifier;
this.sourceEndpointArn = builder.sourceEndpointArn;
this.targetEndpointArn = builder.targetEndpointArn;
this.replicationInstanceArn = builder.replicationInstanceArn;
this.migrationType = builder.migrationType;
this.tableMappings = builder.tableMappings;
this.replicationTaskSettings = builder.replicationTaskSettings;
this.status = builder.status;
this.lastFailureMessage = builder.lastFailureMessage;
this.stopReason = builder.stopReason;
this.replicationTaskCreationDate = builder.replicationTaskCreationDate;
this.replicationTaskStartDate = builder.replicationTaskStartDate;
this.replicationTaskArn = builder.replicationTaskArn;
this.replicationTaskStats = builder.replicationTaskStats;
}
/**
*
* The replication task identifier.
*
*
* Constraints:
*
*
* -
*
* Must contain from 1 to 255 alphanumeric characters or hyphens.
*
*
* -
*
* First character must be a letter.
*
*
* -
*
* Cannot end with a hyphen or contain two consecutive hyphens.
*
*
*
*
* @return The replication task identifier.
*
* Constraints:
*
*
* -
*
* Must contain from 1 to 255 alphanumeric characters or hyphens.
*
*
* -
*
* First character must be a letter.
*
*
* -
*
* Cannot end with a hyphen or contain two consecutive hyphens.
*
*
*/
public String replicationTaskIdentifier() {
return replicationTaskIdentifier;
}
/**
*
* The Amazon Resource Name (ARN) string that uniquely identifies the endpoint.
*
*
* @return The Amazon Resource Name (ARN) string that uniquely identifies the endpoint.
*/
public String sourceEndpointArn() {
return sourceEndpointArn;
}
/**
*
* The Amazon Resource Name (ARN) string that uniquely identifies the endpoint.
*
*
* @return The Amazon Resource Name (ARN) string that uniquely identifies the endpoint.
*/
public String targetEndpointArn() {
return targetEndpointArn;
}
/**
*
* The Amazon Resource Name (ARN) of the replication instance.
*
*
* @return The Amazon Resource Name (ARN) of the replication instance.
*/
public String replicationInstanceArn() {
return replicationInstanceArn;
}
/**
*
* The type of migration.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #migrationType}
* will return {@link MigrationTypeValue#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #migrationTypeAsString}.
*
*
* @return The type of migration.
* @see MigrationTypeValue
*/
public MigrationTypeValue migrationType() {
return MigrationTypeValue.fromValue(migrationType);
}
/**
*
* The type of migration.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #migrationType}
* will return {@link MigrationTypeValue#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #migrationTypeAsString}.
*
*
* @return The type of migration.
* @see MigrationTypeValue
*/
public String migrationTypeAsString() {
return migrationType;
}
/**
*
* Table mappings specified in the task.
*
*
* @return Table mappings specified in the task.
*/
public String tableMappings() {
return tableMappings;
}
/**
*
* The settings for the replication task.
*
*
* @return The settings for the replication task.
*/
public String replicationTaskSettings() {
return replicationTaskSettings;
}
/**
*
* The status of the replication task.
*
*
* @return The status of the replication task.
*/
public String status() {
return status;
}
/**
*
* The last error (failure) message generated for the replication instance.
*
*
* @return The last error (failure) message generated for the replication instance.
*/
public String lastFailureMessage() {
return lastFailureMessage;
}
/**
*
* The reason the replication task was stopped.
*
*
* @return The reason the replication task was stopped.
*/
public String stopReason() {
return stopReason;
}
/**
*
* The date the replication task was created.
*
*
* @return The date the replication task was created.
*/
public Instant replicationTaskCreationDate() {
return replicationTaskCreationDate;
}
/**
*
* The date the replication task is scheduled to start.
*
*
* @return The date the replication task is scheduled to start.
*/
public Instant replicationTaskStartDate() {
return replicationTaskStartDate;
}
/**
*
* The Amazon Resource Name (ARN) of the replication task.
*
*
* @return The Amazon Resource Name (ARN) of the replication task.
*/
public String replicationTaskArn() {
return replicationTaskArn;
}
/**
*
* The statistics for the task, including elapsed time, tables loaded, and table errors.
*
*
* @return The statistics for the task, including elapsed time, tables loaded, and table errors.
*/
public ReplicationTaskStats replicationTaskStats() {
return replicationTaskStats;
}
@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 int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(replicationTaskIdentifier());
hashCode = 31 * hashCode + Objects.hashCode(sourceEndpointArn());
hashCode = 31 * hashCode + Objects.hashCode(targetEndpointArn());
hashCode = 31 * hashCode + Objects.hashCode(replicationInstanceArn());
hashCode = 31 * hashCode + Objects.hashCode(migrationTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(tableMappings());
hashCode = 31 * hashCode + Objects.hashCode(replicationTaskSettings());
hashCode = 31 * hashCode + Objects.hashCode(status());
hashCode = 31 * hashCode + Objects.hashCode(lastFailureMessage());
hashCode = 31 * hashCode + Objects.hashCode(stopReason());
hashCode = 31 * hashCode + Objects.hashCode(replicationTaskCreationDate());
hashCode = 31 * hashCode + Objects.hashCode(replicationTaskStartDate());
hashCode = 31 * hashCode + Objects.hashCode(replicationTaskArn());
hashCode = 31 * hashCode + Objects.hashCode(replicationTaskStats());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof ReplicationTask)) {
return false;
}
ReplicationTask other = (ReplicationTask) obj;
return Objects.equals(replicationTaskIdentifier(), other.replicationTaskIdentifier())
&& Objects.equals(sourceEndpointArn(), other.sourceEndpointArn())
&& Objects.equals(targetEndpointArn(), other.targetEndpointArn())
&& Objects.equals(replicationInstanceArn(), other.replicationInstanceArn())
&& Objects.equals(migrationTypeAsString(), other.migrationTypeAsString())
&& Objects.equals(tableMappings(), other.tableMappings())
&& Objects.equals(replicationTaskSettings(), other.replicationTaskSettings())
&& Objects.equals(status(), other.status()) && Objects.equals(lastFailureMessage(), other.lastFailureMessage())
&& Objects.equals(stopReason(), other.stopReason())
&& Objects.equals(replicationTaskCreationDate(), other.replicationTaskCreationDate())
&& Objects.equals(replicationTaskStartDate(), other.replicationTaskStartDate())
&& Objects.equals(replicationTaskArn(), other.replicationTaskArn())
&& Objects.equals(replicationTaskStats(), other.replicationTaskStats());
}
@Override
public String toString() {
return ToString.builder("ReplicationTask").add("ReplicationTaskIdentifier", replicationTaskIdentifier())
.add("SourceEndpointArn", sourceEndpointArn()).add("TargetEndpointArn", targetEndpointArn())
.add("ReplicationInstanceArn", replicationInstanceArn()).add("MigrationType", migrationTypeAsString())
.add("TableMappings", tableMappings()).add("ReplicationTaskSettings", replicationTaskSettings())
.add("Status", status()).add("LastFailureMessage", lastFailureMessage()).add("StopReason", stopReason())
.add("ReplicationTaskCreationDate", replicationTaskCreationDate())
.add("ReplicationTaskStartDate", replicationTaskStartDate()).add("ReplicationTaskArn", replicationTaskArn())
.add("ReplicationTaskStats", replicationTaskStats()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ReplicationTaskIdentifier":
return Optional.ofNullable(clazz.cast(replicationTaskIdentifier()));
case "SourceEndpointArn":
return Optional.ofNullable(clazz.cast(sourceEndpointArn()));
case "TargetEndpointArn":
return Optional.ofNullable(clazz.cast(targetEndpointArn()));
case "ReplicationInstanceArn":
return Optional.ofNullable(clazz.cast(replicationInstanceArn()));
case "MigrationType":
return Optional.ofNullable(clazz.cast(migrationTypeAsString()));
case "TableMappings":
return Optional.ofNullable(clazz.cast(tableMappings()));
case "ReplicationTaskSettings":
return Optional.ofNullable(clazz.cast(replicationTaskSettings()));
case "Status":
return Optional.ofNullable(clazz.cast(status()));
case "LastFailureMessage":
return Optional.ofNullable(clazz.cast(lastFailureMessage()));
case "StopReason":
return Optional.ofNullable(clazz.cast(stopReason()));
case "ReplicationTaskCreationDate":
return Optional.ofNullable(clazz.cast(replicationTaskCreationDate()));
case "ReplicationTaskStartDate":
return Optional.ofNullable(clazz.cast(replicationTaskStartDate()));
case "ReplicationTaskArn":
return Optional.ofNullable(clazz.cast(replicationTaskArn()));
case "ReplicationTaskStats":
return Optional.ofNullable(clazz.cast(replicationTaskStats()));
default:
return Optional.empty();
}
}
@SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
ReplicationTaskMarshaller.getInstance().marshall(this, protocolMarshaller);
}
public interface Builder extends CopyableBuilder {
/**
*
* The replication task identifier.
*
*
* Constraints:
*
*
* -
*
* Must contain from 1 to 255 alphanumeric characters or hyphens.
*
*
* -
*
* First character must be a letter.
*
*
* -
*
* Cannot end with a hyphen or contain two consecutive hyphens.
*
*
*
*
* @param replicationTaskIdentifier
* The replication task identifier.
*
* Constraints:
*
*
* -
*
* Must contain from 1 to 255 alphanumeric characters or hyphens.
*
*
* -
*
* First character must be a letter.
*
*
* -
*
* Cannot end with a hyphen or contain two consecutive hyphens.
*
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder replicationTaskIdentifier(String replicationTaskIdentifier);
/**
*
* The Amazon Resource Name (ARN) string that uniquely identifies the endpoint.
*
*
* @param sourceEndpointArn
* The Amazon Resource Name (ARN) string that uniquely identifies the endpoint.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder sourceEndpointArn(String sourceEndpointArn);
/**
*
* The Amazon Resource Name (ARN) string that uniquely identifies the endpoint.
*
*
* @param targetEndpointArn
* The Amazon Resource Name (ARN) string that uniquely identifies the endpoint.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder targetEndpointArn(String targetEndpointArn);
/**
*
* The Amazon Resource Name (ARN) of the replication instance.
*
*
* @param replicationInstanceArn
* The Amazon Resource Name (ARN) of the replication instance.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder replicationInstanceArn(String replicationInstanceArn);
/**
*
* The type of migration.
*
*
* @param migrationType
* The type of migration.
* @see MigrationTypeValue
* @return Returns a reference to this object so that method calls can be chained together.
* @see MigrationTypeValue
*/
Builder migrationType(String migrationType);
/**
*
* The type of migration.
*
*
* @param migrationType
* The type of migration.
* @see MigrationTypeValue
* @return Returns a reference to this object so that method calls can be chained together.
* @see MigrationTypeValue
*/
Builder migrationType(MigrationTypeValue migrationType);
/**
*
* Table mappings specified in the task.
*
*
* @param tableMappings
* Table mappings specified in the task.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder tableMappings(String tableMappings);
/**
*
* The settings for the replication task.
*
*
* @param replicationTaskSettings
* The settings for the replication task.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder replicationTaskSettings(String replicationTaskSettings);
/**
*
* The status of the replication task.
*
*
* @param status
* The status of the replication task.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder status(String status);
/**
*
* The last error (failure) message generated for the replication instance.
*
*
* @param lastFailureMessage
* The last error (failure) message generated for the replication instance.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder lastFailureMessage(String lastFailureMessage);
/**
*
* The reason the replication task was stopped.
*
*
* @param stopReason
* The reason the replication task was stopped.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder stopReason(String stopReason);
/**
*
* The date the replication task was created.
*
*
* @param replicationTaskCreationDate
* The date the replication task was created.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder replicationTaskCreationDate(Instant replicationTaskCreationDate);
/**
*
* The date the replication task is scheduled to start.
*
*
* @param replicationTaskStartDate
* The date the replication task is scheduled to start.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder replicationTaskStartDate(Instant replicationTaskStartDate);
/**
*
* The Amazon Resource Name (ARN) of the replication task.
*
*
* @param replicationTaskArn
* The Amazon Resource Name (ARN) of the replication task.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder replicationTaskArn(String replicationTaskArn);
/**
*
* The statistics for the task, including elapsed time, tables loaded, and table errors.
*
*
* @param replicationTaskStats
* The statistics for the task, including elapsed time, tables loaded, and table errors.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder replicationTaskStats(ReplicationTaskStats replicationTaskStats);
/**
*
* The statistics for the task, including elapsed time, tables loaded, and table errors.
*
* This is a convenience that creates an instance of the {@link ReplicationTaskStats.Builder} avoiding the need
* to create one manually via {@link ReplicationTaskStats#builder()}.
*
* When the {@link Consumer} completes, {@link ReplicationTaskStats.Builder#build()} is called immediately and
* its result is passed to {@link #replicationTaskStats(ReplicationTaskStats)}.
*
* @param replicationTaskStats
* a consumer that will call methods on {@link ReplicationTaskStats.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #replicationTaskStats(ReplicationTaskStats)
*/
default Builder replicationTaskStats(Consumer replicationTaskStats) {
return replicationTaskStats(ReplicationTaskStats.builder().applyMutation(replicationTaskStats).build());
}
}
static final class BuilderImpl implements Builder {
private String replicationTaskIdentifier;
private String sourceEndpointArn;
private String targetEndpointArn;
private String replicationInstanceArn;
private String migrationType;
private String tableMappings;
private String replicationTaskSettings;
private String status;
private String lastFailureMessage;
private String stopReason;
private Instant replicationTaskCreationDate;
private Instant replicationTaskStartDate;
private String replicationTaskArn;
private ReplicationTaskStats replicationTaskStats;
private BuilderImpl() {
}
private BuilderImpl(ReplicationTask model) {
replicationTaskIdentifier(model.replicationTaskIdentifier);
sourceEndpointArn(model.sourceEndpointArn);
targetEndpointArn(model.targetEndpointArn);
replicationInstanceArn(model.replicationInstanceArn);
migrationType(model.migrationType);
tableMappings(model.tableMappings);
replicationTaskSettings(model.replicationTaskSettings);
status(model.status);
lastFailureMessage(model.lastFailureMessage);
stopReason(model.stopReason);
replicationTaskCreationDate(model.replicationTaskCreationDate);
replicationTaskStartDate(model.replicationTaskStartDate);
replicationTaskArn(model.replicationTaskArn);
replicationTaskStats(model.replicationTaskStats);
}
public final String getReplicationTaskIdentifier() {
return replicationTaskIdentifier;
}
@Override
public final Builder replicationTaskIdentifier(String replicationTaskIdentifier) {
this.replicationTaskIdentifier = replicationTaskIdentifier;
return this;
}
public final void setReplicationTaskIdentifier(String replicationTaskIdentifier) {
this.replicationTaskIdentifier = replicationTaskIdentifier;
}
public final String getSourceEndpointArn() {
return sourceEndpointArn;
}
@Override
public final Builder sourceEndpointArn(String sourceEndpointArn) {
this.sourceEndpointArn = sourceEndpointArn;
return this;
}
public final void setSourceEndpointArn(String sourceEndpointArn) {
this.sourceEndpointArn = sourceEndpointArn;
}
public final String getTargetEndpointArn() {
return targetEndpointArn;
}
@Override
public final Builder targetEndpointArn(String targetEndpointArn) {
this.targetEndpointArn = targetEndpointArn;
return this;
}
public final void setTargetEndpointArn(String targetEndpointArn) {
this.targetEndpointArn = targetEndpointArn;
}
public final String getReplicationInstanceArn() {
return replicationInstanceArn;
}
@Override
public final Builder replicationInstanceArn(String replicationInstanceArn) {
this.replicationInstanceArn = replicationInstanceArn;
return this;
}
public final void setReplicationInstanceArn(String replicationInstanceArn) {
this.replicationInstanceArn = replicationInstanceArn;
}
public final String getMigrationType() {
return migrationType;
}
@Override
public final Builder migrationType(String migrationType) {
this.migrationType = migrationType;
return this;
}
@Override
public final Builder migrationType(MigrationTypeValue migrationType) {
this.migrationType(migrationType.toString());
return this;
}
public final void setMigrationType(String migrationType) {
this.migrationType = migrationType;
}
public final String getTableMappings() {
return tableMappings;
}
@Override
public final Builder tableMappings(String tableMappings) {
this.tableMappings = tableMappings;
return this;
}
public final void setTableMappings(String tableMappings) {
this.tableMappings = tableMappings;
}
public final String getReplicationTaskSettings() {
return replicationTaskSettings;
}
@Override
public final Builder replicationTaskSettings(String replicationTaskSettings) {
this.replicationTaskSettings = replicationTaskSettings;
return this;
}
public final void setReplicationTaskSettings(String replicationTaskSettings) {
this.replicationTaskSettings = replicationTaskSettings;
}
public final String getStatus() {
return status;
}
@Override
public final Builder status(String status) {
this.status = status;
return this;
}
public final void setStatus(String status) {
this.status = status;
}
public final String getLastFailureMessage() {
return lastFailureMessage;
}
@Override
public final Builder lastFailureMessage(String lastFailureMessage) {
this.lastFailureMessage = lastFailureMessage;
return this;
}
public final void setLastFailureMessage(String lastFailureMessage) {
this.lastFailureMessage = lastFailureMessage;
}
public final String getStopReason() {
return stopReason;
}
@Override
public final Builder stopReason(String stopReason) {
this.stopReason = stopReason;
return this;
}
public final void setStopReason(String stopReason) {
this.stopReason = stopReason;
}
public final Instant getReplicationTaskCreationDate() {
return replicationTaskCreationDate;
}
@Override
public final Builder replicationTaskCreationDate(Instant replicationTaskCreationDate) {
this.replicationTaskCreationDate = replicationTaskCreationDate;
return this;
}
public final void setReplicationTaskCreationDate(Instant replicationTaskCreationDate) {
this.replicationTaskCreationDate = replicationTaskCreationDate;
}
public final Instant getReplicationTaskStartDate() {
return replicationTaskStartDate;
}
@Override
public final Builder replicationTaskStartDate(Instant replicationTaskStartDate) {
this.replicationTaskStartDate = replicationTaskStartDate;
return this;
}
public final void setReplicationTaskStartDate(Instant replicationTaskStartDate) {
this.replicationTaskStartDate = replicationTaskStartDate;
}
public final String getReplicationTaskArn() {
return replicationTaskArn;
}
@Override
public final Builder replicationTaskArn(String replicationTaskArn) {
this.replicationTaskArn = replicationTaskArn;
return this;
}
public final void setReplicationTaskArn(String replicationTaskArn) {
this.replicationTaskArn = replicationTaskArn;
}
public final ReplicationTaskStats.Builder getReplicationTaskStats() {
return replicationTaskStats != null ? replicationTaskStats.toBuilder() : null;
}
@Override
public final Builder replicationTaskStats(ReplicationTaskStats replicationTaskStats) {
this.replicationTaskStats = replicationTaskStats;
return this;
}
public final void setReplicationTaskStats(ReplicationTaskStats.BuilderImpl replicationTaskStats) {
this.replicationTaskStats = replicationTaskStats != null ? replicationTaskStats.build() : null;
}
@Override
public ReplicationTask build() {
return new ReplicationTask(this);
}
}
}