
com.amazonaws.services.backup.model.BackupRule Maven / Gradle / Ivy
/*
* Copyright 2015-2020 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 com.amazonaws.services.backup.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* Specifies a scheduled task used to back up a selection of resources.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class BackupRule implements Serializable, Cloneable, StructuredPojo {
/**
*
* An optional display name for a backup rule.
*
*/
private String ruleName;
/**
*
* The name of a logical container where backups are stored. Backup vaults are identified by names that are unique
* to the account used to create them and the AWS Region where they are created. They consist of lowercase letters,
* numbers, and hyphens.
*
*/
private String targetBackupVaultName;
/**
*
* A CRON expression specifying when AWS Backup initiates a backup job.
*
*/
private String scheduleExpression;
/**
*
* An optional value that specifies a period of time in minutes after a backup is scheduled before a job is canceled
* if it doesn't start successfully.
*
*/
private Long startWindowMinutes;
/**
*
* A value in minutes after a backup job is successfully started before it must be completed or it is canceled by
* AWS Backup. This value is optional.
*
*/
private Long completionWindowMinutes;
/**
*
* 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.
*
*/
private Lifecycle lifecycle;
/**
*
* An array of key-value pair strings that are assigned to resources that are associated with this rule when
* restored from backup.
*
*/
private java.util.Map recoveryPointTags;
/**
*
* Uniquely identifies a rule that is used to schedule the backup of a selection of resources.
*
*/
private String ruleId;
/**
*
* An array of CopyAction
objects, which contains the details of the copy operation.
*
*/
private java.util.List copyActions;
/**
*
* An optional display name for a backup rule.
*
*
* @param ruleName
* An optional display name for a backup rule.
*/
public void setRuleName(String ruleName) {
this.ruleName = ruleName;
}
/**
*
* An optional display name for a backup rule.
*
*
* @return An optional display name for a backup rule.
*/
public String getRuleName() {
return this.ruleName;
}
/**
*
* An optional display name for a backup rule.
*
*
* @param ruleName
* An optional display name for a backup rule.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public BackupRule withRuleName(String ruleName) {
setRuleName(ruleName);
return this;
}
/**
*
* The name of a logical container where backups are stored. Backup vaults are identified by names that are unique
* to the account used to create them and the AWS Region where they are created. They consist of lowercase letters,
* numbers, and hyphens.
*
*
* @param targetBackupVaultName
* The name of a logical container where backups are stored. Backup vaults are identified by names that are
* unique to the account used to create them and the AWS Region where they are created. They consist of
* lowercase letters, numbers, and hyphens.
*/
public void setTargetBackupVaultName(String targetBackupVaultName) {
this.targetBackupVaultName = targetBackupVaultName;
}
/**
*
* The name of a logical container where backups are stored. Backup vaults are identified by names that are unique
* to the account used to create them and the AWS Region where they are created. They consist of lowercase letters,
* numbers, and hyphens.
*
*
* @return The name of a logical container where backups are stored. Backup vaults are identified by names that are
* unique to the account used to create them and the AWS Region where they are created. They consist of
* lowercase letters, numbers, and hyphens.
*/
public String getTargetBackupVaultName() {
return this.targetBackupVaultName;
}
/**
*
* The name of a logical container where backups are stored. Backup vaults are identified by names that are unique
* to the account used to create them and the AWS Region where they are created. They consist of lowercase letters,
* numbers, and hyphens.
*
*
* @param targetBackupVaultName
* The name of a logical container where backups are stored. Backup vaults are identified by names that are
* unique to the account used to create them and the AWS Region where they are created. They consist of
* lowercase letters, numbers, and hyphens.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public BackupRule withTargetBackupVaultName(String targetBackupVaultName) {
setTargetBackupVaultName(targetBackupVaultName);
return this;
}
/**
*
* A CRON expression specifying when AWS Backup initiates a backup job.
*
*
* @param scheduleExpression
* A CRON expression specifying when AWS Backup initiates a backup job.
*/
public void setScheduleExpression(String scheduleExpression) {
this.scheduleExpression = scheduleExpression;
}
/**
*
* A CRON expression specifying when AWS Backup initiates a backup job.
*
*
* @return A CRON expression specifying when AWS Backup initiates a backup job.
*/
public String getScheduleExpression() {
return this.scheduleExpression;
}
/**
*
* A CRON expression specifying when AWS Backup initiates a backup job.
*
*
* @param scheduleExpression
* A CRON expression specifying when AWS Backup initiates a backup job.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public BackupRule withScheduleExpression(String scheduleExpression) {
setScheduleExpression(scheduleExpression);
return this;
}
/**
*
* An optional value that specifies a period of time in minutes after a backup is scheduled before a job is canceled
* if it doesn't start successfully.
*
*
* @param startWindowMinutes
* An optional value that specifies a period of time in minutes after a backup is scheduled before a job is
* canceled if it doesn't start successfully.
*/
public void setStartWindowMinutes(Long startWindowMinutes) {
this.startWindowMinutes = startWindowMinutes;
}
/**
*
* An optional value that specifies a period of time in minutes after a backup is scheduled before a job is canceled
* if it doesn't start successfully.
*
*
* @return An optional value that specifies a period of time in minutes after a backup is scheduled before a job is
* canceled if it doesn't start successfully.
*/
public Long getStartWindowMinutes() {
return this.startWindowMinutes;
}
/**
*
* An optional value that specifies a period of time in minutes after a backup is scheduled before a job is canceled
* if it doesn't start successfully.
*
*
* @param startWindowMinutes
* An optional value that specifies a period of time in minutes after a backup is scheduled before a job is
* canceled if it doesn't start successfully.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public BackupRule withStartWindowMinutes(Long startWindowMinutes) {
setStartWindowMinutes(startWindowMinutes);
return this;
}
/**
*
* A value in minutes after a backup job is successfully started before it must be completed or it is canceled by
* AWS Backup. This value is optional.
*
*
* @param completionWindowMinutes
* A value in minutes after a backup job is successfully started before it must be completed or it is
* canceled by AWS Backup. This value is optional.
*/
public void setCompletionWindowMinutes(Long completionWindowMinutes) {
this.completionWindowMinutes = completionWindowMinutes;
}
/**
*
* A value in minutes after a backup job is successfully started before it must be completed or it is canceled by
* AWS Backup. This value is optional.
*
*
* @return A value in minutes after a backup job is successfully started before it must be completed or it is
* canceled by AWS Backup. This value is optional.
*/
public Long getCompletionWindowMinutes() {
return this.completionWindowMinutes;
}
/**
*
* A value in minutes after a backup job is successfully started before it must be completed or it is canceled by
* AWS Backup. This value is optional.
*
*
* @param completionWindowMinutes
* A value in minutes after a backup job is successfully started before it must be completed or it is
* canceled by AWS Backup. This value is optional.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public BackupRule withCompletionWindowMinutes(Long completionWindowMinutes) {
setCompletionWindowMinutes(completionWindowMinutes);
return this;
}
/**
*
* 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.
*
*
* @param lifecycle
* 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.
*/
public void setLifecycle(Lifecycle lifecycle) {
this.lifecycle = lifecycle;
}
/**
*
* 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.
*
*
* @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.
*/
public Lifecycle getLifecycle() {
return this.lifecycle;
}
/**
*
* 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.
*
*
* @param lifecycle
* 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.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public BackupRule withLifecycle(Lifecycle lifecycle) {
setLifecycle(lifecycle);
return this;
}
/**
*
* An array of key-value pair strings that are assigned to resources that are associated with this rule when
* restored from backup.
*
*
* @return An array of key-value pair strings that are assigned to resources that are associated with this rule when
* restored from backup.
*/
public java.util.Map getRecoveryPointTags() {
return recoveryPointTags;
}
/**
*
* An array of key-value pair strings that are assigned to resources that are associated with this rule when
* restored from backup.
*
*
* @param recoveryPointTags
* An array of key-value pair strings that are assigned to resources that are associated with this rule when
* restored from backup.
*/
public void setRecoveryPointTags(java.util.Map recoveryPointTags) {
this.recoveryPointTags = recoveryPointTags;
}
/**
*
* An array of key-value pair strings that are assigned to resources that are associated with this rule when
* restored from backup.
*
*
* @param recoveryPointTags
* An array of key-value pair strings that are assigned to resources that are associated with this rule when
* restored from backup.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public BackupRule withRecoveryPointTags(java.util.Map recoveryPointTags) {
setRecoveryPointTags(recoveryPointTags);
return this;
}
/**
* Add a single RecoveryPointTags entry
*
* @see BackupRule#withRecoveryPointTags
* @returns a reference to this object so that method calls can be chained together.
*/
public BackupRule addRecoveryPointTagsEntry(String key, String value) {
if (null == this.recoveryPointTags) {
this.recoveryPointTags = new java.util.HashMap();
}
if (this.recoveryPointTags.containsKey(key))
throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided.");
this.recoveryPointTags.put(key, value);
return this;
}
/**
* Removes all the entries added into RecoveryPointTags.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public BackupRule clearRecoveryPointTagsEntries() {
this.recoveryPointTags = null;
return this;
}
/**
*
* Uniquely identifies a rule that is used to schedule the backup of a selection of resources.
*
*
* @param ruleId
* Uniquely identifies a rule that is used to schedule the backup of a selection of resources.
*/
public void setRuleId(String ruleId) {
this.ruleId = ruleId;
}
/**
*
* Uniquely identifies a rule that is used to schedule the backup of a selection of resources.
*
*
* @return Uniquely identifies a rule that is used to schedule the backup of a selection of resources.
*/
public String getRuleId() {
return this.ruleId;
}
/**
*
* Uniquely identifies a rule that is used to schedule the backup of a selection of resources.
*
*
* @param ruleId
* Uniquely identifies a rule that is used to schedule the backup of a selection of resources.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public BackupRule withRuleId(String ruleId) {
setRuleId(ruleId);
return this;
}
/**
*
* An array of CopyAction
objects, which contains the details of the copy operation.
*
*
* @return An array of CopyAction
objects, which contains the details of the copy operation.
*/
public java.util.List getCopyActions() {
return copyActions;
}
/**
*
* An array of CopyAction
objects, which contains the details of the copy operation.
*
*
* @param copyActions
* An array of CopyAction
objects, which contains the details of the copy operation.
*/
public void setCopyActions(java.util.Collection copyActions) {
if (copyActions == null) {
this.copyActions = null;
return;
}
this.copyActions = new java.util.ArrayList(copyActions);
}
/**
*
* An array of CopyAction
objects, which contains the details of the copy operation.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setCopyActions(java.util.Collection)} or {@link #withCopyActions(java.util.Collection)} if you want to
* override the existing values.
*
*
* @param copyActions
* An array of CopyAction
objects, which contains the details of the copy operation.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public BackupRule withCopyActions(CopyAction... copyActions) {
if (this.copyActions == null) {
setCopyActions(new java.util.ArrayList(copyActions.length));
}
for (CopyAction ele : copyActions) {
this.copyActions.add(ele);
}
return this;
}
/**
*
* An array of CopyAction
objects, which contains the details of the copy operation.
*
*
* @param copyActions
* An array of CopyAction
objects, which contains the details of the copy operation.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public BackupRule withCopyActions(java.util.Collection copyActions) {
setCopyActions(copyActions);
return this;
}
/**
* 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.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getRuleName() != null)
sb.append("RuleName: ").append(getRuleName()).append(",");
if (getTargetBackupVaultName() != null)
sb.append("TargetBackupVaultName: ").append(getTargetBackupVaultName()).append(",");
if (getScheduleExpression() != null)
sb.append("ScheduleExpression: ").append(getScheduleExpression()).append(",");
if (getStartWindowMinutes() != null)
sb.append("StartWindowMinutes: ").append(getStartWindowMinutes()).append(",");
if (getCompletionWindowMinutes() != null)
sb.append("CompletionWindowMinutes: ").append(getCompletionWindowMinutes()).append(",");
if (getLifecycle() != null)
sb.append("Lifecycle: ").append(getLifecycle()).append(",");
if (getRecoveryPointTags() != null)
sb.append("RecoveryPointTags: ").append("***Sensitive Data Redacted***").append(",");
if (getRuleId() != null)
sb.append("RuleId: ").append(getRuleId()).append(",");
if (getCopyActions() != null)
sb.append("CopyActions: ").append(getCopyActions());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof BackupRule == false)
return false;
BackupRule other = (BackupRule) obj;
if (other.getRuleName() == null ^ this.getRuleName() == null)
return false;
if (other.getRuleName() != null && other.getRuleName().equals(this.getRuleName()) == false)
return false;
if (other.getTargetBackupVaultName() == null ^ this.getTargetBackupVaultName() == null)
return false;
if (other.getTargetBackupVaultName() != null && other.getTargetBackupVaultName().equals(this.getTargetBackupVaultName()) == false)
return false;
if (other.getScheduleExpression() == null ^ this.getScheduleExpression() == null)
return false;
if (other.getScheduleExpression() != null && other.getScheduleExpression().equals(this.getScheduleExpression()) == false)
return false;
if (other.getStartWindowMinutes() == null ^ this.getStartWindowMinutes() == null)
return false;
if (other.getStartWindowMinutes() != null && other.getStartWindowMinutes().equals(this.getStartWindowMinutes()) == false)
return false;
if (other.getCompletionWindowMinutes() == null ^ this.getCompletionWindowMinutes() == null)
return false;
if (other.getCompletionWindowMinutes() != null && other.getCompletionWindowMinutes().equals(this.getCompletionWindowMinutes()) == false)
return false;
if (other.getLifecycle() == null ^ this.getLifecycle() == null)
return false;
if (other.getLifecycle() != null && other.getLifecycle().equals(this.getLifecycle()) == false)
return false;
if (other.getRecoveryPointTags() == null ^ this.getRecoveryPointTags() == null)
return false;
if (other.getRecoveryPointTags() != null && other.getRecoveryPointTags().equals(this.getRecoveryPointTags()) == false)
return false;
if (other.getRuleId() == null ^ this.getRuleId() == null)
return false;
if (other.getRuleId() != null && other.getRuleId().equals(this.getRuleId()) == false)
return false;
if (other.getCopyActions() == null ^ this.getCopyActions() == null)
return false;
if (other.getCopyActions() != null && other.getCopyActions().equals(this.getCopyActions()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getRuleName() == null) ? 0 : getRuleName().hashCode());
hashCode = prime * hashCode + ((getTargetBackupVaultName() == null) ? 0 : getTargetBackupVaultName().hashCode());
hashCode = prime * hashCode + ((getScheduleExpression() == null) ? 0 : getScheduleExpression().hashCode());
hashCode = prime * hashCode + ((getStartWindowMinutes() == null) ? 0 : getStartWindowMinutes().hashCode());
hashCode = prime * hashCode + ((getCompletionWindowMinutes() == null) ? 0 : getCompletionWindowMinutes().hashCode());
hashCode = prime * hashCode + ((getLifecycle() == null) ? 0 : getLifecycle().hashCode());
hashCode = prime * hashCode + ((getRecoveryPointTags() == null) ? 0 : getRecoveryPointTags().hashCode());
hashCode = prime * hashCode + ((getRuleId() == null) ? 0 : getRuleId().hashCode());
hashCode = prime * hashCode + ((getCopyActions() == null) ? 0 : getCopyActions().hashCode());
return hashCode;
}
@Override
public BackupRule clone() {
try {
return (BackupRule) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.backup.model.transform.BackupRuleMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}