software.amazon.awssdk.services.redshift.model.ModifyScheduledActionRequest Maven / Gradle / Ivy
Show all versions of redshift 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.redshift.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 ModifyScheduledActionRequest extends RedshiftRequest implements
ToCopyableBuilder {
private static final SdkField SCHEDULED_ACTION_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ScheduledActionName").getter(getter(ModifyScheduledActionRequest::scheduledActionName))
.setter(setter(Builder::scheduledActionName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ScheduledActionName").build())
.build();
private static final SdkField TARGET_ACTION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("TargetAction")
.getter(getter(ModifyScheduledActionRequest::targetAction)).setter(setter(Builder::targetAction))
.constructor(ScheduledActionType::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TargetAction").build()).build();
private static final SdkField SCHEDULE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Schedule").getter(getter(ModifyScheduledActionRequest::schedule)).setter(setter(Builder::schedule))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Schedule").build()).build();
private static final SdkField IAM_ROLE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("IamRole").getter(getter(ModifyScheduledActionRequest::iamRole)).setter(setter(Builder::iamRole))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IamRole").build()).build();
private static final SdkField SCHEDULED_ACTION_DESCRIPTION_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("ScheduledActionDescription")
.getter(getter(ModifyScheduledActionRequest::scheduledActionDescription))
.setter(setter(Builder::scheduledActionDescription))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ScheduledActionDescription").build())
.build();
private static final SdkField START_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("StartTime").getter(getter(ModifyScheduledActionRequest::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(ModifyScheduledActionRequest::endTime)).setter(setter(Builder::endTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EndTime").build()).build();
private static final SdkField ENABLE_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("Enable").getter(getter(ModifyScheduledActionRequest::enable)).setter(setter(Builder::enable))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Enable").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(SCHEDULED_ACTION_NAME_FIELD,
TARGET_ACTION_FIELD, SCHEDULE_FIELD, IAM_ROLE_FIELD, SCHEDULED_ACTION_DESCRIPTION_FIELD, START_TIME_FIELD,
END_TIME_FIELD, ENABLE_FIELD));
private final String scheduledActionName;
private final ScheduledActionType targetAction;
private final String schedule;
private final String iamRole;
private final String scheduledActionDescription;
private final Instant startTime;
private final Instant endTime;
private final Boolean enable;
private ModifyScheduledActionRequest(BuilderImpl builder) {
super(builder);
this.scheduledActionName = builder.scheduledActionName;
this.targetAction = builder.targetAction;
this.schedule = builder.schedule;
this.iamRole = builder.iamRole;
this.scheduledActionDescription = builder.scheduledActionDescription;
this.startTime = builder.startTime;
this.endTime = builder.endTime;
this.enable = builder.enable;
}
/**
*
* The name of the scheduled action to modify.
*
*
* @return The name of the scheduled action to modify.
*/
public final String scheduledActionName() {
return scheduledActionName;
}
/**
*
* A modified JSON format of the scheduled action. For more information about this parameter, see
* ScheduledAction.
*
*
* @return A modified JSON format of the scheduled action. For more information about this parameter, see
* ScheduledAction.
*/
public final ScheduledActionType targetAction() {
return targetAction;
}
/**
*
* A modified schedule in either at( )
or cron( )
format. For more information about this
* parameter, see ScheduledAction.
*
*
* @return A modified schedule in either at( )
or cron( )
format. For more information
* about this parameter, see ScheduledAction.
*/
public final String schedule() {
return schedule;
}
/**
*
* A different IAM role to assume to run the target action. For more information about this parameter, see
* ScheduledAction.
*
*
* @return A different IAM role to assume to run the target action. For more information about this parameter, see
* ScheduledAction.
*/
public final String iamRole() {
return iamRole;
}
/**
*
* A modified description of the scheduled action.
*
*
* @return A modified description of the scheduled action.
*/
public final String scheduledActionDescription() {
return scheduledActionDescription;
}
/**
*
* A modified start time of the scheduled action. For more information about this parameter, see
* ScheduledAction.
*
*
* @return A modified start time of the scheduled action. For more information about this parameter, see
* ScheduledAction.
*/
public final Instant startTime() {
return startTime;
}
/**
*
* A modified end time of the scheduled action. For more information about this parameter, see
* ScheduledAction.
*
*
* @return A modified end time of the scheduled action. For more information about this parameter, see
* ScheduledAction.
*/
public final Instant endTime() {
return endTime;
}
/**
*
* A modified enable flag of the scheduled action. If true, the scheduled action is active. If false, the scheduled
* action is disabled.
*
*
* @return A modified enable flag of the scheduled action. If true, the scheduled action is active. If false, the
* scheduled action is disabled.
*/
public final Boolean enable() {
return enable;
}
@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 + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(scheduledActionName());
hashCode = 31 * hashCode + Objects.hashCode(targetAction());
hashCode = 31 * hashCode + Objects.hashCode(schedule());
hashCode = 31 * hashCode + Objects.hashCode(iamRole());
hashCode = 31 * hashCode + Objects.hashCode(scheduledActionDescription());
hashCode = 31 * hashCode + Objects.hashCode(startTime());
hashCode = 31 * hashCode + Objects.hashCode(endTime());
hashCode = 31 * hashCode + Objects.hashCode(enable());
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 ModifyScheduledActionRequest)) {
return false;
}
ModifyScheduledActionRequest other = (ModifyScheduledActionRequest) obj;
return Objects.equals(scheduledActionName(), other.scheduledActionName())
&& Objects.equals(targetAction(), other.targetAction()) && Objects.equals(schedule(), other.schedule())
&& Objects.equals(iamRole(), other.iamRole())
&& Objects.equals(scheduledActionDescription(), other.scheduledActionDescription())
&& Objects.equals(startTime(), other.startTime()) && Objects.equals(endTime(), other.endTime())
&& Objects.equals(enable(), other.enable());
}
/**
* 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("ModifyScheduledActionRequest").add("ScheduledActionName", scheduledActionName())
.add("TargetAction", targetAction()).add("Schedule", schedule()).add("IamRole", iamRole())
.add("ScheduledActionDescription", scheduledActionDescription()).add("StartTime", startTime())
.add("EndTime", endTime()).add("Enable", enable()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ScheduledActionName":
return Optional.ofNullable(clazz.cast(scheduledActionName()));
case "TargetAction":
return Optional.ofNullable(clazz.cast(targetAction()));
case "Schedule":
return Optional.ofNullable(clazz.cast(schedule()));
case "IamRole":
return Optional.ofNullable(clazz.cast(iamRole()));
case "ScheduledActionDescription":
return Optional.ofNullable(clazz.cast(scheduledActionDescription()));
case "StartTime":
return Optional.ofNullable(clazz.cast(startTime()));
case "EndTime":
return Optional.ofNullable(clazz.cast(endTime()));
case "Enable":
return Optional.ofNullable(clazz.cast(enable()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function