com.amazonaws.services.globalaccelerator.model.Attachment Maven / Gradle / Ivy
Show all versions of aws-java-sdk-globalaccelerator Show documentation
/*
* 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.globalaccelerator.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* A cross-account attachment in Global Accelerator. A cross-account attachment specifies the principals who have
* permission to work with resources in your account, which you also list in the attachment.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class Attachment implements Serializable, Cloneable, StructuredPojo {
/**
*
* The Amazon Resource Name (ARN) of the cross-account attachment.
*
*/
private String attachmentArn;
/**
*
* The name of the cross-account attachment.
*
*/
private String name;
/**
*
* The principals included in the cross-account attachment.
*
*/
private java.util.List principals;
/**
*
* The resources included in the cross-account attachment.
*
*/
private java.util.List resources;
/**
*
* The date and time that the cross-account attachment was last modified.
*
*/
private java.util.Date lastModifiedTime;
/**
*
* The date and time that the cross-account attachment was created.
*
*/
private java.util.Date createdTime;
/**
*
* The Amazon Resource Name (ARN) of the cross-account attachment.
*
*
* @param attachmentArn
* The Amazon Resource Name (ARN) of the cross-account attachment.
*/
public void setAttachmentArn(String attachmentArn) {
this.attachmentArn = attachmentArn;
}
/**
*
* The Amazon Resource Name (ARN) of the cross-account attachment.
*
*
* @return The Amazon Resource Name (ARN) of the cross-account attachment.
*/
public String getAttachmentArn() {
return this.attachmentArn;
}
/**
*
* The Amazon Resource Name (ARN) of the cross-account attachment.
*
*
* @param attachmentArn
* The Amazon Resource Name (ARN) of the cross-account attachment.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Attachment withAttachmentArn(String attachmentArn) {
setAttachmentArn(attachmentArn);
return this;
}
/**
*
* The name of the cross-account attachment.
*
*
* @param name
* The name of the cross-account attachment.
*/
public void setName(String name) {
this.name = name;
}
/**
*
* The name of the cross-account attachment.
*
*
* @return The name of the cross-account attachment.
*/
public String getName() {
return this.name;
}
/**
*
* The name of the cross-account attachment.
*
*
* @param name
* The name of the cross-account attachment.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Attachment withName(String name) {
setName(name);
return this;
}
/**
*
* The principals included in the cross-account attachment.
*
*
* @return The principals included in the cross-account attachment.
*/
public java.util.List getPrincipals() {
return principals;
}
/**
*
* The principals included in the cross-account attachment.
*
*
* @param principals
* The principals included in the cross-account attachment.
*/
public void setPrincipals(java.util.Collection principals) {
if (principals == null) {
this.principals = null;
return;
}
this.principals = new java.util.ArrayList(principals);
}
/**
*
* The principals included in the cross-account attachment.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setPrincipals(java.util.Collection)} or {@link #withPrincipals(java.util.Collection)} if you want to
* override the existing values.
*
*
* @param principals
* The principals included in the cross-account attachment.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Attachment withPrincipals(String... principals) {
if (this.principals == null) {
setPrincipals(new java.util.ArrayList(principals.length));
}
for (String ele : principals) {
this.principals.add(ele);
}
return this;
}
/**
*
* The principals included in the cross-account attachment.
*
*
* @param principals
* The principals included in the cross-account attachment.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Attachment withPrincipals(java.util.Collection principals) {
setPrincipals(principals);
return this;
}
/**
*
* The resources included in the cross-account attachment.
*
*
* @return The resources included in the cross-account attachment.
*/
public java.util.List getResources() {
return resources;
}
/**
*
* The resources included in the cross-account attachment.
*
*
* @param resources
* The resources included in the cross-account attachment.
*/
public void setResources(java.util.Collection resources) {
if (resources == null) {
this.resources = null;
return;
}
this.resources = new java.util.ArrayList(resources);
}
/**
*
* The resources included in the cross-account attachment.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setResources(java.util.Collection)} or {@link #withResources(java.util.Collection)} if you want to
* override the existing values.
*
*
* @param resources
* The resources included in the cross-account attachment.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Attachment withResources(Resource... resources) {
if (this.resources == null) {
setResources(new java.util.ArrayList(resources.length));
}
for (Resource ele : resources) {
this.resources.add(ele);
}
return this;
}
/**
*
* The resources included in the cross-account attachment.
*
*
* @param resources
* The resources included in the cross-account attachment.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Attachment withResources(java.util.Collection resources) {
setResources(resources);
return this;
}
/**
*
* The date and time that the cross-account attachment was last modified.
*
*
* @param lastModifiedTime
* The date and time that the cross-account attachment was last modified.
*/
public void setLastModifiedTime(java.util.Date lastModifiedTime) {
this.lastModifiedTime = lastModifiedTime;
}
/**
*
* The date and time that the cross-account attachment was last modified.
*
*
* @return The date and time that the cross-account attachment was last modified.
*/
public java.util.Date getLastModifiedTime() {
return this.lastModifiedTime;
}
/**
*
* The date and time that the cross-account attachment was last modified.
*
*
* @param lastModifiedTime
* The date and time that the cross-account attachment was last modified.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Attachment withLastModifiedTime(java.util.Date lastModifiedTime) {
setLastModifiedTime(lastModifiedTime);
return this;
}
/**
*
* The date and time that the cross-account attachment was created.
*
*
* @param createdTime
* The date and time that the cross-account attachment was created.
*/
public void setCreatedTime(java.util.Date createdTime) {
this.createdTime = createdTime;
}
/**
*
* The date and time that the cross-account attachment was created.
*
*
* @return The date and time that the cross-account attachment was created.
*/
public java.util.Date getCreatedTime() {
return this.createdTime;
}
/**
*
* The date and time that the cross-account attachment was created.
*
*
* @param createdTime
* The date and time that the cross-account attachment was created.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Attachment withCreatedTime(java.util.Date createdTime) {
setCreatedTime(createdTime);
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 (getAttachmentArn() != null)
sb.append("AttachmentArn: ").append(getAttachmentArn()).append(",");
if (getName() != null)
sb.append("Name: ").append(getName()).append(",");
if (getPrincipals() != null)
sb.append("Principals: ").append(getPrincipals()).append(",");
if (getResources() != null)
sb.append("Resources: ").append(getResources()).append(",");
if (getLastModifiedTime() != null)
sb.append("LastModifiedTime: ").append(getLastModifiedTime()).append(",");
if (getCreatedTime() != null)
sb.append("CreatedTime: ").append(getCreatedTime());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof Attachment == false)
return false;
Attachment other = (Attachment) obj;
if (other.getAttachmentArn() == null ^ this.getAttachmentArn() == null)
return false;
if (other.getAttachmentArn() != null && other.getAttachmentArn().equals(this.getAttachmentArn()) == 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.getPrincipals() == null ^ this.getPrincipals() == null)
return false;
if (other.getPrincipals() != null && other.getPrincipals().equals(this.getPrincipals()) == false)
return false;
if (other.getResources() == null ^ this.getResources() == null)
return false;
if (other.getResources() != null && other.getResources().equals(this.getResources()) == false)
return false;
if (other.getLastModifiedTime() == null ^ this.getLastModifiedTime() == null)
return false;
if (other.getLastModifiedTime() != null && other.getLastModifiedTime().equals(this.getLastModifiedTime()) == false)
return false;
if (other.getCreatedTime() == null ^ this.getCreatedTime() == null)
return false;
if (other.getCreatedTime() != null && other.getCreatedTime().equals(this.getCreatedTime()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getAttachmentArn() == null) ? 0 : getAttachmentArn().hashCode());
hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode());
hashCode = prime * hashCode + ((getPrincipals() == null) ? 0 : getPrincipals().hashCode());
hashCode = prime * hashCode + ((getResources() == null) ? 0 : getResources().hashCode());
hashCode = prime * hashCode + ((getLastModifiedTime() == null) ? 0 : getLastModifiedTime().hashCode());
hashCode = prime * hashCode + ((getCreatedTime() == null) ? 0 : getCreatedTime().hashCode());
return hashCode;
}
@Override
public Attachment clone() {
try {
return (Attachment) 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.globalaccelerator.model.transform.AttachmentMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}