
software.amazon.awssdk.services.dynamodb.model.BackupDetails 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.io.Serializable;
import java.time.Instant;
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.Function;
import software.amazon.awssdk.annotations.Generated;
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;
/**
*
* Contains the details of the backup created for the table.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class BackupDetails implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField BACKUP_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("BackupArn").getter(getter(BackupDetails::backupArn)).setter(setter(Builder::backupArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BackupArn").build()).build();
private static final SdkField BACKUP_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("BackupName").getter(getter(BackupDetails::backupName)).setter(setter(Builder::backupName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BackupName").build()).build();
private static final SdkField BACKUP_SIZE_BYTES_FIELD = SdkField. builder(MarshallingType.LONG)
.memberName("BackupSizeBytes").getter(getter(BackupDetails::backupSizeBytes))
.setter(setter(Builder::backupSizeBytes))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BackupSizeBytes").build()).build();
private static final SdkField BACKUP_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("BackupStatus").getter(getter(BackupDetails::backupStatusAsString)).setter(setter(Builder::backupStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BackupStatus").build()).build();
private static final SdkField BACKUP_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("BackupType").getter(getter(BackupDetails::backupTypeAsString)).setter(setter(Builder::backupType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BackupType").build()).build();
private static final SdkField BACKUP_CREATION_DATE_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("BackupCreationDateTime").getter(getter(BackupDetails::backupCreationDateTime))
.setter(setter(Builder::backupCreationDateTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BackupCreationDateTime").build())
.build();
private static final SdkField BACKUP_EXPIRY_DATE_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("BackupExpiryDateTime").getter(getter(BackupDetails::backupExpiryDateTime))
.setter(setter(Builder::backupExpiryDateTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BackupExpiryDateTime").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(BACKUP_ARN_FIELD,
BACKUP_NAME_FIELD, BACKUP_SIZE_BYTES_FIELD, BACKUP_STATUS_FIELD, BACKUP_TYPE_FIELD, BACKUP_CREATION_DATE_TIME_FIELD,
BACKUP_EXPIRY_DATE_TIME_FIELD));
private static final long serialVersionUID = 1L;
private final String backupArn;
private final String backupName;
private final Long backupSizeBytes;
private final String backupStatus;
private final String backupType;
private final Instant backupCreationDateTime;
private final Instant backupExpiryDateTime;
private BackupDetails(BuilderImpl builder) {
this.backupArn = builder.backupArn;
this.backupName = builder.backupName;
this.backupSizeBytes = builder.backupSizeBytes;
this.backupStatus = builder.backupStatus;
this.backupType = builder.backupType;
this.backupCreationDateTime = builder.backupCreationDateTime;
this.backupExpiryDateTime = builder.backupExpiryDateTime;
}
/**
*
* ARN associated with the backup.
*
*
* @return ARN associated with the backup.
*/
public final String backupArn() {
return backupArn;
}
/**
*
* Name of the requested backup.
*
*
* @return Name of the requested backup.
*/
public final String backupName() {
return backupName;
}
/**
*
* Size of the backup in bytes. DynamoDB updates this value approximately every six hours. Recent changes might not
* be reflected in this value.
*
*
* @return Size of the backup in bytes. DynamoDB updates this value approximately every six hours. Recent changes
* might not be reflected in this value.
*/
public final Long backupSizeBytes() {
return backupSizeBytes;
}
/**
*
* Backup can be in one of the following states: CREATING, ACTIVE, DELETED.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #backupStatus} will
* return {@link BackupStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #backupStatusAsString}.
*
*
* @return Backup can be in one of the following states: CREATING, ACTIVE, DELETED.
* @see BackupStatus
*/
public final BackupStatus backupStatus() {
return BackupStatus.fromValue(backupStatus);
}
/**
*
* Backup can be in one of the following states: CREATING, ACTIVE, DELETED.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #backupStatus} will
* return {@link BackupStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #backupStatusAsString}.
*
*
* @return Backup can be in one of the following states: CREATING, ACTIVE, DELETED.
* @see BackupStatus
*/
public final String backupStatusAsString() {
return backupStatus;
}
/**
*
* BackupType:
*
*
* -
*
* USER
- You create and manage these using the on-demand backup feature.
*
*
* -
*
* SYSTEM
- If you delete a table with point-in-time recovery enabled, a SYSTEM
backup is
* automatically created and is retained for 35 days (at no additional cost). System backups allow you to restore
* the deleted table to the state it was in just before the point of deletion.
*
*
* -
*
* AWS_BACKUP
- On-demand backup created by you from Backup service.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #backupType} will
* return {@link BackupType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #backupTypeAsString}.
*
*
* @return BackupType:
*
* -
*
* USER
- You create and manage these using the on-demand backup feature.
*
*
* -
*
* SYSTEM
- If you delete a table with point-in-time recovery enabled, a SYSTEM
* backup is automatically created and is retained for 35 days (at no additional cost). System backups allow
* you to restore the deleted table to the state it was in just before the point of deletion.
*
*
* -
*
* AWS_BACKUP
- On-demand backup created by you from Backup service.
*
*
* @see BackupType
*/
public final BackupType backupType() {
return BackupType.fromValue(backupType);
}
/**
*
* BackupType:
*
*
* -
*
* USER
- You create and manage these using the on-demand backup feature.
*
*
* -
*
* SYSTEM
- If you delete a table with point-in-time recovery enabled, a SYSTEM
backup is
* automatically created and is retained for 35 days (at no additional cost). System backups allow you to restore
* the deleted table to the state it was in just before the point of deletion.
*
*
* -
*
* AWS_BACKUP
- On-demand backup created by you from Backup service.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #backupType} will
* return {@link BackupType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #backupTypeAsString}.
*
*
* @return BackupType:
*
* -
*
* USER
- You create and manage these using the on-demand backup feature.
*
*
* -
*
* SYSTEM
- If you delete a table with point-in-time recovery enabled, a SYSTEM
* backup is automatically created and is retained for 35 days (at no additional cost). System backups allow
* you to restore the deleted table to the state it was in just before the point of deletion.
*
*
* -
*
* AWS_BACKUP
- On-demand backup created by you from Backup service.
*
*
* @see BackupType
*/
public final String backupTypeAsString() {
return backupType;
}
/**
*
* Time at which the backup was created. This is the request time of the backup.
*
*
* @return Time at which the backup was created. This is the request time of the backup.
*/
public final Instant backupCreationDateTime() {
return backupCreationDateTime;
}
/**
*
* Time at which the automatic on-demand backup created by DynamoDB will expire. This SYSTEM
on-demand
* backup expires automatically 35 days after its creation.
*
*
* @return Time at which the automatic on-demand backup created by DynamoDB will expire. This SYSTEM
* on-demand backup expires automatically 35 days after its creation.
*/
public final Instant backupExpiryDateTime() {
return backupExpiryDateTime;
}
@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 + Objects.hashCode(backupArn());
hashCode = 31 * hashCode + Objects.hashCode(backupName());
hashCode = 31 * hashCode + Objects.hashCode(backupSizeBytes());
hashCode = 31 * hashCode + Objects.hashCode(backupStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(backupTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(backupCreationDateTime());
hashCode = 31 * hashCode + Objects.hashCode(backupExpiryDateTime());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof BackupDetails)) {
return false;
}
BackupDetails other = (BackupDetails) obj;
return Objects.equals(backupArn(), other.backupArn()) && Objects.equals(backupName(), other.backupName())
&& Objects.equals(backupSizeBytes(), other.backupSizeBytes())
&& Objects.equals(backupStatusAsString(), other.backupStatusAsString())
&& Objects.equals(backupTypeAsString(), other.backupTypeAsString())
&& Objects.equals(backupCreationDateTime(), other.backupCreationDateTime())
&& Objects.equals(backupExpiryDateTime(), other.backupExpiryDateTime());
}
/**
* 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("BackupDetails").add("BackupArn", backupArn()).add("BackupName", backupName())
.add("BackupSizeBytes", backupSizeBytes()).add("BackupStatus", backupStatusAsString())
.add("BackupType", backupTypeAsString()).add("BackupCreationDateTime", backupCreationDateTime())
.add("BackupExpiryDateTime", backupExpiryDateTime()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "BackupArn":
return Optional.ofNullable(clazz.cast(backupArn()));
case "BackupName":
return Optional.ofNullable(clazz.cast(backupName()));
case "BackupSizeBytes":
return Optional.ofNullable(clazz.cast(backupSizeBytes()));
case "BackupStatus":
return Optional.ofNullable(clazz.cast(backupStatusAsString()));
case "BackupType":
return Optional.ofNullable(clazz.cast(backupTypeAsString()));
case "BackupCreationDateTime":
return Optional.ofNullable(clazz.cast(backupCreationDateTime()));
case "BackupExpiryDateTime":
return Optional.ofNullable(clazz.cast(backupExpiryDateTime()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function