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

software.amazon.awssdk.services.backup.model.CalculatedLifecycle 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.backup.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 DeleteAt and MoveToColdStorageAt timestamps, which are used to specify a lifecycle * for a recovery point. *

*

* The lifecycle defines when a protected resource is transitioned to cold storage and when it expires. AWS Backup * transitions and expires backups automatically according to the lifecycle that you define. *

*

* Backups transitioned to cold storage must be stored in cold storage for a minimum of 90 days. Therefore, the “expire * after days” setting must be 90 days greater than the “transition to cold after days” setting. The “transition to cold * after days” setting cannot be changed after a backup has been transitioned to cold. *

*

* Only Amazon EFS file system backups can be transitioned to cold storage. *

*/ @Generated("software.amazon.awssdk:codegen") public final class CalculatedLifecycle implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField MOVE_TO_COLD_STORAGE_AT_FIELD = SdkField. builder(MarshallingType.INSTANT) .memberName("MoveToColdStorageAt").getter(getter(CalculatedLifecycle::moveToColdStorageAt)) .setter(setter(Builder::moveToColdStorageAt)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MoveToColdStorageAt").build()) .build(); private static final SdkField DELETE_AT_FIELD = SdkField. builder(MarshallingType.INSTANT) .memberName("DeleteAt").getter(getter(CalculatedLifecycle::deleteAt)).setter(setter(Builder::deleteAt)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DeleteAt").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(MOVE_TO_COLD_STORAGE_AT_FIELD, DELETE_AT_FIELD)); private static final long serialVersionUID = 1L; private final Instant moveToColdStorageAt; private final Instant deleteAt; private CalculatedLifecycle(BuilderImpl builder) { this.moveToColdStorageAt = builder.moveToColdStorageAt; this.deleteAt = builder.deleteAt; } /** *

* A timestamp that specifies when to transition a recovery point to cold storage. *

* * @return A timestamp that specifies when to transition a recovery point to cold storage. */ public final Instant moveToColdStorageAt() { return moveToColdStorageAt; } /** *

* A timestamp that specifies when to delete a recovery point. *

* * @return A timestamp that specifies when to delete a recovery point. */ public final Instant deleteAt() { return deleteAt; } @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(moveToColdStorageAt()); hashCode = 31 * hashCode + Objects.hashCode(deleteAt()); 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 CalculatedLifecycle)) { return false; } CalculatedLifecycle other = (CalculatedLifecycle) obj; return Objects.equals(moveToColdStorageAt(), other.moveToColdStorageAt()) && Objects.equals(deleteAt(), other.deleteAt()); } /** * 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("CalculatedLifecycle").add("MoveToColdStorageAt", moveToColdStorageAt()) .add("DeleteAt", deleteAt()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "MoveToColdStorageAt": return Optional.ofNullable(clazz.cast(moveToColdStorageAt())); case "DeleteAt": return Optional.ofNullable(clazz.cast(deleteAt())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((CalculatedLifecycle) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* A timestamp that specifies when to transition a recovery point to cold storage. *

* * @param moveToColdStorageAt * A timestamp that specifies when to transition a recovery point to cold storage. * @return Returns a reference to this object so that method calls can be chained together. */ Builder moveToColdStorageAt(Instant moveToColdStorageAt); /** *

* A timestamp that specifies when to delete a recovery point. *

* * @param deleteAt * A timestamp that specifies when to delete a recovery point. * @return Returns a reference to this object so that method calls can be chained together. */ Builder deleteAt(Instant deleteAt); } static final class BuilderImpl implements Builder { private Instant moveToColdStorageAt; private Instant deleteAt; private BuilderImpl() { } private BuilderImpl(CalculatedLifecycle model) { moveToColdStorageAt(model.moveToColdStorageAt); deleteAt(model.deleteAt); } public final Instant getMoveToColdStorageAt() { return moveToColdStorageAt; } @Override public final Builder moveToColdStorageAt(Instant moveToColdStorageAt) { this.moveToColdStorageAt = moveToColdStorageAt; return this; } public final void setMoveToColdStorageAt(Instant moveToColdStorageAt) { this.moveToColdStorageAt = moveToColdStorageAt; } public final Instant getDeleteAt() { return deleteAt; } @Override public final Builder deleteAt(Instant deleteAt) { this.deleteAt = deleteAt; return this; } public final void setDeleteAt(Instant deleteAt) { this.deleteAt = deleteAt; } @Override public CalculatedLifecycle build() { return new CalculatedLifecycle(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy