
software.amazon.awssdk.services.fsx.model.Backup 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.fsx.model;
import java.io.Serializable;
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.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;
/**
*
* A backup of an Amazon FSx for Windows File Server, Amazon FSx for Lustre file system, Amazon FSx for NetApp ONTAP
* volume, or Amazon FSx for OpenZFS file system.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Backup implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField BACKUP_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("BackupId").getter(getter(Backup::backupId)).setter(setter(Builder::backupId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BackupId").build()).build();
private static final SdkField LIFECYCLE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Lifecycle").getter(getter(Backup::lifecycleAsString)).setter(setter(Builder::lifecycle))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Lifecycle").build()).build();
private static final SdkField FAILURE_DETAILS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("FailureDetails")
.getter(getter(Backup::failureDetails)).setter(setter(Builder::failureDetails))
.constructor(BackupFailureDetails::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FailureDetails").build()).build();
private static final SdkField TYPE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Type")
.getter(getter(Backup::typeAsString)).setter(setter(Builder::type))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Type").build()).build();
private static final SdkField PROGRESS_PERCENT_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("ProgressPercent").getter(getter(Backup::progressPercent)).setter(setter(Builder::progressPercent))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ProgressPercent").build()).build();
private static final SdkField CREATION_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("CreationTime").getter(getter(Backup::creationTime)).setter(setter(Builder::creationTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreationTime").build()).build();
private static final SdkField KMS_KEY_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("KmsKeyId").getter(getter(Backup::kmsKeyId)).setter(setter(Builder::kmsKeyId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("KmsKeyId").build()).build();
private static final SdkField RESOURCE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ResourceARN").getter(getter(Backup::resourceARN)).setter(setter(Builder::resourceARN))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResourceARN").build()).build();
private static final SdkField> TAGS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Tags")
.getter(getter(Backup::tags))
.setter(setter(Builder::tags))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Tags").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(Tag::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField FILE_SYSTEM_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("FileSystem").getter(getter(Backup::fileSystem)).setter(setter(Builder::fileSystem))
.constructor(FileSystem::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FileSystem").build()).build();
private static final SdkField DIRECTORY_INFORMATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("DirectoryInformation")
.getter(getter(Backup::directoryInformation)).setter(setter(Builder::directoryInformation))
.constructor(ActiveDirectoryBackupAttributes::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DirectoryInformation").build())
.build();
private static final SdkField OWNER_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("OwnerId").getter(getter(Backup::ownerId)).setter(setter(Builder::ownerId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OwnerId").build()).build();
private static final SdkField SOURCE_BACKUP_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SourceBackupId").getter(getter(Backup::sourceBackupId)).setter(setter(Builder::sourceBackupId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SourceBackupId").build()).build();
private static final SdkField SOURCE_BACKUP_REGION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SourceBackupRegion").getter(getter(Backup::sourceBackupRegion))
.setter(setter(Builder::sourceBackupRegion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SourceBackupRegion").build())
.build();
private static final SdkField RESOURCE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ResourceType").getter(getter(Backup::resourceTypeAsString)).setter(setter(Builder::resourceType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResourceType").build()).build();
private static final SdkField VOLUME_FIELD = SdkField. builder(MarshallingType.SDK_POJO).memberName("Volume")
.getter(getter(Backup::volume)).setter(setter(Builder::volume)).constructor(Volume::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Volume").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(BACKUP_ID_FIELD,
LIFECYCLE_FIELD, FAILURE_DETAILS_FIELD, TYPE_FIELD, PROGRESS_PERCENT_FIELD, CREATION_TIME_FIELD, KMS_KEY_ID_FIELD,
RESOURCE_ARN_FIELD, TAGS_FIELD, FILE_SYSTEM_FIELD, DIRECTORY_INFORMATION_FIELD, OWNER_ID_FIELD,
SOURCE_BACKUP_ID_FIELD, SOURCE_BACKUP_REGION_FIELD, RESOURCE_TYPE_FIELD, VOLUME_FIELD));
private static final long serialVersionUID = 1L;
private final String backupId;
private final String lifecycle;
private final BackupFailureDetails failureDetails;
private final String type;
private final Integer progressPercent;
private final Instant creationTime;
private final String kmsKeyId;
private final String resourceARN;
private final List tags;
private final FileSystem fileSystem;
private final ActiveDirectoryBackupAttributes directoryInformation;
private final String ownerId;
private final String sourceBackupId;
private final String sourceBackupRegion;
private final String resourceType;
private final Volume volume;
private Backup(BuilderImpl builder) {
this.backupId = builder.backupId;
this.lifecycle = builder.lifecycle;
this.failureDetails = builder.failureDetails;
this.type = builder.type;
this.progressPercent = builder.progressPercent;
this.creationTime = builder.creationTime;
this.kmsKeyId = builder.kmsKeyId;
this.resourceARN = builder.resourceARN;
this.tags = builder.tags;
this.fileSystem = builder.fileSystem;
this.directoryInformation = builder.directoryInformation;
this.ownerId = builder.ownerId;
this.sourceBackupId = builder.sourceBackupId;
this.sourceBackupRegion = builder.sourceBackupRegion;
this.resourceType = builder.resourceType;
this.volume = builder.volume;
}
/**
*
* The ID of the backup.
*
*
* @return The ID of the backup.
*/
public final String backupId() {
return backupId;
}
/**
*
* The lifecycle status of the backup.
*
*
* -
*
* AVAILABLE
- The backup is fully available.
*
*
* -
*
* PENDING
- For user-initiated backups on Lustre file systems only; Amazon FSx hasn't started creating
* the backup.
*
*
* -
*
* CREATING
- Amazon FSx is creating the backup.
*
*
* -
*
* TRANSFERRING
- For user-initiated backups on Lustre file systems only; Amazon FSx is transferring
* the backup to Amazon S3.
*
*
* -
*
* COPYING
- Amazon FSx is copying the backup.
*
*
* -
*
* DELETED
- Amazon FSx deleted the backup and it's no longer available.
*
*
* -
*
* FAILED
- Amazon FSx couldn't finish the backup.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #lifecycle} will
* return {@link BackupLifecycle#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #lifecycleAsString}.
*
*
* @return The lifecycle status of the backup.
*
* -
*
* AVAILABLE
- The backup is fully available.
*
*
* -
*
* PENDING
- For user-initiated backups on Lustre file systems only; Amazon FSx hasn't started
* creating the backup.
*
*
* -
*
* CREATING
- Amazon FSx is creating the backup.
*
*
* -
*
* TRANSFERRING
- For user-initiated backups on Lustre file systems only; Amazon FSx is
* transferring the backup to Amazon S3.
*
*
* -
*
* COPYING
- Amazon FSx is copying the backup.
*
*
* -
*
* DELETED
- Amazon FSx deleted the backup and it's no longer available.
*
*
* -
*
* FAILED
- Amazon FSx couldn't finish the backup.
*
*
* @see BackupLifecycle
*/
public final BackupLifecycle lifecycle() {
return BackupLifecycle.fromValue(lifecycle);
}
/**
*
* The lifecycle status of the backup.
*
*
* -
*
* AVAILABLE
- The backup is fully available.
*
*
* -
*
* PENDING
- For user-initiated backups on Lustre file systems only; Amazon FSx hasn't started creating
* the backup.
*
*
* -
*
* CREATING
- Amazon FSx is creating the backup.
*
*
* -
*
* TRANSFERRING
- For user-initiated backups on Lustre file systems only; Amazon FSx is transferring
* the backup to Amazon S3.
*
*
* -
*
* COPYING
- Amazon FSx is copying the backup.
*
*
* -
*
* DELETED
- Amazon FSx deleted the backup and it's no longer available.
*
*
* -
*
* FAILED
- Amazon FSx couldn't finish the backup.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #lifecycle} will
* return {@link BackupLifecycle#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #lifecycleAsString}.
*
*
* @return The lifecycle status of the backup.
*
* -
*
* AVAILABLE
- The backup is fully available.
*
*
* -
*
* PENDING
- For user-initiated backups on Lustre file systems only; Amazon FSx hasn't started
* creating the backup.
*
*
* -
*
* CREATING
- Amazon FSx is creating the backup.
*
*
* -
*
* TRANSFERRING
- For user-initiated backups on Lustre file systems only; Amazon FSx is
* transferring the backup to Amazon S3.
*
*
* -
*
* COPYING
- Amazon FSx is copying the backup.
*
*
* -
*
* DELETED
- Amazon FSx deleted the backup and it's no longer available.
*
*
* -
*
* FAILED
- Amazon FSx couldn't finish the backup.
*
*
* @see BackupLifecycle
*/
public final String lifecycleAsString() {
return lifecycle;
}
/**
*
* Details explaining any failures that occurred when creating a backup.
*
*
* @return Details explaining any failures that occurred when creating a backup.
*/
public final BackupFailureDetails failureDetails() {
return failureDetails;
}
/**
*
* The type of the file-system backup.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #type} will return
* {@link BackupType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #typeAsString}.
*
*
* @return The type of the file-system backup.
* @see BackupType
*/
public final BackupType type() {
return BackupType.fromValue(type);
}
/**
*
* The type of the file-system backup.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #type} will return
* {@link BackupType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #typeAsString}.
*
*
* @return The type of the file-system backup.
* @see BackupType
*/
public final String typeAsString() {
return type;
}
/**
* Returns the value of the ProgressPercent property for this object.
*
* @return The value of the ProgressPercent property for this object.
*/
public final Integer progressPercent() {
return progressPercent;
}
/**
*
* The time when a particular backup was created.
*
*
* @return The time when a particular backup was created.
*/
public final Instant creationTime() {
return creationTime;
}
/**
*
* The ID of the Key Management Service (KMS) key used to encrypt the backup of the Amazon FSx file system's data at
* rest.
*
*
* @return The ID of the Key Management Service (KMS) key used to encrypt the backup of the Amazon FSx file system's
* data at rest.
*/
public final String kmsKeyId() {
return kmsKeyId;
}
/**
*
* The Amazon Resource Name (ARN) for the backup resource.
*
*
* @return The Amazon Resource Name (ARN) for the backup resource.
*/
public final String resourceARN() {
return resourceARN;
}
/**
* For responses, this returns true if the service returned a value for the Tags 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 hasTags() {
return tags != null && !(tags instanceof SdkAutoConstructList);
}
/**
*
* The tags associated with a particular file system.
*
*
* 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 #hasTags} method.
*
*
* @return The tags associated with a particular file system.
*/
public final List tags() {
return tags;
}
/**
*
* The metadata of the file system associated with the backup. This metadata is persisted even if the file system is
* deleted.
*
*
* @return The metadata of the file system associated with the backup. This metadata is persisted even if the file
* system is deleted.
*/
public final FileSystem fileSystem() {
return fileSystem;
}
/**
*
* The configuration of the self-managed Microsoft Active Directory directory to which the Windows File Server
* instance is joined.
*
*
* @return The configuration of the self-managed Microsoft Active Directory directory to which the Windows File
* Server instance is joined.
*/
public final ActiveDirectoryBackupAttributes directoryInformation() {
return directoryInformation;
}
/**
* Returns the value of the OwnerId property for this object.
*
* @return The value of the OwnerId property for this object.
*/
public final String ownerId() {
return ownerId;
}
/**
* Returns the value of the SourceBackupId property for this object.
*
* @return The value of the SourceBackupId property for this object.
*/
public final String sourceBackupId() {
return sourceBackupId;
}
/**
*
* The source Region of the backup. Specifies the Region from where this backup is copied.
*
*
* @return The source Region of the backup. Specifies the Region from where this backup is copied.
*/
public final String sourceBackupRegion() {
return sourceBackupRegion;
}
/**
*
* Specifies the resource type that's backed up.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #resourceType} will
* return {@link ResourceType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #resourceTypeAsString}.
*
*
* @return Specifies the resource type that's backed up.
* @see ResourceType
*/
public final ResourceType resourceType() {
return ResourceType.fromValue(resourceType);
}
/**
*
* Specifies the resource type that's backed up.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #resourceType} will
* return {@link ResourceType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #resourceTypeAsString}.
*
*
* @return Specifies the resource type that's backed up.
* @see ResourceType
*/
public final String resourceTypeAsString() {
return resourceType;
}
/**
* Returns the value of the Volume property for this object.
*
* @return The value of the Volume property for this object.
*/
public final Volume volume() {
return volume;
}
@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(backupId());
hashCode = 31 * hashCode + Objects.hashCode(lifecycleAsString());
hashCode = 31 * hashCode + Objects.hashCode(failureDetails());
hashCode = 31 * hashCode + Objects.hashCode(typeAsString());
hashCode = 31 * hashCode + Objects.hashCode(progressPercent());
hashCode = 31 * hashCode + Objects.hashCode(creationTime());
hashCode = 31 * hashCode + Objects.hashCode(kmsKeyId());
hashCode = 31 * hashCode + Objects.hashCode(resourceARN());
hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : null);
hashCode = 31 * hashCode + Objects.hashCode(fileSystem());
hashCode = 31 * hashCode + Objects.hashCode(directoryInformation());
hashCode = 31 * hashCode + Objects.hashCode(ownerId());
hashCode = 31 * hashCode + Objects.hashCode(sourceBackupId());
hashCode = 31 * hashCode + Objects.hashCode(sourceBackupRegion());
hashCode = 31 * hashCode + Objects.hashCode(resourceTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(volume());
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 Backup)) {
return false;
}
Backup other = (Backup) obj;
return Objects.equals(backupId(), other.backupId()) && Objects.equals(lifecycleAsString(), other.lifecycleAsString())
&& Objects.equals(failureDetails(), other.failureDetails())
&& Objects.equals(typeAsString(), other.typeAsString())
&& Objects.equals(progressPercent(), other.progressPercent())
&& Objects.equals(creationTime(), other.creationTime()) && Objects.equals(kmsKeyId(), other.kmsKeyId())
&& Objects.equals(resourceARN(), other.resourceARN()) && hasTags() == other.hasTags()
&& Objects.equals(tags(), other.tags()) && Objects.equals(fileSystem(), other.fileSystem())
&& Objects.equals(directoryInformation(), other.directoryInformation())
&& Objects.equals(ownerId(), other.ownerId()) && Objects.equals(sourceBackupId(), other.sourceBackupId())
&& Objects.equals(sourceBackupRegion(), other.sourceBackupRegion())
&& Objects.equals(resourceTypeAsString(), other.resourceTypeAsString())
&& Objects.equals(volume(), other.volume());
}
/**
* 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("Backup").add("BackupId", backupId()).add("Lifecycle", lifecycleAsString())
.add("FailureDetails", failureDetails()).add("Type", typeAsString()).add("ProgressPercent", progressPercent())
.add("CreationTime", creationTime()).add("KmsKeyId", kmsKeyId()).add("ResourceARN", resourceARN())
.add("Tags", hasTags() ? tags() : null).add("FileSystem", fileSystem())
.add("DirectoryInformation", directoryInformation()).add("OwnerId", ownerId())
.add("SourceBackupId", sourceBackupId()).add("SourceBackupRegion", sourceBackupRegion())
.add("ResourceType", resourceTypeAsString()).add("Volume", volume()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "BackupId":
return Optional.ofNullable(clazz.cast(backupId()));
case "Lifecycle":
return Optional.ofNullable(clazz.cast(lifecycleAsString()));
case "FailureDetails":
return Optional.ofNullable(clazz.cast(failureDetails()));
case "Type":
return Optional.ofNullable(clazz.cast(typeAsString()));
case "ProgressPercent":
return Optional.ofNullable(clazz.cast(progressPercent()));
case "CreationTime":
return Optional.ofNullable(clazz.cast(creationTime()));
case "KmsKeyId":
return Optional.ofNullable(clazz.cast(kmsKeyId()));
case "ResourceARN":
return Optional.ofNullable(clazz.cast(resourceARN()));
case "Tags":
return Optional.ofNullable(clazz.cast(tags()));
case "FileSystem":
return Optional.ofNullable(clazz.cast(fileSystem()));
case "DirectoryInformation":
return Optional.ofNullable(clazz.cast(directoryInformation()));
case "OwnerId":
return Optional.ofNullable(clazz.cast(ownerId()));
case "SourceBackupId":
return Optional.ofNullable(clazz.cast(sourceBackupId()));
case "SourceBackupRegion":
return Optional.ofNullable(clazz.cast(sourceBackupRegion()));
case "ResourceType":
return Optional.ofNullable(clazz.cast(resourceTypeAsString()));
case "Volume":
return Optional.ofNullable(clazz.cast(volume()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function