/* * 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; /** *
* Details of an Amazon EC2 AMI. *
* * @see AWS API * Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class Ami implements Serializable, Cloneable, StructuredPojo { /** ** The Amazon Web Services Region of the Amazon EC2 AMI. *
*/ private String region; /** ** The AMI ID of the Amazon EC2 AMI. *
*/ private String image; /** ** The name of the Amazon EC2 AMI. *
*/ private String name; /** ** The description of the Amazon EC2 AMI. Minimum and maximum length are in characters. *
*/ private String description; private ImageState state; /** ** The account ID of the owner of the AMI. *
*/ private String accountId; /** ** The Amazon Web Services Region of the Amazon EC2 AMI. *
* * @param region * The Amazon Web Services Region of the Amazon EC2 AMI. */ public void setRegion(String region) { this.region = region; } /** ** The Amazon Web Services Region of the Amazon EC2 AMI. *
* * @return The Amazon Web Services Region of the Amazon EC2 AMI. */ public String getRegion() { return this.region; } /** ** The Amazon Web Services Region of the Amazon EC2 AMI. *
* * @param region * The Amazon Web Services Region of the Amazon EC2 AMI. * @return Returns a reference to this object so that method calls can be chained together. */ public Ami withRegion(String region) { setRegion(region); return this; } /** ** The AMI ID of the Amazon EC2 AMI. *
* * @param image * The AMI ID of the Amazon EC2 AMI. */ public void setImage(String image) { this.image = image; } /** ** The AMI ID of the Amazon EC2 AMI. *
* * @return The AMI ID of the Amazon EC2 AMI. */ public String getImage() { return this.image; } /** ** The AMI ID of the Amazon EC2 AMI. *
* * @param image * The AMI ID of the Amazon EC2 AMI. * @return Returns a reference to this object so that method calls can be chained together. */ public Ami withImage(String image) { setImage(image); return this; } /** ** The name of the Amazon EC2 AMI. *
* * @param name * The name of the Amazon EC2 AMI. */ public void setName(String name) { this.name = name; } /** ** The name of the Amazon EC2 AMI. *
* * @return The name of the Amazon EC2 AMI. */ public String getName() { return this.name; } /** ** The name of the Amazon EC2 AMI. *
* * @param name * The name of the Amazon EC2 AMI. * @return Returns a reference to this object so that method calls can be chained together. */ public Ami withName(String name) { setName(name); return this; } /** ** The description of the Amazon EC2 AMI. Minimum and maximum length are in characters. *
* * @param description * The description of the Amazon EC2 AMI. Minimum and maximum length are in characters. */ public void setDescription(String description) { this.description = description; } /** ** The description of the Amazon EC2 AMI. Minimum and maximum length are in characters. *
* * @return The description of the Amazon EC2 AMI. Minimum and maximum length are in characters. */ public String getDescription() { return this.description; } /** ** The description of the Amazon EC2 AMI. Minimum and maximum length are in characters. *
* * @param description * The description of the Amazon EC2 AMI. Minimum and maximum length are in characters. * @return Returns a reference to this object so that method calls can be chained together. */ public Ami withDescription(String description) { setDescription(description); return this; } /** * @param state */ public void setState(ImageState state) { this.state = state; } /** * @return */ public ImageState getState() { return this.state; } /** * @param state * @return Returns a reference to this object so that method calls can be chained together. */ public Ami withState(ImageState state) { setState(state); return this; } /** ** The account ID of the owner of the AMI. *
* * @param accountId * The account ID of the owner of the AMI. */ public void setAccountId(String accountId) { this.accountId = accountId; } /** ** The account ID of the owner of the AMI. *
* * @return The account ID of the owner of the AMI. */ public String getAccountId() { return this.accountId; } /** ** The account ID of the owner of the AMI. *
* * @param accountId * The account ID of the owner of the AMI. * @return Returns a reference to this object so that method calls can be chained together. */ public Ami withAccountId(String accountId) { setAccountId(accountId); 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 (getRegion() != null) sb.append("Region: ").append(getRegion()).append(","); if (getImage() != null) sb.append("Image: ").append(getImage()).append(","); if (getName() != null) sb.append("Name: ").append(getName()).append(","); if (getDescription() != null) sb.append("Description: ").append(getDescription()).append(","); if (getState() != null) sb.append("State: ").append(getState()).append(","); if (getAccountId() != null) sb.append("AccountId: ").append(getAccountId()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof Ami == false) return false; Ami other = (Ami) obj; if (other.getRegion() == null ^ this.getRegion() == null) return false; if (other.getRegion() != null && other.getRegion().equals(this.getRegion()) == false) return false; if (other.getImage() == null ^ this.getImage() == null) return false; if (other.getImage() != null && other.getImage().equals(this.getImage()) == 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.getState() == null ^ this.getState() == null) return false; if (other.getState() != null && other.getState().equals(this.getState()) == false) return false; if (other.getAccountId() == null ^ this.getAccountId() == null) return false; if (other.getAccountId() != null && other.getAccountId().equals(this.getAccountId()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getRegion() == null) ? 0 : getRegion().hashCode()); hashCode = prime * hashCode + ((getImage() == null) ? 0 : getImage().hashCode()); hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode()); hashCode = prime * hashCode + ((getDescription() == null) ? 0 : getDescription().hashCode()); hashCode = prime * hashCode + ((getState() == null) ? 0 : getState().hashCode()); hashCode = prime * hashCode + ((getAccountId() == null) ? 0 : getAccountId().hashCode()); return hashCode; } @Override public Ami clone() { try { return (Ami) 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.AmiMarshaller.getInstance().marshall(this, protocolMarshaller); } }