software.amazon.awssdk.services.autoscaling.model.Activity Maven / Gradle / Ivy
Show all versions of autoscaling 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.autoscaling.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;
/**
*
* Describes scaling activity, which is a long-running process that represents a change to your Auto Scaling group, such
* as changing its size or replacing an instance.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Activity implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField ACTIVITY_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ActivityId").getter(getter(Activity::activityId)).setter(setter(Builder::activityId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ActivityId").build()).build();
private static final SdkField AUTO_SCALING_GROUP_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AutoScalingGroupName").getter(getter(Activity::autoScalingGroupName))
.setter(setter(Builder::autoScalingGroupName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AutoScalingGroupName").build())
.build();
private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Description").getter(getter(Activity::description)).setter(setter(Builder::description))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Description").build()).build();
private static final SdkField CAUSE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Cause")
.getter(getter(Activity::cause)).setter(setter(Builder::cause))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Cause").build()).build();
private static final SdkField START_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("StartTime").getter(getter(Activity::startTime)).setter(setter(Builder::startTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StartTime").build()).build();
private static final SdkField END_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("EndTime").getter(getter(Activity::endTime)).setter(setter(Builder::endTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EndTime").build()).build();
private static final SdkField STATUS_CODE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("StatusCode").getter(getter(Activity::statusCodeAsString)).setter(setter(Builder::statusCode))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StatusCode").build()).build();
private static final SdkField STATUS_MESSAGE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("StatusMessage").getter(getter(Activity::statusMessage)).setter(setter(Builder::statusMessage))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StatusMessage").build()).build();
private static final SdkField PROGRESS_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("Progress").getter(getter(Activity::progress)).setter(setter(Builder::progress))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Progress").build()).build();
private static final SdkField DETAILS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Details")
.getter(getter(Activity::details)).setter(setter(Builder::details))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Details").build()).build();
private static final SdkField AUTO_SCALING_GROUP_STATE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AutoScalingGroupState").getter(getter(Activity::autoScalingGroupState))
.setter(setter(Builder::autoScalingGroupState))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AutoScalingGroupState").build())
.build();
private static final SdkField AUTO_SCALING_GROUP_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AutoScalingGroupARN").getter(getter(Activity::autoScalingGroupARN))
.setter(setter(Builder::autoScalingGroupARN))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AutoScalingGroupARN").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ACTIVITY_ID_FIELD,
AUTO_SCALING_GROUP_NAME_FIELD, DESCRIPTION_FIELD, CAUSE_FIELD, START_TIME_FIELD, END_TIME_FIELD, STATUS_CODE_FIELD,
STATUS_MESSAGE_FIELD, PROGRESS_FIELD, DETAILS_FIELD, AUTO_SCALING_GROUP_STATE_FIELD, AUTO_SCALING_GROUP_ARN_FIELD));
private static final long serialVersionUID = 1L;
private final String activityId;
private final String autoScalingGroupName;
private final String description;
private final String cause;
private final Instant startTime;
private final Instant endTime;
private final String statusCode;
private final String statusMessage;
private final Integer progress;
private final String details;
private final String autoScalingGroupState;
private final String autoScalingGroupARN;
private Activity(BuilderImpl builder) {
this.activityId = builder.activityId;
this.autoScalingGroupName = builder.autoScalingGroupName;
this.description = builder.description;
this.cause = builder.cause;
this.startTime = builder.startTime;
this.endTime = builder.endTime;
this.statusCode = builder.statusCode;
this.statusMessage = builder.statusMessage;
this.progress = builder.progress;
this.details = builder.details;
this.autoScalingGroupState = builder.autoScalingGroupState;
this.autoScalingGroupARN = builder.autoScalingGroupARN;
}
/**
*
* The ID of the activity.
*
*
* @return The ID of the activity.
*/
public final String activityId() {
return activityId;
}
/**
*
* The name of the Auto Scaling group.
*
*
* @return The name of the Auto Scaling group.
*/
public final String autoScalingGroupName() {
return autoScalingGroupName;
}
/**
*
* A friendly, more verbose description of the activity.
*
*
* @return A friendly, more verbose description of the activity.
*/
public final String description() {
return description;
}
/**
*
* The reason the activity began.
*
*
* @return The reason the activity began.
*/
public final String cause() {
return cause;
}
/**
*
* The start time of the activity.
*
*
* @return The start time of the activity.
*/
public final Instant startTime() {
return startTime;
}
/**
*
* The end time of the activity.
*
*
* @return The end time of the activity.
*/
public final Instant endTime() {
return endTime;
}
/**
*
* The current status of the activity.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #statusCode} will
* return {@link ScalingActivityStatusCode#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #statusCodeAsString}.
*
*
* @return The current status of the activity.
* @see ScalingActivityStatusCode
*/
public final ScalingActivityStatusCode statusCode() {
return ScalingActivityStatusCode.fromValue(statusCode);
}
/**
*
* The current status of the activity.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #statusCode} will
* return {@link ScalingActivityStatusCode#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #statusCodeAsString}.
*
*
* @return The current status of the activity.
* @see ScalingActivityStatusCode
*/
public final String statusCodeAsString() {
return statusCode;
}
/**
*
* A friendly, more verbose description of the activity status.
*
*
* @return A friendly, more verbose description of the activity status.
*/
public final String statusMessage() {
return statusMessage;
}
/**
*
* A value between 0 and 100 that indicates the progress of the activity.
*
*
* @return A value between 0 and 100 that indicates the progress of the activity.
*/
public final Integer progress() {
return progress;
}
/**
*
* The details about the activity.
*
*
* @return The details about the activity.
*/
public final String details() {
return details;
}
/**
*
* The state of the Auto Scaling group, which is either InService
or Deleted
.
*
*
* @return The state of the Auto Scaling group, which is either InService
or Deleted
.
*/
public final String autoScalingGroupState() {
return autoScalingGroupState;
}
/**
*
* The Amazon Resource Name (ARN) of the Auto Scaling group.
*
*
* @return The Amazon Resource Name (ARN) of the Auto Scaling group.
*/
public final String autoScalingGroupARN() {
return autoScalingGroupARN;
}
@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(activityId());
hashCode = 31 * hashCode + Objects.hashCode(autoScalingGroupName());
hashCode = 31 * hashCode + Objects.hashCode(description());
hashCode = 31 * hashCode + Objects.hashCode(cause());
hashCode = 31 * hashCode + Objects.hashCode(startTime());
hashCode = 31 * hashCode + Objects.hashCode(endTime());
hashCode = 31 * hashCode + Objects.hashCode(statusCodeAsString());
hashCode = 31 * hashCode + Objects.hashCode(statusMessage());
hashCode = 31 * hashCode + Objects.hashCode(progress());
hashCode = 31 * hashCode + Objects.hashCode(details());
hashCode = 31 * hashCode + Objects.hashCode(autoScalingGroupState());
hashCode = 31 * hashCode + Objects.hashCode(autoScalingGroupARN());
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 Activity)) {
return false;
}
Activity other = (Activity) obj;
return Objects.equals(activityId(), other.activityId())
&& Objects.equals(autoScalingGroupName(), other.autoScalingGroupName())
&& Objects.equals(description(), other.description()) && Objects.equals(cause(), other.cause())
&& Objects.equals(startTime(), other.startTime()) && Objects.equals(endTime(), other.endTime())
&& Objects.equals(statusCodeAsString(), other.statusCodeAsString())
&& Objects.equals(statusMessage(), other.statusMessage()) && Objects.equals(progress(), other.progress())
&& Objects.equals(details(), other.details())
&& Objects.equals(autoScalingGroupState(), other.autoScalingGroupState())
&& Objects.equals(autoScalingGroupARN(), other.autoScalingGroupARN());
}
/**
* 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("Activity").add("ActivityId", activityId()).add("AutoScalingGroupName", autoScalingGroupName())
.add("Description", description()).add("Cause", cause()).add("StartTime", startTime()).add("EndTime", endTime())
.add("StatusCode", statusCodeAsString()).add("StatusMessage", statusMessage()).add("Progress", progress())
.add("Details", details()).add("AutoScalingGroupState", autoScalingGroupState())
.add("AutoScalingGroupARN", autoScalingGroupARN()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ActivityId":
return Optional.ofNullable(clazz.cast(activityId()));
case "AutoScalingGroupName":
return Optional.ofNullable(clazz.cast(autoScalingGroupName()));
case "Description":
return Optional.ofNullable(clazz.cast(description()));
case "Cause":
return Optional.ofNullable(clazz.cast(cause()));
case "StartTime":
return Optional.ofNullable(clazz.cast(startTime()));
case "EndTime":
return Optional.ofNullable(clazz.cast(endTime()));
case "StatusCode":
return Optional.ofNullable(clazz.cast(statusCodeAsString()));
case "StatusMessage":
return Optional.ofNullable(clazz.cast(statusMessage()));
case "Progress":
return Optional.ofNullable(clazz.cast(progress()));
case "Details":
return Optional.ofNullable(clazz.cast(details()));
case "AutoScalingGroupState":
return Optional.ofNullable(clazz.cast(autoScalingGroupState()));
case "AutoScalingGroupARN":
return Optional.ofNullable(clazz.cast(autoScalingGroupARN()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function