
software.amazon.awssdk.services.dynamodb.model.PointInTimeRecoveryDescription Maven / Gradle / Ivy
/*
* Copyright 2013-2018 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.Objects;
import java.util.Optional;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.core.protocol.ProtocolMarshaller;
import software.amazon.awssdk.core.protocol.StructuredPojo;
import software.amazon.awssdk.services.dynamodb.transform.PointInTimeRecoveryDescriptionMarshaller;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* The description of the point in time settings applied to the table.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class PointInTimeRecoveryDescription implements StructuredPojo,
ToCopyableBuilder {
private final String pointInTimeRecoveryStatus;
private final Instant earliestRestorableDateTime;
private final Instant latestRestorableDateTime;
private PointInTimeRecoveryDescription(BuilderImpl builder) {
this.pointInTimeRecoveryStatus = builder.pointInTimeRecoveryStatus;
this.earliestRestorableDateTime = builder.earliestRestorableDateTime;
this.latestRestorableDateTime = builder.latestRestorableDateTime;
}
/**
*
* The current state of point in time recovery:
*
*
* -
*
* ENABLING
- Point in time recovery is being enabled.
*
*
* -
*
* ENABLED
- Point in time recovery is enabled.
*
*
* -
*
* DISABLED
- Point in time recovery is disabled.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #pointInTimeRecoveryStatus} will return {@link PointInTimeRecoveryStatus#UNKNOWN_TO_SDK_VERSION}. The raw
* value returned by the service is available from {@link #pointInTimeRecoveryStatusAsString}.
*
*
* @return The current state of point in time recovery:
*
* -
*
* ENABLING
- Point in time recovery is being enabled.
*
*
* -
*
* ENABLED
- Point in time recovery is enabled.
*
*
* -
*
* DISABLED
- Point in time recovery is disabled.
*
*
* @see PointInTimeRecoveryStatus
*/
public PointInTimeRecoveryStatus pointInTimeRecoveryStatus() {
return PointInTimeRecoveryStatus.fromValue(pointInTimeRecoveryStatus);
}
/**
*
* The current state of point in time recovery:
*
*
* -
*
* ENABLING
- Point in time recovery is being enabled.
*
*
* -
*
* ENABLED
- Point in time recovery is enabled.
*
*
* -
*
* DISABLED
- Point in time recovery is disabled.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #pointInTimeRecoveryStatus} will return {@link PointInTimeRecoveryStatus#UNKNOWN_TO_SDK_VERSION}. The raw
* value returned by the service is available from {@link #pointInTimeRecoveryStatusAsString}.
*
*
* @return The current state of point in time recovery:
*
* -
*
* ENABLING
- Point in time recovery is being enabled.
*
*
* -
*
* ENABLED
- Point in time recovery is enabled.
*
*
* -
*
* DISABLED
- Point in time recovery is disabled.
*
*
* @see PointInTimeRecoveryStatus
*/
public String pointInTimeRecoveryStatusAsString() {
return pointInTimeRecoveryStatus;
}
/**
*
* Specifies the earliest point in time you can restore your table to. It You can restore your table to any point in
* time during the last 35 days.
*
*
* @return Specifies the earliest point in time you can restore your table to. It You can restore your table to any
* point in time during the last 35 days.
*/
public Instant earliestRestorableDateTime() {
return earliestRestorableDateTime;
}
/**
*
* LatestRestorableDateTime
is typically 5 minutes before the current time.
*
*
* @return LatestRestorableDateTime
is typically 5 minutes before the current time.
*/
public Instant latestRestorableDateTime() {
return latestRestorableDateTime;
}
@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 int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(pointInTimeRecoveryStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(earliestRestorableDateTime());
hashCode = 31 * hashCode + Objects.hashCode(latestRestorableDateTime());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof PointInTimeRecoveryDescription)) {
return false;
}
PointInTimeRecoveryDescription other = (PointInTimeRecoveryDescription) obj;
return Objects.equals(pointInTimeRecoveryStatusAsString(), other.pointInTimeRecoveryStatusAsString())
&& Objects.equals(earliestRestorableDateTime(), other.earliestRestorableDateTime())
&& Objects.equals(latestRestorableDateTime(), other.latestRestorableDateTime());
}
@Override
public String toString() {
return ToString.builder("PointInTimeRecoveryDescription")
.add("PointInTimeRecoveryStatus", pointInTimeRecoveryStatusAsString())
.add("EarliestRestorableDateTime", earliestRestorableDateTime())
.add("LatestRestorableDateTime", latestRestorableDateTime()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "PointInTimeRecoveryStatus":
return Optional.ofNullable(clazz.cast(pointInTimeRecoveryStatusAsString()));
case "EarliestRestorableDateTime":
return Optional.ofNullable(clazz.cast(earliestRestorableDateTime()));
case "LatestRestorableDateTime":
return Optional.ofNullable(clazz.cast(latestRestorableDateTime()));
default:
return Optional.empty();
}
}
@SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
PointInTimeRecoveryDescriptionMarshaller.getInstance().marshall(this, protocolMarshaller);
}
public interface Builder extends CopyableBuilder {
/**
*
* The current state of point in time recovery:
*
*
* -
*
* ENABLING
- Point in time recovery is being enabled.
*
*
* -
*
* ENABLED
- Point in time recovery is enabled.
*
*
* -
*
* DISABLED
- Point in time recovery is disabled.
*
*
*
*
* @param pointInTimeRecoveryStatus
* The current state of point in time recovery:
*
* -
*
* ENABLING
- Point in time recovery is being enabled.
*
*
* -
*
* ENABLED
- Point in time recovery is enabled.
*
*
* -
*
* DISABLED
- Point in time recovery is disabled.
*
*
* @see PointInTimeRecoveryStatus
* @return Returns a reference to this object so that method calls can be chained together.
* @see PointInTimeRecoveryStatus
*/
Builder pointInTimeRecoveryStatus(String pointInTimeRecoveryStatus);
/**
*
* The current state of point in time recovery:
*
*
* -
*
* ENABLING
- Point in time recovery is being enabled.
*
*
* -
*
* ENABLED
- Point in time recovery is enabled.
*
*
* -
*
* DISABLED
- Point in time recovery is disabled.
*
*
*
*
* @param pointInTimeRecoveryStatus
* The current state of point in time recovery:
*
* -
*
* ENABLING
- Point in time recovery is being enabled.
*
*
* -
*
* ENABLED
- Point in time recovery is enabled.
*
*
* -
*
* DISABLED
- Point in time recovery is disabled.
*
*
* @see PointInTimeRecoveryStatus
* @return Returns a reference to this object so that method calls can be chained together.
* @see PointInTimeRecoveryStatus
*/
Builder pointInTimeRecoveryStatus(PointInTimeRecoveryStatus pointInTimeRecoveryStatus);
/**
*
* Specifies the earliest point in time you can restore your table to. It You can restore your table to any
* point in time during the last 35 days.
*
*
* @param earliestRestorableDateTime
* Specifies the earliest point in time you can restore your table to. It You can restore your table to
* any point in time during the last 35 days.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder earliestRestorableDateTime(Instant earliestRestorableDateTime);
/**
*
* LatestRestorableDateTime
is typically 5 minutes before the current time.
*
*
* @param latestRestorableDateTime
* LatestRestorableDateTime
is typically 5 minutes before the current time.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder latestRestorableDateTime(Instant latestRestorableDateTime);
}
static final class BuilderImpl implements Builder {
private String pointInTimeRecoveryStatus;
private Instant earliestRestorableDateTime;
private Instant latestRestorableDateTime;
private BuilderImpl() {
}
private BuilderImpl(PointInTimeRecoveryDescription model) {
pointInTimeRecoveryStatus(model.pointInTimeRecoveryStatus);
earliestRestorableDateTime(model.earliestRestorableDateTime);
latestRestorableDateTime(model.latestRestorableDateTime);
}
public final String getPointInTimeRecoveryStatus() {
return pointInTimeRecoveryStatus;
}
@Override
public final Builder pointInTimeRecoveryStatus(String pointInTimeRecoveryStatus) {
this.pointInTimeRecoveryStatus = pointInTimeRecoveryStatus;
return this;
}
@Override
public final Builder pointInTimeRecoveryStatus(PointInTimeRecoveryStatus pointInTimeRecoveryStatus) {
this.pointInTimeRecoveryStatus(pointInTimeRecoveryStatus.toString());
return this;
}
public final void setPointInTimeRecoveryStatus(String pointInTimeRecoveryStatus) {
this.pointInTimeRecoveryStatus = pointInTimeRecoveryStatus;
}
public final Instant getEarliestRestorableDateTime() {
return earliestRestorableDateTime;
}
@Override
public final Builder earliestRestorableDateTime(Instant earliestRestorableDateTime) {
this.earliestRestorableDateTime = earliestRestorableDateTime;
return this;
}
public final void setEarliestRestorableDateTime(Instant earliestRestorableDateTime) {
this.earliestRestorableDateTime = earliestRestorableDateTime;
}
public final Instant getLatestRestorableDateTime() {
return latestRestorableDateTime;
}
@Override
public final Builder latestRestorableDateTime(Instant latestRestorableDateTime) {
this.latestRestorableDateTime = latestRestorableDateTime;
return this;
}
public final void setLatestRestorableDateTime(Instant latestRestorableDateTime) {
this.latestRestorableDateTime = latestRestorableDateTime;
}
@Override
public PointInTimeRecoveryDescription build() {
return new PointInTimeRecoveryDescription(this);
}
}
}