software.amazon.awssdk.services.neptune.model.CopyDbClusterSnapshotRequest Maven / Gradle / Ivy
Show all versions of neptune 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.neptune.model;
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.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.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;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class CopyDbClusterSnapshotRequest extends NeptuneRequest implements
ToCopyableBuilder {
private static final SdkField SOURCE_DB_CLUSTER_SNAPSHOT_IDENTIFIER_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("SourceDBClusterSnapshotIdentifier")
.getter(getter(CopyDbClusterSnapshotRequest::sourceDBClusterSnapshotIdentifier))
.setter(setter(Builder::sourceDBClusterSnapshotIdentifier))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SourceDBClusterSnapshotIdentifier")
.build()).build();
private static final SdkField TARGET_DB_CLUSTER_SNAPSHOT_IDENTIFIER_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("TargetDBClusterSnapshotIdentifier")
.getter(getter(CopyDbClusterSnapshotRequest::targetDBClusterSnapshotIdentifier))
.setter(setter(Builder::targetDBClusterSnapshotIdentifier))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TargetDBClusterSnapshotIdentifier")
.build()).build();
private static final SdkField KMS_KEY_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("KmsKeyId").getter(getter(CopyDbClusterSnapshotRequest::kmsKeyId)).setter(setter(Builder::kmsKeyId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("KmsKeyId").build()).build();
private static final SdkField PRE_SIGNED_URL_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("PreSignedUrl").getter(getter(CopyDbClusterSnapshotRequest::preSignedUrl))
.setter(setter(Builder::preSignedUrl))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PreSignedUrl").build()).build();
private static final SdkField COPY_TAGS_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("CopyTags").getter(getter(CopyDbClusterSnapshotRequest::copyTags)).setter(setter(Builder::copyTags))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CopyTags").build()).build();
private static final SdkField> TAGS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Tags")
.getter(getter(CopyDbClusterSnapshotRequest::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 SOURCE_REGION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SourceRegion").getter(getter(CopyDbClusterSnapshotRequest::sourceRegion))
.setter(setter(Builder::sourceRegion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SourceRegion").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(
SOURCE_DB_CLUSTER_SNAPSHOT_IDENTIFIER_FIELD, TARGET_DB_CLUSTER_SNAPSHOT_IDENTIFIER_FIELD, KMS_KEY_ID_FIELD,
PRE_SIGNED_URL_FIELD, COPY_TAGS_FIELD, TAGS_FIELD, SOURCE_REGION_FIELD));
private final String sourceDBClusterSnapshotIdentifier;
private final String targetDBClusterSnapshotIdentifier;
private final String kmsKeyId;
private final String preSignedUrl;
private final Boolean copyTags;
private final List tags;
private final String sourceRegion;
private CopyDbClusterSnapshotRequest(BuilderImpl builder) {
super(builder);
this.sourceDBClusterSnapshotIdentifier = builder.sourceDBClusterSnapshotIdentifier;
this.targetDBClusterSnapshotIdentifier = builder.targetDBClusterSnapshotIdentifier;
this.kmsKeyId = builder.kmsKeyId;
this.preSignedUrl = builder.preSignedUrl;
this.copyTags = builder.copyTags;
this.tags = builder.tags;
this.sourceRegion = builder.sourceRegion;
}
/**
*
* The identifier of the DB cluster snapshot to copy. This parameter is not case-sensitive.
*
*
* Constraints:
*
*
* -
*
* Must specify a valid system snapshot in the "available" state.
*
*
* -
*
* Specify a valid DB snapshot identifier.
*
*
*
*
* Example: my-cluster-snapshot1
*
*
* @return The identifier of the DB cluster snapshot to copy. This parameter is not case-sensitive.
*
* Constraints:
*
*
* -
*
* Must specify a valid system snapshot in the "available" state.
*
*
* -
*
* Specify a valid DB snapshot identifier.
*
*
*
*
* Example: my-cluster-snapshot1
*/
public final String sourceDBClusterSnapshotIdentifier() {
return sourceDBClusterSnapshotIdentifier;
}
/**
*
* The identifier of the new DB cluster snapshot to create from the source DB cluster snapshot. This parameter is
* not case-sensitive.
*
*
* Constraints:
*
*
* -
*
* Must contain from 1 to 63 letters, numbers, or hyphens.
*
*
* -
*
* First character must be a letter.
*
*
* -
*
* Cannot end with a hyphen or contain two consecutive hyphens.
*
*
*
*
* Example: my-cluster-snapshot2
*
*
* @return The identifier of the new DB cluster snapshot to create from the source DB cluster snapshot. This
* parameter is not case-sensitive.
*
* Constraints:
*
*
* -
*
* Must contain from 1 to 63 letters, numbers, or hyphens.
*
*
* -
*
* First character must be a letter.
*
*
* -
*
* Cannot end with a hyphen or contain two consecutive hyphens.
*
*
*
*
* Example: my-cluster-snapshot2
*/
public final String targetDBClusterSnapshotIdentifier() {
return targetDBClusterSnapshotIdentifier;
}
/**
*
* The Amazon Amazon KMS key ID for an encrypted DB cluster snapshot. The KMS key ID is the Amazon Resource Name
* (ARN), KMS key identifier, or the KMS key alias for the KMS encryption key.
*
*
* If you copy an encrypted DB cluster snapshot from your Amazon account, you can specify a value for
* KmsKeyId
to encrypt the copy with a new KMS encryption key. If you don't specify a value for
* KmsKeyId
, then the copy of the DB cluster snapshot is encrypted with the same KMS key as the source
* DB cluster snapshot.
*
*
* If you copy an encrypted DB cluster snapshot that is shared from another Amazon account, then you must specify a
* value for KmsKeyId
.
*
*
* KMS encryption keys are specific to the Amazon Region that they are created in, and you can't use encryption keys
* from one Amazon Region in another Amazon Region.
*
*
* You cannot encrypt an unencrypted DB cluster snapshot when you copy it. If you try to copy an unencrypted DB
* cluster snapshot and specify a value for the KmsKeyId parameter, an error is returned.
*
*
* @return The Amazon Amazon KMS key ID for an encrypted DB cluster snapshot. The KMS key ID is the Amazon Resource
* Name (ARN), KMS key identifier, or the KMS key alias for the KMS encryption key.
*
* If you copy an encrypted DB cluster snapshot from your Amazon account, you can specify a value for
* KmsKeyId
to encrypt the copy with a new KMS encryption key. If you don't specify a value for
* KmsKeyId
, then the copy of the DB cluster snapshot is encrypted with the same KMS key as the
* source DB cluster snapshot.
*
*
* If you copy an encrypted DB cluster snapshot that is shared from another Amazon account, then you must
* specify a value for KmsKeyId
.
*
*
* KMS encryption keys are specific to the Amazon Region that they are created in, and you can't use
* encryption keys from one Amazon Region in another Amazon Region.
*
*
* You cannot encrypt an unencrypted DB cluster snapshot when you copy it. If you try to copy an unencrypted
* DB cluster snapshot and specify a value for the KmsKeyId parameter, an error is returned.
*/
public final String kmsKeyId() {
return kmsKeyId;
}
/**
*
* Not currently supported.
*
*
* @return Not currently supported.
*/
public final String preSignedUrl() {
return preSignedUrl;
}
/**
*
* True to copy all tags from the source DB cluster snapshot to the target DB cluster snapshot, and otherwise false.
* The default is false.
*
*
* @return True to copy all tags from the source DB cluster snapshot to the target DB cluster snapshot, and
* otherwise false. The default is false.
*/
public final Boolean copyTags() {
return copyTags;
}
/**
* For responses, this returns true if the service returned a value for the Tags property. This DOES NOT check that
* the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is useful
* because the SDK will never return a null collection or map, but you may need to differentiate between the service
* returning nothing (or null) and the service returning an empty collection or map. For requests, this returns true
* if a value for the property was specified in the request builder, and false if a value was not specified.
*/
public final boolean hasTags() {
return tags != null && !(tags instanceof SdkAutoConstructList);
}
/**
*
* The tags to assign to the new DB cluster snapshot copy.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasTags} method.
*
*
* @return The tags to assign to the new DB cluster snapshot copy.
*/
public final List tags() {
return tags;
}
/**
* If PreSignedUrl is not specified, this is the region where the source snapshot is located. A PreSignedUrl will be
* generated automatically by the SDK.
*
* @return If PreSignedUrl is not specified, this is the region where the source snapshot is located. A PreSignedUrl
* will be generated automatically by the SDK.
*/
public final String sourceRegion() {
return sourceRegion;
}
@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(sourceDBClusterSnapshotIdentifier());
hashCode = 31 * hashCode + Objects.hashCode(targetDBClusterSnapshotIdentifier());
hashCode = 31 * hashCode + Objects.hashCode(kmsKeyId());
hashCode = 31 * hashCode + Objects.hashCode(preSignedUrl());
hashCode = 31 * hashCode + Objects.hashCode(copyTags());
hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : null);
hashCode = 31 * hashCode + Objects.hashCode(sourceRegion());
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 CopyDbClusterSnapshotRequest)) {
return false;
}
CopyDbClusterSnapshotRequest other = (CopyDbClusterSnapshotRequest) obj;
return Objects.equals(sourceDBClusterSnapshotIdentifier(), other.sourceDBClusterSnapshotIdentifier())
&& Objects.equals(targetDBClusterSnapshotIdentifier(), other.targetDBClusterSnapshotIdentifier())
&& Objects.equals(kmsKeyId(), other.kmsKeyId()) && Objects.equals(preSignedUrl(), other.preSignedUrl())
&& Objects.equals(copyTags(), other.copyTags()) && hasTags() == other.hasTags()
&& Objects.equals(tags(), other.tags()) && Objects.equals(sourceRegion(), other.sourceRegion());
}
/**
* 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("CopyDbClusterSnapshotRequest")
.add("SourceDBClusterSnapshotIdentifier", sourceDBClusterSnapshotIdentifier())
.add("TargetDBClusterSnapshotIdentifier", targetDBClusterSnapshotIdentifier()).add("KmsKeyId", kmsKeyId())
.add("PreSignedUrl", preSignedUrl()).add("CopyTags", copyTags()).add("Tags", hasTags() ? tags() : null)
.add("SourceRegion", sourceRegion()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "SourceDBClusterSnapshotIdentifier":
return Optional.ofNullable(clazz.cast(sourceDBClusterSnapshotIdentifier()));
case "TargetDBClusterSnapshotIdentifier":
return Optional.ofNullable(clazz.cast(targetDBClusterSnapshotIdentifier()));
case "KmsKeyId":
return Optional.ofNullable(clazz.cast(kmsKeyId()));
case "PreSignedUrl":
return Optional.ofNullable(clazz.cast(preSignedUrl()));
case "CopyTags":
return Optional.ofNullable(clazz.cast(copyTags()));
case "Tags":
return Optional.ofNullable(clazz.cast(tags()));
case "SourceRegion":
return Optional.ofNullable(clazz.cast(sourceRegion()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function