software.amazon.awssdk.services.databasemigration.model.ReloadTablesRequest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dms Show documentation
Show all versions of dms Show documentation
The AWS Java SDK for AWS Database Migration Service module holds the client classes that are used for
communicating with AWS Database Migration Service.
/*
* Copyright 2012-2017 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.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import javax.annotation.Generated;
import software.amazon.awssdk.core.AmazonWebServiceRequest;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public class ReloadTablesRequest extends AmazonWebServiceRequest implements
ToCopyableBuilder {
private final String replicationTaskArn;
private final List tablesToReload;
private ReloadTablesRequest(BuilderImpl builder) {
this.replicationTaskArn = builder.replicationTaskArn;
this.tablesToReload = builder.tablesToReload;
}
/**
*
* The Amazon Resource Name (ARN) of the replication instance.
*
*
* @return The Amazon Resource Name (ARN) of the replication instance.
*/
public String replicationTaskArn() {
return replicationTaskArn;
}
/**
*
* The name and schema of the table to be reloaded.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return The name and schema of the table to be reloaded.
*/
public List tablesToReload() {
return tablesToReload;
}
@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 + ((replicationTaskArn() == null) ? 0 : replicationTaskArn().hashCode());
hashCode = 31 * hashCode + ((tablesToReload() == null) ? 0 : tablesToReload().hashCode());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof ReloadTablesRequest)) {
return false;
}
ReloadTablesRequest other = (ReloadTablesRequest) obj;
if (other.replicationTaskArn() == null ^ this.replicationTaskArn() == null) {
return false;
}
if (other.replicationTaskArn() != null && !other.replicationTaskArn().equals(this.replicationTaskArn())) {
return false;
}
if (other.tablesToReload() == null ^ this.tablesToReload() == null) {
return false;
}
if (other.tablesToReload() != null && !other.tablesToReload().equals(this.tablesToReload())) {
return false;
}
return true;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("{");
if (replicationTaskArn() != null) {
sb.append("ReplicationTaskArn: ").append(replicationTaskArn()).append(",");
}
if (tablesToReload() != null) {
sb.append("TablesToReload: ").append(tablesToReload()).append(",");
}
if (sb.length() > 1) {
sb.setLength(sb.length() - 1);
}
sb.append("}");
return sb.toString();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ReplicationTaskArn":
return Optional.of(clazz.cast(replicationTaskArn()));
case "TablesToReload":
return Optional.of(clazz.cast(tablesToReload()));
default:
return Optional.empty();
}
}
public interface Builder extends CopyableBuilder {
/**
*
* The Amazon Resource Name (ARN) of the replication instance.
*
*
* @param replicationTaskArn
* 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 replicationTaskArn(String replicationTaskArn);
/**
*
* The name and schema of the table to be reloaded.
*
*
* @param tablesToReload
* The name and schema of the table to be reloaded.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder tablesToReload(Collection tablesToReload);
/**
*
* The name and schema of the table to be reloaded.
*
*
* @param tablesToReload
* The name and schema of the table to be reloaded.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder tablesToReload(TableToReload... tablesToReload);
}
static final class BuilderImpl implements Builder {
private String replicationTaskArn;
private List tablesToReload;
private BuilderImpl() {
}
private BuilderImpl(ReloadTablesRequest model) {
replicationTaskArn(model.replicationTaskArn);
tablesToReload(model.tablesToReload);
}
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 Collection getTablesToReload() {
return tablesToReload != null ? tablesToReload.stream().map(TableToReload::toBuilder).collect(Collectors.toList())
: null;
}
@Override
public final Builder tablesToReload(Collection tablesToReload) {
this.tablesToReload = TableListToReloadCopier.copy(tablesToReload);
return this;
}
@Override
@SafeVarargs
public final Builder tablesToReload(TableToReload... tablesToReload) {
tablesToReload(Arrays.asList(tablesToReload));
return this;
}
public final void setTablesToReload(Collection tablesToReload) {
this.tablesToReload = TableListToReloadCopier.copyFromBuilder(tablesToReload);
}
@Override
public ReloadTablesRequest build() {
return new ReloadTablesRequest(this);
}
}
}