software.amazon.awssdk.services.redshift.model.SnapshotSchedule 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.io.Serializable;
import java.time.Instant;
import java.util.Arrays;
import java.util.Collection;
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 java.util.stream.Collectors;
import java.util.stream.Stream;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Describes a snapshot schedule. You can set a regular interval for creating snapshots of a cluster. You can also
* schedule snapshots for specific dates.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class SnapshotSchedule implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField> SCHEDULE_DEFINITIONS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("ScheduleDefinitions")
.getter(getter(SnapshotSchedule::scheduleDefinitions))
.setter(setter(Builder::scheduleDefinitions))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ScheduleDefinitions").build(),
ListTrait
.builder()
.memberLocationName("ScheduleDefinition")
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("ScheduleDefinition").build()).build()).build()).build();
private static final SdkField SCHEDULE_IDENTIFIER_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ScheduleIdentifier").getter(getter(SnapshotSchedule::scheduleIdentifier))
.setter(setter(Builder::scheduleIdentifier))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ScheduleIdentifier").build())
.build();
private static final SdkField SCHEDULE_DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ScheduleDescription").getter(getter(SnapshotSchedule::scheduleDescription))
.setter(setter(Builder::scheduleDescription))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ScheduleDescription").build())
.build();
private static final SdkField> TAGS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Tags")
.getter(getter(SnapshotSchedule::tags))
.setter(setter(Builder::tags))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Tags").build(),
ListTrait
.builder()
.memberLocationName("Tag")
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(Tag::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("Tag").build()).build()).build()).build();
private static final SdkField> NEXT_INVOCATIONS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("NextInvocations")
.getter(getter(SnapshotSchedule::nextInvocations))
.setter(setter(Builder::nextInvocations))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NextInvocations").build(),
ListTrait
.builder()
.memberLocationName("SnapshotTime")
.memberFieldInfo(
SdkField. builder(MarshallingType.INSTANT)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("SnapshotTime").build()).build()).build()).build();
private static final SdkField ASSOCIATED_CLUSTER_COUNT_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("AssociatedClusterCount").getter(getter(SnapshotSchedule::associatedClusterCount))
.setter(setter(Builder::associatedClusterCount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AssociatedClusterCount").build())
.build();
private static final SdkField> ASSOCIATED_CLUSTERS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("AssociatedClusters")
.getter(getter(SnapshotSchedule::associatedClusters))
.setter(setter(Builder::associatedClusters))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AssociatedClusters").build(),
ListTrait
.builder()
.memberLocationName("ClusterAssociatedToSchedule")
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(ClusterAssociatedToSchedule::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("ClusterAssociatedToSchedule").build()).build()).build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(SCHEDULE_DEFINITIONS_FIELD,
SCHEDULE_IDENTIFIER_FIELD, SCHEDULE_DESCRIPTION_FIELD, TAGS_FIELD, NEXT_INVOCATIONS_FIELD,
ASSOCIATED_CLUSTER_COUNT_FIELD, ASSOCIATED_CLUSTERS_FIELD));
private static final long serialVersionUID = 1L;
private final List scheduleDefinitions;
private final String scheduleIdentifier;
private final String scheduleDescription;
private final List tags;
private final List nextInvocations;
private final Integer associatedClusterCount;
private final List associatedClusters;
private SnapshotSchedule(BuilderImpl builder) {
this.scheduleDefinitions = builder.scheduleDefinitions;
this.scheduleIdentifier = builder.scheduleIdentifier;
this.scheduleDescription = builder.scheduleDescription;
this.tags = builder.tags;
this.nextInvocations = builder.nextInvocations;
this.associatedClusterCount = builder.associatedClusterCount;
this.associatedClusters = builder.associatedClusters;
}
/**
* Returns true if the ScheduleDefinitions property was specified by the sender (it may be empty), or false if the
* sender did not specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS
* service.
*/
public final boolean hasScheduleDefinitions() {
return scheduleDefinitions != null && !(scheduleDefinitions instanceof SdkAutoConstructList);
}
/**
*
* A list of ScheduleDefinitions.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasScheduleDefinitions()} to see if a value was sent in this field.
*
*
* @return A list of ScheduleDefinitions.
*/
public final List scheduleDefinitions() {
return scheduleDefinitions;
}
/**
*
* A unique identifier for the schedule.
*
*
* @return A unique identifier for the schedule.
*/
public final String scheduleIdentifier() {
return scheduleIdentifier;
}
/**
*
* The description of the schedule.
*
*
* @return The description of the schedule.
*/
public final String scheduleDescription() {
return scheduleDescription;
}
/**
* Returns true if the Tags property was specified by the sender (it may be empty), or false if the sender did not
* specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service.
*/
public final boolean hasTags() {
return tags != null && !(tags instanceof SdkAutoConstructList);
}
/**
*
* An optional set of tags describing the schedule.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasTags()} to see if a value was sent in this field.
*
*
* @return An optional set of tags describing the schedule.
*/
public final List tags() {
return tags;
}
/**
* Returns true if the NextInvocations property was specified by the sender (it may be empty), or false if the
* sender did not specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS
* service.
*/
public final boolean hasNextInvocations() {
return nextInvocations != null && !(nextInvocations instanceof SdkAutoConstructList);
}
/**
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasNextInvocations()} to see if a value was sent in this field.
*
*
* @return
*/
public final List nextInvocations() {
return nextInvocations;
}
/**
*
* The number of clusters associated with the schedule.
*
*
* @return The number of clusters associated with the schedule.
*/
public final Integer associatedClusterCount() {
return associatedClusterCount;
}
/**
* Returns true if the AssociatedClusters property was specified by the sender (it may be empty), or false if the
* sender did not specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS
* service.
*/
public final boolean hasAssociatedClusters() {
return associatedClusters != null && !(associatedClusters instanceof SdkAutoConstructList);
}
/**
*
* A list of clusters associated with the schedule. A maximum of 100 clusters is returned.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasAssociatedClusters()} to see if a value was sent in this field.
*
*
* @return A list of clusters associated with the schedule. A maximum of 100 clusters is returned.
*/
public final List associatedClusters() {
return associatedClusters;
}
@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(hasScheduleDefinitions() ? scheduleDefinitions() : null);
hashCode = 31 * hashCode + Objects.hashCode(scheduleIdentifier());
hashCode = 31 * hashCode + Objects.hashCode(scheduleDescription());
hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasNextInvocations() ? nextInvocations() : null);
hashCode = 31 * hashCode + Objects.hashCode(associatedClusterCount());
hashCode = 31 * hashCode + Objects.hashCode(hasAssociatedClusters() ? associatedClusters() : null);
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 SnapshotSchedule)) {
return false;
}
SnapshotSchedule other = (SnapshotSchedule) obj;
return hasScheduleDefinitions() == other.hasScheduleDefinitions()
&& Objects.equals(scheduleDefinitions(), other.scheduleDefinitions())
&& Objects.equals(scheduleIdentifier(), other.scheduleIdentifier())
&& Objects.equals(scheduleDescription(), other.scheduleDescription()) && hasTags() == other.hasTags()
&& Objects.equals(tags(), other.tags()) && hasNextInvocations() == other.hasNextInvocations()
&& Objects.equals(nextInvocations(), other.nextInvocations())
&& Objects.equals(associatedClusterCount(), other.associatedClusterCount())
&& hasAssociatedClusters() == other.hasAssociatedClusters()
&& Objects.equals(associatedClusters(), other.associatedClusters());
}
/**
* 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("SnapshotSchedule")
.add("ScheduleDefinitions", hasScheduleDefinitions() ? scheduleDefinitions() : null)
.add("ScheduleIdentifier", scheduleIdentifier()).add("ScheduleDescription", scheduleDescription())
.add("Tags", hasTags() ? tags() : null).add("NextInvocations", hasNextInvocations() ? nextInvocations() : null)
.add("AssociatedClusterCount", associatedClusterCount())
.add("AssociatedClusters", hasAssociatedClusters() ? associatedClusters() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ScheduleDefinitions":
return Optional.ofNullable(clazz.cast(scheduleDefinitions()));
case "ScheduleIdentifier":
return Optional.ofNullable(clazz.cast(scheduleIdentifier()));
case "ScheduleDescription":
return Optional.ofNullable(clazz.cast(scheduleDescription()));
case "Tags":
return Optional.ofNullable(clazz.cast(tags()));
case "NextInvocations":
return Optional.ofNullable(clazz.cast(nextInvocations()));
case "AssociatedClusterCount":
return Optional.ofNullable(clazz.cast(associatedClusterCount()));
case "AssociatedClusters":
return Optional.ofNullable(clazz.cast(associatedClusters()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function