com.amazonaws.services.dlm.model.LifecyclePolicySummary 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;
/**
*
* Summary information about a lifecycle policy.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class LifecyclePolicySummary 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 tags.
*
*/
private java.util.Map tags;
/**
*
* The type of policy. EBS_SNAPSHOT_MANAGEMENT
indicates that the policy manages the lifecycle of
* Amazon EBS snapshots. IMAGE_MANAGEMENT
indicates that the policy manages the lifecycle of EBS-backed
* AMIs. EVENT_BASED_POLICY
indicates that the policy automates cross-account snapshot copies for
* snapshots that are shared with your account.
*
*/
private String policyType;
/**
*
* [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 LifecyclePolicySummary 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 LifecyclePolicySummary 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 LifecyclePolicySummary 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 LifecyclePolicySummary withState(GettablePolicyStateValues state) {
this.state = state.toString();
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 LifecyclePolicySummary withTags(java.util.Map tags) {
setTags(tags);
return this;
}
/**
* Add a single Tags entry
*
* @see LifecyclePolicySummary#withTags
* @returns a reference to this object so that method calls can be chained together.
*/
public LifecyclePolicySummary 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 LifecyclePolicySummary clearTagsEntries() {
this.tags = null;
return this;
}
/**
*
* The type of policy. EBS_SNAPSHOT_MANAGEMENT
indicates that the policy manages the lifecycle of
* Amazon EBS snapshots. IMAGE_MANAGEMENT
indicates that the policy manages the lifecycle of EBS-backed
* AMIs. EVENT_BASED_POLICY
indicates that the policy automates cross-account snapshot copies for
* snapshots that are shared with your account.
*
*
* @param policyType
* The type of policy. EBS_SNAPSHOT_MANAGEMENT
indicates that the policy manages the lifecycle
* of Amazon EBS snapshots. IMAGE_MANAGEMENT
indicates that the policy manages the lifecycle of
* EBS-backed AMIs. EVENT_BASED_POLICY
indicates that the policy automates cross-account
* snapshot copies for snapshots that are shared with your account.
* @see PolicyTypeValues
*/
public void setPolicyType(String policyType) {
this.policyType = policyType;
}
/**
*
* The type of policy. EBS_SNAPSHOT_MANAGEMENT
indicates that the policy manages the lifecycle of
* Amazon EBS snapshots. IMAGE_MANAGEMENT
indicates that the policy manages the lifecycle of EBS-backed
* AMIs. EVENT_BASED_POLICY
indicates that the policy automates cross-account snapshot copies for
* snapshots that are shared with your account.
*
*
* @return The type of policy. EBS_SNAPSHOT_MANAGEMENT
indicates that the policy manages the lifecycle
* of Amazon EBS snapshots. IMAGE_MANAGEMENT
indicates that the policy manages the lifecycle of
* EBS-backed AMIs. EVENT_BASED_POLICY
indicates that the policy automates cross-account
* snapshot copies for snapshots that are shared with your account.
* @see PolicyTypeValues
*/
public String getPolicyType() {
return this.policyType;
}
/**
*
* The type of policy. EBS_SNAPSHOT_MANAGEMENT
indicates that the policy manages the lifecycle of
* Amazon EBS snapshots. IMAGE_MANAGEMENT
indicates that the policy manages the lifecycle of EBS-backed
* AMIs. EVENT_BASED_POLICY
indicates that the policy automates cross-account snapshot copies for
* snapshots that are shared with your account.
*
*
* @param policyType
* The type of policy. EBS_SNAPSHOT_MANAGEMENT
indicates that the policy manages the lifecycle
* of Amazon EBS snapshots. IMAGE_MANAGEMENT
indicates that the policy manages the lifecycle of
* EBS-backed AMIs. EVENT_BASED_POLICY
indicates that the policy automates cross-account
* snapshot copies for snapshots that are shared with your account.
* @return Returns a reference to this object so that method calls can be chained together.
* @see PolicyTypeValues
*/
public LifecyclePolicySummary withPolicyType(String policyType) {
setPolicyType(policyType);
return this;
}
/**
*
* The type of policy. EBS_SNAPSHOT_MANAGEMENT
indicates that the policy manages the lifecycle of
* Amazon EBS snapshots. IMAGE_MANAGEMENT
indicates that the policy manages the lifecycle of EBS-backed
* AMIs. EVENT_BASED_POLICY
indicates that the policy automates cross-account snapshot copies for
* snapshots that are shared with your account.
*
*
* @param policyType
* The type of policy. EBS_SNAPSHOT_MANAGEMENT
indicates that the policy manages the lifecycle
* of Amazon EBS snapshots. IMAGE_MANAGEMENT
indicates that the policy manages the lifecycle of
* EBS-backed AMIs. EVENT_BASED_POLICY
indicates that the policy automates cross-account
* snapshot copies for snapshots that are shared with your account.
* @return Returns a reference to this object so that method calls can be chained together.
* @see PolicyTypeValues
*/
public LifecyclePolicySummary withPolicyType(PolicyTypeValues policyType) {
this.policyType = policyType.toString();
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 LifecyclePolicySummary 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 (getTags() != null)
sb.append("Tags: ").append(getTags()).append(",");
if (getPolicyType() != null)
sb.append("PolicyType: ").append(getPolicyType()).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 LifecyclePolicySummary == false)
return false;
LifecyclePolicySummary other = (LifecyclePolicySummary) 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.getTags() == null ^ this.getTags() == null)
return false;
if (other.getTags() != null && other.getTags().equals(this.getTags()) == false)
return false;
if (other.getPolicyType() == null ^ this.getPolicyType() == null)
return false;
if (other.getPolicyType() != null && other.getPolicyType().equals(this.getPolicyType()) == 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 + ((getTags() == null) ? 0 : getTags().hashCode());
hashCode = prime * hashCode + ((getPolicyType() == null) ? 0 : getPolicyType().hashCode());
hashCode = prime * hashCode + ((getDefaultPolicy() == null) ? 0 : getDefaultPolicy().hashCode());
return hashCode;
}
@Override
public LifecyclePolicySummary clone() {
try {
return (LifecyclePolicySummary) 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.LifecyclePolicySummaryMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}