com.amazonaws.services.dlm.model.LifecyclePolicy Maven / Gradle / Ivy
Show all versions of aws-java-sdk-dlm 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.dlm.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* [Custom policies only] Detailed information about a snapshot, AMI, or event-based lifecycle policy.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class LifecyclePolicy implements Serializable, Cloneable, StructuredPojo {
/**
*
* The identifier of the lifecycle policy.
*
*/
private String policyId;
/**
*
* The description of the lifecycle policy.
*
*/
private String description;
/**
*
* The activation state of the lifecycle policy.
*
*/
private String state;
/**
*
* The description of the status.
*
*/
private String statusMessage;
/**
*
* The Amazon Resource Name (ARN) of the IAM role used to run the operations specified by the lifecycle policy.
*
*/
private String executionRoleArn;
/**
*
* The local date and time when the lifecycle policy was created.
*
*/
private java.util.Date dateCreated;
/**
*
* The local date and time when the lifecycle policy was last modified.
*
*/
private java.util.Date dateModified;
/**
*
* The configuration of the lifecycle policy
*
*/
private PolicyDetails policyDetails;
/**
*
* The tags.
*
*/
private java.util.Map tags;
/**
*
* The Amazon Resource Name (ARN) of the policy.
*
*/
private String policyArn;
/**
*
* [Default policies only] The type of default policy. Values include:
*
*
* -
*
* VOLUME
- Default policy for EBS snapshots
*
*
* -
*
* INSTANCE
- Default policy for EBS-backed AMIs
*
*
*
*/
private Boolean defaultPolicy;
/**
*
* The identifier of the lifecycle policy.
*
*
* @param policyId
* The identifier of the lifecycle policy.
*/
public void setPolicyId(String policyId) {
this.policyId = policyId;
}
/**
*
* The identifier of the lifecycle policy.
*
*
* @return The identifier of the lifecycle policy.
*/
public String getPolicyId() {
return this.policyId;
}
/**
*
* The identifier of the lifecycle policy.
*
*
* @param policyId
* The identifier of the lifecycle policy.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public LifecyclePolicy withPolicyId(String policyId) {
setPolicyId(policyId);
return this;
}
/**
*
* The description of the lifecycle policy.
*
*
* @param description
* The description of the lifecycle policy.
*/
public void setDescription(String description) {
this.description = description;
}
/**
*
* The description of the lifecycle policy.
*
*
* @return The description of the lifecycle policy.
*/
public String getDescription() {
return this.description;
}
/**
*
* The description of the lifecycle policy.
*
*
* @param description
* The description of the lifecycle policy.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public LifecyclePolicy withDescription(String description) {
setDescription(description);
return this;
}
/**
*
* The activation state of the lifecycle policy.
*
*
* @param state
* The activation state of the lifecycle policy.
* @see GettablePolicyStateValues
*/
public void setState(String state) {
this.state = state;
}
/**
*
* The activation state of the lifecycle policy.
*
*
* @return The activation state of the lifecycle policy.
* @see GettablePolicyStateValues
*/
public String getState() {
return this.state;
}
/**
*
* The activation state of the lifecycle policy.
*
*
* @param state
* The activation state of the lifecycle policy.
* @return Returns a reference to this object so that method calls can be chained together.
* @see GettablePolicyStateValues
*/
public LifecyclePolicy withState(String state) {
setState(state);
return this;
}
/**
*
* The activation state of the lifecycle policy.
*
*
* @param state
* The activation state of the lifecycle policy.
* @return Returns a reference to this object so that method calls can be chained together.
* @see GettablePolicyStateValues
*/
public LifecyclePolicy withState(GettablePolicyStateValues state) {
this.state = state.toString();
return this;
}
/**
*
* The description of the status.
*
*
* @param statusMessage
* The description of the status.
*/
public void setStatusMessage(String statusMessage) {
this.statusMessage = statusMessage;
}
/**
*
* The description of the status.
*
*
* @return The description of the status.
*/
public String getStatusMessage() {
return this.statusMessage;
}
/**
*
* The description of the status.
*
*
* @param statusMessage
* The description of the status.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public LifecyclePolicy withStatusMessage(String statusMessage) {
setStatusMessage(statusMessage);
return this;
}
/**
*
* The Amazon Resource Name (ARN) of the IAM role used to run the operations specified by the lifecycle policy.
*
*
* @param executionRoleArn
* The Amazon Resource Name (ARN) of the IAM role used to run the operations specified by the lifecycle
* policy.
*/
public void setExecutionRoleArn(String executionRoleArn) {
this.executionRoleArn = executionRoleArn;
}
/**
*
* The Amazon Resource Name (ARN) of the IAM role used to run the operations specified by the lifecycle policy.
*
*
* @return The Amazon Resource Name (ARN) of the IAM role used to run the operations specified by the lifecycle
* policy.
*/
public String getExecutionRoleArn() {
return this.executionRoleArn;
}
/**
*
* The Amazon Resource Name (ARN) of the IAM role used to run the operations specified by the lifecycle policy.
*
*
* @param executionRoleArn
* The Amazon Resource Name (ARN) of the IAM role used to run the operations specified by the lifecycle
* policy.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public LifecyclePolicy withExecutionRoleArn(String executionRoleArn) {
setExecutionRoleArn(executionRoleArn);
return this;
}
/**
*
* The local date and time when the lifecycle policy was created.
*
*
* @param dateCreated
* The local date and time when the lifecycle policy was created.
*/
public void setDateCreated(java.util.Date dateCreated) {
this.dateCreated = dateCreated;
}
/**
*
* The local date and time when the lifecycle policy was created.
*
*
* @return The local date and time when the lifecycle policy was created.
*/
public java.util.Date getDateCreated() {
return this.dateCreated;
}
/**
*
* The local date and time when the lifecycle policy was created.
*
*
* @param dateCreated
* The local date and time when the lifecycle policy was created.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public LifecyclePolicy withDateCreated(java.util.Date dateCreated) {
setDateCreated(dateCreated);
return this;
}
/**
*
* The local date and time when the lifecycle policy was last modified.
*
*
* @param dateModified
* The local date and time when the lifecycle policy was last modified.
*/
public void setDateModified(java.util.Date dateModified) {
this.dateModified = dateModified;
}
/**
*
* The local date and time when the lifecycle policy was last modified.
*
*
* @return The local date and time when the lifecycle policy was last modified.
*/
public java.util.Date getDateModified() {
return this.dateModified;
}
/**
*
* The local date and time when the lifecycle policy was last modified.
*
*
* @param dateModified
* The local date and time when the lifecycle policy was last modified.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public LifecyclePolicy withDateModified(java.util.Date dateModified) {
setDateModified(dateModified);
return this;
}
/**
*
* The configuration of the lifecycle policy
*
*
* @param policyDetails
* The configuration of the lifecycle policy
*/
public void setPolicyDetails(PolicyDetails policyDetails) {
this.policyDetails = policyDetails;
}
/**
*
* The configuration of the lifecycle policy
*
*
* @return The configuration of the lifecycle policy
*/
public PolicyDetails getPolicyDetails() {
return this.policyDetails;
}
/**
*
* The configuration of the lifecycle policy
*
*
* @param policyDetails
* The configuration of the lifecycle policy
* @return Returns a reference to this object so that method calls can be chained together.
*/
public LifecyclePolicy withPolicyDetails(PolicyDetails policyDetails) {
setPolicyDetails(policyDetails);
return this;
}
/**
*
* The tags.
*
*
* @return The tags.
*/
public java.util.Map getTags() {
return tags;
}
/**
*
* The tags.
*
*
* @param tags
* The tags.
*/
public void setTags(java.util.Map tags) {
this.tags = tags;
}
/**
*
* The tags.
*
*
* @param tags
* The tags.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public LifecyclePolicy withTags(java.util.Map tags) {
setTags(tags);
return this;
}
/**
* Add a single Tags entry
*
* @see LifecyclePolicy#withTags
* @returns a reference to this object so that method calls can be chained together.
*/
public LifecyclePolicy 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 LifecyclePolicy clearTagsEntries() {
this.tags = null;
return this;
}
/**
*
* The Amazon Resource Name (ARN) of the policy.
*
*
* @param policyArn
* The Amazon Resource Name (ARN) of the policy.
*/
public void setPolicyArn(String policyArn) {
this.policyArn = policyArn;
}
/**
*
* The Amazon Resource Name (ARN) of the policy.
*
*
* @return The Amazon Resource Name (ARN) of the policy.
*/
public String getPolicyArn() {
return this.policyArn;
}
/**
*
* The Amazon Resource Name (ARN) of the policy.
*
*
* @param policyArn
* The Amazon Resource Name (ARN) of the policy.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public LifecyclePolicy withPolicyArn(String policyArn) {
setPolicyArn(policyArn);
return this;
}
/**
*
* [Default policies only] The type of default policy. Values include:
*
*
* -
*
* VOLUME
- Default policy for EBS snapshots
*
*
* -
*
* INSTANCE
- Default policy for EBS-backed AMIs
*
*
*
*
* @param defaultPolicy
* [Default policies only] The type of default policy. Values include:
*
* -
*
* VOLUME
- Default policy for EBS snapshots
*
*
* -
*
* INSTANCE
- Default policy for EBS-backed AMIs
*
*
*/
public void setDefaultPolicy(Boolean defaultPolicy) {
this.defaultPolicy = defaultPolicy;
}
/**
*
* [Default policies only] The type of default policy. Values include:
*
*
* -
*
* VOLUME
- Default policy for EBS snapshots
*
*
* -
*
* INSTANCE
- Default policy for EBS-backed AMIs
*
*
*
*
* @return [Default policies only] The type of default policy. Values include:
*
* -
*
* VOLUME
- Default policy for EBS snapshots
*
*
* -
*
* INSTANCE
- Default policy for EBS-backed AMIs
*
*
*/
public Boolean getDefaultPolicy() {
return this.defaultPolicy;
}
/**
*
* [Default policies only] The type of default policy. Values include:
*
*
* -
*
* VOLUME
- Default policy for EBS snapshots
*
*
* -
*
* INSTANCE
- Default policy for EBS-backed AMIs
*
*
*
*
* @param defaultPolicy
* [Default policies only] The type of default policy. Values include:
*
* -
*
* VOLUME
- Default policy for EBS snapshots
*
*
* -
*
* INSTANCE
- Default policy for EBS-backed AMIs
*
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public LifecyclePolicy withDefaultPolicy(Boolean defaultPolicy) {
setDefaultPolicy(defaultPolicy);
return this;
}
/**
*
* [Default policies only] The type of default policy. Values include:
*
*
* -
*
* VOLUME
- Default policy for EBS snapshots
*
*
* -
*
* INSTANCE
- Default policy for EBS-backed AMIs
*
*
*
*
* @return [Default policies only] The type of default policy. Values include:
*
* -
*
* VOLUME
- Default policy for EBS snapshots
*
*
* -
*
* INSTANCE
- Default policy for EBS-backed AMIs
*
*
*/
public Boolean isDefaultPolicy() {
return this.defaultPolicy;
}
/**
* 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 (getPolicyId() != null)
sb.append("PolicyId: ").append(getPolicyId()).append(",");
if (getDescription() != null)
sb.append("Description: ").append(getDescription()).append(",");
if (getState() != null)
sb.append("State: ").append(getState()).append(",");
if (getStatusMessage() != null)
sb.append("StatusMessage: ").append(getStatusMessage()).append(",");
if (getExecutionRoleArn() != null)
sb.append("ExecutionRoleArn: ").append(getExecutionRoleArn()).append(",");
if (getDateCreated() != null)
sb.append("DateCreated: ").append(getDateCreated()).append(",");
if (getDateModified() != null)
sb.append("DateModified: ").append(getDateModified()).append(",");
if (getPolicyDetails() != null)
sb.append("PolicyDetails: ").append(getPolicyDetails()).append(",");
if (getTags() != null)
sb.append("Tags: ").append(getTags()).append(",");
if (getPolicyArn() != null)
sb.append("PolicyArn: ").append(getPolicyArn()).append(",");
if (getDefaultPolicy() != null)
sb.append("DefaultPolicy: ").append(getDefaultPolicy());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof LifecyclePolicy == false)
return false;
LifecyclePolicy other = (LifecyclePolicy) obj;
if (other.getPolicyId() == null ^ this.getPolicyId() == null)
return false;
if (other.getPolicyId() != null && other.getPolicyId().equals(this.getPolicyId()) == false)
return false;
if (other.getDescription() == null ^ this.getDescription() == null)
return false;
if (other.getDescription() != null && other.getDescription().equals(this.getDescription()) == false)
return false;
if (other.getState() == null ^ this.getState() == null)
return false;
if (other.getState() != null && other.getState().equals(this.getState()) == false)
return false;
if (other.getStatusMessage() == null ^ this.getStatusMessage() == null)
return false;
if (other.getStatusMessage() != null && other.getStatusMessage().equals(this.getStatusMessage()) == false)
return false;
if (other.getExecutionRoleArn() == null ^ this.getExecutionRoleArn() == null)
return false;
if (other.getExecutionRoleArn() != null && other.getExecutionRoleArn().equals(this.getExecutionRoleArn()) == false)
return false;
if (other.getDateCreated() == null ^ this.getDateCreated() == null)
return false;
if (other.getDateCreated() != null && other.getDateCreated().equals(this.getDateCreated()) == false)
return false;
if (other.getDateModified() == null ^ this.getDateModified() == null)
return false;
if (other.getDateModified() != null && other.getDateModified().equals(this.getDateModified()) == false)
return false;
if (other.getPolicyDetails() == null ^ this.getPolicyDetails() == null)
return false;
if (other.getPolicyDetails() != null && other.getPolicyDetails().equals(this.getPolicyDetails()) == 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.getPolicyArn() == null ^ this.getPolicyArn() == null)
return false;
if (other.getPolicyArn() != null && other.getPolicyArn().equals(this.getPolicyArn()) == false)
return false;
if (other.getDefaultPolicy() == null ^ this.getDefaultPolicy() == null)
return false;
if (other.getDefaultPolicy() != null && other.getDefaultPolicy().equals(this.getDefaultPolicy()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getPolicyId() == null) ? 0 : getPolicyId().hashCode());
hashCode = prime * hashCode + ((getDescription() == null) ? 0 : getDescription().hashCode());
hashCode = prime * hashCode + ((getState() == null) ? 0 : getState().hashCode());
hashCode = prime * hashCode + ((getStatusMessage() == null) ? 0 : getStatusMessage().hashCode());
hashCode = prime * hashCode + ((getExecutionRoleArn() == null) ? 0 : getExecutionRoleArn().hashCode());
hashCode = prime * hashCode + ((getDateCreated() == null) ? 0 : getDateCreated().hashCode());
hashCode = prime * hashCode + ((getDateModified() == null) ? 0 : getDateModified().hashCode());
hashCode = prime * hashCode + ((getPolicyDetails() == null) ? 0 : getPolicyDetails().hashCode());
hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode());
hashCode = prime * hashCode + ((getPolicyArn() == null) ? 0 : getPolicyArn().hashCode());
hashCode = prime * hashCode + ((getDefaultPolicy() == null) ? 0 : getDefaultPolicy().hashCode());
return hashCode;
}
@Override
public LifecyclePolicy clone() {
try {
return (LifecyclePolicy) 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.dlm.model.transform.LifecyclePolicyMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}