All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.autoscaling.model.Activity Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Auto Scaling module holds the client classes that are used for communicating with Auto Scaling Service

There is a newer version: 2.29.15
Show newest version
/*
 * 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 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 getter(Function g) { return obj -> g.apply((Activity) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The ID of the activity. *

* * @param activityId * The ID of the activity. * @return Returns a reference to this object so that method calls can be chained together. */ Builder activityId(String activityId); /** *

* The name of the Auto Scaling group. *

* * @param autoScalingGroupName * The name of the Auto Scaling group. * @return Returns a reference to this object so that method calls can be chained together. */ Builder autoScalingGroupName(String autoScalingGroupName); /** *

* A friendly, more verbose description of the activity. *

* * @param description * A friendly, more verbose description of the activity. * @return Returns a reference to this object so that method calls can be chained together. */ Builder description(String description); /** *

* The reason the activity began. *

* * @param cause * The reason the activity began. * @return Returns a reference to this object so that method calls can be chained together. */ Builder cause(String cause); /** *

* The start time of the activity. *

* * @param startTime * The start time of the activity. * @return Returns a reference to this object so that method calls can be chained together. */ Builder startTime(Instant startTime); /** *

* The end time of the activity. *

* * @param endTime * The end time of the activity. * @return Returns a reference to this object so that method calls can be chained together. */ Builder endTime(Instant endTime); /** *

* The current status of the activity. *

* * @param statusCode * The current status of the activity. * @see ScalingActivityStatusCode * @return Returns a reference to this object so that method calls can be chained together. * @see ScalingActivityStatusCode */ Builder statusCode(String statusCode); /** *

* The current status of the activity. *

* * @param statusCode * The current status of the activity. * @see ScalingActivityStatusCode * @return Returns a reference to this object so that method calls can be chained together. * @see ScalingActivityStatusCode */ Builder statusCode(ScalingActivityStatusCode statusCode); /** *

* A friendly, more verbose description of the activity status. *

* * @param statusMessage * A friendly, more verbose description of the activity status. * @return Returns a reference to this object so that method calls can be chained together. */ Builder statusMessage(String statusMessage); /** *

* A value between 0 and 100 that indicates the progress of the activity. *

* * @param progress * A value between 0 and 100 that indicates the progress of the activity. * @return Returns a reference to this object so that method calls can be chained together. */ Builder progress(Integer progress); /** *

* The details about the activity. *

* * @param details * The details about the activity. * @return Returns a reference to this object so that method calls can be chained together. */ Builder details(String details); /** *

* The state of the Auto Scaling group, which is either InService or Deleted. *

* * @param autoScalingGroupState * The state of the Auto Scaling group, which is either InService or Deleted. * @return Returns a reference to this object so that method calls can be chained together. */ Builder autoScalingGroupState(String autoScalingGroupState); /** *

* The Amazon Resource Name (ARN) of the Auto Scaling group. *

* * @param autoScalingGroupARN * The Amazon Resource Name (ARN) of the Auto Scaling group. * @return Returns a reference to this object so that method calls can be chained together. */ Builder autoScalingGroupARN(String autoScalingGroupARN); } static final class BuilderImpl implements Builder { private String activityId; private String autoScalingGroupName; private String description; private String cause; private Instant startTime; private Instant endTime; private String statusCode; private String statusMessage; private Integer progress; private String details; private String autoScalingGroupState; private String autoScalingGroupARN; private BuilderImpl() { } private BuilderImpl(Activity model) { activityId(model.activityId); autoScalingGroupName(model.autoScalingGroupName); description(model.description); cause(model.cause); startTime(model.startTime); endTime(model.endTime); statusCode(model.statusCode); statusMessage(model.statusMessage); progress(model.progress); details(model.details); autoScalingGroupState(model.autoScalingGroupState); autoScalingGroupARN(model.autoScalingGroupARN); } public final String getActivityId() { return activityId; } public final void setActivityId(String activityId) { this.activityId = activityId; } @Override public final Builder activityId(String activityId) { this.activityId = activityId; return this; } public final String getAutoScalingGroupName() { return autoScalingGroupName; } public final void setAutoScalingGroupName(String autoScalingGroupName) { this.autoScalingGroupName = autoScalingGroupName; } @Override public final Builder autoScalingGroupName(String autoScalingGroupName) { this.autoScalingGroupName = autoScalingGroupName; return this; } public final String getDescription() { return description; } public final void setDescription(String description) { this.description = description; } @Override public final Builder description(String description) { this.description = description; return this; } public final String getCause() { return cause; } public final void setCause(String cause) { this.cause = cause; } @Override public final Builder cause(String cause) { this.cause = cause; return this; } public final Instant getStartTime() { return startTime; } public final void setStartTime(Instant startTime) { this.startTime = startTime; } @Override public final Builder startTime(Instant startTime) { this.startTime = startTime; return this; } public final Instant getEndTime() { return endTime; } public final void setEndTime(Instant endTime) { this.endTime = endTime; } @Override public final Builder endTime(Instant endTime) { this.endTime = endTime; return this; } public final String getStatusCode() { return statusCode; } public final void setStatusCode(String statusCode) { this.statusCode = statusCode; } @Override public final Builder statusCode(String statusCode) { this.statusCode = statusCode; return this; } @Override public final Builder statusCode(ScalingActivityStatusCode statusCode) { this.statusCode(statusCode == null ? null : statusCode.toString()); return this; } public final String getStatusMessage() { return statusMessage; } public final void setStatusMessage(String statusMessage) { this.statusMessage = statusMessage; } @Override public final Builder statusMessage(String statusMessage) { this.statusMessage = statusMessage; return this; } public final Integer getProgress() { return progress; } public final void setProgress(Integer progress) { this.progress = progress; } @Override public final Builder progress(Integer progress) { this.progress = progress; return this; } public final String getDetails() { return details; } public final void setDetails(String details) { this.details = details; } @Override public final Builder details(String details) { this.details = details; return this; } public final String getAutoScalingGroupState() { return autoScalingGroupState; } public final void setAutoScalingGroupState(String autoScalingGroupState) { this.autoScalingGroupState = autoScalingGroupState; } @Override public final Builder autoScalingGroupState(String autoScalingGroupState) { this.autoScalingGroupState = autoScalingGroupState; return this; } public final String getAutoScalingGroupARN() { return autoScalingGroupARN; } public final void setAutoScalingGroupARN(String autoScalingGroupARN) { this.autoScalingGroupARN = autoScalingGroupARN; } @Override public final Builder autoScalingGroupARN(String autoScalingGroupARN) { this.autoScalingGroupARN = autoScalingGroupARN; return this; } @Override public Activity build() { return new Activity(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy