software.amazon.awssdk.services.databasemigration.model.ReplicationTaskStats Maven / Gradle / Ivy
Show all versions of databasemigration Show documentation
/*
* 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.time.Instant;
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;
/**
*
* In response to a request by the DescribeReplicationTasks
operation, this object provides a collection of
* statistics about a replication task.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ReplicationTaskStats implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField FULL_LOAD_PROGRESS_PERCENT_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("FullLoadProgressPercent").getter(getter(ReplicationTaskStats::fullLoadProgressPercent))
.setter(setter(Builder::fullLoadProgressPercent))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FullLoadProgressPercent").build())
.build();
private static final SdkField ELAPSED_TIME_MILLIS_FIELD = SdkField. builder(MarshallingType.LONG)
.memberName("ElapsedTimeMillis").getter(getter(ReplicationTaskStats::elapsedTimeMillis))
.setter(setter(Builder::elapsedTimeMillis))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ElapsedTimeMillis").build()).build();
private static final SdkField TABLES_LOADED_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("TablesLoaded").getter(getter(ReplicationTaskStats::tablesLoaded)).setter(setter(Builder::tablesLoaded))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TablesLoaded").build()).build();
private static final SdkField TABLES_LOADING_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("TablesLoading").getter(getter(ReplicationTaskStats::tablesLoading))
.setter(setter(Builder::tablesLoading))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TablesLoading").build()).build();
private static final SdkField TABLES_QUEUED_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("TablesQueued").getter(getter(ReplicationTaskStats::tablesQueued)).setter(setter(Builder::tablesQueued))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TablesQueued").build()).build();
private static final SdkField TABLES_ERRORED_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("TablesErrored").getter(getter(ReplicationTaskStats::tablesErrored))
.setter(setter(Builder::tablesErrored))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TablesErrored").build()).build();
private static final SdkField FRESH_START_DATE_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("FreshStartDate").getter(getter(ReplicationTaskStats::freshStartDate))
.setter(setter(Builder::freshStartDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FreshStartDate").build()).build();
private static final SdkField START_DATE_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("StartDate").getter(getter(ReplicationTaskStats::startDate)).setter(setter(Builder::startDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StartDate").build()).build();
private static final SdkField STOP_DATE_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("StopDate").getter(getter(ReplicationTaskStats::stopDate)).setter(setter(Builder::stopDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StopDate").build()).build();
private static final SdkField FULL_LOAD_START_DATE_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("FullLoadStartDate").getter(getter(ReplicationTaskStats::fullLoadStartDate))
.setter(setter(Builder::fullLoadStartDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FullLoadStartDate").build()).build();
private static final SdkField FULL_LOAD_FINISH_DATE_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("FullLoadFinishDate").getter(getter(ReplicationTaskStats::fullLoadFinishDate))
.setter(setter(Builder::fullLoadFinishDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FullLoadFinishDate").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(
FULL_LOAD_PROGRESS_PERCENT_FIELD, ELAPSED_TIME_MILLIS_FIELD, TABLES_LOADED_FIELD, TABLES_LOADING_FIELD,
TABLES_QUEUED_FIELD, TABLES_ERRORED_FIELD, FRESH_START_DATE_FIELD, START_DATE_FIELD, STOP_DATE_FIELD,
FULL_LOAD_START_DATE_FIELD, FULL_LOAD_FINISH_DATE_FIELD));
private static final long serialVersionUID = 1L;
private final Integer fullLoadProgressPercent;
private final Long elapsedTimeMillis;
private final Integer tablesLoaded;
private final Integer tablesLoading;
private final Integer tablesQueued;
private final Integer tablesErrored;
private final Instant freshStartDate;
private final Instant startDate;
private final Instant stopDate;
private final Instant fullLoadStartDate;
private final Instant fullLoadFinishDate;
private ReplicationTaskStats(BuilderImpl builder) {
this.fullLoadProgressPercent = builder.fullLoadProgressPercent;
this.elapsedTimeMillis = builder.elapsedTimeMillis;
this.tablesLoaded = builder.tablesLoaded;
this.tablesLoading = builder.tablesLoading;
this.tablesQueued = builder.tablesQueued;
this.tablesErrored = builder.tablesErrored;
this.freshStartDate = builder.freshStartDate;
this.startDate = builder.startDate;
this.stopDate = builder.stopDate;
this.fullLoadStartDate = builder.fullLoadStartDate;
this.fullLoadFinishDate = builder.fullLoadFinishDate;
}
/**
*
* The percent complete for the full load migration task.
*
*
* @return The percent complete for the full load migration task.
*/
public final Integer fullLoadProgressPercent() {
return fullLoadProgressPercent;
}
/**
*
* The elapsed time of the task, in milliseconds.
*
*
* @return The elapsed time of the task, in milliseconds.
*/
public final Long elapsedTimeMillis() {
return elapsedTimeMillis;
}
/**
*
* The number of tables loaded for this task.
*
*
* @return The number of tables loaded for this task.
*/
public final Integer tablesLoaded() {
return tablesLoaded;
}
/**
*
* The number of tables currently loading for this task.
*
*
* @return The number of tables currently loading for this task.
*/
public final Integer tablesLoading() {
return tablesLoading;
}
/**
*
* The number of tables queued for this task.
*
*
* @return The number of tables queued for this task.
*/
public final Integer tablesQueued() {
return tablesQueued;
}
/**
*
* The number of errors that have occurred during this task.
*
*
* @return The number of errors that have occurred during this task.
*/
public final Integer tablesErrored() {
return tablesErrored;
}
/**
*
* The date the replication task was started either with a fresh start or a target reload.
*
*
* @return The date the replication task was started either with a fresh start or a target reload.
*/
public final Instant freshStartDate() {
return freshStartDate;
}
/**
*
* The date the replication task was started either with a fresh start or a resume. For more information, see StartReplicationTaskType.
*
*
* @return The date the replication task was started either with a fresh start or a resume. For more information,
* see StartReplicationTaskType.
*/
public final Instant startDate() {
return startDate;
}
/**
*
* The date the replication task was stopped.
*
*
* @return The date the replication task was stopped.
*/
public final Instant stopDate() {
return stopDate;
}
/**
*
* The date the replication task full load was started.
*
*
* @return The date the replication task full load was started.
*/
public final Instant fullLoadStartDate() {
return fullLoadStartDate;
}
/**
*
* The date the replication task full load was completed.
*
*
* @return The date the replication task full load was completed.
*/
public final Instant fullLoadFinishDate() {
return fullLoadFinishDate;
}
@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(fullLoadProgressPercent());
hashCode = 31 * hashCode + Objects.hashCode(elapsedTimeMillis());
hashCode = 31 * hashCode + Objects.hashCode(tablesLoaded());
hashCode = 31 * hashCode + Objects.hashCode(tablesLoading());
hashCode = 31 * hashCode + Objects.hashCode(tablesQueued());
hashCode = 31 * hashCode + Objects.hashCode(tablesErrored());
hashCode = 31 * hashCode + Objects.hashCode(freshStartDate());
hashCode = 31 * hashCode + Objects.hashCode(startDate());
hashCode = 31 * hashCode + Objects.hashCode(stopDate());
hashCode = 31 * hashCode + Objects.hashCode(fullLoadStartDate());
hashCode = 31 * hashCode + Objects.hashCode(fullLoadFinishDate());
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 ReplicationTaskStats)) {
return false;
}
ReplicationTaskStats other = (ReplicationTaskStats) obj;
return Objects.equals(fullLoadProgressPercent(), other.fullLoadProgressPercent())
&& Objects.equals(elapsedTimeMillis(), other.elapsedTimeMillis())
&& Objects.equals(tablesLoaded(), other.tablesLoaded()) && Objects.equals(tablesLoading(), other.tablesLoading())
&& Objects.equals(tablesQueued(), other.tablesQueued()) && Objects.equals(tablesErrored(), other.tablesErrored())
&& Objects.equals(freshStartDate(), other.freshStartDate()) && Objects.equals(startDate(), other.startDate())
&& Objects.equals(stopDate(), other.stopDate()) && Objects.equals(fullLoadStartDate(), other.fullLoadStartDate())
&& Objects.equals(fullLoadFinishDate(), other.fullLoadFinishDate());
}
/**
* 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("ReplicationTaskStats").add("FullLoadProgressPercent", fullLoadProgressPercent())
.add("ElapsedTimeMillis", elapsedTimeMillis()).add("TablesLoaded", tablesLoaded())
.add("TablesLoading", tablesLoading()).add("TablesQueued", tablesQueued()).add("TablesErrored", tablesErrored())
.add("FreshStartDate", freshStartDate()).add("StartDate", startDate()).add("StopDate", stopDate())
.add("FullLoadStartDate", fullLoadStartDate()).add("FullLoadFinishDate", fullLoadFinishDate()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "FullLoadProgressPercent":
return Optional.ofNullable(clazz.cast(fullLoadProgressPercent()));
case "ElapsedTimeMillis":
return Optional.ofNullable(clazz.cast(elapsedTimeMillis()));
case "TablesLoaded":
return Optional.ofNullable(clazz.cast(tablesLoaded()));
case "TablesLoading":
return Optional.ofNullable(clazz.cast(tablesLoading()));
case "TablesQueued":
return Optional.ofNullable(clazz.cast(tablesQueued()));
case "TablesErrored":
return Optional.ofNullable(clazz.cast(tablesErrored()));
case "FreshStartDate":
return Optional.ofNullable(clazz.cast(freshStartDate()));
case "StartDate":
return Optional.ofNullable(clazz.cast(startDate()));
case "StopDate":
return Optional.ofNullable(clazz.cast(stopDate()));
case "FullLoadStartDate":
return Optional.ofNullable(clazz.cast(fullLoadStartDate()));
case "FullLoadFinishDate":
return Optional.ofNullable(clazz.cast(fullLoadFinishDate()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function