software.amazon.awssdk.services.databasemigration.model.CreateReplicationTaskRequest 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.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
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 CreateReplicationTaskRequest extends DatabaseMigrationRequest implements
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 Instant cdcStartTime;
private final List tags;
private CreateReplicationTaskRequest(BuilderImpl builder) {
super(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.cdcStartTime = builder.cdcStartTime;
this.tags = builder.tags;
}
/**
*
* 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 migration type.
*
*
* 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 migration type.
* @see MigrationTypeValue
*/
public MigrationTypeValue migrationType() {
return MigrationTypeValue.fromValue(migrationType);
}
/**
*
* The migration type.
*
*
* 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 migration type.
* @see MigrationTypeValue
*/
public String migrationTypeAsString() {
return migrationType;
}
/**
*
* When using the AWS CLI or boto3, provide the path of the JSON file that contains the table mappings. Precede the
* path with "file://". When working with the DMS API, provide the JSON as the parameter value.
*
*
* For example, --table-mappings file://mappingfile.json
*
*
* @return When using the AWS CLI or boto3, provide the path of the JSON file that contains the table mappings.
* Precede the path with "file://". When working with the DMS API, provide the JSON as the parameter
* value.
*
* For example, --table-mappings file://mappingfile.json
*/
public String tableMappings() {
return tableMappings;
}
/**
*
* Settings for the task, such as target metadata settings. For a complete list of task settings, see Task
* Settings for AWS Database Migration Service Tasks.
*
*
* @return Settings for the task, such as target metadata settings. For a complete list of task settings, see Task
* Settings for AWS Database Migration Service Tasks.
*/
public String replicationTaskSettings() {
return replicationTaskSettings;
}
/**
*
* The start time for the Change Data Capture (CDC) operation.
*
*
* @return The start time for the Change Data Capture (CDC) operation.
*/
public Instant cdcStartTime() {
return cdcStartTime;
}
/**
*
* Tags to be added to the replication instance.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return Tags to be added to the replication instance.
*/
public List tags() {
return tags;
}
@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(cdcStartTime());
hashCode = 31 * hashCode + Objects.hashCode(tags());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof CreateReplicationTaskRequest)) {
return false;
}
CreateReplicationTaskRequest other = (CreateReplicationTaskRequest) 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(cdcStartTime(), other.cdcStartTime()) && Objects.equals(tags(), other.tags());
}
@Override
public String toString() {
return ToString.builder("CreateReplicationTaskRequest").add("ReplicationTaskIdentifier", replicationTaskIdentifier())
.add("SourceEndpointArn", sourceEndpointArn()).add("TargetEndpointArn", targetEndpointArn())
.add("ReplicationInstanceArn", replicationInstanceArn()).add("MigrationType", migrationTypeAsString())
.add("TableMappings", tableMappings()).add("ReplicationTaskSettings", replicationTaskSettings())
.add("CdcStartTime", cdcStartTime()).add("Tags", tags()).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 "CdcStartTime":
return Optional.ofNullable(clazz.cast(cdcStartTime()));
case "Tags":
return Optional.ofNullable(clazz.cast(tags()));
default:
return Optional.empty();
}
}
public interface Builder extends DatabaseMigrationRequest.Builder, 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 migration type.
*
*
* @param migrationType
* The migration type.
* @see MigrationTypeValue
* @return Returns a reference to this object so that method calls can be chained together.
* @see MigrationTypeValue
*/
Builder migrationType(String migrationType);
/**
*
* The migration type.
*
*
* @param migrationType
* The migration type.
* @see MigrationTypeValue
* @return Returns a reference to this object so that method calls can be chained together.
* @see MigrationTypeValue
*/
Builder migrationType(MigrationTypeValue migrationType);
/**
*
* When using the AWS CLI or boto3, provide the path of the JSON file that contains the table mappings. Precede
* the path with "file://". When working with the DMS API, provide the JSON as the parameter value.
*
*
* For example, --table-mappings file://mappingfile.json
*
*
* @param tableMappings
* When using the AWS CLI or boto3, provide the path of the JSON file that contains the table mappings.
* Precede the path with "file://". When working with the DMS API, provide the JSON as the parameter
* value.
*
* For example, --table-mappings file://mappingfile.json
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder tableMappings(String tableMappings);
/**
*
* Settings for the task, such as target metadata settings. For a complete list of task settings, see Task
* Settings for AWS Database Migration Service Tasks.
*
*
* @param replicationTaskSettings
* Settings for the task, such as target metadata settings. For a complete list of task settings, see Task
* Settings for AWS Database Migration Service Tasks.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder replicationTaskSettings(String replicationTaskSettings);
/**
*
* The start time for the Change Data Capture (CDC) operation.
*
*
* @param cdcStartTime
* The start time for the Change Data Capture (CDC) operation.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder cdcStartTime(Instant cdcStartTime);
/**
*
* Tags to be added to the replication instance.
*
*
* @param tags
* Tags to be added to the replication instance.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder tags(Collection tags);
/**
*
* Tags to be added to the replication instance.
*
*
* @param tags
* Tags to be added to the replication instance.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder tags(Tag... tags);
/**
*
* Tags to be added to the replication instance.
*
* This is a convenience that creates an instance of the {@link List.Builder} avoiding the need to create
* one manually via {@link List#builder()}.
*
* When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately and its result
* is passed to {@link #tags(List)}.
*
* @param tags
* a consumer that will call methods on {@link List.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #tags(List)
*/
Builder tags(Consumer... tags);
@Override
Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration);
@Override
Builder overrideConfiguration(Consumer builderConsumer);
}
static final class BuilderImpl extends DatabaseMigrationRequest.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 Instant cdcStartTime;
private List tags = DefaultSdkAutoConstructList.getInstance();
private BuilderImpl() {
}
private BuilderImpl(CreateReplicationTaskRequest model) {
super(model);
replicationTaskIdentifier(model.replicationTaskIdentifier);
sourceEndpointArn(model.sourceEndpointArn);
targetEndpointArn(model.targetEndpointArn);
replicationInstanceArn(model.replicationInstanceArn);
migrationType(model.migrationType);
tableMappings(model.tableMappings);
replicationTaskSettings(model.replicationTaskSettings);
cdcStartTime(model.cdcStartTime);
tags(model.tags);
}
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 Instant getCdcStartTime() {
return cdcStartTime;
}
@Override
public final Builder cdcStartTime(Instant cdcStartTime) {
this.cdcStartTime = cdcStartTime;
return this;
}
public final void setCdcStartTime(Instant cdcStartTime) {
this.cdcStartTime = cdcStartTime;
}
public final Collection getTags() {
return tags != null ? tags.stream().map(Tag::toBuilder).collect(Collectors.toList()) : null;
}
@Override
public final Builder tags(Collection tags) {
this.tags = TagListCopier.copy(tags);
return this;
}
@Override
@SafeVarargs
public final Builder tags(Tag... tags) {
tags(Arrays.asList(tags));
return this;
}
@Override
@SafeVarargs
public final Builder tags(Consumer... tags) {
tags(Stream.of(tags).map(c -> Tag.builder().applyMutation(c).build()).collect(Collectors.toList()));
return this;
}
public final void setTags(Collection tags) {
this.tags = TagListCopier.copyFromBuilder(tags);
}
@Override
public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) {
super.overrideConfiguration(overrideConfiguration);
return this;
}
@Override
public Builder overrideConfiguration(Consumer builderConsumer) {
super.overrideConfiguration(builderConsumer);
return this;
}
@Override
public CreateReplicationTaskRequest build() {
return new CreateReplicationTaskRequest(this);
}
}
}