
com.amazonaws.services.imagebuilder.model.CreateLifecyclePolicyRequest 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.AmazonWebServiceRequest;
/**
*
* @see AWS
* API Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class CreateLifecyclePolicyRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable {
/**
*
* The name of the lifecycle policy to create.
*
*/
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) for the IAM role you create that grants Image Builder access to run
* lifecycle actions.
*
*/
private String executionRole;
/**
*
* The type of Image Builder resource that the lifecycle policy applies to.
*
*/
private String resourceType;
/**
*
* Configuration details for the lifecycle policy rules.
*
*/
private java.util.List policyDetails;
/**
*
* Selection criteria for the resources that the lifecycle policy applies to.
*
*/
private LifecyclePolicyResourceSelection resourceSelection;
/**
*
* Tags to apply to the lifecycle policy resource.
*
*/
private java.util.Map tags;
/**
*
* Unique, case-sensitive identifier you provide to ensure idempotency of the request. For more information, see Ensuring
* idempotency in the Amazon EC2 API Reference.
*
*/
private String clientToken;
/**
*
* The name of the lifecycle policy to create.
*
*
* @param name
* The name of the lifecycle policy to create.
*/
public void setName(String name) {
this.name = name;
}
/**
*
* The name of the lifecycle policy to create.
*
*
* @return The name of the lifecycle policy to create.
*/
public String getName() {
return this.name;
}
/**
*
* The name of the lifecycle policy to create.
*
*
* @param name
* The name of the lifecycle policy to create.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateLifecyclePolicyRequest 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 CreateLifecyclePolicyRequest 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 CreateLifecyclePolicyRequest 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 CreateLifecyclePolicyRequest withStatus(LifecyclePolicyStatus status) {
this.status = status.toString();
return this;
}
/**
*
* The name or Amazon Resource Name (ARN) for the IAM role you create that grants Image Builder access to run
* lifecycle actions.
*
*
* @param executionRole
* The name or Amazon Resource Name (ARN) for the IAM role you create that grants Image Builder access to run
* lifecycle actions.
*/
public void setExecutionRole(String executionRole) {
this.executionRole = executionRole;
}
/**
*
* The name or Amazon Resource Name (ARN) for the IAM role you create that grants Image Builder access to run
* lifecycle actions.
*
*
* @return The name or Amazon Resource Name (ARN) for the IAM role you create that grants Image Builder access to
* run lifecycle actions.
*/
public String getExecutionRole() {
return this.executionRole;
}
/**
*
* The name or Amazon Resource Name (ARN) for the IAM role you create that grants Image Builder access to run
* lifecycle actions.
*
*
* @param executionRole
* The name or Amazon Resource Name (ARN) for the IAM role you create that grants Image Builder access to run
* lifecycle actions.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateLifecyclePolicyRequest withExecutionRole(String executionRole) {
setExecutionRole(executionRole);
return this;
}
/**
*
* The type of Image Builder resource that the lifecycle policy applies to.
*
*
* @param resourceType
* The type of Image Builder resource that the lifecycle policy applies to.
* @see LifecyclePolicyResourceType
*/
public void setResourceType(String resourceType) {
this.resourceType = resourceType;
}
/**
*
* The type of Image Builder resource that the lifecycle policy applies to.
*
*
* @return The type of Image Builder resource that the lifecycle policy applies to.
* @see LifecyclePolicyResourceType
*/
public String getResourceType() {
return this.resourceType;
}
/**
*
* The type of Image Builder resource that the lifecycle policy applies to.
*
*
* @param resourceType
* The type of Image Builder resource that the lifecycle policy applies to.
* @return Returns a reference to this object so that method calls can be chained together.
* @see LifecyclePolicyResourceType
*/
public CreateLifecyclePolicyRequest withResourceType(String resourceType) {
setResourceType(resourceType);
return this;
}
/**
*
* The type of Image Builder resource that the lifecycle policy applies to.
*
*
* @param resourceType
* The type of Image Builder resource that the lifecycle policy applies to.
* @return Returns a reference to this object so that method calls can be chained together.
* @see LifecyclePolicyResourceType
*/
public CreateLifecyclePolicyRequest withResourceType(LifecyclePolicyResourceType resourceType) {
this.resourceType = resourceType.toString();
return this;
}
/**
*
* Configuration details for the lifecycle policy rules.
*
*
* @return Configuration details for the lifecycle policy rules.
*/
public java.util.List getPolicyDetails() {
return policyDetails;
}
/**
*
* Configuration details for the lifecycle policy rules.
*
*
* @param policyDetails
* Configuration details for the lifecycle policy rules.
*/
public void setPolicyDetails(java.util.Collection policyDetails) {
if (policyDetails == null) {
this.policyDetails = null;
return;
}
this.policyDetails = new java.util.ArrayList(policyDetails);
}
/**
*
* Configuration details for the lifecycle policy rules.
*
*
* 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
* Configuration details for the lifecycle policy rules.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateLifecyclePolicyRequest withPolicyDetails(LifecyclePolicyDetail... policyDetails) {
if (this.policyDetails == null) {
setPolicyDetails(new java.util.ArrayList(policyDetails.length));
}
for (LifecyclePolicyDetail ele : policyDetails) {
this.policyDetails.add(ele);
}
return this;
}
/**
*
* Configuration details for the lifecycle policy rules.
*
*
* @param policyDetails
* Configuration details for the lifecycle policy rules.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateLifecyclePolicyRequest withPolicyDetails(java.util.Collection policyDetails) {
setPolicyDetails(policyDetails);
return this;
}
/**
*
* Selection criteria for the resources that the lifecycle policy applies to.
*
*
* @param resourceSelection
* Selection criteria for the resources that the lifecycle policy applies to.
*/
public void setResourceSelection(LifecyclePolicyResourceSelection resourceSelection) {
this.resourceSelection = resourceSelection;
}
/**
*
* Selection criteria for the resources that the lifecycle policy applies to.
*
*
* @return Selection criteria for the resources that the lifecycle policy applies to.
*/
public LifecyclePolicyResourceSelection getResourceSelection() {
return this.resourceSelection;
}
/**
*
* Selection criteria for the resources that the lifecycle policy applies to.
*
*
* @param resourceSelection
* Selection criteria for the resources that the lifecycle policy applies to.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateLifecyclePolicyRequest withResourceSelection(LifecyclePolicyResourceSelection resourceSelection) {
setResourceSelection(resourceSelection);
return this;
}
/**
*
* Tags to apply to the lifecycle policy resource.
*
*
* @return Tags to apply to the lifecycle policy resource.
*/
public java.util.Map getTags() {
return tags;
}
/**
*
* Tags to apply to the lifecycle policy resource.
*
*
* @param tags
* Tags to apply to the lifecycle policy resource.
*/
public void setTags(java.util.Map tags) {
this.tags = tags;
}
/**
*
* Tags to apply to the lifecycle policy resource.
*
*
* @param tags
* Tags to apply to the lifecycle policy resource.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateLifecyclePolicyRequest withTags(java.util.Map tags) {
setTags(tags);
return this;
}
/**
* Add a single Tags entry
*
* @see CreateLifecyclePolicyRequest#withTags
* @returns a reference to this object so that method calls can be chained together.
*/
public CreateLifecyclePolicyRequest 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 CreateLifecyclePolicyRequest clearTagsEntries() {
this.tags = null;
return this;
}
/**
*
* Unique, case-sensitive identifier you provide to ensure idempotency of the request. For more information, see Ensuring
* idempotency in the Amazon EC2 API Reference.
*
*
* @param clientToken
* Unique, case-sensitive identifier you provide to ensure idempotency of the request. For more information,
* see Ensuring
* idempotency in the Amazon EC2 API Reference.
*/
public void setClientToken(String clientToken) {
this.clientToken = clientToken;
}
/**
*
* Unique, case-sensitive identifier you provide to ensure idempotency of the request. For more information, see Ensuring
* idempotency in the Amazon EC2 API Reference.
*
*
* @return Unique, case-sensitive identifier you provide to ensure idempotency of the request. For more information,
* see Ensuring
* idempotency in the Amazon EC2 API Reference.
*/
public String getClientToken() {
return this.clientToken;
}
/**
*
* Unique, case-sensitive identifier you provide to ensure idempotency of the request. For more information, see Ensuring
* idempotency in the Amazon EC2 API Reference.
*
*
* @param clientToken
* Unique, case-sensitive identifier you provide to ensure idempotency of the request. For more information,
* see Ensuring
* idempotency in the Amazon EC2 API Reference.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateLifecyclePolicyRequest withClientToken(String clientToken) {
setClientToken(clientToken);
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 (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 (getTags() != null)
sb.append("Tags: ").append(getTags()).append(",");
if (getClientToken() != null)
sb.append("ClientToken: ").append(getClientToken());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof CreateLifecyclePolicyRequest == false)
return false;
CreateLifecyclePolicyRequest other = (CreateLifecyclePolicyRequest) obj;
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.getTags() == null ^ this.getTags() == null)
return false;
if (other.getTags() != null && other.getTags().equals(this.getTags()) == false)
return false;
if (other.getClientToken() == null ^ this.getClientToken() == null)
return false;
if (other.getClientToken() != null && other.getClientToken().equals(this.getClientToken()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
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 + ((getTags() == null) ? 0 : getTags().hashCode());
hashCode = prime * hashCode + ((getClientToken() == null) ? 0 : getClientToken().hashCode());
return hashCode;
}
@Override
public CreateLifecyclePolicyRequest clone() {
return (CreateLifecyclePolicyRequest) super.clone();
}
}