All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.cloudhsmv2.model.Backup Maven / Gradle / Ivy

Go to download

The AWS Java SDK for AWS CloudHSM V2 module holds the client classes that are used for communicating with AWS CloudHSM V2 Service

There is a newer version: 2.29.39
Show newest version
/*
 * 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.cloudhsmv2.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;

/**
 * 

* Contains information about a backup of an AWS CloudHSM cluster. All backup objects contain the BackupId, * BackupState, ClusterId, and CreateTimestamp parameters. Backups that were * copied into a destination region additionally contain the CopyTimestamp, SourceBackup, * SourceCluster, and SourceRegion parameters. A backup that is pending deletion will include * the DeleteTimestamp parameter. *

*/ @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 BACKUP_STATE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("BackupState").getter(getter(Backup::backupStateAsString)).setter(setter(Builder::backupState)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BackupState").build()).build(); private static final SdkField CLUSTER_ID_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("ClusterId").getter(getter(Backup::clusterId)).setter(setter(Builder::clusterId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ClusterId").build()).build(); private static final SdkField CREATE_TIMESTAMP_FIELD = SdkField. builder(MarshallingType.INSTANT) .memberName("CreateTimestamp").getter(getter(Backup::createTimestamp)).setter(setter(Builder::createTimestamp)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreateTimestamp").build()).build(); private static final SdkField COPY_TIMESTAMP_FIELD = SdkField. builder(MarshallingType.INSTANT) .memberName("CopyTimestamp").getter(getter(Backup::copyTimestamp)).setter(setter(Builder::copyTimestamp)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CopyTimestamp").build()).build(); private static final SdkField NEVER_EXPIRES_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .memberName("NeverExpires").getter(getter(Backup::neverExpires)).setter(setter(Builder::neverExpires)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NeverExpires").build()).build(); private static final SdkField SOURCE_REGION_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("SourceRegion").getter(getter(Backup::sourceRegion)).setter(setter(Builder::sourceRegion)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SourceRegion").build()).build(); private static final SdkField SOURCE_BACKUP_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("SourceBackup").getter(getter(Backup::sourceBackup)).setter(setter(Builder::sourceBackup)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SourceBackup").build()).build(); private static final SdkField SOURCE_CLUSTER_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("SourceCluster").getter(getter(Backup::sourceCluster)).setter(setter(Builder::sourceCluster)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SourceCluster").build()).build(); private static final SdkField DELETE_TIMESTAMP_FIELD = SdkField. builder(MarshallingType.INSTANT) .memberName("DeleteTimestamp").getter(getter(Backup::deleteTimestamp)).setter(setter(Builder::deleteTimestamp)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DeleteTimestamp").build()).build(); private static final SdkField> TAG_LIST_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("TagList") .getter(getter(Backup::tagList)) .setter(setter(Builder::tagList)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TagList").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 List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(BACKUP_ID_FIELD, BACKUP_STATE_FIELD, CLUSTER_ID_FIELD, CREATE_TIMESTAMP_FIELD, COPY_TIMESTAMP_FIELD, NEVER_EXPIRES_FIELD, SOURCE_REGION_FIELD, SOURCE_BACKUP_FIELD, SOURCE_CLUSTER_FIELD, DELETE_TIMESTAMP_FIELD, TAG_LIST_FIELD)); private static final long serialVersionUID = 1L; private final String backupId; private final String backupState; private final String clusterId; private final Instant createTimestamp; private final Instant copyTimestamp; private final Boolean neverExpires; private final String sourceRegion; private final String sourceBackup; private final String sourceCluster; private final Instant deleteTimestamp; private final List tagList; private Backup(BuilderImpl builder) { this.backupId = builder.backupId; this.backupState = builder.backupState; this.clusterId = builder.clusterId; this.createTimestamp = builder.createTimestamp; this.copyTimestamp = builder.copyTimestamp; this.neverExpires = builder.neverExpires; this.sourceRegion = builder.sourceRegion; this.sourceBackup = builder.sourceBackup; this.sourceCluster = builder.sourceCluster; this.deleteTimestamp = builder.deleteTimestamp; this.tagList = builder.tagList; } /** *

* The identifier (ID) of the backup. *

* * @return The identifier (ID) of the backup. */ public final String backupId() { return backupId; } /** *

* The state of the backup. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #backupState} will * return {@link BackupState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #backupStateAsString}. *

* * @return The state of the backup. * @see BackupState */ public final BackupState backupState() { return BackupState.fromValue(backupState); } /** *

* The state of the backup. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #backupState} will * return {@link BackupState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #backupStateAsString}. *

* * @return The state of the backup. * @see BackupState */ public final String backupStateAsString() { return backupState; } /** *

* The identifier (ID) of the cluster that was backed up. *

* * @return The identifier (ID) of the cluster that was backed up. */ public final String clusterId() { return clusterId; } /** *

* The date and time when the backup was created. *

* * @return The date and time when the backup was created. */ public final Instant createTimestamp() { return createTimestamp; } /** *

* The date and time when the backup was copied from a source backup. *

* * @return The date and time when the backup was copied from a source backup. */ public final Instant copyTimestamp() { return copyTimestamp; } /** *

* Specifies whether the service should exempt a backup from the retention policy for the cluster. True * exempts a backup from the retention policy. False means the service applies the backup retention * policy defined at the cluster. *

* * @return Specifies whether the service should exempt a backup from the retention policy for the cluster. * True exempts a backup from the retention policy. False means the service * applies the backup retention policy defined at the cluster. */ public final Boolean neverExpires() { return neverExpires; } /** *

* The AWS Region that contains the source backup from which the new backup was copied. *

* * @return The AWS Region that contains the source backup from which the new backup was copied. */ public final String sourceRegion() { return sourceRegion; } /** *

* The identifier (ID) of the source backup from which the new backup was copied. *

* * @return The identifier (ID) of the source backup from which the new backup was copied. */ public final String sourceBackup() { return sourceBackup; } /** *

* The identifier (ID) of the cluster containing the source backup from which the new backup was copied. *

* * @return The identifier (ID) of the cluster containing the source backup from which the new backup was copied. */ public final String sourceCluster() { return sourceCluster; } /** *

* The date and time when the backup will be permanently deleted. *

* * @return The date and time when the backup will be permanently deleted. */ public final Instant deleteTimestamp() { return deleteTimestamp; } /** * For responses, this returns true if the service returned a value for the TagList 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 hasTagList() { return tagList != null && !(tagList instanceof SdkAutoConstructList); } /** *

* The list of tags for the backup. *

*

* 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 #hasTagList} method. *

* * @return The list of tags for the backup. */ public final List tagList() { return tagList; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(backupId()); hashCode = 31 * hashCode + Objects.hashCode(backupStateAsString()); hashCode = 31 * hashCode + Objects.hashCode(clusterId()); hashCode = 31 * hashCode + Objects.hashCode(createTimestamp()); hashCode = 31 * hashCode + Objects.hashCode(copyTimestamp()); hashCode = 31 * hashCode + Objects.hashCode(neverExpires()); hashCode = 31 * hashCode + Objects.hashCode(sourceRegion()); hashCode = 31 * hashCode + Objects.hashCode(sourceBackup()); hashCode = 31 * hashCode + Objects.hashCode(sourceCluster()); hashCode = 31 * hashCode + Objects.hashCode(deleteTimestamp()); hashCode = 31 * hashCode + Objects.hashCode(hasTagList() ? tagList() : null); 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(backupStateAsString(), other.backupStateAsString()) && Objects.equals(clusterId(), other.clusterId()) && Objects.equals(createTimestamp(), other.createTimestamp()) && Objects.equals(copyTimestamp(), other.copyTimestamp()) && Objects.equals(neverExpires(), other.neverExpires()) && Objects.equals(sourceRegion(), other.sourceRegion()) && Objects.equals(sourceBackup(), other.sourceBackup()) && Objects.equals(sourceCluster(), other.sourceCluster()) && Objects.equals(deleteTimestamp(), other.deleteTimestamp()) && hasTagList() == other.hasTagList() && Objects.equals(tagList(), other.tagList()); } /** * 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("BackupState", backupStateAsString()) .add("ClusterId", clusterId()).add("CreateTimestamp", createTimestamp()).add("CopyTimestamp", copyTimestamp()) .add("NeverExpires", neverExpires()).add("SourceRegion", sourceRegion()).add("SourceBackup", sourceBackup()) .add("SourceCluster", sourceCluster()).add("DeleteTimestamp", deleteTimestamp()) .add("TagList", hasTagList() ? tagList() : null).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "BackupId": return Optional.ofNullable(clazz.cast(backupId())); case "BackupState": return Optional.ofNullable(clazz.cast(backupStateAsString())); case "ClusterId": return Optional.ofNullable(clazz.cast(clusterId())); case "CreateTimestamp": return Optional.ofNullable(clazz.cast(createTimestamp())); case "CopyTimestamp": return Optional.ofNullable(clazz.cast(copyTimestamp())); case "NeverExpires": return Optional.ofNullable(clazz.cast(neverExpires())); case "SourceRegion": return Optional.ofNullable(clazz.cast(sourceRegion())); case "SourceBackup": return Optional.ofNullable(clazz.cast(sourceBackup())); case "SourceCluster": return Optional.ofNullable(clazz.cast(sourceCluster())); case "DeleteTimestamp": return Optional.ofNullable(clazz.cast(deleteTimestamp())); case "TagList": return Optional.ofNullable(clazz.cast(tagList())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((Backup) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The identifier (ID) of the backup. *

* * @param backupId * The identifier (ID) of the backup. * @return Returns a reference to this object so that method calls can be chained together. */ Builder backupId(String backupId); /** *

* The state of the backup. *

* * @param backupState * The state of the backup. * @see BackupState * @return Returns a reference to this object so that method calls can be chained together. * @see BackupState */ Builder backupState(String backupState); /** *

* The state of the backup. *

* * @param backupState * The state of the backup. * @see BackupState * @return Returns a reference to this object so that method calls can be chained together. * @see BackupState */ Builder backupState(BackupState backupState); /** *

* The identifier (ID) of the cluster that was backed up. *

* * @param clusterId * The identifier (ID) of the cluster that was backed up. * @return Returns a reference to this object so that method calls can be chained together. */ Builder clusterId(String clusterId); /** *

* The date and time when the backup was created. *

* * @param createTimestamp * The date and time when the backup was created. * @return Returns a reference to this object so that method calls can be chained together. */ Builder createTimestamp(Instant createTimestamp); /** *

* The date and time when the backup was copied from a source backup. *

* * @param copyTimestamp * The date and time when the backup was copied from a source backup. * @return Returns a reference to this object so that method calls can be chained together. */ Builder copyTimestamp(Instant copyTimestamp); /** *

* Specifies whether the service should exempt a backup from the retention policy for the cluster. * True exempts a backup from the retention policy. False means the service applies * the backup retention policy defined at the cluster. *

* * @param neverExpires * Specifies whether the service should exempt a backup from the retention policy for the cluster. * True exempts a backup from the retention policy. False means the service * applies the backup retention policy defined at the cluster. * @return Returns a reference to this object so that method calls can be chained together. */ Builder neverExpires(Boolean neverExpires); /** *

* The AWS Region that contains the source backup from which the new backup was copied. *

* * @param sourceRegion * The AWS Region that contains the source backup from which the new backup was copied. * @return Returns a reference to this object so that method calls can be chained together. */ Builder sourceRegion(String sourceRegion); /** *

* The identifier (ID) of the source backup from which the new backup was copied. *

* * @param sourceBackup * The identifier (ID) of the source backup from which the new backup was copied. * @return Returns a reference to this object so that method calls can be chained together. */ Builder sourceBackup(String sourceBackup); /** *

* The identifier (ID) of the cluster containing the source backup from which the new backup was copied. *

* * @param sourceCluster * The identifier (ID) of the cluster containing the source backup from which the new backup was copied. * @return Returns a reference to this object so that method calls can be chained together. */ Builder sourceCluster(String sourceCluster); /** *

* The date and time when the backup will be permanently deleted. *

* * @param deleteTimestamp * The date and time when the backup will be permanently deleted. * @return Returns a reference to this object so that method calls can be chained together. */ Builder deleteTimestamp(Instant deleteTimestamp); /** *

* The list of tags for the backup. *

* * @param tagList * The list of tags for the backup. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tagList(Collection tagList); /** *

* The list of tags for the backup. *

* * @param tagList * The list of tags for the backup. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tagList(Tag... tagList); /** *

* The list of tags for the backup. *

* This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.cloudhsmv2.model.Tag.Builder} avoiding the need to create one manually * via {@link software.amazon.awssdk.services.cloudhsmv2.model.Tag#builder()}. * *

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.cloudhsmv2.model.Tag.Builder#build()} is called immediately and its * result is passed to {@link #tagList(List)}. * * @param tagList * a consumer that will call methods on * {@link software.amazon.awssdk.services.cloudhsmv2.model.Tag.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #tagList(java.util.Collection) */ Builder tagList(Consumer... tagList); } static final class BuilderImpl implements Builder { private String backupId; private String backupState; private String clusterId; private Instant createTimestamp; private Instant copyTimestamp; private Boolean neverExpires; private String sourceRegion; private String sourceBackup; private String sourceCluster; private Instant deleteTimestamp; private List tagList = DefaultSdkAutoConstructList.getInstance(); private BuilderImpl() { } private BuilderImpl(Backup model) { backupId(model.backupId); backupState(model.backupState); clusterId(model.clusterId); createTimestamp(model.createTimestamp); copyTimestamp(model.copyTimestamp); neverExpires(model.neverExpires); sourceRegion(model.sourceRegion); sourceBackup(model.sourceBackup); sourceCluster(model.sourceCluster); deleteTimestamp(model.deleteTimestamp); tagList(model.tagList); } public final String getBackupId() { return backupId; } public final void setBackupId(String backupId) { this.backupId = backupId; } @Override public final Builder backupId(String backupId) { this.backupId = backupId; return this; } public final String getBackupState() { return backupState; } public final void setBackupState(String backupState) { this.backupState = backupState; } @Override public final Builder backupState(String backupState) { this.backupState = backupState; return this; } @Override public final Builder backupState(BackupState backupState) { this.backupState(backupState == null ? null : backupState.toString()); return this; } public final String getClusterId() { return clusterId; } public final void setClusterId(String clusterId) { this.clusterId = clusterId; } @Override public final Builder clusterId(String clusterId) { this.clusterId = clusterId; return this; } public final Instant getCreateTimestamp() { return createTimestamp; } public final void setCreateTimestamp(Instant createTimestamp) { this.createTimestamp = createTimestamp; } @Override public final Builder createTimestamp(Instant createTimestamp) { this.createTimestamp = createTimestamp; return this; } public final Instant getCopyTimestamp() { return copyTimestamp; } public final void setCopyTimestamp(Instant copyTimestamp) { this.copyTimestamp = copyTimestamp; } @Override public final Builder copyTimestamp(Instant copyTimestamp) { this.copyTimestamp = copyTimestamp; return this; } public final Boolean getNeverExpires() { return neverExpires; } public final void setNeverExpires(Boolean neverExpires) { this.neverExpires = neverExpires; } @Override public final Builder neverExpires(Boolean neverExpires) { this.neverExpires = neverExpires; return this; } public final String getSourceRegion() { return sourceRegion; } public final void setSourceRegion(String sourceRegion) { this.sourceRegion = sourceRegion; } @Override public final Builder sourceRegion(String sourceRegion) { this.sourceRegion = sourceRegion; return this; } public final String getSourceBackup() { return sourceBackup; } public final void setSourceBackup(String sourceBackup) { this.sourceBackup = sourceBackup; } @Override public final Builder sourceBackup(String sourceBackup) { this.sourceBackup = sourceBackup; return this; } public final String getSourceCluster() { return sourceCluster; } public final void setSourceCluster(String sourceCluster) { this.sourceCluster = sourceCluster; } @Override public final Builder sourceCluster(String sourceCluster) { this.sourceCluster = sourceCluster; return this; } public final Instant getDeleteTimestamp() { return deleteTimestamp; } public final void setDeleteTimestamp(Instant deleteTimestamp) { this.deleteTimestamp = deleteTimestamp; } @Override public final Builder deleteTimestamp(Instant deleteTimestamp) { this.deleteTimestamp = deleteTimestamp; return this; } public final List getTagList() { List result = TagListCopier.copyToBuilder(this.tagList); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setTagList(Collection tagList) { this.tagList = TagListCopier.copyFromBuilder(tagList); } @Override public final Builder tagList(Collection tagList) { this.tagList = TagListCopier.copy(tagList); return this; } @Override @SafeVarargs public final Builder tagList(Tag... tagList) { tagList(Arrays.asList(tagList)); return this; } @Override @SafeVarargs public final Builder tagList(Consumer... tagList) { tagList(Stream.of(tagList).map(c -> Tag.builder().applyMutation(c).build()).collect(Collectors.toList())); return this; } @Override public Backup build() { return new Backup(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy