
com.amazonaws.services.imagebuilder.model.LifecyclePolicy Maven / Gradle / Ivy
/*
* 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.imagebuilder.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* The configuration details for a lifecycle policy resource.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class LifecyclePolicy implements Serializable, Cloneable, StructuredPojo {
/**
*
* The Amazon Resource Name (ARN) of the lifecycle policy resource.
*
*/
private String arn;
/**
*
* The name of the lifecycle policy.
*
*/
private String name;
/**
*
* Optional description for the lifecycle policy.
*
*/
private String description;
/**
*
* Indicates whether the lifecycle policy resource is enabled.
*
*/
private String status;
/**
*
* The name or Amazon Resource Name (ARN) of the IAM role that Image Builder uses to run the lifecycle policy. This
* is a custom role that you create.
*
*/
private String executionRole;
/**
*
* The type of resources the lifecycle policy targets.
*
*/
private String resourceType;
/**
*
* The configuration details for a lifecycle policy resource.
*
*/
private java.util.List policyDetails;
/**
*
* Resource selection criteria used to run the lifecycle policy.
*
*/
private LifecyclePolicyResourceSelection resourceSelection;
/**
*
* The timestamp when Image Builder created the lifecycle policy resource.
*
*/
private java.util.Date dateCreated;
/**
*
* The timestamp when Image Builder updated the lifecycle policy resource.
*
*/
private java.util.Date dateUpdated;
/**
*
* The timestamp for the last time Image Builder ran the lifecycle policy.
*
*/
private java.util.Date dateLastRun;
/**
*
* To help manage your lifecycle policy resources, you can assign your own metadata to each resource in the form of
* tags. Each tag consists of a key and an optional value, both of which you define.
*
*/
private java.util.Map tags;
/**
*
* The Amazon Resource Name (ARN) of the lifecycle policy resource.
*
*
* @param arn
* The Amazon Resource Name (ARN) of the lifecycle policy resource.
*/
public void setArn(String arn) {
this.arn = arn;
}
/**
*
* The Amazon Resource Name (ARN) of the lifecycle policy resource.
*
*
* @return The Amazon Resource Name (ARN) of the lifecycle policy resource.
*/
public String getArn() {
return this.arn;
}
/**
*
* The Amazon Resource Name (ARN) of the lifecycle policy resource.
*
*
* @param arn
* The Amazon Resource Name (ARN) of the lifecycle policy resource.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public LifecyclePolicy withArn(String arn) {
setArn(arn);
return this;
}
/**
*
* The name of the lifecycle policy.
*
*
* @param name
* The name of the lifecycle policy.
*/
public void setName(String name) {
this.name = name;
}
/**
*
* The name of the lifecycle policy.
*
*
* @return The name of the lifecycle policy.
*/
public String getName() {
return this.name;
}
/**
*
* The name of the lifecycle policy.
*
*
* @param name
* The name of the lifecycle policy.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public LifecyclePolicy withName(String name) {
setName(name);
return this;
}
/**
*
* Optional description for the lifecycle policy.
*
*
* @param description
* Optional description for the lifecycle policy.
*/
public void setDescription(String description) {
this.description = description;
}
/**
*
* Optional description for the lifecycle policy.
*
*
* @return Optional description for the lifecycle policy.
*/
public String getDescription() {
return this.description;
}
/**
*
* Optional description for the lifecycle policy.
*
*
* @param description
* Optional description for 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;
}
/**
*
* Indicates whether the lifecycle policy resource is enabled.
*
*
* @param status
* Indicates whether the lifecycle policy resource is enabled.
* @see LifecyclePolicyStatus
*/
public void setStatus(String status) {
this.status = status;
}
/**
*
* Indicates whether the lifecycle policy resource is enabled.
*
*
* @return Indicates whether the lifecycle policy resource is enabled.
* @see LifecyclePolicyStatus
*/
public String getStatus() {
return this.status;
}
/**
*
* Indicates whether the lifecycle policy resource is enabled.
*
*
* @param status
* Indicates whether the lifecycle policy resource is enabled.
* @return Returns a reference to this object so that method calls can be chained together.
* @see LifecyclePolicyStatus
*/
public LifecyclePolicy withStatus(String status) {
setStatus(status);
return this;
}
/**
*
* Indicates whether the lifecycle policy resource is enabled.
*
*
* @param status
* Indicates whether the lifecycle policy resource is enabled.
* @return Returns a reference to this object so that method calls can be chained together.
* @see LifecyclePolicyStatus
*/
public LifecyclePolicy withStatus(LifecyclePolicyStatus status) {
this.status = status.toString();
return this;
}
/**
*
* The name or Amazon Resource Name (ARN) of the IAM role that Image Builder uses to run the lifecycle policy. This
* is a custom role that you create.
*
*
* @param executionRole
* The name or Amazon Resource Name (ARN) of the IAM role that Image Builder uses to run the lifecycle
* policy. This is a custom role that you create.
*/
public void setExecutionRole(String executionRole) {
this.executionRole = executionRole;
}
/**
*
* The name or Amazon Resource Name (ARN) of the IAM role that Image Builder uses to run the lifecycle policy. This
* is a custom role that you create.
*
*
* @return The name or Amazon Resource Name (ARN) of the IAM role that Image Builder uses to run the lifecycle
* policy. This is a custom role that you create.
*/
public String getExecutionRole() {
return this.executionRole;
}
/**
*
* The name or Amazon Resource Name (ARN) of the IAM role that Image Builder uses to run the lifecycle policy. This
* is a custom role that you create.
*
*
* @param executionRole
* The name or Amazon Resource Name (ARN) of the IAM role that Image Builder uses to run the lifecycle
* policy. This is a custom role that you create.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public LifecyclePolicy withExecutionRole(String executionRole) {
setExecutionRole(executionRole);
return this;
}
/**
*
* The type of resources the lifecycle policy targets.
*
*
* @param resourceType
* The type of resources the lifecycle policy targets.
* @see LifecyclePolicyResourceType
*/
public void setResourceType(String resourceType) {
this.resourceType = resourceType;
}
/**
*
* The type of resources the lifecycle policy targets.
*
*
* @return The type of resources the lifecycle policy targets.
* @see LifecyclePolicyResourceType
*/
public String getResourceType() {
return this.resourceType;
}
/**
*
* The type of resources the lifecycle policy targets.
*
*
* @param resourceType
* The type of resources the lifecycle policy targets.
* @return Returns a reference to this object so that method calls can be chained together.
* @see LifecyclePolicyResourceType
*/
public LifecyclePolicy withResourceType(String resourceType) {
setResourceType(resourceType);
return this;
}
/**
*
* The type of resources the lifecycle policy targets.
*
*
* @param resourceType
* The type of resources the lifecycle policy targets.
* @return Returns a reference to this object so that method calls can be chained together.
* @see LifecyclePolicyResourceType
*/
public LifecyclePolicy withResourceType(LifecyclePolicyResourceType resourceType) {
this.resourceType = resourceType.toString();
return this;
}
/**
*
* The configuration details for a lifecycle policy resource.
*
*
* @return The configuration details for a lifecycle policy resource.
*/
public java.util.List getPolicyDetails() {
return policyDetails;
}
/**
*
* The configuration details for a lifecycle policy resource.
*
*
* @param policyDetails
* The configuration details for a lifecycle policy resource.
*/
public void setPolicyDetails(java.util.Collection policyDetails) {
if (policyDetails == null) {
this.policyDetails = null;
return;
}
this.policyDetails = new java.util.ArrayList(policyDetails);
}
/**
*
* The configuration details for a lifecycle policy resource.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setPolicyDetails(java.util.Collection)} or {@link #withPolicyDetails(java.util.Collection)} if you want
* to override the existing values.
*
*
* @param policyDetails
* The configuration details for a lifecycle policy resource.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public LifecyclePolicy withPolicyDetails(LifecyclePolicyDetail... policyDetails) {
if (this.policyDetails == null) {
setPolicyDetails(new java.util.ArrayList(policyDetails.length));
}
for (LifecyclePolicyDetail ele : policyDetails) {
this.policyDetails.add(ele);
}
return this;
}
/**
*
* The configuration details for a lifecycle policy resource.
*
*
* @param policyDetails
* The configuration details for a lifecycle policy resource.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public LifecyclePolicy withPolicyDetails(java.util.Collection policyDetails) {
setPolicyDetails(policyDetails);
return this;
}
/**
*
* Resource selection criteria used to run the lifecycle policy.
*
*
* @param resourceSelection
* Resource selection criteria used to run the lifecycle policy.
*/
public void setResourceSelection(LifecyclePolicyResourceSelection resourceSelection) {
this.resourceSelection = resourceSelection;
}
/**
*
* Resource selection criteria used to run the lifecycle policy.
*
*
* @return Resource selection criteria used to run the lifecycle policy.
*/
public LifecyclePolicyResourceSelection getResourceSelection() {
return this.resourceSelection;
}
/**
*
* Resource selection criteria used to run the lifecycle policy.
*
*
* @param resourceSelection
* Resource selection criteria used to run the lifecycle policy.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public LifecyclePolicy withResourceSelection(LifecyclePolicyResourceSelection resourceSelection) {
setResourceSelection(resourceSelection);
return this;
}
/**
*
* The timestamp when Image Builder created the lifecycle policy resource.
*
*
* @param dateCreated
* The timestamp when Image Builder created the lifecycle policy resource.
*/
public void setDateCreated(java.util.Date dateCreated) {
this.dateCreated = dateCreated;
}
/**
*
* The timestamp when Image Builder created the lifecycle policy resource.
*
*
* @return The timestamp when Image Builder created the lifecycle policy resource.
*/
public java.util.Date getDateCreated() {
return this.dateCreated;
}
/**
*
* The timestamp when Image Builder created the lifecycle policy resource.
*
*
* @param dateCreated
* The timestamp when Image Builder created the lifecycle policy resource.
* @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 timestamp when Image Builder updated the lifecycle policy resource.
*
*
* @param dateUpdated
* The timestamp when Image Builder updated the lifecycle policy resource.
*/
public void setDateUpdated(java.util.Date dateUpdated) {
this.dateUpdated = dateUpdated;
}
/**
*
* The timestamp when Image Builder updated the lifecycle policy resource.
*
*
* @return The timestamp when Image Builder updated the lifecycle policy resource.
*/
public java.util.Date getDateUpdated() {
return this.dateUpdated;
}
/**
*
* The timestamp when Image Builder updated the lifecycle policy resource.
*
*
* @param dateUpdated
* The timestamp when Image Builder updated the lifecycle policy resource.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public LifecyclePolicy withDateUpdated(java.util.Date dateUpdated) {
setDateUpdated(dateUpdated);
return this;
}
/**
*
* The timestamp for the last time Image Builder ran the lifecycle policy.
*
*
* @param dateLastRun
* The timestamp for the last time Image Builder ran the lifecycle policy.
*/
public void setDateLastRun(java.util.Date dateLastRun) {
this.dateLastRun = dateLastRun;
}
/**
*
* The timestamp for the last time Image Builder ran the lifecycle policy.
*
*
* @return The timestamp for the last time Image Builder ran the lifecycle policy.
*/
public java.util.Date getDateLastRun() {
return this.dateLastRun;
}
/**
*
* The timestamp for the last time Image Builder ran the lifecycle policy.
*
*
* @param dateLastRun
* The timestamp for the last time Image Builder ran the lifecycle policy.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public LifecyclePolicy withDateLastRun(java.util.Date dateLastRun) {
setDateLastRun(dateLastRun);
return this;
}
/**
*
* To help manage your lifecycle policy resources, you can assign your own metadata to each resource in the form of
* tags. Each tag consists of a key and an optional value, both of which you define.
*
*
* @return To help manage your lifecycle policy resources, you can assign your own metadata to each resource in the
* form of tags. Each tag consists of a key and an optional value, both of which you define.
*/
public java.util.Map getTags() {
return tags;
}
/**
*
* To help manage your lifecycle policy resources, you can assign your own metadata to each resource in the form of
* tags. Each tag consists of a key and an optional value, both of which you define.
*
*
* @param tags
* To help manage your lifecycle policy resources, you can assign your own metadata to each resource in the
* form of tags. Each tag consists of a key and an optional value, both of which you define.
*/
public void setTags(java.util.Map tags) {
this.tags = tags;
}
/**
*
* To help manage your lifecycle policy resources, you can assign your own metadata to each resource in the form of
* tags. Each tag consists of a key and an optional value, both of which you define.
*
*
* @param tags
* To help manage your lifecycle policy resources, you can assign your own metadata to each resource in the
* form of tags. Each tag consists of a key and an optional value, both of which you define.
* @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;
}
/**
* 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 (getArn() != null)
sb.append("Arn: ").append(getArn()).append(",");
if (getName() != null)
sb.append("Name: ").append(getName()).append(",");
if (getDescription() != null)
sb.append("Description: ").append(getDescription()).append(",");
if (getStatus() != null)
sb.append("Status: ").append(getStatus()).append(",");
if (getExecutionRole() != null)
sb.append("ExecutionRole: ").append(getExecutionRole()).append(",");
if (getResourceType() != null)
sb.append("ResourceType: ").append(getResourceType()).append(",");
if (getPolicyDetails() != null)
sb.append("PolicyDetails: ").append(getPolicyDetails()).append(",");
if (getResourceSelection() != null)
sb.append("ResourceSelection: ").append(getResourceSelection()).append(",");
if (getDateCreated() != null)
sb.append("DateCreated: ").append(getDateCreated()).append(",");
if (getDateUpdated() != null)
sb.append("DateUpdated: ").append(getDateUpdated()).append(",");
if (getDateLastRun() != null)
sb.append("DateLastRun: ").append(getDateLastRun()).append(",");
if (getTags() != null)
sb.append("Tags: ").append(getTags());
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.getArn() == null ^ this.getArn() == null)
return false;
if (other.getArn() != null && other.getArn().equals(this.getArn()) == false)
return false;
if (other.getName() == null ^ this.getName() == null)
return false;
if (other.getName() != null && other.getName().equals(this.getName()) == 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.getStatus() == null ^ this.getStatus() == null)
return false;
if (other.getStatus() != null && other.getStatus().equals(this.getStatus()) == false)
return false;
if (other.getExecutionRole() == null ^ this.getExecutionRole() == null)
return false;
if (other.getExecutionRole() != null && other.getExecutionRole().equals(this.getExecutionRole()) == false)
return false;
if (other.getResourceType() == null ^ this.getResourceType() == null)
return false;
if (other.getResourceType() != null && other.getResourceType().equals(this.getResourceType()) == 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.getResourceSelection() == null ^ this.getResourceSelection() == null)
return false;
if (other.getResourceSelection() != null && other.getResourceSelection().equals(this.getResourceSelection()) == 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.getDateUpdated() == null ^ this.getDateUpdated() == null)
return false;
if (other.getDateUpdated() != null && other.getDateUpdated().equals(this.getDateUpdated()) == false)
return false;
if (other.getDateLastRun() == null ^ this.getDateLastRun() == null)
return false;
if (other.getDateLastRun() != null && other.getDateLastRun().equals(this.getDateLastRun()) == false)
return false;
if (other.getTags() == null ^ this.getTags() == null)
return false;
if (other.getTags() != null && other.getTags().equals(this.getTags()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getArn() == null) ? 0 : getArn().hashCode());
hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode());
hashCode = prime * hashCode + ((getDescription() == null) ? 0 : getDescription().hashCode());
hashCode = prime * hashCode + ((getStatus() == null) ? 0 : getStatus().hashCode());
hashCode = prime * hashCode + ((getExecutionRole() == null) ? 0 : getExecutionRole().hashCode());
hashCode = prime * hashCode + ((getResourceType() == null) ? 0 : getResourceType().hashCode());
hashCode = prime * hashCode + ((getPolicyDetails() == null) ? 0 : getPolicyDetails().hashCode());
hashCode = prime * hashCode + ((getResourceSelection() == null) ? 0 : getResourceSelection().hashCode());
hashCode = prime * hashCode + ((getDateCreated() == null) ? 0 : getDateCreated().hashCode());
hashCode = prime * hashCode + ((getDateUpdated() == null) ? 0 : getDateUpdated().hashCode());
hashCode = prime * hashCode + ((getDateLastRun() == null) ? 0 : getDateLastRun().hashCode());
hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().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.imagebuilder.model.transform.LifecyclePolicyMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}