software.amazon.awssdk.services.autoscaling.model.RollbackDetails Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of autoscaling Show documentation
Show all versions of autoscaling Show documentation
The AWS Java SDK for Auto Scaling module holds the client classes that are used for communicating with
Auto Scaling
Service
/*
* 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.autoscaling.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.Consumer;
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;
/**
*
* Details about an instance refresh rollback.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class RollbackDetails implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField ROLLBACK_REASON_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("RollbackReason").getter(getter(RollbackDetails::rollbackReason)).setter(setter(Builder::rollbackReason))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RollbackReason").build()).build();
private static final SdkField ROLLBACK_START_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("RollbackStartTime").getter(getter(RollbackDetails::rollbackStartTime))
.setter(setter(Builder::rollbackStartTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RollbackStartTime").build()).build();
private static final SdkField PERCENTAGE_COMPLETE_ON_ROLLBACK_FIELD = SdkField
. builder(MarshallingType.INTEGER)
.memberName("PercentageCompleteOnRollback")
.getter(getter(RollbackDetails::percentageCompleteOnRollback))
.setter(setter(Builder::percentageCompleteOnRollback))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PercentageCompleteOnRollback")
.build()).build();
private static final SdkField INSTANCES_TO_UPDATE_ON_ROLLBACK_FIELD = SdkField
. builder(MarshallingType.INTEGER)
.memberName("InstancesToUpdateOnRollback")
.getter(getter(RollbackDetails::instancesToUpdateOnRollback))
.setter(setter(Builder::instancesToUpdateOnRollback))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InstancesToUpdateOnRollback")
.build()).build();
private static final SdkField PROGRESS_DETAILS_ON_ROLLBACK_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("ProgressDetailsOnRollback")
.getter(getter(RollbackDetails::progressDetailsOnRollback)).setter(setter(Builder::progressDetailsOnRollback))
.constructor(InstanceRefreshProgressDetails::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ProgressDetailsOnRollback").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ROLLBACK_REASON_FIELD,
ROLLBACK_START_TIME_FIELD, PERCENTAGE_COMPLETE_ON_ROLLBACK_FIELD, INSTANCES_TO_UPDATE_ON_ROLLBACK_FIELD,
PROGRESS_DETAILS_ON_ROLLBACK_FIELD));
private static final Map> SDK_NAME_TO_FIELD = Collections
.unmodifiableMap(new HashMap>() {
{
put("RollbackReason", ROLLBACK_REASON_FIELD);
put("RollbackStartTime", ROLLBACK_START_TIME_FIELD);
put("PercentageCompleteOnRollback", PERCENTAGE_COMPLETE_ON_ROLLBACK_FIELD);
put("InstancesToUpdateOnRollback", INSTANCES_TO_UPDATE_ON_ROLLBACK_FIELD);
put("ProgressDetailsOnRollback", PROGRESS_DETAILS_ON_ROLLBACK_FIELD);
}
});
private static final long serialVersionUID = 1L;
private final String rollbackReason;
private final Instant rollbackStartTime;
private final Integer percentageCompleteOnRollback;
private final Integer instancesToUpdateOnRollback;
private final InstanceRefreshProgressDetails progressDetailsOnRollback;
private RollbackDetails(BuilderImpl builder) {
this.rollbackReason = builder.rollbackReason;
this.rollbackStartTime = builder.rollbackStartTime;
this.percentageCompleteOnRollback = builder.percentageCompleteOnRollback;
this.instancesToUpdateOnRollback = builder.instancesToUpdateOnRollback;
this.progressDetailsOnRollback = builder.progressDetailsOnRollback;
}
/**
*
* The reason for this instance refresh rollback (for example, whether a manual or automatic rollback was
* initiated).
*
*
* @return The reason for this instance refresh rollback (for example, whether a manual or automatic rollback was
* initiated).
*/
public final String rollbackReason() {
return rollbackReason;
}
/**
*
* The date and time at which the rollback began.
*
*
* @return The date and time at which the rollback began.
*/
public final Instant rollbackStartTime() {
return rollbackStartTime;
}
/**
*
* Indicates the value of PercentageComplete
at the time the rollback started.
*
*
* @return Indicates the value of PercentageComplete
at the time the rollback started.
*/
public final Integer percentageCompleteOnRollback() {
return percentageCompleteOnRollback;
}
/**
*
* Indicates the value of InstancesToUpdate
at the time the rollback started.
*
*
* @return Indicates the value of InstancesToUpdate
at the time the rollback started.
*/
public final Integer instancesToUpdateOnRollback() {
return instancesToUpdateOnRollback;
}
/**
*
* Reports progress on replacing instances in an Auto Scaling group that has a warm pool. This includes separate
* details for instances in the warm pool and instances in the Auto Scaling group (the live pool).
*
*
* @return Reports progress on replacing instances in an Auto Scaling group that has a warm pool. This includes
* separate details for instances in the warm pool and instances in the Auto Scaling group (the live pool).
*/
public final InstanceRefreshProgressDetails progressDetailsOnRollback() {
return progressDetailsOnRollback;
}
@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(rollbackReason());
hashCode = 31 * hashCode + Objects.hashCode(rollbackStartTime());
hashCode = 31 * hashCode + Objects.hashCode(percentageCompleteOnRollback());
hashCode = 31 * hashCode + Objects.hashCode(instancesToUpdateOnRollback());
hashCode = 31 * hashCode + Objects.hashCode(progressDetailsOnRollback());
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 RollbackDetails)) {
return false;
}
RollbackDetails other = (RollbackDetails) obj;
return Objects.equals(rollbackReason(), other.rollbackReason())
&& Objects.equals(rollbackStartTime(), other.rollbackStartTime())
&& Objects.equals(percentageCompleteOnRollback(), other.percentageCompleteOnRollback())
&& Objects.equals(instancesToUpdateOnRollback(), other.instancesToUpdateOnRollback())
&& Objects.equals(progressDetailsOnRollback(), other.progressDetailsOnRollback());
}
/**
* 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("RollbackDetails").add("RollbackReason", rollbackReason())
.add("RollbackStartTime", rollbackStartTime())
.add("PercentageCompleteOnRollback", percentageCompleteOnRollback())
.add("InstancesToUpdateOnRollback", instancesToUpdateOnRollback())
.add("ProgressDetailsOnRollback", progressDetailsOnRollback()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "RollbackReason":
return Optional.ofNullable(clazz.cast(rollbackReason()));
case "RollbackStartTime":
return Optional.ofNullable(clazz.cast(rollbackStartTime()));
case "PercentageCompleteOnRollback":
return Optional.ofNullable(clazz.cast(percentageCompleteOnRollback()));
case "InstancesToUpdateOnRollback":
return Optional.ofNullable(clazz.cast(instancesToUpdateOnRollback()));
case "ProgressDetailsOnRollback":
return Optional.ofNullable(clazz.cast(progressDetailsOnRollback()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Function