All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.redshiftserverless.model.RestoreFromSnapshotRequest Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Redshift Serverless module holds the client classes that are used for communicating with Redshift Serverless.

There is a newer version: 2.29.15
Show newest version
/*
 * 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 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 getter(Function g) { return obj -> g.apply((RestoreFromSnapshotRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends RedshiftServerlessRequest.Builder, SdkPojo, CopyableBuilder { /** *

* The ID of the Key Management Service (KMS) key used to encrypt and store the namespace's admin credentials * secret. *

* * @param adminPasswordSecretKmsKeyId * The ID of the Key Management Service (KMS) key used to encrypt and store the namespace's admin * credentials secret. * @return Returns a reference to this object so that method calls can be chained together. */ Builder adminPasswordSecretKmsKeyId(String 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. *

* * @param manageAdminPassword * 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 Returns a reference to this object so that method calls can be chained together. */ Builder manageAdminPassword(Boolean manageAdminPassword); /** *

* The name of the namespace to restore the snapshot to. *

* * @param namespaceName * The name of the namespace to restore the snapshot to. * @return Returns a reference to this object so that method calls can be chained together. */ Builder namespaceName(String namespaceName); /** *

* The Amazon Web Services account that owns the snapshot. *

* * @param ownerAccount * The Amazon Web Services account that owns the snapshot. * @return Returns a reference to this object so that method calls can be chained together. */ Builder ownerAccount(String 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>. *

* * @param snapshotArn * 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 Returns a reference to this object so that method calls can be chained together. */ Builder snapshotArn(String snapshotArn); /** *

* The name of the snapshot to restore from. Must not be specified at the same time as snapshotArn. *

* * @param snapshotName * The name of the snapshot to restore from. Must not be specified at the same time as * snapshotArn. * @return Returns a reference to this object so that method calls can be chained together. */ Builder snapshotName(String snapshotName); /** *

* The name of the workgroup used to restore the snapshot. *

* * @param workgroupName * The name of the workgroup used to restore the snapshot. * @return Returns a reference to this object so that method calls can be chained together. */ Builder workgroupName(String workgroupName); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends RedshiftServerlessRequest.BuilderImpl implements Builder { private String adminPasswordSecretKmsKeyId; private Boolean manageAdminPassword; private String namespaceName; private String ownerAccount; private String snapshotArn; private String snapshotName; private String workgroupName; private BuilderImpl() { } private BuilderImpl(RestoreFromSnapshotRequest model) { super(model); adminPasswordSecretKmsKeyId(model.adminPasswordSecretKmsKeyId); manageAdminPassword(model.manageAdminPassword); namespaceName(model.namespaceName); ownerAccount(model.ownerAccount); snapshotArn(model.snapshotArn); snapshotName(model.snapshotName); workgroupName(model.workgroupName); } public final String getAdminPasswordSecretKmsKeyId() { return adminPasswordSecretKmsKeyId; } public final void setAdminPasswordSecretKmsKeyId(String adminPasswordSecretKmsKeyId) { this.adminPasswordSecretKmsKeyId = adminPasswordSecretKmsKeyId; } @Override public final Builder adminPasswordSecretKmsKeyId(String adminPasswordSecretKmsKeyId) { this.adminPasswordSecretKmsKeyId = adminPasswordSecretKmsKeyId; return this; } public final Boolean getManageAdminPassword() { return manageAdminPassword; } public final void setManageAdminPassword(Boolean manageAdminPassword) { this.manageAdminPassword = manageAdminPassword; } @Override public final Builder manageAdminPassword(Boolean manageAdminPassword) { this.manageAdminPassword = manageAdminPassword; return this; } public final String getNamespaceName() { return namespaceName; } public final void setNamespaceName(String namespaceName) { this.namespaceName = namespaceName; } @Override public final Builder namespaceName(String namespaceName) { this.namespaceName = namespaceName; return this; } public final String getOwnerAccount() { return ownerAccount; } public final void setOwnerAccount(String ownerAccount) { this.ownerAccount = ownerAccount; } @Override public final Builder ownerAccount(String ownerAccount) { this.ownerAccount = ownerAccount; return this; } public final String getSnapshotArn() { return snapshotArn; } public final void setSnapshotArn(String snapshotArn) { this.snapshotArn = snapshotArn; } @Override public final Builder snapshotArn(String snapshotArn) { this.snapshotArn = snapshotArn; return this; } public final String getSnapshotName() { return snapshotName; } public final void setSnapshotName(String snapshotName) { this.snapshotName = snapshotName; } @Override public final Builder snapshotName(String snapshotName) { this.snapshotName = snapshotName; return this; } public final String getWorkgroupName() { return workgroupName; } public final void setWorkgroupName(String workgroupName) { this.workgroupName = workgroupName; } @Override public final Builder workgroupName(String workgroupName) { this.workgroupName = workgroupName; 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 RestoreFromSnapshotRequest build() { return new RestoreFromSnapshotRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy