
software.amazon.awssdk.services.dynamodb.model.RestoreTableToPointInTimeRequest Maven / Gradle / Ivy
/*
* 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.dynamodb.model;
import java.time.Instant;
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 RestoreTableToPointInTimeRequest extends DynamoDbRequest implements
ToCopyableBuilder {
private static final SdkField SOURCE_TABLE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SourceTableArn").getter(getter(RestoreTableToPointInTimeRequest::sourceTableArn))
.setter(setter(Builder::sourceTableArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SourceTableArn").build()).build();
private static final SdkField SOURCE_TABLE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SourceTableName").getter(getter(RestoreTableToPointInTimeRequest::sourceTableName))
.setter(setter(Builder::sourceTableName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SourceTableName").build()).build();
private static final SdkField TARGET_TABLE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("TargetTableName").getter(getter(RestoreTableToPointInTimeRequest::targetTableName))
.setter(setter(Builder::targetTableName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TargetTableName").build()).build();
private static final SdkField USE_LATEST_RESTORABLE_TIME_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("UseLatestRestorableTime").getter(getter(RestoreTableToPointInTimeRequest::useLatestRestorableTime))
.setter(setter(Builder::useLatestRestorableTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UseLatestRestorableTime").build())
.build();
private static final SdkField RESTORE_DATE_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("RestoreDateTime").getter(getter(RestoreTableToPointInTimeRequest::restoreDateTime))
.setter(setter(Builder::restoreDateTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RestoreDateTime").build()).build();
private static final SdkField BILLING_MODE_OVERRIDE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("BillingModeOverride").getter(getter(RestoreTableToPointInTimeRequest::billingModeOverrideAsString))
.setter(setter(Builder::billingModeOverride))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BillingModeOverride").build())
.build();
private static final SdkField> GLOBAL_SECONDARY_INDEX_OVERRIDE_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("GlobalSecondaryIndexOverride")
.getter(getter(RestoreTableToPointInTimeRequest::globalSecondaryIndexOverride))
.setter(setter(Builder::globalSecondaryIndexOverride))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("GlobalSecondaryIndexOverride")
.build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(GlobalSecondaryIndex::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField> LOCAL_SECONDARY_INDEX_OVERRIDE_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("LocalSecondaryIndexOverride")
.getter(getter(RestoreTableToPointInTimeRequest::localSecondaryIndexOverride))
.setter(setter(Builder::localSecondaryIndexOverride))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LocalSecondaryIndexOverride")
.build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(LocalSecondaryIndex::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField PROVISIONED_THROUGHPUT_OVERRIDE_FIELD = SdkField
. builder(MarshallingType.SDK_POJO)
.memberName("ProvisionedThroughputOverride")
.getter(getter(RestoreTableToPointInTimeRequest::provisionedThroughputOverride))
.setter(setter(Builder::provisionedThroughputOverride))
.constructor(ProvisionedThroughput::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ProvisionedThroughputOverride")
.build()).build();
private static final SdkField SSE_SPECIFICATION_OVERRIDE_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("SSESpecificationOverride")
.getter(getter(RestoreTableToPointInTimeRequest::sseSpecificationOverride))
.setter(setter(Builder::sseSpecificationOverride)).constructor(SSESpecification::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SSESpecificationOverride").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(SOURCE_TABLE_ARN_FIELD,
SOURCE_TABLE_NAME_FIELD, TARGET_TABLE_NAME_FIELD, USE_LATEST_RESTORABLE_TIME_FIELD, RESTORE_DATE_TIME_FIELD,
BILLING_MODE_OVERRIDE_FIELD, GLOBAL_SECONDARY_INDEX_OVERRIDE_FIELD, LOCAL_SECONDARY_INDEX_OVERRIDE_FIELD,
PROVISIONED_THROUGHPUT_OVERRIDE_FIELD, SSE_SPECIFICATION_OVERRIDE_FIELD));
private final String sourceTableArn;
private final String sourceTableName;
private final String targetTableName;
private final Boolean useLatestRestorableTime;
private final Instant restoreDateTime;
private final String billingModeOverride;
private final List globalSecondaryIndexOverride;
private final List localSecondaryIndexOverride;
private final ProvisionedThroughput provisionedThroughputOverride;
private final SSESpecification sseSpecificationOverride;
private RestoreTableToPointInTimeRequest(BuilderImpl builder) {
super(builder);
this.sourceTableArn = builder.sourceTableArn;
this.sourceTableName = builder.sourceTableName;
this.targetTableName = builder.targetTableName;
this.useLatestRestorableTime = builder.useLatestRestorableTime;
this.restoreDateTime = builder.restoreDateTime;
this.billingModeOverride = builder.billingModeOverride;
this.globalSecondaryIndexOverride = builder.globalSecondaryIndexOverride;
this.localSecondaryIndexOverride = builder.localSecondaryIndexOverride;
this.provisionedThroughputOverride = builder.provisionedThroughputOverride;
this.sseSpecificationOverride = builder.sseSpecificationOverride;
}
/**
*
* The DynamoDB table that will be restored. This value is an Amazon Resource Name (ARN).
*
*
* @return The DynamoDB table that will be restored. This value is an Amazon Resource Name (ARN).
*/
public final String sourceTableArn() {
return sourceTableArn;
}
/**
*
* Name of the source table that is being restored.
*
*
* @return Name of the source table that is being restored.
*/
public final String sourceTableName() {
return sourceTableName;
}
/**
*
* The name of the new table to which it must be restored to.
*
*
* @return The name of the new table to which it must be restored to.
*/
public final String targetTableName() {
return targetTableName;
}
/**
*
* Restore the table to the latest possible time. LatestRestorableDateTime
is typically 5 minutes
* before the current time.
*
*
* @return Restore the table to the latest possible time. LatestRestorableDateTime
is typically 5
* minutes before the current time.
*/
public final Boolean useLatestRestorableTime() {
return useLatestRestorableTime;
}
/**
*
* Time in the past to restore the table to.
*
*
* @return Time in the past to restore the table to.
*/
public final Instant restoreDateTime() {
return restoreDateTime;
}
/**
*
* The billing mode of the restored table.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #billingModeOverride} will return {@link BillingMode#UNKNOWN_TO_SDK_VERSION}. The raw value returned by
* the service is available from {@link #billingModeOverrideAsString}.
*
*
* @return The billing mode of the restored table.
* @see BillingMode
*/
public final BillingMode billingModeOverride() {
return BillingMode.fromValue(billingModeOverride);
}
/**
*
* The billing mode of the restored table.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #billingModeOverride} will return {@link BillingMode#UNKNOWN_TO_SDK_VERSION}. The raw value returned by
* the service is available from {@link #billingModeOverrideAsString}.
*
*
* @return The billing mode of the restored table.
* @see BillingMode
*/
public final String billingModeOverrideAsString() {
return billingModeOverride;
}
/**
* For responses, this returns true if the service returned a value for the GlobalSecondaryIndexOverride 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 hasGlobalSecondaryIndexOverride() {
return globalSecondaryIndexOverride != null && !(globalSecondaryIndexOverride instanceof SdkAutoConstructList);
}
/**
*
* List of global secondary indexes for the restored table. The indexes provided should match existing secondary
* indexes. You can choose to exclude some or all of the indexes at the time of restore.
*
*
* 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 #hasGlobalSecondaryIndexOverride} method.
*
*
* @return List of global secondary indexes for the restored table. The indexes provided should match existing
* secondary indexes. You can choose to exclude some or all of the indexes at the time of restore.
*/
public final List globalSecondaryIndexOverride() {
return globalSecondaryIndexOverride;
}
/**
* For responses, this returns true if the service returned a value for the LocalSecondaryIndexOverride 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 hasLocalSecondaryIndexOverride() {
return localSecondaryIndexOverride != null && !(localSecondaryIndexOverride instanceof SdkAutoConstructList);
}
/**
*
* List of local secondary indexes for the restored table. The indexes provided should match existing secondary
* indexes. You can choose to exclude some or all of the indexes at the time of restore.
*
*
* 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 #hasLocalSecondaryIndexOverride} method.
*
*
* @return List of local secondary indexes for the restored table. The indexes provided should match existing
* secondary indexes. You can choose to exclude some or all of the indexes at the time of restore.
*/
public final List localSecondaryIndexOverride() {
return localSecondaryIndexOverride;
}
/**
*
* Provisioned throughput settings for the restored table.
*
*
* @return Provisioned throughput settings for the restored table.
*/
public final ProvisionedThroughput provisionedThroughputOverride() {
return provisionedThroughputOverride;
}
/**
*
* The new server-side encryption settings for the restored table.
*
*
* @return The new server-side encryption settings for the restored table.
*/
public final SSESpecification sseSpecificationOverride() {
return sseSpecificationOverride;
}
@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(sourceTableArn());
hashCode = 31 * hashCode + Objects.hashCode(sourceTableName());
hashCode = 31 * hashCode + Objects.hashCode(targetTableName());
hashCode = 31 * hashCode + Objects.hashCode(useLatestRestorableTime());
hashCode = 31 * hashCode + Objects.hashCode(restoreDateTime());
hashCode = 31 * hashCode + Objects.hashCode(billingModeOverrideAsString());
hashCode = 31 * hashCode + Objects.hashCode(hasGlobalSecondaryIndexOverride() ? globalSecondaryIndexOverride() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasLocalSecondaryIndexOverride() ? localSecondaryIndexOverride() : null);
hashCode = 31 * hashCode + Objects.hashCode(provisionedThroughputOverride());
hashCode = 31 * hashCode + Objects.hashCode(sseSpecificationOverride());
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 RestoreTableToPointInTimeRequest)) {
return false;
}
RestoreTableToPointInTimeRequest other = (RestoreTableToPointInTimeRequest) obj;
return Objects.equals(sourceTableArn(), other.sourceTableArn())
&& Objects.equals(sourceTableName(), other.sourceTableName())
&& Objects.equals(targetTableName(), other.targetTableName())
&& Objects.equals(useLatestRestorableTime(), other.useLatestRestorableTime())
&& Objects.equals(restoreDateTime(), other.restoreDateTime())
&& Objects.equals(billingModeOverrideAsString(), other.billingModeOverrideAsString())
&& hasGlobalSecondaryIndexOverride() == other.hasGlobalSecondaryIndexOverride()
&& Objects.equals(globalSecondaryIndexOverride(), other.globalSecondaryIndexOverride())
&& hasLocalSecondaryIndexOverride() == other.hasLocalSecondaryIndexOverride()
&& Objects.equals(localSecondaryIndexOverride(), other.localSecondaryIndexOverride())
&& Objects.equals(provisionedThroughputOverride(), other.provisionedThroughputOverride())
&& Objects.equals(sseSpecificationOverride(), other.sseSpecificationOverride());
}
/**
* 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("RestoreTableToPointInTimeRequest").add("SourceTableArn", sourceTableArn())
.add("SourceTableName", sourceTableName()).add("TargetTableName", targetTableName())
.add("UseLatestRestorableTime", useLatestRestorableTime()).add("RestoreDateTime", restoreDateTime())
.add("BillingModeOverride", billingModeOverrideAsString())
.add("GlobalSecondaryIndexOverride", hasGlobalSecondaryIndexOverride() ? globalSecondaryIndexOverride() : null)
.add("LocalSecondaryIndexOverride", hasLocalSecondaryIndexOverride() ? localSecondaryIndexOverride() : null)
.add("ProvisionedThroughputOverride", provisionedThroughputOverride())
.add("SSESpecificationOverride", sseSpecificationOverride()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "SourceTableArn":
return Optional.ofNullable(clazz.cast(sourceTableArn()));
case "SourceTableName":
return Optional.ofNullable(clazz.cast(sourceTableName()));
case "TargetTableName":
return Optional.ofNullable(clazz.cast(targetTableName()));
case "UseLatestRestorableTime":
return Optional.ofNullable(clazz.cast(useLatestRestorableTime()));
case "RestoreDateTime":
return Optional.ofNullable(clazz.cast(restoreDateTime()));
case "BillingModeOverride":
return Optional.ofNullable(clazz.cast(billingModeOverrideAsString()));
case "GlobalSecondaryIndexOverride":
return Optional.ofNullable(clazz.cast(globalSecondaryIndexOverride()));
case "LocalSecondaryIndexOverride":
return Optional.ofNullable(clazz.cast(localSecondaryIndexOverride()));
case "ProvisionedThroughputOverride":
return Optional.ofNullable(clazz.cast(provisionedThroughputOverride()));
case "SSESpecificationOverride":
return Optional.ofNullable(clazz.cast(sseSpecificationOverride()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function