com.amazonaws.services.resiliencehub.model.ResiliencyPolicy Maven / Gradle / Ivy
Show all versions of aws-java-sdk-resiliencehub Show documentation
/*
* Copyright 2019-2024 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.resiliencehub.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* Defines a resiliency policy.
*
*
*
* Resilience Hub allows you to provide a value of zero for rtoInSecs
and rpoInSecs
of your
* resiliency policy. But, while assessing your application, the lowest possible assessment result is near zero. Hence,
* if you provide value zero for rtoInSecs
and rpoInSecs
, the estimated workload RTO and
* estimated workload RPO result will be near zero and the Compliance status for your application will be set to
* Policy breached.
*
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class ResiliencyPolicy implements Serializable, Cloneable, StructuredPojo {
/**
*
* Date and time when the resiliency policy was created.
*
*/
private java.util.Date creationTime;
/**
*
* Specifies a high-level geographical location constraint for where your resilience policy data can be stored.
*
*/
private String dataLocationConstraint;
/**
*
* Specifies the estimated cost tier of the resiliency policy.
*
*/
private String estimatedCostTier;
/**
*
* The resiliency policy.
*
*/
private java.util.Map policy;
/**
*
* Amazon Resource Name (ARN) of the resiliency policy. The format for this ARN is: arn:partition
* :resiliencehub:region
:account
:resiliency-policy/policy-id
. For more
* information about ARNs, see
* Amazon Resource Names (ARNs) in the Amazon Web Services General Reference guide.
*
*/
private String policyArn;
/**
*
* The description for the policy.
*
*/
private String policyDescription;
/**
*
* The name of the policy
*
*/
private String policyName;
/**
*
* Tags assigned to the resource. A tag is a label that you assign to an Amazon Web Services resource. Each tag
* consists of a key/value pair.
*
*/
private java.util.Map tags;
/**
*
* The tier for this resiliency policy, ranging from the highest severity (MissionCritical
) to lowest (
* NonCritical
).
*
*/
private String tier;
/**
*
* Date and time when the resiliency policy was created.
*
*
* @param creationTime
* Date and time when the resiliency policy was created.
*/
public void setCreationTime(java.util.Date creationTime) {
this.creationTime = creationTime;
}
/**
*
* Date and time when the resiliency policy was created.
*
*
* @return Date and time when the resiliency policy was created.
*/
public java.util.Date getCreationTime() {
return this.creationTime;
}
/**
*
* Date and time when the resiliency policy was created.
*
*
* @param creationTime
* Date and time when the resiliency policy was created.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ResiliencyPolicy withCreationTime(java.util.Date creationTime) {
setCreationTime(creationTime);
return this;
}
/**
*
* Specifies a high-level geographical location constraint for where your resilience policy data can be stored.
*
*
* @param dataLocationConstraint
* Specifies a high-level geographical location constraint for where your resilience policy data can be
* stored.
* @see DataLocationConstraint
*/
public void setDataLocationConstraint(String dataLocationConstraint) {
this.dataLocationConstraint = dataLocationConstraint;
}
/**
*
* Specifies a high-level geographical location constraint for where your resilience policy data can be stored.
*
*
* @return Specifies a high-level geographical location constraint for where your resilience policy data can be
* stored.
* @see DataLocationConstraint
*/
public String getDataLocationConstraint() {
return this.dataLocationConstraint;
}
/**
*
* Specifies a high-level geographical location constraint for where your resilience policy data can be stored.
*
*
* @param dataLocationConstraint
* Specifies a high-level geographical location constraint for where your resilience policy data can be
* stored.
* @return Returns a reference to this object so that method calls can be chained together.
* @see DataLocationConstraint
*/
public ResiliencyPolicy withDataLocationConstraint(String dataLocationConstraint) {
setDataLocationConstraint(dataLocationConstraint);
return this;
}
/**
*
* Specifies a high-level geographical location constraint for where your resilience policy data can be stored.
*
*
* @param dataLocationConstraint
* Specifies a high-level geographical location constraint for where your resilience policy data can be
* stored.
* @return Returns a reference to this object so that method calls can be chained together.
* @see DataLocationConstraint
*/
public ResiliencyPolicy withDataLocationConstraint(DataLocationConstraint dataLocationConstraint) {
this.dataLocationConstraint = dataLocationConstraint.toString();
return this;
}
/**
*
* Specifies the estimated cost tier of the resiliency policy.
*
*
* @param estimatedCostTier
* Specifies the estimated cost tier of the resiliency policy.
* @see EstimatedCostTier
*/
public void setEstimatedCostTier(String estimatedCostTier) {
this.estimatedCostTier = estimatedCostTier;
}
/**
*
* Specifies the estimated cost tier of the resiliency policy.
*
*
* @return Specifies the estimated cost tier of the resiliency policy.
* @see EstimatedCostTier
*/
public String getEstimatedCostTier() {
return this.estimatedCostTier;
}
/**
*
* Specifies the estimated cost tier of the resiliency policy.
*
*
* @param estimatedCostTier
* Specifies the estimated cost tier of the resiliency policy.
* @return Returns a reference to this object so that method calls can be chained together.
* @see EstimatedCostTier
*/
public ResiliencyPolicy withEstimatedCostTier(String estimatedCostTier) {
setEstimatedCostTier(estimatedCostTier);
return this;
}
/**
*
* Specifies the estimated cost tier of the resiliency policy.
*
*
* @param estimatedCostTier
* Specifies the estimated cost tier of the resiliency policy.
* @return Returns a reference to this object so that method calls can be chained together.
* @see EstimatedCostTier
*/
public ResiliencyPolicy withEstimatedCostTier(EstimatedCostTier estimatedCostTier) {
this.estimatedCostTier = estimatedCostTier.toString();
return this;
}
/**
*
* The resiliency policy.
*
*
* @return The resiliency policy.
*/
public java.util.Map getPolicy() {
return policy;
}
/**
*
* The resiliency policy.
*
*
* @param policy
* The resiliency policy.
*/
public void setPolicy(java.util.Map policy) {
this.policy = policy;
}
/**
*
* The resiliency policy.
*
*
* @param policy
* The resiliency policy.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ResiliencyPolicy withPolicy(java.util.Map policy) {
setPolicy(policy);
return this;
}
/**
* Add a single Policy entry
*
* @see ResiliencyPolicy#withPolicy
* @returns a reference to this object so that method calls can be chained together.
*/
public ResiliencyPolicy addPolicyEntry(String key, FailurePolicy value) {
if (null == this.policy) {
this.policy = new java.util.HashMap();
}
if (this.policy.containsKey(key))
throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided.");
this.policy.put(key, value);
return this;
}
/**
* Removes all the entries added into Policy.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ResiliencyPolicy clearPolicyEntries() {
this.policy = null;
return this;
}
/**
*
* Amazon Resource Name (ARN) of the resiliency policy. The format for this ARN is: arn:partition
* :resiliencehub:region
:account
:resiliency-policy/policy-id
. For more
* information about ARNs, see
* Amazon Resource Names (ARNs) in the Amazon Web Services General Reference guide.
*
*
* @param policyArn
* Amazon Resource Name (ARN) of the resiliency policy. The format for this ARN is: arn:
* partition
:resiliencehub:region
:account
:resiliency-policy/
* policy-id
. For more information about ARNs, see Amazon Resource Names
* (ARNs) in the Amazon Web Services General Reference guide.
*/
public void setPolicyArn(String policyArn) {
this.policyArn = policyArn;
}
/**
*
* Amazon Resource Name (ARN) of the resiliency policy. The format for this ARN is: arn:partition
* :resiliencehub:region
:account
:resiliency-policy/policy-id
. For more
* information about ARNs, see
* Amazon Resource Names (ARNs) in the Amazon Web Services General Reference guide.
*
*
* @return Amazon Resource Name (ARN) of the resiliency policy. The format for this ARN is: arn:
* partition
:resiliencehub:region
:account
:resiliency-policy/
* policy-id
. For more information about ARNs, see Amazon Resource Names
* (ARNs) in the Amazon Web Services General Reference guide.
*/
public String getPolicyArn() {
return this.policyArn;
}
/**
*
* Amazon Resource Name (ARN) of the resiliency policy. The format for this ARN is: arn:partition
* :resiliencehub:region
:account
:resiliency-policy/policy-id
. For more
* information about ARNs, see
* Amazon Resource Names (ARNs) in the Amazon Web Services General Reference guide.
*
*
* @param policyArn
* Amazon Resource Name (ARN) of the resiliency policy. The format for this ARN is: arn:
* partition
:resiliencehub:region
:account
:resiliency-policy/
* policy-id
. For more information about ARNs, see Amazon Resource Names
* (ARNs) in the Amazon Web Services General Reference guide.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ResiliencyPolicy withPolicyArn(String policyArn) {
setPolicyArn(policyArn);
return this;
}
/**
*
* The description for the policy.
*
*
* @param policyDescription
* The description for the policy.
*/
public void setPolicyDescription(String policyDescription) {
this.policyDescription = policyDescription;
}
/**
*
* The description for the policy.
*
*
* @return The description for the policy.
*/
public String getPolicyDescription() {
return this.policyDescription;
}
/**
*
* The description for the policy.
*
*
* @param policyDescription
* The description for the policy.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ResiliencyPolicy withPolicyDescription(String policyDescription) {
setPolicyDescription(policyDescription);
return this;
}
/**
*
* The name of the policy
*
*
* @param policyName
* The name of the policy
*/
public void setPolicyName(String policyName) {
this.policyName = policyName;
}
/**
*
* The name of the policy
*
*
* @return The name of the policy
*/
public String getPolicyName() {
return this.policyName;
}
/**
*
* The name of the policy
*
*
* @param policyName
* The name of the policy
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ResiliencyPolicy withPolicyName(String policyName) {
setPolicyName(policyName);
return this;
}
/**
*
* Tags assigned to the resource. A tag is a label that you assign to an Amazon Web Services resource. Each tag
* consists of a key/value pair.
*
*
* @return Tags assigned to the resource. A tag is a label that you assign to an Amazon Web Services resource. Each
* tag consists of a key/value pair.
*/
public java.util.Map getTags() {
return tags;
}
/**
*
* Tags assigned to the resource. A tag is a label that you assign to an Amazon Web Services resource. Each tag
* consists of a key/value pair.
*
*
* @param tags
* Tags assigned to the resource. A tag is a label that you assign to an Amazon Web Services resource. Each
* tag consists of a key/value pair.
*/
public void setTags(java.util.Map tags) {
this.tags = tags;
}
/**
*
* Tags assigned to the resource. A tag is a label that you assign to an Amazon Web Services resource. Each tag
* consists of a key/value pair.
*
*
* @param tags
* Tags assigned to the resource. A tag is a label that you assign to an Amazon Web Services resource. Each
* tag consists of a key/value pair.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ResiliencyPolicy withTags(java.util.Map tags) {
setTags(tags);
return this;
}
/**
* Add a single Tags entry
*
* @see ResiliencyPolicy#withTags
* @returns a reference to this object so that method calls can be chained together.
*/
public ResiliencyPolicy addTagsEntry(String key, String value) {
if (null == this.tags) {
this.tags = new java.util.HashMap();
}
if (this.tags.containsKey(key))
throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided.");
this.tags.put(key, value);
return this;
}
/**
* Removes all the entries added into Tags.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ResiliencyPolicy clearTagsEntries() {
this.tags = null;
return this;
}
/**
*
* The tier for this resiliency policy, ranging from the highest severity (MissionCritical
) to lowest (
* NonCritical
).
*
*
* @param tier
* The tier for this resiliency policy, ranging from the highest severity (MissionCritical
) to
* lowest (NonCritical
).
* @see ResiliencyPolicyTier
*/
public void setTier(String tier) {
this.tier = tier;
}
/**
*
* The tier for this resiliency policy, ranging from the highest severity (MissionCritical
) to lowest (
* NonCritical
).
*
*
* @return The tier for this resiliency policy, ranging from the highest severity (MissionCritical
) to
* lowest (NonCritical
).
* @see ResiliencyPolicyTier
*/
public String getTier() {
return this.tier;
}
/**
*
* The tier for this resiliency policy, ranging from the highest severity (MissionCritical
) to lowest (
* NonCritical
).
*
*
* @param tier
* The tier for this resiliency policy, ranging from the highest severity (MissionCritical
) to
* lowest (NonCritical
).
* @return Returns a reference to this object so that method calls can be chained together.
* @see ResiliencyPolicyTier
*/
public ResiliencyPolicy withTier(String tier) {
setTier(tier);
return this;
}
/**
*
* The tier for this resiliency policy, ranging from the highest severity (MissionCritical
) to lowest (
* NonCritical
).
*
*
* @param tier
* The tier for this resiliency policy, ranging from the highest severity (MissionCritical
) to
* lowest (NonCritical
).
* @return Returns a reference to this object so that method calls can be chained together.
* @see ResiliencyPolicyTier
*/
public ResiliencyPolicy withTier(ResiliencyPolicyTier tier) {
this.tier = tier.toString();
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 (getCreationTime() != null)
sb.append("CreationTime: ").append(getCreationTime()).append(",");
if (getDataLocationConstraint() != null)
sb.append("DataLocationConstraint: ").append(getDataLocationConstraint()).append(",");
if (getEstimatedCostTier() != null)
sb.append("EstimatedCostTier: ").append(getEstimatedCostTier()).append(",");
if (getPolicy() != null)
sb.append("Policy: ").append(getPolicy()).append(",");
if (getPolicyArn() != null)
sb.append("PolicyArn: ").append(getPolicyArn()).append(",");
if (getPolicyDescription() != null)
sb.append("PolicyDescription: ").append(getPolicyDescription()).append(",");
if (getPolicyName() != null)
sb.append("PolicyName: ").append(getPolicyName()).append(",");
if (getTags() != null)
sb.append("Tags: ").append("***Sensitive Data Redacted***").append(",");
if (getTier() != null)
sb.append("Tier: ").append(getTier());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof ResiliencyPolicy == false)
return false;
ResiliencyPolicy other = (ResiliencyPolicy) obj;
if (other.getCreationTime() == null ^ this.getCreationTime() == null)
return false;
if (other.getCreationTime() != null && other.getCreationTime().equals(this.getCreationTime()) == false)
return false;
if (other.getDataLocationConstraint() == null ^ this.getDataLocationConstraint() == null)
return false;
if (other.getDataLocationConstraint() != null && other.getDataLocationConstraint().equals(this.getDataLocationConstraint()) == false)
return false;
if (other.getEstimatedCostTier() == null ^ this.getEstimatedCostTier() == null)
return false;
if (other.getEstimatedCostTier() != null && other.getEstimatedCostTier().equals(this.getEstimatedCostTier()) == false)
return false;
if (other.getPolicy() == null ^ this.getPolicy() == null)
return false;
if (other.getPolicy() != null && other.getPolicy().equals(this.getPolicy()) == false)
return false;
if (other.getPolicyArn() == null ^ this.getPolicyArn() == null)
return false;
if (other.getPolicyArn() != null && other.getPolicyArn().equals(this.getPolicyArn()) == false)
return false;
if (other.getPolicyDescription() == null ^ this.getPolicyDescription() == null)
return false;
if (other.getPolicyDescription() != null && other.getPolicyDescription().equals(this.getPolicyDescription()) == false)
return false;
if (other.getPolicyName() == null ^ this.getPolicyName() == null)
return false;
if (other.getPolicyName() != null && other.getPolicyName().equals(this.getPolicyName()) == false)
return false;
if (other.getTags() == null ^ this.getTags() == null)
return false;
if (other.getTags() != null && other.getTags().equals(this.getTags()) == false)
return false;
if (other.getTier() == null ^ this.getTier() == null)
return false;
if (other.getTier() != null && other.getTier().equals(this.getTier()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getCreationTime() == null) ? 0 : getCreationTime().hashCode());
hashCode = prime * hashCode + ((getDataLocationConstraint() == null) ? 0 : getDataLocationConstraint().hashCode());
hashCode = prime * hashCode + ((getEstimatedCostTier() == null) ? 0 : getEstimatedCostTier().hashCode());
hashCode = prime * hashCode + ((getPolicy() == null) ? 0 : getPolicy().hashCode());
hashCode = prime * hashCode + ((getPolicyArn() == null) ? 0 : getPolicyArn().hashCode());
hashCode = prime * hashCode + ((getPolicyDescription() == null) ? 0 : getPolicyDescription().hashCode());
hashCode = prime * hashCode + ((getPolicyName() == null) ? 0 : getPolicyName().hashCode());
hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode());
hashCode = prime * hashCode + ((getTier() == null) ? 0 : getTier().hashCode());
return hashCode;
}
@Override
public ResiliencyPolicy clone() {
try {
return (ResiliencyPolicy) 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.resiliencehub.model.transform.ResiliencyPolicyMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}