
software.amazon.awssdk.services.dynamodb.model.BackupSummary 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 details for the backup.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class BackupSummary implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField TABLE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("TableName").getter(getter(BackupSummary::tableName)).setter(setter(Builder::tableName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TableName").build()).build();
private static final SdkField TABLE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("TableId").getter(getter(BackupSummary::tableId)).setter(setter(Builder::tableId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TableId").build()).build();
private static final SdkField TABLE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("TableArn").getter(getter(BackupSummary::tableArn)).setter(setter(Builder::tableArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TableArn").build()).build();
private static final SdkField BACKUP_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("BackupArn").getter(getter(BackupSummary::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(BackupSummary::backupName)).setter(setter(Builder::backupName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BackupName").build()).build();
private static final SdkField BACKUP_CREATION_DATE_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("BackupCreationDateTime").getter(getter(BackupSummary::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(BackupSummary::backupExpiryDateTime))
.setter(setter(Builder::backupExpiryDateTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BackupExpiryDateTime").build())
.build();
private static final SdkField BACKUP_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("BackupStatus").getter(getter(BackupSummary::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(BackupSummary::backupTypeAsString)).setter(setter(Builder::backupType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BackupType").build()).build();
private static final SdkField BACKUP_SIZE_BYTES_FIELD = SdkField. builder(MarshallingType.LONG)
.memberName("BackupSizeBytes").getter(getter(BackupSummary::backupSizeBytes))
.setter(setter(Builder::backupSizeBytes))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BackupSizeBytes").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(TABLE_NAME_FIELD,
TABLE_ID_FIELD, TABLE_ARN_FIELD, BACKUP_ARN_FIELD, BACKUP_NAME_FIELD, BACKUP_CREATION_DATE_TIME_FIELD,
BACKUP_EXPIRY_DATE_TIME_FIELD, BACKUP_STATUS_FIELD, BACKUP_TYPE_FIELD, BACKUP_SIZE_BYTES_FIELD));
private static final long serialVersionUID = 1L;
private final String tableName;
private final String tableId;
private final String tableArn;
private final String backupArn;
private final String backupName;
private final Instant backupCreationDateTime;
private final Instant backupExpiryDateTime;
private final String backupStatus;
private final String backupType;
private final Long backupSizeBytes;
private BackupSummary(BuilderImpl builder) {
this.tableName = builder.tableName;
this.tableId = builder.tableId;
this.tableArn = builder.tableArn;
this.backupArn = builder.backupArn;
this.backupName = builder.backupName;
this.backupCreationDateTime = builder.backupCreationDateTime;
this.backupExpiryDateTime = builder.backupExpiryDateTime;
this.backupStatus = builder.backupStatus;
this.backupType = builder.backupType;
this.backupSizeBytes = builder.backupSizeBytes;
}
/**
*
* Name of the table.
*
*
* @return Name of the table.
*/
public final String tableName() {
return tableName;
}
/**
*
* Unique identifier for the table.
*
*
* @return Unique identifier for the table.
*/
public final String tableId() {
return tableId;
}
/**
*
* ARN associated with the table.
*
*
* @return ARN associated with the table.
*/
public final String tableArn() {
return tableArn;
}
/**
*
* ARN associated with the backup.
*
*
* @return ARN associated with the backup.
*/
public final String backupArn() {
return backupArn;
}
/**
*
* Name of the specified backup.
*
*
* @return Name of the specified backup.
*/
public final String backupName() {
return backupName;
}
/**
*
* Time at which the backup was created.
*
*
* @return Time at which the backup was created.
*/
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;
}
/**
*
* 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;
}
/**
*
* Size of the backup in bytes.
*
*
* @return Size of the backup in bytes.
*/
public final Long backupSizeBytes() {
return backupSizeBytes;
}
@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(tableName());
hashCode = 31 * hashCode + Objects.hashCode(tableId());
hashCode = 31 * hashCode + Objects.hashCode(tableArn());
hashCode = 31 * hashCode + Objects.hashCode(backupArn());
hashCode = 31 * hashCode + Objects.hashCode(backupName());
hashCode = 31 * hashCode + Objects.hashCode(backupCreationDateTime());
hashCode = 31 * hashCode + Objects.hashCode(backupExpiryDateTime());
hashCode = 31 * hashCode + Objects.hashCode(backupStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(backupTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(backupSizeBytes());
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 BackupSummary)) {
return false;
}
BackupSummary other = (BackupSummary) obj;
return Objects.equals(tableName(), other.tableName()) && Objects.equals(tableId(), other.tableId())
&& Objects.equals(tableArn(), other.tableArn()) && Objects.equals(backupArn(), other.backupArn())
&& Objects.equals(backupName(), other.backupName())
&& Objects.equals(backupCreationDateTime(), other.backupCreationDateTime())
&& Objects.equals(backupExpiryDateTime(), other.backupExpiryDateTime())
&& Objects.equals(backupStatusAsString(), other.backupStatusAsString())
&& Objects.equals(backupTypeAsString(), other.backupTypeAsString())
&& Objects.equals(backupSizeBytes(), other.backupSizeBytes());
}
/**
* 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("BackupSummary").add("TableName", tableName()).add("TableId", tableId())
.add("TableArn", tableArn()).add("BackupArn", backupArn()).add("BackupName", backupName())
.add("BackupCreationDateTime", backupCreationDateTime()).add("BackupExpiryDateTime", backupExpiryDateTime())
.add("BackupStatus", backupStatusAsString()).add("BackupType", backupTypeAsString())
.add("BackupSizeBytes", backupSizeBytes()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "TableName":
return Optional.ofNullable(clazz.cast(tableName()));
case "TableId":
return Optional.ofNullable(clazz.cast(tableId()));
case "TableArn":
return Optional.ofNullable(clazz.cast(tableArn()));
case "BackupArn":
return Optional.ofNullable(clazz.cast(backupArn()));
case "BackupName":
return Optional.ofNullable(clazz.cast(backupName()));
case "BackupCreationDateTime":
return Optional.ofNullable(clazz.cast(backupCreationDateTime()));
case "BackupExpiryDateTime":
return Optional.ofNullable(clazz.cast(backupExpiryDateTime()));
case "BackupStatus":
return Optional.ofNullable(clazz.cast(backupStatusAsString()));
case "BackupType":
return Optional.ofNullable(clazz.cast(backupTypeAsString()));
case "BackupSizeBytes":
return Optional.ofNullable(clazz.cast(backupSizeBytes()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function