/* * Copyright 2012-2017 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.ec2.model; import java.io.Serializable; import javax.annotation.Generated; /** * <p> * Describes an association between an IAM instance profile and an instance. * </p> * * @see <a href="http://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/IamInstanceProfileAssociation" target="_top">AWS * API Documentation</a> */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class IamInstanceProfileAssociation implements Serializable, Cloneable { /** * <p> * The ID of the association. * </p> */ private String associationId; /** * <p> * The ID of the instance. * </p> */ private String instanceId; /** * <p> * The IAM instance profile. * </p> */ private IamInstanceProfile iamInstanceProfile; /** * <p> * The state of the association. * </p> */ private String state; /** * <p> * The time the IAM instance profile was associated with the instance. * </p> */ private java.util.Date timestamp; /** * <p> * The ID of the association. * </p> * * @param associationId * The ID of the association. */ public void setAssociationId(String associationId) { this.associationId = associationId; } /** * <p> * The ID of the association. * </p> * * @return The ID of the association. */ public String getAssociationId() { return this.associationId; } /** * <p> * The ID of the association. * </p> * * @param associationId * The ID of the association. * @return Returns a reference to this object so that method calls can be chained together. */ public IamInstanceProfileAssociation withAssociationId(String associationId) { setAssociationId(associationId); return this; } /** * <p> * The ID of the instance. * </p> * * @param instanceId * The ID of the instance. */ public void setInstanceId(String instanceId) { this.instanceId = instanceId; } /** * <p> * The ID of the instance. * </p> * * @return The ID of the instance. */ public String getInstanceId() { return this.instanceId; } /** * <p> * The ID of the instance. * </p> * * @param instanceId * The ID of the instance. * @return Returns a reference to this object so that method calls can be chained together. */ public IamInstanceProfileAssociation withInstanceId(String instanceId) { setInstanceId(instanceId); return this; } /** * <p> * The IAM instance profile. * </p> * * @param iamInstanceProfile * The IAM instance profile. */ public void setIamInstanceProfile(IamInstanceProfile iamInstanceProfile) { this.iamInstanceProfile = iamInstanceProfile; } /** * <p> * The IAM instance profile. * </p> * * @return The IAM instance profile. */ public IamInstanceProfile getIamInstanceProfile() { return this.iamInstanceProfile; } /** * <p> * The IAM instance profile. * </p> * * @param iamInstanceProfile * The IAM instance profile. * @return Returns a reference to this object so that method calls can be chained together. */ public IamInstanceProfileAssociation withIamInstanceProfile(IamInstanceProfile iamInstanceProfile) { setIamInstanceProfile(iamInstanceProfile); return this; } /** * <p> * The state of the association. * </p> * * @param state * The state of the association. * @see IamInstanceProfileAssociationState */ public void setState(String state) { this.state = state; } /** * <p> * The state of the association. * </p> * * @return The state of the association. * @see IamInstanceProfileAssociationState */ public String getState() { return this.state; } /** * <p> * The state of the association. * </p> * * @param state * The state of the association. * @return Returns a reference to this object so that method calls can be chained together. * @see IamInstanceProfileAssociationState */ public IamInstanceProfileAssociation withState(String state) { setState(state); return this; } /** * <p> * The state of the association. * </p> * * @param state * The state of the association. * @see IamInstanceProfileAssociationState */ public void setState(IamInstanceProfileAssociationState state) { this.state = state.toString(); } /** * <p> * The state of the association. * </p> * * @param state * The state of the association. * @return Returns a reference to this object so that method calls can be chained together. * @see IamInstanceProfileAssociationState */ public IamInstanceProfileAssociation withState(IamInstanceProfileAssociationState state) { setState(state); return this; } /** * <p> * The time the IAM instance profile was associated with the instance. * </p> * * @param timestamp * The time the IAM instance profile was associated with the instance. */ public void setTimestamp(java.util.Date timestamp) { this.timestamp = timestamp; } /** * <p> * The time the IAM instance profile was associated with the instance. * </p> * * @return The time the IAM instance profile was associated with the instance. */ public java.util.Date getTimestamp() { return this.timestamp; } /** * <p> * The time the IAM instance profile was associated with the instance. * </p> * * @param timestamp * The time the IAM instance profile was associated with the instance. * @return Returns a reference to this object so that method calls can be chained together. */ public IamInstanceProfileAssociation withTimestamp(java.util.Date timestamp) { setTimestamp(timestamp); return this; } /** * Returns a string representation of this object; useful for testing and debugging. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getAssociationId() != null) sb.append("AssociationId: ").append(getAssociationId()).append(","); if (getInstanceId() != null) sb.append("InstanceId: ").append(getInstanceId()).append(","); if (getIamInstanceProfile() != null) sb.append("IamInstanceProfile: ").append(getIamInstanceProfile()).append(","); if (getState() != null) sb.append("State: ").append(getState()).append(","); if (getTimestamp() != null) sb.append("Timestamp: ").append(getTimestamp()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof IamInstanceProfileAssociation == false) return false; IamInstanceProfileAssociation other = (IamInstanceProfileAssociation) obj; if (other.getAssociationId() == null ^ this.getAssociationId() == null) return false; if (other.getAssociationId() != null && other.getAssociationId().equals(this.getAssociationId()) == false) return false; if (other.getInstanceId() == null ^ this.getInstanceId() == null) return false; if (other.getInstanceId() != null && other.getInstanceId().equals(this.getInstanceId()) == false) return false; if (other.getIamInstanceProfile() == null ^ this.getIamInstanceProfile() == null) return false; if (other.getIamInstanceProfile() != null && other.getIamInstanceProfile().equals(this.getIamInstanceProfile()) == 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.getTimestamp() == null ^ this.getTimestamp() == null) return false; if (other.getTimestamp() != null && other.getTimestamp().equals(this.getTimestamp()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getAssociationId() == null) ? 0 : getAssociationId().hashCode()); hashCode = prime * hashCode + ((getInstanceId() == null) ? 0 : getInstanceId().hashCode()); hashCode = prime * hashCode + ((getIamInstanceProfile() == null) ? 0 : getIamInstanceProfile().hashCode()); hashCode = prime * hashCode + ((getState() == null) ? 0 : getState().hashCode()); hashCode = prime * hashCode + ((getTimestamp() == null) ? 0 : getTimestamp().hashCode()); return hashCode; } @Override public IamInstanceProfileAssociation clone() { try { return (IamInstanceProfileAssociation) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } }