software.amazon.awssdk.services.autoscaling.model.ScheduledUpdateGroupAction 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 a scheduled scaling action.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ScheduledUpdateGroupAction implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField AUTO_SCALING_GROUP_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AutoScalingGroupName").getter(getter(ScheduledUpdateGroupAction::autoScalingGroupName))
.setter(setter(Builder::autoScalingGroupName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AutoScalingGroupName").build())
.build();
private static final SdkField SCHEDULED_ACTION_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ScheduledActionName").getter(getter(ScheduledUpdateGroupAction::scheduledActionName))
.setter(setter(Builder::scheduledActionName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ScheduledActionName").build())
.build();
private static final SdkField SCHEDULED_ACTION_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ScheduledActionARN").getter(getter(ScheduledUpdateGroupAction::scheduledActionARN))
.setter(setter(Builder::scheduledActionARN))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ScheduledActionARN").build())
.build();
private static final SdkField TIME_FIELD = SdkField. builder(MarshallingType.INSTANT).memberName("Time")
.getter(getter(ScheduledUpdateGroupAction::time)).setter(setter(Builder::time))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Time").build()).build();
private static final SdkField START_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("StartTime").getter(getter(ScheduledUpdateGroupAction::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(ScheduledUpdateGroupAction::endTime)).setter(setter(Builder::endTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EndTime").build()).build();
private static final SdkField RECURRENCE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Recurrence").getter(getter(ScheduledUpdateGroupAction::recurrence)).setter(setter(Builder::recurrence))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Recurrence").build()).build();
private static final SdkField MIN_SIZE_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("MinSize").getter(getter(ScheduledUpdateGroupAction::minSize)).setter(setter(Builder::minSize))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MinSize").build()).build();
private static final SdkField MAX_SIZE_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("MaxSize").getter(getter(ScheduledUpdateGroupAction::maxSize)).setter(setter(Builder::maxSize))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MaxSize").build()).build();
private static final SdkField DESIRED_CAPACITY_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("DesiredCapacity").getter(getter(ScheduledUpdateGroupAction::desiredCapacity))
.setter(setter(Builder::desiredCapacity))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DesiredCapacity").build()).build();
private static final SdkField TIME_ZONE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("TimeZone").getter(getter(ScheduledUpdateGroupAction::timeZone)).setter(setter(Builder::timeZone))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TimeZone").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(AUTO_SCALING_GROUP_NAME_FIELD,
SCHEDULED_ACTION_NAME_FIELD, SCHEDULED_ACTION_ARN_FIELD, TIME_FIELD, START_TIME_FIELD, END_TIME_FIELD,
RECURRENCE_FIELD, MIN_SIZE_FIELD, MAX_SIZE_FIELD, DESIRED_CAPACITY_FIELD, TIME_ZONE_FIELD));
private static final long serialVersionUID = 1L;
private final String autoScalingGroupName;
private final String scheduledActionName;
private final String scheduledActionARN;
private final Instant time;
private final Instant startTime;
private final Instant endTime;
private final String recurrence;
private final Integer minSize;
private final Integer maxSize;
private final Integer desiredCapacity;
private final String timeZone;
private ScheduledUpdateGroupAction(BuilderImpl builder) {
this.autoScalingGroupName = builder.autoScalingGroupName;
this.scheduledActionName = builder.scheduledActionName;
this.scheduledActionARN = builder.scheduledActionARN;
this.time = builder.time;
this.startTime = builder.startTime;
this.endTime = builder.endTime;
this.recurrence = builder.recurrence;
this.minSize = builder.minSize;
this.maxSize = builder.maxSize;
this.desiredCapacity = builder.desiredCapacity;
this.timeZone = builder.timeZone;
}
/**
*
* The name of the Auto Scaling group.
*
*
* @return The name of the Auto Scaling group.
*/
public final String autoScalingGroupName() {
return autoScalingGroupName;
}
/**
*
* The name of the scheduled action.
*
*
* @return The name of the scheduled action.
*/
public final String scheduledActionName() {
return scheduledActionName;
}
/**
*
* The Amazon Resource Name (ARN) of the scheduled action.
*
*
* @return The Amazon Resource Name (ARN) of the scheduled action.
*/
public final String scheduledActionARN() {
return scheduledActionARN;
}
/**
*
* This property is no longer used.
*
*
* @return This property is no longer used.
*/
public final Instant time() {
return time;
}
/**
*
* The date and time in UTC for this action to start. For example, "2019-06-01T00:00:00Z"
.
*
*
* @return The date and time in UTC for this action to start. For example, "2019-06-01T00:00:00Z"
.
*/
public final Instant startTime() {
return startTime;
}
/**
*
* The date and time in UTC for the recurring schedule to end. For example, "2019-06-01T00:00:00Z"
.
*
*
* @return The date and time in UTC for the recurring schedule to end. For example,
* "2019-06-01T00:00:00Z"
.
*/
public final Instant endTime() {
return endTime;
}
/**
*
* The recurring schedule for the action, in Unix cron syntax format.
*
*
* When StartTime
and EndTime
are specified with Recurrence
, they form the
* boundaries of when the recurring action starts and stops.
*
*
* @return The recurring schedule for the action, in Unix cron syntax format.
*
* When StartTime
and EndTime
are specified with Recurrence
, they
* form the boundaries of when the recurring action starts and stops.
*/
public final String recurrence() {
return recurrence;
}
/**
*
* The minimum size of the Auto Scaling group.
*
*
* @return The minimum size of the Auto Scaling group.
*/
public final Integer minSize() {
return minSize;
}
/**
*
* The maximum size of the Auto Scaling group.
*
*
* @return The maximum size of the Auto Scaling group.
*/
public final Integer maxSize() {
return maxSize;
}
/**
*
* The desired capacity is the initial capacity of the Auto Scaling group after the scheduled action runs and the
* capacity it attempts to maintain.
*
*
* @return The desired capacity is the initial capacity of the Auto Scaling group after the scheduled action runs
* and the capacity it attempts to maintain.
*/
public final Integer desiredCapacity() {
return desiredCapacity;
}
/**
*
* The time zone for the cron expression.
*
*
* @return The time zone for the cron expression.
*/
public final String timeZone() {
return timeZone;
}
@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(autoScalingGroupName());
hashCode = 31 * hashCode + Objects.hashCode(scheduledActionName());
hashCode = 31 * hashCode + Objects.hashCode(scheduledActionARN());
hashCode = 31 * hashCode + Objects.hashCode(time());
hashCode = 31 * hashCode + Objects.hashCode(startTime());
hashCode = 31 * hashCode + Objects.hashCode(endTime());
hashCode = 31 * hashCode + Objects.hashCode(recurrence());
hashCode = 31 * hashCode + Objects.hashCode(minSize());
hashCode = 31 * hashCode + Objects.hashCode(maxSize());
hashCode = 31 * hashCode + Objects.hashCode(desiredCapacity());
hashCode = 31 * hashCode + Objects.hashCode(timeZone());
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 ScheduledUpdateGroupAction)) {
return false;
}
ScheduledUpdateGroupAction other = (ScheduledUpdateGroupAction) obj;
return Objects.equals(autoScalingGroupName(), other.autoScalingGroupName())
&& Objects.equals(scheduledActionName(), other.scheduledActionName())
&& Objects.equals(scheduledActionARN(), other.scheduledActionARN()) && Objects.equals(time(), other.time())
&& Objects.equals(startTime(), other.startTime()) && Objects.equals(endTime(), other.endTime())
&& Objects.equals(recurrence(), other.recurrence()) && Objects.equals(minSize(), other.minSize())
&& Objects.equals(maxSize(), other.maxSize()) && Objects.equals(desiredCapacity(), other.desiredCapacity())
&& Objects.equals(timeZone(), other.timeZone());
}
/**
* 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("ScheduledUpdateGroupAction").add("AutoScalingGroupName", autoScalingGroupName())
.add("ScheduledActionName", scheduledActionName()).add("ScheduledActionARN", scheduledActionARN())
.add("Time", time()).add("StartTime", startTime()).add("EndTime", endTime()).add("Recurrence", recurrence())
.add("MinSize", minSize()).add("MaxSize", maxSize()).add("DesiredCapacity", desiredCapacity())
.add("TimeZone", timeZone()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "AutoScalingGroupName":
return Optional.ofNullable(clazz.cast(autoScalingGroupName()));
case "ScheduledActionName":
return Optional.ofNullable(clazz.cast(scheduledActionName()));
case "ScheduledActionARN":
return Optional.ofNullable(clazz.cast(scheduledActionARN()));
case "Time":
return Optional.ofNullable(clazz.cast(time()));
case "StartTime":
return Optional.ofNullable(clazz.cast(startTime()));
case "EndTime":
return Optional.ofNullable(clazz.cast(endTime()));
case "Recurrence":
return Optional.ofNullable(clazz.cast(recurrence()));
case "MinSize":
return Optional.ofNullable(clazz.cast(minSize()));
case "MaxSize":
return Optional.ofNullable(clazz.cast(maxSize()));
case "DesiredCapacity":
return Optional.ofNullable(clazz.cast(desiredCapacity()));
case "TimeZone":
return Optional.ofNullable(clazz.cast(timeZone()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function