software.amazon.awssdk.services.rds.model.StartExportTaskRequest Maven / Gradle / Ivy
Show all versions of rds 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.rds.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 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 StartExportTaskRequest extends RdsRequest implements
ToCopyableBuilder {
private static final SdkField EXPORT_TASK_IDENTIFIER_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ExportTaskIdentifier").getter(getter(StartExportTaskRequest::exportTaskIdentifier))
.setter(setter(Builder::exportTaskIdentifier))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ExportTaskIdentifier").build())
.build();
private static final SdkField SOURCE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SourceArn").getter(getter(StartExportTaskRequest::sourceArn)).setter(setter(Builder::sourceArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SourceArn").build()).build();
private static final SdkField S3_BUCKET_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("S3BucketName").getter(getter(StartExportTaskRequest::s3BucketName))
.setter(setter(Builder::s3BucketName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("S3BucketName").build()).build();
private static final SdkField IAM_ROLE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("IamRoleArn").getter(getter(StartExportTaskRequest::iamRoleArn)).setter(setter(Builder::iamRoleArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IamRoleArn").build()).build();
private static final SdkField KMS_KEY_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("KmsKeyId").getter(getter(StartExportTaskRequest::kmsKeyId)).setter(setter(Builder::kmsKeyId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("KmsKeyId").build()).build();
private static final SdkField S3_PREFIX_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("S3Prefix").getter(getter(StartExportTaskRequest::s3Prefix)).setter(setter(Builder::s3Prefix))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("S3Prefix").build()).build();
private static final SdkField> EXPORT_ONLY_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("ExportOnly")
.getter(getter(StartExportTaskRequest::exportOnly))
.setter(setter(Builder::exportOnly))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ExportOnly").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(EXPORT_TASK_IDENTIFIER_FIELD,
SOURCE_ARN_FIELD, S3_BUCKET_NAME_FIELD, IAM_ROLE_ARN_FIELD, KMS_KEY_ID_FIELD, S3_PREFIX_FIELD, EXPORT_ONLY_FIELD));
private final String exportTaskIdentifier;
private final String sourceArn;
private final String s3BucketName;
private final String iamRoleArn;
private final String kmsKeyId;
private final String s3Prefix;
private final List exportOnly;
private StartExportTaskRequest(BuilderImpl builder) {
super(builder);
this.exportTaskIdentifier = builder.exportTaskIdentifier;
this.sourceArn = builder.sourceArn;
this.s3BucketName = builder.s3BucketName;
this.iamRoleArn = builder.iamRoleArn;
this.kmsKeyId = builder.kmsKeyId;
this.s3Prefix = builder.s3Prefix;
this.exportOnly = builder.exportOnly;
}
/**
*
* A unique identifier for the export task. This ID isn't an identifier for the Amazon S3 bucket where the data is
* to be exported.
*
*
* @return A unique identifier for the export task. This ID isn't an identifier for the Amazon S3 bucket where the
* data is to be exported.
*/
public final String exportTaskIdentifier() {
return exportTaskIdentifier;
}
/**
*
* The Amazon Resource Name (ARN) of the snapshot or cluster to export to Amazon S3.
*
*
* @return The Amazon Resource Name (ARN) of the snapshot or cluster to export to Amazon S3.
*/
public final String sourceArn() {
return sourceArn;
}
/**
*
* The name of the Amazon S3 bucket to export the snapshot or cluster data to.
*
*
* @return The name of the Amazon S3 bucket to export the snapshot or cluster data to.
*/
public final String s3BucketName() {
return s3BucketName;
}
/**
*
* The name of the IAM role to use for writing to the Amazon S3 bucket when exporting a snapshot or cluster.
*
*
* In the IAM policy attached to your IAM role, include the following required actions to allow the transfer of
* files from Amazon RDS or Amazon Aurora to an S3 bucket:
*
*
* -
*
* s3:PutObject*
*
*
* -
*
* s3:GetObject*
*
*
* -
*
* s3:ListBucket
*
*
* -
*
* s3:DeleteObject*
*
*
* -
*
* s3:GetBucketLocation
*
*
*
*
* In the policy, include the resources to identify the S3 bucket and objects in the bucket. The following list of
* resources shows the Amazon Resource Name (ARN) format for accessing S3:
*
*
* -
*
* arn:aws:s3:::your-s3-bucket
*
*
* -
*
* arn:aws:s3:::your-s3-bucket/*
*
*
*
*
* @return The name of the IAM role to use for writing to the Amazon S3 bucket when exporting a snapshot or
* cluster.
*
* In the IAM policy attached to your IAM role, include the following required actions to allow the transfer
* of files from Amazon RDS or Amazon Aurora to an S3 bucket:
*
*
* -
*
* s3:PutObject*
*
*
* -
*
* s3:GetObject*
*
*
* -
*
* s3:ListBucket
*
*
* -
*
* s3:DeleteObject*
*
*
* -
*
* s3:GetBucketLocation
*
*
*
*
* In the policy, include the resources to identify the S3 bucket and objects in the bucket. The following
* list of resources shows the Amazon Resource Name (ARN) format for accessing S3:
*
*
* -
*
* arn:aws:s3:::your-s3-bucket
*
*
* -
*
* arn:aws:s3:::your-s3-bucket/*
*
*
*/
public final String iamRoleArn() {
return iamRoleArn;
}
/**
*
* The ID of the Amazon Web Services KMS key to use to encrypt the data exported to Amazon S3. The Amazon Web
* Services KMS key identifier is the key ARN, key ID, alias ARN, or alias name for the KMS key. The caller of this
* operation must be authorized to run the following operations. These can be set in the Amazon Web Services KMS key
* policy:
*
*
* -
*
* kms:Encrypt
*
*
* -
*
* kms:Decrypt
*
*
* -
*
* kms:GenerateDataKey
*
*
* -
*
* kms:GenerateDataKeyWithoutPlaintext
*
*
* -
*
* kms:ReEncryptFrom
*
*
* -
*
* kms:ReEncryptTo
*
*
* -
*
* kms:CreateGrant
*
*
* -
*
* kms:DescribeKey
*
*
* -
*
* kms:RetireGrant
*
*
*
*
* @return The ID of the Amazon Web Services KMS key to use to encrypt the data exported to Amazon S3. The Amazon
* Web Services KMS key identifier is the key ARN, key ID, alias ARN, or alias name for the KMS key. The
* caller of this operation must be authorized to run the following operations. These can be set in the
* Amazon Web Services KMS key policy:
*
* -
*
* kms:Encrypt
*
*
* -
*
* kms:Decrypt
*
*
* -
*
* kms:GenerateDataKey
*
*
* -
*
* kms:GenerateDataKeyWithoutPlaintext
*
*
* -
*
* kms:ReEncryptFrom
*
*
* -
*
* kms:ReEncryptTo
*
*
* -
*
* kms:CreateGrant
*
*
* -
*
* kms:DescribeKey
*
*
* -
*
* kms:RetireGrant
*
*
*/
public final String kmsKeyId() {
return kmsKeyId;
}
/**
*
* The Amazon S3 bucket prefix to use as the file name and path of the exported data.
*
*
* @return The Amazon S3 bucket prefix to use as the file name and path of the exported data.
*/
public final String s3Prefix() {
return s3Prefix;
}
/**
* For responses, this returns true if the service returned a value for the ExportOnly 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 hasExportOnly() {
return exportOnly != null && !(exportOnly instanceof SdkAutoConstructList);
}
/**
*
* The data to be exported from the snapshot or cluster. If this parameter isn't provided, all of the data is
* exported.
*
*
* Valid Values:
*
*
* -
*
* database
- Export all the data from a specified database.
*
*
* -
*
* database.table
table-name - Export a table of the snapshot or cluster. This format is valid
* only for RDS for MySQL, RDS for MariaDB, and Aurora MySQL.
*
*
* -
*
* database.schema
schema-name - Export a database schema of the snapshot or cluster. This
* format is valid only for RDS for PostgreSQL and Aurora PostgreSQL.
*
*
* -
*
* database.schema.table
table-name - Export a table of the database schema. This format is
* valid only for RDS for PostgreSQL and Aurora PostgreSQL.
*
*
*
*
* 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 #hasExportOnly} method.
*
*
* @return The data to be exported from the snapshot or cluster. If this parameter isn't provided, all of the data
* is exported.
*
* Valid Values:
*
*
* -
*
* database
- Export all the data from a specified database.
*
*
* -
*
* database.table
table-name - Export a table of the snapshot or cluster. This format is
* valid only for RDS for MySQL, RDS for MariaDB, and Aurora MySQL.
*
*
* -
*
* database.schema
schema-name - Export a database schema of the snapshot or cluster.
* This format is valid only for RDS for PostgreSQL and Aurora PostgreSQL.
*
*
* -
*
* database.schema.table
table-name - Export a table of the database schema. This format
* is valid only for RDS for PostgreSQL and Aurora PostgreSQL.
*
*
*/
public final List exportOnly() {
return exportOnly;
}
@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(exportTaskIdentifier());
hashCode = 31 * hashCode + Objects.hashCode(sourceArn());
hashCode = 31 * hashCode + Objects.hashCode(s3BucketName());
hashCode = 31 * hashCode + Objects.hashCode(iamRoleArn());
hashCode = 31 * hashCode + Objects.hashCode(kmsKeyId());
hashCode = 31 * hashCode + Objects.hashCode(s3Prefix());
hashCode = 31 * hashCode + Objects.hashCode(hasExportOnly() ? exportOnly() : null);
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 StartExportTaskRequest)) {
return false;
}
StartExportTaskRequest other = (StartExportTaskRequest) obj;
return Objects.equals(exportTaskIdentifier(), other.exportTaskIdentifier())
&& Objects.equals(sourceArn(), other.sourceArn()) && Objects.equals(s3BucketName(), other.s3BucketName())
&& Objects.equals(iamRoleArn(), other.iamRoleArn()) && Objects.equals(kmsKeyId(), other.kmsKeyId())
&& Objects.equals(s3Prefix(), other.s3Prefix()) && hasExportOnly() == other.hasExportOnly()
&& Objects.equals(exportOnly(), other.exportOnly());
}
/**
* 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("StartExportTaskRequest").add("ExportTaskIdentifier", exportTaskIdentifier())
.add("SourceArn", sourceArn()).add("S3BucketName", s3BucketName()).add("IamRoleArn", iamRoleArn())
.add("KmsKeyId", kmsKeyId()).add("S3Prefix", s3Prefix()).add("ExportOnly", hasExportOnly() ? exportOnly() : null)
.build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ExportTaskIdentifier":
return Optional.ofNullable(clazz.cast(exportTaskIdentifier()));
case "SourceArn":
return Optional.ofNullable(clazz.cast(sourceArn()));
case "S3BucketName":
return Optional.ofNullable(clazz.cast(s3BucketName()));
case "IamRoleArn":
return Optional.ofNullable(clazz.cast(iamRoleArn()));
case "KmsKeyId":
return Optional.ofNullable(clazz.cast(kmsKeyId()));
case "S3Prefix":
return Optional.ofNullable(clazz.cast(s3Prefix()));
case "ExportOnly":
return Optional.ofNullable(clazz.cast(exportOnly()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function