
software.amazon.awssdk.services.backup.model.UpdateRecoveryPointLifecycleResponse 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.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.Consumer;
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;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class UpdateRecoveryPointLifecycleResponse extends BackupResponse implements
ToCopyableBuilder {
private static final SdkField BACKUP_VAULT_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("BackupVaultArn").getter(getter(UpdateRecoveryPointLifecycleResponse::backupVaultArn))
.setter(setter(Builder::backupVaultArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BackupVaultArn").build()).build();
private static final SdkField RECOVERY_POINT_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("RecoveryPointArn").getter(getter(UpdateRecoveryPointLifecycleResponse::recoveryPointArn))
.setter(setter(Builder::recoveryPointArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RecoveryPointArn").build()).build();
private static final SdkField LIFECYCLE_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("Lifecycle").getter(getter(UpdateRecoveryPointLifecycleResponse::lifecycle))
.setter(setter(Builder::lifecycle)).constructor(Lifecycle::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Lifecycle").build()).build();
private static final SdkField CALCULATED_LIFECYCLE_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("CalculatedLifecycle")
.getter(getter(UpdateRecoveryPointLifecycleResponse::calculatedLifecycle))
.setter(setter(Builder::calculatedLifecycle)).constructor(CalculatedLifecycle::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CalculatedLifecycle").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(BACKUP_VAULT_ARN_FIELD,
RECOVERY_POINT_ARN_FIELD, LIFECYCLE_FIELD, CALCULATED_LIFECYCLE_FIELD));
private final String backupVaultArn;
private final String recoveryPointArn;
private final Lifecycle lifecycle;
private final CalculatedLifecycle calculatedLifecycle;
private UpdateRecoveryPointLifecycleResponse(BuilderImpl builder) {
super(builder);
this.backupVaultArn = builder.backupVaultArn;
this.recoveryPointArn = builder.recoveryPointArn;
this.lifecycle = builder.lifecycle;
this.calculatedLifecycle = builder.calculatedLifecycle;
}
/**
*
* An ARN that uniquely identifies a backup vault; for example,
* arn:aws:backup:us-east-1:123456789012:vault:aBackupVault
.
*
*
* @return An ARN that uniquely identifies a backup vault; for example,
* arn:aws:backup:us-east-1:123456789012:vault:aBackupVault
.
*/
public final String backupVaultArn() {
return backupVaultArn;
}
/**
*
* An Amazon Resource Name (ARN) that uniquely identifies a recovery point; for example,
* arn:aws:backup:us-east-1:123456789012:recovery-point:1EB3B5E7-9EB0-435A-A80B-108B488B0D45
.
*
*
* @return An Amazon Resource Name (ARN) that uniquely identifies a recovery point; for example,
* arn:aws:backup:us-east-1:123456789012:recovery-point:1EB3B5E7-9EB0-435A-A80B-108B488B0D45
.
*/
public final String recoveryPointArn() {
return recoveryPointArn;
}
/**
*
* 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.
*
*
* @return 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.
*/
public final Lifecycle lifecycle() {
return lifecycle;
}
/**
*
* A CalculatedLifecycle
object containing DeleteAt
and MoveToColdStorageAt
* timestamps.
*
*
* @return A CalculatedLifecycle
object containing DeleteAt
and
* MoveToColdStorageAt
timestamps.
*/
public final CalculatedLifecycle calculatedLifecycle() {
return calculatedLifecycle;
}
@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 + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(backupVaultArn());
hashCode = 31 * hashCode + Objects.hashCode(recoveryPointArn());
hashCode = 31 * hashCode + Objects.hashCode(lifecycle());
hashCode = 31 * hashCode + Objects.hashCode(calculatedLifecycle());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof UpdateRecoveryPointLifecycleResponse)) {
return false;
}
UpdateRecoveryPointLifecycleResponse other = (UpdateRecoveryPointLifecycleResponse) obj;
return Objects.equals(backupVaultArn(), other.backupVaultArn())
&& Objects.equals(recoveryPointArn(), other.recoveryPointArn()) && Objects.equals(lifecycle(), other.lifecycle())
&& Objects.equals(calculatedLifecycle(), other.calculatedLifecycle());
}
/**
* 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("UpdateRecoveryPointLifecycleResponse").add("BackupVaultArn", backupVaultArn())
.add("RecoveryPointArn", recoveryPointArn()).add("Lifecycle", lifecycle())
.add("CalculatedLifecycle", calculatedLifecycle()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "BackupVaultArn":
return Optional.ofNullable(clazz.cast(backupVaultArn()));
case "RecoveryPointArn":
return Optional.ofNullable(clazz.cast(recoveryPointArn()));
case "Lifecycle":
return Optional.ofNullable(clazz.cast(lifecycle()));
case "CalculatedLifecycle":
return Optional.ofNullable(clazz.cast(calculatedLifecycle()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function