com.amazonaws.services.ec2.model.IamInstanceProfileAssociation Maven / Gradle / Ivy
Show all versions of aws-java-sdk-ec2 Show documentation
/*
* Copyright 2017-2022 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;
/**
*
* Describes an association between an IAM instance profile and an instance.
*
*
* @see AWS
* API Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class IamInstanceProfileAssociation implements Serializable, Cloneable {
/**
*
* The ID of the association.
*
*/
private String associationId;
/**
*
* The ID of the instance.
*
*/
private String instanceId;
/**
*
* The IAM instance profile.
*
*/
private IamInstanceProfile iamInstanceProfile;
/**
*
* The state of the association.
*
*/
private String state;
/**
*
* The time the IAM instance profile was associated with the instance.
*
*/
private java.util.Date timestamp;
/**
*
* The ID of the association.
*
*
* @param associationId
* The ID of the association.
*/
public void setAssociationId(String associationId) {
this.associationId = associationId;
}
/**
*
* The ID of the association.
*
*
* @return The ID of the association.
*/
public String getAssociationId() {
return this.associationId;
}
/**
*
* The ID of the association.
*
*
* @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;
}
/**
*
* The ID of the instance.
*
*
* @param instanceId
* The ID of the instance.
*/
public void setInstanceId(String instanceId) {
this.instanceId = instanceId;
}
/**
*
* The ID of the instance.
*
*
* @return The ID of the instance.
*/
public String getInstanceId() {
return this.instanceId;
}
/**
*
* The ID of the instance.
*
*
* @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;
}
/**
*
* The IAM instance profile.
*
*
* @param iamInstanceProfile
* The IAM instance profile.
*/
public void setIamInstanceProfile(IamInstanceProfile iamInstanceProfile) {
this.iamInstanceProfile = iamInstanceProfile;
}
/**
*
* The IAM instance profile.
*
*
* @return The IAM instance profile.
*/
public IamInstanceProfile getIamInstanceProfile() {
return this.iamInstanceProfile;
}
/**
*
* The IAM instance profile.
*
*
* @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;
}
/**
*
* The state of the association.
*
*
* @param state
* The state of the association.
* @see IamInstanceProfileAssociationState
*/
public void setState(String state) {
this.state = state;
}
/**
*
* The state of the association.
*
*
* @return The state of the association.
* @see IamInstanceProfileAssociationState
*/
public String getState() {
return this.state;
}
/**
*
* The state of the association.
*
*
* @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;
}
/**
*
* The state of the association.
*
*
* @param state
* The state of the association.
* @see IamInstanceProfileAssociationState
*/
public void setState(IamInstanceProfileAssociationState state) {
withState(state);
}
/**
*
* The state of the association.
*
*
* @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) {
this.state = state.toString();
return this;
}
/**
*
* The time the IAM instance profile was associated with the instance.
*
*
* @param timestamp
* The time the IAM instance profile was associated with the instance.
*/
public void setTimestamp(java.util.Date timestamp) {
this.timestamp = timestamp;
}
/**
*
* The time the IAM instance profile was associated with the instance.
*
*
* @return The time the IAM instance profile was associated with the instance.
*/
public java.util.Date getTimestamp() {
return this.timestamp;
}
/**
*
* The time the IAM instance profile was associated with the instance.
*
*
* @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. 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 (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);
}
}
}