/* * Copyright 2018-2023 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; /** *
* An image recipe. *
* * @see AWS API * Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class ImageRecipe implements Serializable, Cloneable, StructuredPojo { /** ** The Amazon Resource Name (ARN) of the image recipe. *
*/ private String arn; /** ** Specifies which type of image is created by the recipe - an AMI or a container image. *
*/ private String type; /** ** The name of the image recipe. *
*/ private String name; /** ** The description of the image recipe. *
*/ private String description; /** ** The platform of the image recipe. *
*/ private String platform; /** ** The owner of the image recipe. *
*/ private String owner; /** ** The version of the image recipe. *
*/ private String version; /** ** The components that are included in the image recipe. Recipes require a minimum of one build component, and can * have a maximum of 20 build and test components in any combination. *
*/ private java.util.List* The base image of the image recipe. *
*/ private String parentImage; /** ** The block device mappings to apply when creating images from this recipe. *
*/ private java.util.List* The date on which this image recipe was created. *
*/ private String dateCreated; /** ** The tags of the image recipe. *
*/ private java.util.Map* The working directory to be used during build and test workflows. *
*/ private String workingDirectory; /** ** Before you create a new AMI, Image Builder launches temporary Amazon EC2 instances to build and test your image * configuration. Instance configuration adds a layer of control over those instances. You can define settings and * add scripts to run when an instance is launched from your AMI. *
*/ private AdditionalInstanceConfiguration additionalInstanceConfiguration; /** ** The Amazon Resource Name (ARN) of the image recipe. *
* * @param arn * The Amazon Resource Name (ARN) of the image recipe. */ public void setArn(String arn) { this.arn = arn; } /** ** The Amazon Resource Name (ARN) of the image recipe. *
* * @return The Amazon Resource Name (ARN) of the image recipe. */ public String getArn() { return this.arn; } /** ** The Amazon Resource Name (ARN) of the image recipe. *
* * @param arn * The Amazon Resource Name (ARN) of the image recipe. * @return Returns a reference to this object so that method calls can be chained together. */ public ImageRecipe withArn(String arn) { setArn(arn); return this; } /** ** Specifies which type of image is created by the recipe - an AMI or a container image. *
* * @param type * Specifies which type of image is created by the recipe - an AMI or a container image. * @see ImageType */ public void setType(String type) { this.type = type; } /** ** Specifies which type of image is created by the recipe - an AMI or a container image. *
* * @return Specifies which type of image is created by the recipe - an AMI or a container image. * @see ImageType */ public String getType() { return this.type; } /** ** Specifies which type of image is created by the recipe - an AMI or a container image. *
* * @param type * Specifies which type of image is created by the recipe - an AMI or a container image. * @return Returns a reference to this object so that method calls can be chained together. * @see ImageType */ public ImageRecipe withType(String type) { setType(type); return this; } /** ** Specifies which type of image is created by the recipe - an AMI or a container image. *
* * @param type * Specifies which type of image is created by the recipe - an AMI or a container image. * @return Returns a reference to this object so that method calls can be chained together. * @see ImageType */ public ImageRecipe withType(ImageType type) { this.type = type.toString(); return this; } /** ** The name of the image recipe. *
* * @param name * The name of the image recipe. */ public void setName(String name) { this.name = name; } /** ** The name of the image recipe. *
* * @return The name of the image recipe. */ public String getName() { return this.name; } /** ** The name of the image recipe. *
* * @param name * The name of the image recipe. * @return Returns a reference to this object so that method calls can be chained together. */ public ImageRecipe withName(String name) { setName(name); return this; } /** ** The description of the image recipe. *
* * @param description * The description of the image recipe. */ public void setDescription(String description) { this.description = description; } /** ** The description of the image recipe. *
* * @return The description of the image recipe. */ public String getDescription() { return this.description; } /** ** The description of the image recipe. *
* * @param description * The description of the image recipe. * @return Returns a reference to this object so that method calls can be chained together. */ public ImageRecipe withDescription(String description) { setDescription(description); return this; } /** ** The platform of the image recipe. *
* * @param platform * The platform of the image recipe. * @see Platform */ public void setPlatform(String platform) { this.platform = platform; } /** ** The platform of the image recipe. *
* * @return The platform of the image recipe. * @see Platform */ public String getPlatform() { return this.platform; } /** ** The platform of the image recipe. *
* * @param platform * The platform of the image recipe. * @return Returns a reference to this object so that method calls can be chained together. * @see Platform */ public ImageRecipe withPlatform(String platform) { setPlatform(platform); return this; } /** ** The platform of the image recipe. *
* * @param platform * The platform of the image recipe. * @return Returns a reference to this object so that method calls can be chained together. * @see Platform */ public ImageRecipe withPlatform(Platform platform) { this.platform = platform.toString(); return this; } /** ** The owner of the image recipe. *
* * @param owner * The owner of the image recipe. */ public void setOwner(String owner) { this.owner = owner; } /** ** The owner of the image recipe. *
* * @return The owner of the image recipe. */ public String getOwner() { return this.owner; } /** ** The owner of the image recipe. *
* * @param owner * The owner of the image recipe. * @return Returns a reference to this object so that method calls can be chained together. */ public ImageRecipe withOwner(String owner) { setOwner(owner); return this; } /** ** The version of the image recipe. *
* * @param version * The version of the image recipe. */ public void setVersion(String version) { this.version = version; } /** ** The version of the image recipe. *
* * @return The version of the image recipe. */ public String getVersion() { return this.version; } /** ** The version of the image recipe. *
* * @param version * The version of the image recipe. * @return Returns a reference to this object so that method calls can be chained together. */ public ImageRecipe withVersion(String version) { setVersion(version); return this; } /** ** The components that are included in the image recipe. Recipes require a minimum of one build component, and can * have a maximum of 20 build and test components in any combination. *
* * @return The components that are included in the image recipe. Recipes require a minimum of one build component, * and can have a maximum of 20 build and test components in any combination. */ public java.util.List* The components that are included in the image recipe. Recipes require a minimum of one build component, and can * have a maximum of 20 build and test components in any combination. *
* * @param components * The components that are included in the image recipe. Recipes require a minimum of one build component, * and can have a maximum of 20 build and test components in any combination. */ public void setComponents(java.util.Collection* The components that are included in the image recipe. Recipes require a minimum of one build component, and can * have a maximum of 20 build and test components in any combination. *
** NOTE: This method appends the values to the existing list (if any). Use * {@link #setComponents(java.util.Collection)} or {@link #withComponents(java.util.Collection)} if you want to * override the existing values. *
* * @param components * The components that are included in the image recipe. Recipes require a minimum of one build component, * and can have a maximum of 20 build and test components in any combination. * @return Returns a reference to this object so that method calls can be chained together. */ public ImageRecipe withComponents(ComponentConfiguration... components) { if (this.components == null) { setComponents(new java.util.ArrayList* The components that are included in the image recipe. Recipes require a minimum of one build component, and can * have a maximum of 20 build and test components in any combination. *
* * @param components * The components that are included in the image recipe. Recipes require a minimum of one build component, * and can have a maximum of 20 build and test components in any combination. * @return Returns a reference to this object so that method calls can be chained together. */ public ImageRecipe withComponents(java.util.Collection* The base image of the image recipe. *
* * @param parentImage * The base image of the image recipe. */ public void setParentImage(String parentImage) { this.parentImage = parentImage; } /** ** The base image of the image recipe. *
* * @return The base image of the image recipe. */ public String getParentImage() { return this.parentImage; } /** ** The base image of the image recipe. *
* * @param parentImage * The base image of the image recipe. * @return Returns a reference to this object so that method calls can be chained together. */ public ImageRecipe withParentImage(String parentImage) { setParentImage(parentImage); return this; } /** ** The block device mappings to apply when creating images from this recipe. *
* * @return The block device mappings to apply when creating images from this recipe. */ public java.util.List* The block device mappings to apply when creating images from this recipe. *
* * @param blockDeviceMappings * The block device mappings to apply when creating images from this recipe. */ public void setBlockDeviceMappings(java.util.Collection* The block device mappings to apply when creating images from this recipe. *
** NOTE: This method appends the values to the existing list (if any). Use * {@link #setBlockDeviceMappings(java.util.Collection)} or {@link #withBlockDeviceMappings(java.util.Collection)} * if you want to override the existing values. *
* * @param blockDeviceMappings * The block device mappings to apply when creating images from this recipe. * @return Returns a reference to this object so that method calls can be chained together. */ public ImageRecipe withBlockDeviceMappings(InstanceBlockDeviceMapping... blockDeviceMappings) { if (this.blockDeviceMappings == null) { setBlockDeviceMappings(new java.util.ArrayList* The block device mappings to apply when creating images from this recipe. *
* * @param blockDeviceMappings * The block device mappings to apply when creating images from this recipe. * @return Returns a reference to this object so that method calls can be chained together. */ public ImageRecipe withBlockDeviceMappings(java.util.Collection* The date on which this image recipe was created. *
* * @param dateCreated * The date on which this image recipe was created. */ public void setDateCreated(String dateCreated) { this.dateCreated = dateCreated; } /** ** The date on which this image recipe was created. *
* * @return The date on which this image recipe was created. */ public String getDateCreated() { return this.dateCreated; } /** ** The date on which this image recipe was created. *
* * @param dateCreated * The date on which this image recipe was created. * @return Returns a reference to this object so that method calls can be chained together. */ public ImageRecipe withDateCreated(String dateCreated) { setDateCreated(dateCreated); return this; } /** ** The tags of the image recipe. *
* * @return The tags of the image recipe. */ public java.util.Map* The tags of the image recipe. *
* * @param tags * The tags of the image recipe. */ public void setTags(java.util.Map* The tags of the image recipe. *
* * @param tags * The tags of the image recipe. * @return Returns a reference to this object so that method calls can be chained together. */ public ImageRecipe withTags(java.util.Map* The working directory to be used during build and test workflows. *
* * @param workingDirectory * The working directory to be used during build and test workflows. */ public void setWorkingDirectory(String workingDirectory) { this.workingDirectory = workingDirectory; } /** ** The working directory to be used during build and test workflows. *
* * @return The working directory to be used during build and test workflows. */ public String getWorkingDirectory() { return this.workingDirectory; } /** ** The working directory to be used during build and test workflows. *
* * @param workingDirectory * The working directory to be used during build and test workflows. * @return Returns a reference to this object so that method calls can be chained together. */ public ImageRecipe withWorkingDirectory(String workingDirectory) { setWorkingDirectory(workingDirectory); return this; } /** ** Before you create a new AMI, Image Builder launches temporary Amazon EC2 instances to build and test your image * configuration. Instance configuration adds a layer of control over those instances. You can define settings and * add scripts to run when an instance is launched from your AMI. *
* * @param additionalInstanceConfiguration * Before you create a new AMI, Image Builder launches temporary Amazon EC2 instances to build and test your * image configuration. Instance configuration adds a layer of control over those instances. You can define * settings and add scripts to run when an instance is launched from your AMI. */ public void setAdditionalInstanceConfiguration(AdditionalInstanceConfiguration additionalInstanceConfiguration) { this.additionalInstanceConfiguration = additionalInstanceConfiguration; } /** ** Before you create a new AMI, Image Builder launches temporary Amazon EC2 instances to build and test your image * configuration. Instance configuration adds a layer of control over those instances. You can define settings and * add scripts to run when an instance is launched from your AMI. *
* * @return Before you create a new AMI, Image Builder launches temporary Amazon EC2 instances to build and test your * image configuration. Instance configuration adds a layer of control over those instances. You can define * settings and add scripts to run when an instance is launched from your AMI. */ public AdditionalInstanceConfiguration getAdditionalInstanceConfiguration() { return this.additionalInstanceConfiguration; } /** ** Before you create a new AMI, Image Builder launches temporary Amazon EC2 instances to build and test your image * configuration. Instance configuration adds a layer of control over those instances. You can define settings and * add scripts to run when an instance is launched from your AMI. *
* * @param additionalInstanceConfiguration * Before you create a new AMI, Image Builder launches temporary Amazon EC2 instances to build and test your * image configuration. Instance configuration adds a layer of control over those instances. You can define * settings and add scripts to run when an instance is launched from your AMI. * @return Returns a reference to this object so that method calls can be chained together. */ public ImageRecipe withAdditionalInstanceConfiguration(AdditionalInstanceConfiguration additionalInstanceConfiguration) { setAdditionalInstanceConfiguration(additionalInstanceConfiguration); 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 (getType() != null) sb.append("Type: ").append(getType()).append(","); if (getName() != null) sb.append("Name: ").append(getName()).append(","); if (getDescription() != null) sb.append("Description: ").append(getDescription()).append(","); if (getPlatform() != null) sb.append("Platform: ").append(getPlatform()).append(","); if (getOwner() != null) sb.append("Owner: ").append(getOwner()).append(","); if (getVersion() != null) sb.append("Version: ").append(getVersion()).append(","); if (getComponents() != null) sb.append("Components: ").append(getComponents()).append(","); if (getParentImage() != null) sb.append("ParentImage: ").append(getParentImage()).append(","); if (getBlockDeviceMappings() != null) sb.append("BlockDeviceMappings: ").append(getBlockDeviceMappings()).append(","); if (getDateCreated() != null) sb.append("DateCreated: ").append(getDateCreated()).append(","); if (getTags() != null) sb.append("Tags: ").append(getTags()).append(","); if (getWorkingDirectory() != null) sb.append("WorkingDirectory: ").append(getWorkingDirectory()).append(","); if (getAdditionalInstanceConfiguration() != null) sb.append("AdditionalInstanceConfiguration: ").append(getAdditionalInstanceConfiguration()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ImageRecipe == false) return false; ImageRecipe other = (ImageRecipe) obj; if (other.getArn() == null ^ this.getArn() == null) return false; if (other.getArn() != null && other.getArn().equals(this.getArn()) == false) return false; if (other.getType() == null ^ this.getType() == null) return false; if (other.getType() != null && other.getType().equals(this.getType()) == 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.getPlatform() == null ^ this.getPlatform() == null) return false; if (other.getPlatform() != null && other.getPlatform().equals(this.getPlatform()) == false) return false; if (other.getOwner() == null ^ this.getOwner() == null) return false; if (other.getOwner() != null && other.getOwner().equals(this.getOwner()) == false) return false; if (other.getVersion() == null ^ this.getVersion() == null) return false; if (other.getVersion() != null && other.getVersion().equals(this.getVersion()) == false) return false; if (other.getComponents() == null ^ this.getComponents() == null) return false; if (other.getComponents() != null && other.getComponents().equals(this.getComponents()) == false) return false; if (other.getParentImage() == null ^ this.getParentImage() == null) return false; if (other.getParentImage() != null && other.getParentImage().equals(this.getParentImage()) == false) return false; if (other.getBlockDeviceMappings() == null ^ this.getBlockDeviceMappings() == null) return false; if (other.getBlockDeviceMappings() != null && other.getBlockDeviceMappings().equals(this.getBlockDeviceMappings()) == 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.getTags() == null ^ this.getTags() == null) return false; if (other.getTags() != null && other.getTags().equals(this.getTags()) == false) return false; if (other.getWorkingDirectory() == null ^ this.getWorkingDirectory() == null) return false; if (other.getWorkingDirectory() != null && other.getWorkingDirectory().equals(this.getWorkingDirectory()) == false) return false; if (other.getAdditionalInstanceConfiguration() == null ^ this.getAdditionalInstanceConfiguration() == null) return false; if (other.getAdditionalInstanceConfiguration() != null && other.getAdditionalInstanceConfiguration().equals(this.getAdditionalInstanceConfiguration()) == 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 + ((getType() == null) ? 0 : getType().hashCode()); hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode()); hashCode = prime * hashCode + ((getDescription() == null) ? 0 : getDescription().hashCode()); hashCode = prime * hashCode + ((getPlatform() == null) ? 0 : getPlatform().hashCode()); hashCode = prime * hashCode + ((getOwner() == null) ? 0 : getOwner().hashCode()); hashCode = prime * hashCode + ((getVersion() == null) ? 0 : getVersion().hashCode()); hashCode = prime * hashCode + ((getComponents() == null) ? 0 : getComponents().hashCode()); hashCode = prime * hashCode + ((getParentImage() == null) ? 0 : getParentImage().hashCode()); hashCode = prime * hashCode + ((getBlockDeviceMappings() == null) ? 0 : getBlockDeviceMappings().hashCode()); hashCode = prime * hashCode + ((getDateCreated() == null) ? 0 : getDateCreated().hashCode()); hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode()); hashCode = prime * hashCode + ((getWorkingDirectory() == null) ? 0 : getWorkingDirectory().hashCode()); hashCode = prime * hashCode + ((getAdditionalInstanceConfiguration() == null) ? 0 : getAdditionalInstanceConfiguration().hashCode()); return hashCode; } @Override public ImageRecipe clone() { try { return (ImageRecipe) 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.ImageRecipeMarshaller.getInstance().marshall(this, protocolMarshaller); } }