software.amazon.awssdk.services.redshift.model.EnableSnapshotCopyRequest 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.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 EnableSnapshotCopyRequest extends RedshiftRequest implements
ToCopyableBuilder {
private static final SdkField CLUSTER_IDENTIFIER_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ClusterIdentifier").getter(getter(EnableSnapshotCopyRequest::clusterIdentifier))
.setter(setter(Builder::clusterIdentifier))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ClusterIdentifier").build()).build();
private static final SdkField DESTINATION_REGION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DestinationRegion").getter(getter(EnableSnapshotCopyRequest::destinationRegion))
.setter(setter(Builder::destinationRegion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DestinationRegion").build()).build();
private static final SdkField RETENTION_PERIOD_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("RetentionPeriod").getter(getter(EnableSnapshotCopyRequest::retentionPeriod))
.setter(setter(Builder::retentionPeriod))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RetentionPeriod").build()).build();
private static final SdkField SNAPSHOT_COPY_GRANT_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SnapshotCopyGrantName").getter(getter(EnableSnapshotCopyRequest::snapshotCopyGrantName))
.setter(setter(Builder::snapshotCopyGrantName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SnapshotCopyGrantName").build())
.build();
private static final SdkField MANUAL_SNAPSHOT_RETENTION_PERIOD_FIELD = SdkField
. builder(MarshallingType.INTEGER)
.memberName("ManualSnapshotRetentionPeriod")
.getter(getter(EnableSnapshotCopyRequest::manualSnapshotRetentionPeriod))
.setter(setter(Builder::manualSnapshotRetentionPeriod))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ManualSnapshotRetentionPeriod")
.build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CLUSTER_IDENTIFIER_FIELD,
DESTINATION_REGION_FIELD, RETENTION_PERIOD_FIELD, SNAPSHOT_COPY_GRANT_NAME_FIELD,
MANUAL_SNAPSHOT_RETENTION_PERIOD_FIELD));
private final String clusterIdentifier;
private final String destinationRegion;
private final Integer retentionPeriod;
private final String snapshotCopyGrantName;
private final Integer manualSnapshotRetentionPeriod;
private EnableSnapshotCopyRequest(BuilderImpl builder) {
super(builder);
this.clusterIdentifier = builder.clusterIdentifier;
this.destinationRegion = builder.destinationRegion;
this.retentionPeriod = builder.retentionPeriod;
this.snapshotCopyGrantName = builder.snapshotCopyGrantName;
this.manualSnapshotRetentionPeriod = builder.manualSnapshotRetentionPeriod;
}
/**
*
* The unique identifier of the source cluster to copy snapshots from.
*
*
* Constraints: Must be the valid name of an existing cluster that does not already have cross-region snapshot copy
* enabled.
*
*
* @return The unique identifier of the source cluster to copy snapshots from.
*
* Constraints: Must be the valid name of an existing cluster that does not already have cross-region
* snapshot copy enabled.
*/
public final String clusterIdentifier() {
return clusterIdentifier;
}
/**
*
* The destination Amazon Web Services Region that you want to copy snapshots to.
*
*
* Constraints: Must be the name of a valid Amazon Web Services Region. For more information, see Regions and Endpoints in the
* Amazon Web Services General Reference.
*
*
* @return The destination Amazon Web Services Region that you want to copy snapshots to.
*
* Constraints: Must be the name of a valid Amazon Web Services Region. For more information, see Regions and Endpoints
* in the Amazon Web Services General Reference.
*/
public final String destinationRegion() {
return destinationRegion;
}
/**
*
* The number of days to retain automated snapshots in the destination region after they are copied from the source
* region.
*
*
* Default: 7.
*
*
* Constraints: Must be at least 1 and no more than 35.
*
*
* @return The number of days to retain automated snapshots in the destination region after they are copied from the
* source region.
*
* Default: 7.
*
*
* Constraints: Must be at least 1 and no more than 35.
*/
public final Integer retentionPeriod() {
return retentionPeriod;
}
/**
*
* The name of the snapshot copy grant to use when snapshots of an Amazon Web Services KMS-encrypted cluster are
* copied to the destination region.
*
*
* @return The name of the snapshot copy grant to use when snapshots of an Amazon Web Services KMS-encrypted cluster
* are copied to the destination region.
*/
public final String snapshotCopyGrantName() {
return snapshotCopyGrantName;
}
/**
*
* The number of days to retain newly copied snapshots in the destination Amazon Web Services Region after they are
* copied from the source Amazon Web Services Region. If the value is -1, the manual snapshot is retained
* indefinitely.
*
*
* The value must be either -1 or an integer between 1 and 3,653.
*
*
* @return The number of days to retain newly copied snapshots in the destination Amazon Web Services Region after
* they are copied from the source Amazon Web Services Region. If the value is -1, the manual snapshot is
* retained indefinitely.
*
* The value must be either -1 or an integer between 1 and 3,653.
*/
public final Integer manualSnapshotRetentionPeriod() {
return manualSnapshotRetentionPeriod;
}
@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(clusterIdentifier());
hashCode = 31 * hashCode + Objects.hashCode(destinationRegion());
hashCode = 31 * hashCode + Objects.hashCode(retentionPeriod());
hashCode = 31 * hashCode + Objects.hashCode(snapshotCopyGrantName());
hashCode = 31 * hashCode + Objects.hashCode(manualSnapshotRetentionPeriod());
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 EnableSnapshotCopyRequest)) {
return false;
}
EnableSnapshotCopyRequest other = (EnableSnapshotCopyRequest) obj;
return Objects.equals(clusterIdentifier(), other.clusterIdentifier())
&& Objects.equals(destinationRegion(), other.destinationRegion())
&& Objects.equals(retentionPeriod(), other.retentionPeriod())
&& Objects.equals(snapshotCopyGrantName(), other.snapshotCopyGrantName())
&& Objects.equals(manualSnapshotRetentionPeriod(), other.manualSnapshotRetentionPeriod());
}
/**
* 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("EnableSnapshotCopyRequest").add("ClusterIdentifier", clusterIdentifier())
.add("DestinationRegion", destinationRegion()).add("RetentionPeriod", retentionPeriod())
.add("SnapshotCopyGrantName", snapshotCopyGrantName())
.add("ManualSnapshotRetentionPeriod", manualSnapshotRetentionPeriod()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ClusterIdentifier":
return Optional.ofNullable(clazz.cast(clusterIdentifier()));
case "DestinationRegion":
return Optional.ofNullable(clazz.cast(destinationRegion()));
case "RetentionPeriod":
return Optional.ofNullable(clazz.cast(retentionPeriod()));
case "SnapshotCopyGrantName":
return Optional.ofNullable(clazz.cast(snapshotCopyGrantName()));
case "ManualSnapshotRetentionPeriod":
return Optional.ofNullable(clazz.cast(manualSnapshotRetentionPeriod()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function
*
* Constraints: Must be the valid name of an existing cluster that does not already have cross-region
* snapshot copy enabled.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder clusterIdentifier(String clusterIdentifier);
/**
*
* The destination Amazon Web Services Region that you want to copy snapshots to.
*
*
* Constraints: Must be the name of a valid Amazon Web Services Region. For more information, see Regions and Endpoints in
* the Amazon Web Services General Reference.
*
*
* @param destinationRegion
* The destination Amazon Web Services Region that you want to copy snapshots to.
*
* Constraints: Must be the name of a valid Amazon Web Services Region. For more information, see Regions and
* Endpoints in the Amazon Web Services General Reference.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder destinationRegion(String destinationRegion);
/**
*
* The number of days to retain automated snapshots in the destination region after they are copied from the
* source region.
*
*
* Default: 7.
*
*
* Constraints: Must be at least 1 and no more than 35.
*
*
* @param retentionPeriod
* The number of days to retain automated snapshots in the destination region after they are copied from
* the source region.
*
* Default: 7.
*
*
* Constraints: Must be at least 1 and no more than 35.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder retentionPeriod(Integer retentionPeriod);
/**
*
* The name of the snapshot copy grant to use when snapshots of an Amazon Web Services KMS-encrypted cluster are
* copied to the destination region.
*
*
* @param snapshotCopyGrantName
* The name of the snapshot copy grant to use when snapshots of an Amazon Web Services KMS-encrypted
* cluster are copied to the destination region.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder snapshotCopyGrantName(String snapshotCopyGrantName);
/**
*
* The number of days to retain newly copied snapshots in the destination Amazon Web Services Region after they
* are copied from the source Amazon Web Services Region. If the value is -1, the manual snapshot is retained
* indefinitely.
*
*
* The value must be either -1 or an integer between 1 and 3,653.
*
*
* @param manualSnapshotRetentionPeriod
* The number of days to retain newly copied snapshots in the destination Amazon Web Services Region
* after they are copied from the source Amazon Web Services Region. If the value is -1, the manual
* snapshot is retained indefinitely.
*
* The value must be either -1 or an integer between 1 and 3,653.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder manualSnapshotRetentionPeriod(Integer manualSnapshotRetentionPeriod);
@Override
Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration);
@Override
Builder overrideConfiguration(Consumer builderConsumer);
}
static final class BuilderImpl extends RedshiftRequest.BuilderImpl implements Builder {
private String clusterIdentifier;
private String destinationRegion;
private Integer retentionPeriod;
private String snapshotCopyGrantName;
private Integer manualSnapshotRetentionPeriod;
private BuilderImpl() {
}
private BuilderImpl(EnableSnapshotCopyRequest model) {
super(model);
clusterIdentifier(model.clusterIdentifier);
destinationRegion(model.destinationRegion);
retentionPeriod(model.retentionPeriod);
snapshotCopyGrantName(model.snapshotCopyGrantName);
manualSnapshotRetentionPeriod(model.manualSnapshotRetentionPeriod);
}
public final String getClusterIdentifier() {
return clusterIdentifier;
}
public final void setClusterIdentifier(String clusterIdentifier) {
this.clusterIdentifier = clusterIdentifier;
}
@Override
public final Builder clusterIdentifier(String clusterIdentifier) {
this.clusterIdentifier = clusterIdentifier;
return this;
}
public final String getDestinationRegion() {
return destinationRegion;
}
public final void setDestinationRegion(String destinationRegion) {
this.destinationRegion = destinationRegion;
}
@Override
public final Builder destinationRegion(String destinationRegion) {
this.destinationRegion = destinationRegion;
return this;
}
public final Integer getRetentionPeriod() {
return retentionPeriod;
}
public final void setRetentionPeriod(Integer retentionPeriod) {
this.retentionPeriod = retentionPeriod;
}
@Override
public final Builder retentionPeriod(Integer retentionPeriod) {
this.retentionPeriod = retentionPeriod;
return this;
}
public final String getSnapshotCopyGrantName() {
return snapshotCopyGrantName;
}
public final void setSnapshotCopyGrantName(String snapshotCopyGrantName) {
this.snapshotCopyGrantName = snapshotCopyGrantName;
}
@Override
public final Builder snapshotCopyGrantName(String snapshotCopyGrantName) {
this.snapshotCopyGrantName = snapshotCopyGrantName;
return this;
}
public final Integer getManualSnapshotRetentionPeriod() {
return manualSnapshotRetentionPeriod;
}
public final void setManualSnapshotRetentionPeriod(Integer manualSnapshotRetentionPeriod) {
this.manualSnapshotRetentionPeriod = manualSnapshotRetentionPeriod;
}
@Override
public final Builder manualSnapshotRetentionPeriod(Integer manualSnapshotRetentionPeriod) {
this.manualSnapshotRetentionPeriod = manualSnapshotRetentionPeriod;
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 EnableSnapshotCopyRequest build() {
return new EnableSnapshotCopyRequest(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}