software.amazon.awssdk.services.redshiftserverless.model.RestoreFromSnapshotRequest Maven / Gradle / Ivy
Show all versions of redshiftserverless 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.redshiftserverless.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 RestoreFromSnapshotRequest extends RedshiftServerlessRequest implements
ToCopyableBuilder {
private static final SdkField ADMIN_PASSWORD_SECRET_KMS_KEY_ID_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("adminPasswordSecretKmsKeyId")
.getter(getter(RestoreFromSnapshotRequest::adminPasswordSecretKmsKeyId))
.setter(setter(Builder::adminPasswordSecretKmsKeyId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("adminPasswordSecretKmsKeyId")
.build()).build();
private static final SdkField MANAGE_ADMIN_PASSWORD_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("manageAdminPassword").getter(getter(RestoreFromSnapshotRequest::manageAdminPassword))
.setter(setter(Builder::manageAdminPassword))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("manageAdminPassword").build())
.build();
private static final SdkField NAMESPACE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("namespaceName").getter(getter(RestoreFromSnapshotRequest::namespaceName))
.setter(setter(Builder::namespaceName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("namespaceName").build()).build();
private static final SdkField OWNER_ACCOUNT_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ownerAccount").getter(getter(RestoreFromSnapshotRequest::ownerAccount))
.setter(setter(Builder::ownerAccount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ownerAccount").build()).build();
private static final SdkField SNAPSHOT_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("snapshotArn").getter(getter(RestoreFromSnapshotRequest::snapshotArn))
.setter(setter(Builder::snapshotArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("snapshotArn").build()).build();
private static final SdkField SNAPSHOT_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("snapshotName").getter(getter(RestoreFromSnapshotRequest::snapshotName))
.setter(setter(Builder::snapshotName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("snapshotName").build()).build();
private static final SdkField WORKGROUP_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("workgroupName").getter(getter(RestoreFromSnapshotRequest::workgroupName))
.setter(setter(Builder::workgroupName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("workgroupName").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(
ADMIN_PASSWORD_SECRET_KMS_KEY_ID_FIELD, MANAGE_ADMIN_PASSWORD_FIELD, NAMESPACE_NAME_FIELD, OWNER_ACCOUNT_FIELD,
SNAPSHOT_ARN_FIELD, SNAPSHOT_NAME_FIELD, WORKGROUP_NAME_FIELD));
private final String adminPasswordSecretKmsKeyId;
private final Boolean manageAdminPassword;
private final String namespaceName;
private final String ownerAccount;
private final String snapshotArn;
private final String snapshotName;
private final String workgroupName;
private RestoreFromSnapshotRequest(BuilderImpl builder) {
super(builder);
this.adminPasswordSecretKmsKeyId = builder.adminPasswordSecretKmsKeyId;
this.manageAdminPassword = builder.manageAdminPassword;
this.namespaceName = builder.namespaceName;
this.ownerAccount = builder.ownerAccount;
this.snapshotArn = builder.snapshotArn;
this.snapshotName = builder.snapshotName;
this.workgroupName = builder.workgroupName;
}
/**
*
* The ID of the Key Management Service (KMS) key used to encrypt and store the namespace's admin credentials
* secret.
*
*
* @return The ID of the Key Management Service (KMS) key used to encrypt and store the namespace's admin
* credentials secret.
*/
public final String adminPasswordSecretKmsKeyId() {
return adminPasswordSecretKmsKeyId;
}
/**
*
* If true
, Amazon Redshift uses Secrets Manager to manage the restored snapshot's admin credentials.
* If MmanageAdminPassword
is false or not set, Amazon Redshift uses the admin credentials that the
* namespace or cluster had at the time the snapshot was taken.
*
*
* @return If true
, Amazon Redshift uses Secrets Manager to manage the restored snapshot's admin
* credentials. If MmanageAdminPassword
is false or not set, Amazon Redshift uses the admin
* credentials that the namespace or cluster had at the time the snapshot was taken.
*/
public final Boolean manageAdminPassword() {
return manageAdminPassword;
}
/**
*
* The name of the namespace to restore the snapshot to.
*
*
* @return The name of the namespace to restore the snapshot to.
*/
public final String namespaceName() {
return namespaceName;
}
/**
*
* The Amazon Web Services account that owns the snapshot.
*
*
* @return The Amazon Web Services account that owns the snapshot.
*/
public final String ownerAccount() {
return ownerAccount;
}
/**
*
* The Amazon Resource Name (ARN) of the snapshot to restore from. Required if restoring from Amazon Redshift
* Serverless to a provisioned cluster. Must not be specified at the same time as snapshotName
.
*
*
* The format of the ARN is
* arn:aws:redshift:<region>:<account_id>:snapshot:<cluster_identifier>/<
* ;snapshot_identifier>.
*
*
* @return The Amazon Resource Name (ARN) of the snapshot to restore from. Required if restoring from Amazon
* Redshift Serverless to a provisioned cluster. Must not be specified at the same time as
* snapshotName
.
*
* The format of the ARN is
* arn:aws:redshift:<region>:<account_id>:snapshot:<cluster_identifier
* >/<snapshot_identifier>.
*/
public final String snapshotArn() {
return snapshotArn;
}
/**
*
* The name of the snapshot to restore from. Must not be specified at the same time as snapshotArn
.
*
*
* @return The name of the snapshot to restore from. Must not be specified at the same time as
* snapshotArn
.
*/
public final String snapshotName() {
return snapshotName;
}
/**
*
* The name of the workgroup used to restore the snapshot.
*
*
* @return The name of the workgroup used to restore the snapshot.
*/
public final String workgroupName() {
return workgroupName;
}
@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(adminPasswordSecretKmsKeyId());
hashCode = 31 * hashCode + Objects.hashCode(manageAdminPassword());
hashCode = 31 * hashCode + Objects.hashCode(namespaceName());
hashCode = 31 * hashCode + Objects.hashCode(ownerAccount());
hashCode = 31 * hashCode + Objects.hashCode(snapshotArn());
hashCode = 31 * hashCode + Objects.hashCode(snapshotName());
hashCode = 31 * hashCode + Objects.hashCode(workgroupName());
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 RestoreFromSnapshotRequest)) {
return false;
}
RestoreFromSnapshotRequest other = (RestoreFromSnapshotRequest) obj;
return Objects.equals(adminPasswordSecretKmsKeyId(), other.adminPasswordSecretKmsKeyId())
&& Objects.equals(manageAdminPassword(), other.manageAdminPassword())
&& Objects.equals(namespaceName(), other.namespaceName()) && Objects.equals(ownerAccount(), other.ownerAccount())
&& Objects.equals(snapshotArn(), other.snapshotArn()) && Objects.equals(snapshotName(), other.snapshotName())
&& Objects.equals(workgroupName(), other.workgroupName());
}
/**
* 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("RestoreFromSnapshotRequest").add("AdminPasswordSecretKmsKeyId", adminPasswordSecretKmsKeyId())
.add("ManageAdminPassword", manageAdminPassword()).add("NamespaceName", namespaceName())
.add("OwnerAccount", ownerAccount()).add("SnapshotArn", snapshotArn()).add("SnapshotName", snapshotName())
.add("WorkgroupName", workgroupName()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "adminPasswordSecretKmsKeyId":
return Optional.ofNullable(clazz.cast(adminPasswordSecretKmsKeyId()));
case "manageAdminPassword":
return Optional.ofNullable(clazz.cast(manageAdminPassword()));
case "namespaceName":
return Optional.ofNullable(clazz.cast(namespaceName()));
case "ownerAccount":
return Optional.ofNullable(clazz.cast(ownerAccount()));
case "snapshotArn":
return Optional.ofNullable(clazz.cast(snapshotArn()));
case "snapshotName":
return Optional.ofNullable(clazz.cast(snapshotName()));
case "workgroupName":
return Optional.ofNullable(clazz.cast(workgroupName()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function