software.amazon.awscdk.services.backup.BackupPlanRuleProps Maven / Gradle / Ivy
Show all versions of backup Show documentation
package software.amazon.awscdk.services.backup;
/**
* Properties for a BackupPlanRule.
*
* Example:
*
*
* BackupPlan plan;
* plan.addRule(BackupPlanRule.Builder.create()
* .completionWindow(Duration.hours(2))
* .startWindow(Duration.hours(1))
* .scheduleExpression(Schedule.cron(CronOptions.builder() // Only cron expressions are supported
* .day("15")
* .hour("3")
* .minute("30").build()))
* .moveToColdStorageAfter(Duration.days(30))
* .build());
*
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.73.0 (build 6faeda3)", date = "2023-01-25T18:29:12.702Z")
@software.amazon.jsii.Jsii(module = software.amazon.awscdk.services.backup.$Module.class, fqn = "@aws-cdk/aws-backup.BackupPlanRuleProps")
@software.amazon.jsii.Jsii.Proxy(BackupPlanRuleProps.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public interface BackupPlanRuleProps extends software.amazon.jsii.JsiiSerializable {
/**
* The backup vault where backups are.
*
* Default: - use the vault defined at the plan level. If not defined a new
* common vault for the plan will be created
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.backup.IBackupVault getBackupVault() {
return null;
}
/**
* The duration after a backup job is successfully started before it must be completed or it is canceled by AWS Backup.
*
* Default: - 8 hours
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.core.Duration getCompletionWindow() {
return null;
}
/**
* Specifies the duration after creation that a recovery point is deleted.
*
* Must be greater than moveToColdStorageAfter
.
*
* Default: - recovery point is never deleted
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.core.Duration getDeleteAfter() {
return null;
}
/**
* Enables continuous backup and point-in-time restores (PITR).
*
* Property deleteAfter
defines the retention period for the backup. It is mandatory if PITR is enabled.
* If no value is specified, the retention period is set to 35 days which is the maximum retention period supported by PITR.
*
* Property moveToColdStorageAfter
must not be specified because PITR does not support this option.
*
* Default: false
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.lang.Boolean getEnableContinuousBackup() {
return null;
}
/**
* Specifies the duration after creation that a recovery point is moved to cold storage.
*
* Default: - recovery point is never moved to cold storage
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.core.Duration getMoveToColdStorageAfter() {
return null;
}
/**
* A display name for the backup rule.
*
* Default: - a CDK generated name
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.lang.String getRuleName() {
return null;
}
/**
* A CRON expression specifying when AWS Backup initiates a backup job.
*
* Default: - no schedule
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.events.Schedule getScheduleExpression() {
return null;
}
/**
* The duration after a backup is scheduled before a job is canceled if it doesn't start successfully.
*
* Default: - 8 hours
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.core.Duration getStartWindow() {
return null;
}
/**
* @return a {@link Builder} of {@link BackupPlanRuleProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link BackupPlanRuleProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static final class Builder implements software.amazon.jsii.Builder {
software.amazon.awscdk.services.backup.IBackupVault backupVault;
software.amazon.awscdk.core.Duration completionWindow;
software.amazon.awscdk.core.Duration deleteAfter;
java.lang.Boolean enableContinuousBackup;
software.amazon.awscdk.core.Duration moveToColdStorageAfter;
java.lang.String ruleName;
software.amazon.awscdk.services.events.Schedule scheduleExpression;
software.amazon.awscdk.core.Duration startWindow;
/**
* Sets the value of {@link BackupPlanRuleProps#getBackupVault}
* @param backupVault The backup vault where backups are.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder backupVault(software.amazon.awscdk.services.backup.IBackupVault backupVault) {
this.backupVault = backupVault;
return this;
}
/**
* Sets the value of {@link BackupPlanRuleProps#getCompletionWindow}
* @param completionWindow The duration after a backup job is successfully started before it must be completed or it is canceled by AWS Backup.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder completionWindow(software.amazon.awscdk.core.Duration completionWindow) {
this.completionWindow = completionWindow;
return this;
}
/**
* Sets the value of {@link BackupPlanRuleProps#getDeleteAfter}
* @param deleteAfter Specifies the duration after creation that a recovery point is deleted.
* Must be greater than moveToColdStorageAfter
.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder deleteAfter(software.amazon.awscdk.core.Duration deleteAfter) {
this.deleteAfter = deleteAfter;
return this;
}
/**
* Sets the value of {@link BackupPlanRuleProps#getEnableContinuousBackup}
* @param enableContinuousBackup Enables continuous backup and point-in-time restores (PITR).
* Property deleteAfter
defines the retention period for the backup. It is mandatory if PITR is enabled.
* If no value is specified, the retention period is set to 35 days which is the maximum retention period supported by PITR.
*
* Property moveToColdStorageAfter
must not be specified because PITR does not support this option.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder enableContinuousBackup(java.lang.Boolean enableContinuousBackup) {
this.enableContinuousBackup = enableContinuousBackup;
return this;
}
/**
* Sets the value of {@link BackupPlanRuleProps#getMoveToColdStorageAfter}
* @param moveToColdStorageAfter Specifies the duration after creation that a recovery point is moved to cold storage.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder moveToColdStorageAfter(software.amazon.awscdk.core.Duration moveToColdStorageAfter) {
this.moveToColdStorageAfter = moveToColdStorageAfter;
return this;
}
/**
* Sets the value of {@link BackupPlanRuleProps#getRuleName}
* @param ruleName A display name for the backup rule.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder ruleName(java.lang.String ruleName) {
this.ruleName = ruleName;
return this;
}
/**
* Sets the value of {@link BackupPlanRuleProps#getScheduleExpression}
* @param scheduleExpression A CRON expression specifying when AWS Backup initiates a backup job.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder scheduleExpression(software.amazon.awscdk.services.events.Schedule scheduleExpression) {
this.scheduleExpression = scheduleExpression;
return this;
}
/**
* Sets the value of {@link BackupPlanRuleProps#getStartWindow}
* @param startWindow The duration after a backup is scheduled before a job is canceled if it doesn't start successfully.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder startWindow(software.amazon.awscdk.core.Duration startWindow) {
this.startWindow = startWindow;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link BackupPlanRuleProps}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@Override
public BackupPlanRuleProps build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link BackupPlanRuleProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements BackupPlanRuleProps {
private final software.amazon.awscdk.services.backup.IBackupVault backupVault;
private final software.amazon.awscdk.core.Duration completionWindow;
private final software.amazon.awscdk.core.Duration deleteAfter;
private final java.lang.Boolean enableContinuousBackup;
private final software.amazon.awscdk.core.Duration moveToColdStorageAfter;
private final java.lang.String ruleName;
private final software.amazon.awscdk.services.events.Schedule scheduleExpression;
private final software.amazon.awscdk.core.Duration startWindow;
/**
* Constructor that initializes the object based on values retrieved from the JsiiObject.
* @param objRef Reference to the JSII managed object.
*/
protected Jsii$Proxy(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
this.backupVault = software.amazon.jsii.Kernel.get(this, "backupVault", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.backup.IBackupVault.class));
this.completionWindow = software.amazon.jsii.Kernel.get(this, "completionWindow", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.core.Duration.class));
this.deleteAfter = software.amazon.jsii.Kernel.get(this, "deleteAfter", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.core.Duration.class));
this.enableContinuousBackup = software.amazon.jsii.Kernel.get(this, "enableContinuousBackup", software.amazon.jsii.NativeType.forClass(java.lang.Boolean.class));
this.moveToColdStorageAfter = software.amazon.jsii.Kernel.get(this, "moveToColdStorageAfter", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.core.Duration.class));
this.ruleName = software.amazon.jsii.Kernel.get(this, "ruleName", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.scheduleExpression = software.amazon.jsii.Kernel.get(this, "scheduleExpression", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.events.Schedule.class));
this.startWindow = software.amazon.jsii.Kernel.get(this, "startWindow", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.core.Duration.class));
}
/**
* Constructor that initializes the object based on literal property values passed by the {@link Builder}.
*/
protected Jsii$Proxy(final Builder builder) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
this.backupVault = builder.backupVault;
this.completionWindow = builder.completionWindow;
this.deleteAfter = builder.deleteAfter;
this.enableContinuousBackup = builder.enableContinuousBackup;
this.moveToColdStorageAfter = builder.moveToColdStorageAfter;
this.ruleName = builder.ruleName;
this.scheduleExpression = builder.scheduleExpression;
this.startWindow = builder.startWindow;
}
@Override
public final software.amazon.awscdk.services.backup.IBackupVault getBackupVault() {
return this.backupVault;
}
@Override
public final software.amazon.awscdk.core.Duration getCompletionWindow() {
return this.completionWindow;
}
@Override
public final software.amazon.awscdk.core.Duration getDeleteAfter() {
return this.deleteAfter;
}
@Override
public final java.lang.Boolean getEnableContinuousBackup() {
return this.enableContinuousBackup;
}
@Override
public final software.amazon.awscdk.core.Duration getMoveToColdStorageAfter() {
return this.moveToColdStorageAfter;
}
@Override
public final java.lang.String getRuleName() {
return this.ruleName;
}
@Override
public final software.amazon.awscdk.services.events.Schedule getScheduleExpression() {
return this.scheduleExpression;
}
@Override
public final software.amazon.awscdk.core.Duration getStartWindow() {
return this.startWindow;
}
@Override
@software.amazon.jsii.Internal
public com.fasterxml.jackson.databind.JsonNode $jsii$toJson() {
final com.fasterxml.jackson.databind.ObjectMapper om = software.amazon.jsii.JsiiObjectMapper.INSTANCE;
final com.fasterxml.jackson.databind.node.ObjectNode data = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
if (this.getBackupVault() != null) {
data.set("backupVault", om.valueToTree(this.getBackupVault()));
}
if (this.getCompletionWindow() != null) {
data.set("completionWindow", om.valueToTree(this.getCompletionWindow()));
}
if (this.getDeleteAfter() != null) {
data.set("deleteAfter", om.valueToTree(this.getDeleteAfter()));
}
if (this.getEnableContinuousBackup() != null) {
data.set("enableContinuousBackup", om.valueToTree(this.getEnableContinuousBackup()));
}
if (this.getMoveToColdStorageAfter() != null) {
data.set("moveToColdStorageAfter", om.valueToTree(this.getMoveToColdStorageAfter()));
}
if (this.getRuleName() != null) {
data.set("ruleName", om.valueToTree(this.getRuleName()));
}
if (this.getScheduleExpression() != null) {
data.set("scheduleExpression", om.valueToTree(this.getScheduleExpression()));
}
if (this.getStartWindow() != null) {
data.set("startWindow", om.valueToTree(this.getStartWindow()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("@aws-cdk/aws-backup.BackupPlanRuleProps"));
struct.set("data", data);
final com.fasterxml.jackson.databind.node.ObjectNode obj = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
obj.set("$jsii.struct", struct);
return obj;
}
@Override
public final boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
BackupPlanRuleProps.Jsii$Proxy that = (BackupPlanRuleProps.Jsii$Proxy) o;
if (this.backupVault != null ? !this.backupVault.equals(that.backupVault) : that.backupVault != null) return false;
if (this.completionWindow != null ? !this.completionWindow.equals(that.completionWindow) : that.completionWindow != null) return false;
if (this.deleteAfter != null ? !this.deleteAfter.equals(that.deleteAfter) : that.deleteAfter != null) return false;
if (this.enableContinuousBackup != null ? !this.enableContinuousBackup.equals(that.enableContinuousBackup) : that.enableContinuousBackup != null) return false;
if (this.moveToColdStorageAfter != null ? !this.moveToColdStorageAfter.equals(that.moveToColdStorageAfter) : that.moveToColdStorageAfter != null) return false;
if (this.ruleName != null ? !this.ruleName.equals(that.ruleName) : that.ruleName != null) return false;
if (this.scheduleExpression != null ? !this.scheduleExpression.equals(that.scheduleExpression) : that.scheduleExpression != null) return false;
return this.startWindow != null ? this.startWindow.equals(that.startWindow) : that.startWindow == null;
}
@Override
public final int hashCode() {
int result = this.backupVault != null ? this.backupVault.hashCode() : 0;
result = 31 * result + (this.completionWindow != null ? this.completionWindow.hashCode() : 0);
result = 31 * result + (this.deleteAfter != null ? this.deleteAfter.hashCode() : 0);
result = 31 * result + (this.enableContinuousBackup != null ? this.enableContinuousBackup.hashCode() : 0);
result = 31 * result + (this.moveToColdStorageAfter != null ? this.moveToColdStorageAfter.hashCode() : 0);
result = 31 * result + (this.ruleName != null ? this.ruleName.hashCode() : 0);
result = 31 * result + (this.scheduleExpression != null ? this.scheduleExpression.hashCode() : 0);
result = 31 * result + (this.startWindow != null ? this.startWindow.hashCode() : 0);
return result;
}
}
}