
software.amazon.awssdk.services.migrationhubstrategy.model.DataCollectionDetails 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.migrationhubstrategy.model;
import java.io.Serializable;
import java.time.Instant;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
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;
/**
*
* Detailed information about an assessment.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class DataCollectionDetails implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField COMPLETION_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("completionTime").getter(getter(DataCollectionDetails::completionTime))
.setter(setter(Builder::completionTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("completionTime").build()).build();
private static final SdkField FAILED_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("failed").getter(getter(DataCollectionDetails::failed)).setter(setter(Builder::failed))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("failed").build()).build();
private static final SdkField IN_PROGRESS_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("inProgress").getter(getter(DataCollectionDetails::inProgress)).setter(setter(Builder::inProgress))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("inProgress").build()).build();
private static final SdkField SERVERS_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("servers").getter(getter(DataCollectionDetails::servers)).setter(setter(Builder::servers))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("servers").build()).build();
private static final SdkField START_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("startTime").getter(getter(DataCollectionDetails::startTime)).setter(setter(Builder::startTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("startTime").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("status")
.getter(getter(DataCollectionDetails::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("status").build()).build();
private static final SdkField STATUS_MESSAGE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("statusMessage").getter(getter(DataCollectionDetails::statusMessage))
.setter(setter(Builder::statusMessage))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("statusMessage").build()).build();
private static final SdkField SUCCESS_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("success").getter(getter(DataCollectionDetails::success)).setter(setter(Builder::success))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("success").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(COMPLETION_TIME_FIELD,
FAILED_FIELD, IN_PROGRESS_FIELD, SERVERS_FIELD, START_TIME_FIELD, STATUS_FIELD, STATUS_MESSAGE_FIELD, SUCCESS_FIELD));
private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer();
private static final long serialVersionUID = 1L;
private final Instant completionTime;
private final Integer failed;
private final Integer inProgress;
private final Integer servers;
private final Instant startTime;
private final String status;
private final String statusMessage;
private final Integer success;
private DataCollectionDetails(BuilderImpl builder) {
this.completionTime = builder.completionTime;
this.failed = builder.failed;
this.inProgress = builder.inProgress;
this.servers = builder.servers;
this.startTime = builder.startTime;
this.status = builder.status;
this.statusMessage = builder.statusMessage;
this.success = builder.success;
}
/**
*
* The time the assessment completes.
*
*
* @return The time the assessment completes.
*/
public final Instant completionTime() {
return completionTime;
}
/**
*
* The number of failed servers in the assessment.
*
*
* @return The number of failed servers in the assessment.
*/
public final Integer failed() {
return failed;
}
/**
*
* The number of servers with the assessment status IN_PROGESS
.
*
*
* @return The number of servers with the assessment status IN_PROGESS
.
*/
public final Integer inProgress() {
return inProgress;
}
/**
*
* The total number of servers in the assessment.
*
*
* @return The total number of servers in the assessment.
*/
public final Integer servers() {
return servers;
}
/**
*
* The start time of assessment.
*
*
* @return The start time of assessment.
*/
public final Instant startTime() {
return startTime;
}
/**
*
* The status of the assessment.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link AssessmentStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The status of the assessment.
* @see AssessmentStatus
*/
public final AssessmentStatus status() {
return AssessmentStatus.fromValue(status);
}
/**
*
* The status of the assessment.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link AssessmentStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The status of the assessment.
* @see AssessmentStatus
*/
public final String statusAsString() {
return status;
}
/**
*
* The status message of the assessment.
*
*
* @return The status message of the assessment.
*/
public final String statusMessage() {
return statusMessage;
}
/**
*
* The number of successful servers in the assessment.
*
*
* @return The number of successful servers in the assessment.
*/
public final Integer success() {
return success;
}
@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(completionTime());
hashCode = 31 * hashCode + Objects.hashCode(failed());
hashCode = 31 * hashCode + Objects.hashCode(inProgress());
hashCode = 31 * hashCode + Objects.hashCode(servers());
hashCode = 31 * hashCode + Objects.hashCode(startTime());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(statusMessage());
hashCode = 31 * hashCode + Objects.hashCode(success());
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 DataCollectionDetails)) {
return false;
}
DataCollectionDetails other = (DataCollectionDetails) obj;
return Objects.equals(completionTime(), other.completionTime()) && Objects.equals(failed(), other.failed())
&& Objects.equals(inProgress(), other.inProgress()) && Objects.equals(servers(), other.servers())
&& Objects.equals(startTime(), other.startTime()) && Objects.equals(statusAsString(), other.statusAsString())
&& Objects.equals(statusMessage(), other.statusMessage()) && Objects.equals(success(), other.success());
}
/**
* 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("DataCollectionDetails").add("CompletionTime", completionTime()).add("Failed", failed())
.add("InProgress", inProgress()).add("Servers", servers()).add("StartTime", startTime())
.add("Status", statusAsString()).add("StatusMessage", statusMessage()).add("Success", success()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "completionTime":
return Optional.ofNullable(clazz.cast(completionTime()));
case "failed":
return Optional.ofNullable(clazz.cast(failed()));
case "inProgress":
return Optional.ofNullable(clazz.cast(inProgress()));
case "servers":
return Optional.ofNullable(clazz.cast(servers()));
case "startTime":
return Optional.ofNullable(clazz.cast(startTime()));
case "status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "statusMessage":
return Optional.ofNullable(clazz.cast(statusMessage()));
case "success":
return Optional.ofNullable(clazz.cast(success()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Map> memberNameToFieldInitializer() {
Map> map = new HashMap<>();
map.put("completionTime", COMPLETION_TIME_FIELD);
map.put("failed", FAILED_FIELD);
map.put("inProgress", IN_PROGRESS_FIELD);
map.put("servers", SERVERS_FIELD);
map.put("startTime", START_TIME_FIELD);
map.put("status", STATUS_FIELD);
map.put("statusMessage", STATUS_MESSAGE_FIELD);
map.put("success", SUCCESS_FIELD);
return Collections.unmodifiableMap(map);
}
private static Function