software.amazon.awssdk.services.autoscaling.model.PutScheduledUpdateGroupActionRequest 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.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.Consumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
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;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class PutScheduledUpdateGroupActionRequest extends AutoScalingRequest implements
ToCopyableBuilder {
private static final SdkField AUTO_SCALING_GROUP_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AutoScalingGroupName").getter(getter(PutScheduledUpdateGroupActionRequest::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(PutScheduledUpdateGroupActionRequest::scheduledActionName))
.setter(setter(Builder::scheduledActionName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ScheduledActionName").build())
.build();
private static final SdkField TIME_FIELD = SdkField. builder(MarshallingType.INSTANT).memberName("Time")
.getter(getter(PutScheduledUpdateGroupActionRequest::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(PutScheduledUpdateGroupActionRequest::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(PutScheduledUpdateGroupActionRequest::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(PutScheduledUpdateGroupActionRequest::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(PutScheduledUpdateGroupActionRequest::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(PutScheduledUpdateGroupActionRequest::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(PutScheduledUpdateGroupActionRequest::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(PutScheduledUpdateGroupActionRequest::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, TIME_FIELD, START_TIME_FIELD, END_TIME_FIELD, RECURRENCE_FIELD, MIN_SIZE_FIELD,
MAX_SIZE_FIELD, DESIRED_CAPACITY_FIELD, TIME_ZONE_FIELD));
private final String autoScalingGroupName;
private final String scheduledActionName;
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 PutScheduledUpdateGroupActionRequest(BuilderImpl builder) {
super(builder);
this.autoScalingGroupName = builder.autoScalingGroupName;
this.scheduledActionName = builder.scheduledActionName;
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 this scaling action.
*
*
* @return The name of this scaling action.
*/
public final String scheduledActionName() {
return scheduledActionName;
}
/**
*
* This property is no longer used.
*
*
* @return This property is no longer used.
*/
public final Instant time() {
return time;
}
/**
*
* The date and time for this action to start, in YYYY-MM-DDThh:mm:ssZ format in UTC/GMT only and in quotes (for
* example, "2021-06-01T00:00:00Z"
).
*
*
* If you specify Recurrence
and StartTime
, Amazon EC2 Auto Scaling performs the action at
* this time, and then performs the action based on the specified recurrence.
*
*
* @return The date and time for this action to start, in YYYY-MM-DDThh:mm:ssZ format in UTC/GMT only and in quotes
* (for example, "2021-06-01T00:00:00Z"
).
*
* If you specify Recurrence
and StartTime
, Amazon EC2 Auto Scaling performs the
* action at this time, and then performs the action based on the specified recurrence.
*/
public final Instant startTime() {
return startTime;
}
/**
*
* The date and time for the recurring schedule to end, in UTC. For example, "2021-06-01T00:00:00Z"
.
*
*
* @return The date and time for the recurring schedule to end, in UTC. For example,
* "2021-06-01T00:00:00Z"
.
*/
public final Instant endTime() {
return endTime;
}
/**
*
* The recurring schedule for this action. This format consists of five fields separated by white spaces: [Minute]
* [Hour] [Day_of_Month] [Month_of_Year] [Day_of_Week]. The value must be in quotes (for example,
* "30 0 1 1,6,12 *"
). For more information about this format, see Crontab.
*
*
* When StartTime
and EndTime
are specified with Recurrence
, they form the
* boundaries of when the recurring action starts and stops.
*
*
* Cron expressions use Universal Coordinated Time (UTC) by default.
*
*
* @return The recurring schedule for this action. This format consists of five fields separated by white spaces:
* [Minute] [Hour] [Day_of_Month] [Month_of_Year] [Day_of_Week]. The value must be in quotes (for example,
* "30 0 1 1,6,12 *"
). For more information about this format, see Crontab.
*
* When StartTime
and EndTime
are specified with Recurrence
, they
* form the boundaries of when the recurring action starts and stops.
*
*
* Cron expressions use Universal Coordinated Time (UTC) by default.
*/
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. It can scale beyond this capacity if you add more scaling conditions.
*
*
*
* You must specify at least one of the following properties: MaxSize
, MinSize
, or
* DesiredCapacity
.
*
*
*
* @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. It can scale beyond this capacity if you add more scaling
* conditions.
*
* You must specify at least one of the following properties: MaxSize
, MinSize
, or
* DesiredCapacity
.
*
*/
public final Integer desiredCapacity() {
return desiredCapacity;
}
/**
*
* Specifies the time zone for a cron expression. If a time zone is not provided, UTC is used by default.
*
*
* Valid values are the canonical names of the IANA time zones, derived from the IANA Time Zone Database (such as
* Etc/GMT+9
or Pacific/Tahiti
). For more information, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones.
*
*
* @return Specifies the time zone for a cron expression. If a time zone is not provided, UTC is used by default.
*
*
* Valid values are the canonical names of the IANA time zones, derived from the IANA Time Zone Database
* (such as Etc/GMT+9
or Pacific/Tahiti
). For more information, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones.
*/
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 + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(autoScalingGroupName());
hashCode = 31 * hashCode + Objects.hashCode(scheduledActionName());
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 super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof PutScheduledUpdateGroupActionRequest)) {
return false;
}
PutScheduledUpdateGroupActionRequest other = (PutScheduledUpdateGroupActionRequest) obj;
return Objects.equals(autoScalingGroupName(), other.autoScalingGroupName())
&& Objects.equals(scheduledActionName(), other.scheduledActionName()) && 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("PutScheduledUpdateGroupActionRequest").add("AutoScalingGroupName", autoScalingGroupName())
.add("ScheduledActionName", scheduledActionName()).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 "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
*
* If you specify Recurrence
and StartTime
, Amazon EC2 Auto Scaling performs
* the action at this time, and then performs the action based on the specified recurrence.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder startTime(Instant startTime);
/**
*
* The date and time for the recurring schedule to end, in UTC. For example, "2021-06-01T00:00:00Z"
* .
*
*
* @param endTime
* The date and time for the recurring schedule to end, in UTC. For example,
* "2021-06-01T00:00:00Z"
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder endTime(Instant endTime);
/**
*
* The recurring schedule for this action. This format consists of five fields separated by white spaces:
* [Minute] [Hour] [Day_of_Month] [Month_of_Year] [Day_of_Week]. The value must be in quotes (for example,
* "30 0 1 1,6,12 *"
). For more information about this format, see Crontab.
*
*
* When StartTime
and EndTime
are specified with Recurrence
, they form
* the boundaries of when the recurring action starts and stops.
*
*
* Cron expressions use Universal Coordinated Time (UTC) by default.
*
*
* @param recurrence
* The recurring schedule for this action. This format consists of five fields separated by white spaces:
* [Minute] [Hour] [Day_of_Month] [Month_of_Year] [Day_of_Week]. The value must be in quotes (for
* example, "30 0 1 1,6,12 *"
). For more information about this format, see Crontab.
*
* When StartTime
and EndTime
are specified with Recurrence
, they
* form the boundaries of when the recurring action starts and stops.
*
*
* Cron expressions use Universal Coordinated Time (UTC) by default.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder recurrence(String recurrence);
/**
*
* The minimum size of the Auto Scaling group.
*
*
* @param minSize
* The minimum size of the Auto Scaling group.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder minSize(Integer minSize);
/**
*
* The maximum size of the Auto Scaling group.
*
*
* @param maxSize
* The maximum size of the Auto Scaling group.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder maxSize(Integer 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. It can scale beyond this capacity if you add more scaling conditions.
*
*
*
* You must specify at least one of the following properties: MaxSize
, MinSize
, or
* DesiredCapacity
.
*
*
*
* @param desiredCapacity
* The desired capacity is the initial capacity of the Auto Scaling group after the scheduled action runs
* and the capacity it attempts to maintain. It can scale beyond this capacity if you add more scaling
* conditions.
*
* You must specify at least one of the following properties: MaxSize
, MinSize
,
* or DesiredCapacity
.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder desiredCapacity(Integer desiredCapacity);
/**
*
* Specifies the time zone for a cron expression. If a time zone is not provided, UTC is used by default.
*
*
* Valid values are the canonical names of the IANA time zones, derived from the IANA Time Zone Database (such
* as Etc/GMT+9
or Pacific/Tahiti
). For more information, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones.
*
*
* @param timeZone
* Specifies the time zone for a cron expression. If a time zone is not provided, UTC is used by default.
*
*
* Valid values are the canonical names of the IANA time zones, derived from the IANA Time Zone Database
* (such as Etc/GMT+9
or Pacific/Tahiti
). For more information, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder timeZone(String timeZone);
@Override
Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration);
@Override
Builder overrideConfiguration(Consumer builderConsumer);
}
static final class BuilderImpl extends AutoScalingRequest.BuilderImpl implements Builder {
private String autoScalingGroupName;
private String scheduledActionName;
private Instant time;
private Instant startTime;
private Instant endTime;
private String recurrence;
private Integer minSize;
private Integer maxSize;
private Integer desiredCapacity;
private String timeZone;
private BuilderImpl() {
}
private BuilderImpl(PutScheduledUpdateGroupActionRequest model) {
super(model);
autoScalingGroupName(model.autoScalingGroupName);
scheduledActionName(model.scheduledActionName);
time(model.time);
startTime(model.startTime);
endTime(model.endTime);
recurrence(model.recurrence);
minSize(model.minSize);
maxSize(model.maxSize);
desiredCapacity(model.desiredCapacity);
timeZone(model.timeZone);
}
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 getScheduledActionName() {
return scheduledActionName;
}
public final void setScheduledActionName(String scheduledActionName) {
this.scheduledActionName = scheduledActionName;
}
@Override
public final Builder scheduledActionName(String scheduledActionName) {
this.scheduledActionName = scheduledActionName;
return this;
}
public final Instant getTime() {
return time;
}
public final void setTime(Instant time) {
this.time = time;
}
@Override
public final Builder time(Instant time) {
this.time = time;
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 getRecurrence() {
return recurrence;
}
public final void setRecurrence(String recurrence) {
this.recurrence = recurrence;
}
@Override
public final Builder recurrence(String recurrence) {
this.recurrence = recurrence;
return this;
}
public final Integer getMinSize() {
return minSize;
}
public final void setMinSize(Integer minSize) {
this.minSize = minSize;
}
@Override
public final Builder minSize(Integer minSize) {
this.minSize = minSize;
return this;
}
public final Integer getMaxSize() {
return maxSize;
}
public final void setMaxSize(Integer maxSize) {
this.maxSize = maxSize;
}
@Override
public final Builder maxSize(Integer maxSize) {
this.maxSize = maxSize;
return this;
}
public final Integer getDesiredCapacity() {
return desiredCapacity;
}
public final void setDesiredCapacity(Integer desiredCapacity) {
this.desiredCapacity = desiredCapacity;
}
@Override
public final Builder desiredCapacity(Integer desiredCapacity) {
this.desiredCapacity = desiredCapacity;
return this;
}
public final String getTimeZone() {
return timeZone;
}
public final void setTimeZone(String timeZone) {
this.timeZone = timeZone;
}
@Override
public final Builder timeZone(String timeZone) {
this.timeZone = timeZone;
return this;
}
@Override
public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) {
super.overrideConfiguration(overrideConfiguration);
return this;
}
@Override
public Builder overrideConfiguration(Consumer builderConsumer) {
super.overrideConfiguration(builderConsumer);
return this;
}
@Override
public PutScheduledUpdateGroupActionRequest build() {
return new PutScheduledUpdateGroupActionRequest(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}