com.amazonaws.services.macie2.model.S3Object Maven / Gradle / Ivy
Show all versions of aws-java-sdk-macie2 Show documentation
/*
* 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.macie2.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* Provides information about the S3 object that a finding applies to.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class S3Object implements Serializable, Cloneable, StructuredPojo {
/**
*
* The Amazon Resource Name (ARN) of the bucket that contains the object.
*
*/
private String bucketArn;
/**
*
* The entity tag (ETag) that identifies the affected version of the object. If the object was overwritten or
* changed after Amazon Macie produced the finding, this value might be different from the current ETag for the
* object.
*
*/
private String eTag;
/**
*
* The file name extension of the object. If the object doesn't have a file name extension, this value is "".
*
*/
private String extension;
/**
*
* The full name (key) of the object, including the object's prefix if applicable.
*
*/
private String key;
/**
*
* The date and time, in UTC and extended ISO 8601 format, when the object was last modified.
*
*/
private java.util.Date lastModified;
/**
*
* The full path to the affected object, including the name of the affected bucket and the object's name (key).
*
*/
private String path;
/**
*
* Specifies whether the object is publicly accessible due to the combination of permissions settings that apply to
* the object.
*
*/
private Boolean publicAccess;
/**
*
* The type of server-side encryption that was used to encrypt the object.
*
*/
private ServerSideEncryption serverSideEncryption;
/**
*
* The total storage size, in bytes, of the object.
*
*/
private Long size;
/**
*
* The storage class of the object.
*
*/
private String storageClass;
/**
*
* The tags that are associated with the object.
*
*/
private java.util.List tags;
/**
*
* The identifier for the affected version of the object.
*
*/
private String versionId;
/**
*
* The Amazon Resource Name (ARN) of the bucket that contains the object.
*
*
* @param bucketArn
* The Amazon Resource Name (ARN) of the bucket that contains the object.
*/
public void setBucketArn(String bucketArn) {
this.bucketArn = bucketArn;
}
/**
*
* The Amazon Resource Name (ARN) of the bucket that contains the object.
*
*
* @return The Amazon Resource Name (ARN) of the bucket that contains the object.
*/
public String getBucketArn() {
return this.bucketArn;
}
/**
*
* The Amazon Resource Name (ARN) of the bucket that contains the object.
*
*
* @param bucketArn
* The Amazon Resource Name (ARN) of the bucket that contains the object.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public S3Object withBucketArn(String bucketArn) {
setBucketArn(bucketArn);
return this;
}
/**
*
* The entity tag (ETag) that identifies the affected version of the object. If the object was overwritten or
* changed after Amazon Macie produced the finding, this value might be different from the current ETag for the
* object.
*
*
* @param eTag
* The entity tag (ETag) that identifies the affected version of the object. If the object was overwritten or
* changed after Amazon Macie produced the finding, this value might be different from the current ETag for
* the object.
*/
public void setETag(String eTag) {
this.eTag = eTag;
}
/**
*
* The entity tag (ETag) that identifies the affected version of the object. If the object was overwritten or
* changed after Amazon Macie produced the finding, this value might be different from the current ETag for the
* object.
*
*
* @return The entity tag (ETag) that identifies the affected version of the object. If the object was overwritten
* or changed after Amazon Macie produced the finding, this value might be different from the current ETag
* for the object.
*/
public String getETag() {
return this.eTag;
}
/**
*
* The entity tag (ETag) that identifies the affected version of the object. If the object was overwritten or
* changed after Amazon Macie produced the finding, this value might be different from the current ETag for the
* object.
*
*
* @param eTag
* The entity tag (ETag) that identifies the affected version of the object. If the object was overwritten or
* changed after Amazon Macie produced the finding, this value might be different from the current ETag for
* the object.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public S3Object withETag(String eTag) {
setETag(eTag);
return this;
}
/**
*
* The file name extension of the object. If the object doesn't have a file name extension, this value is "".
*
*
* @param extension
* The file name extension of the object. If the object doesn't have a file name extension, this value is "".
*/
public void setExtension(String extension) {
this.extension = extension;
}
/**
*
* The file name extension of the object. If the object doesn't have a file name extension, this value is "".
*
*
* @return The file name extension of the object. If the object doesn't have a file name extension, this value is
* "".
*/
public String getExtension() {
return this.extension;
}
/**
*
* The file name extension of the object. If the object doesn't have a file name extension, this value is "".
*
*
* @param extension
* The file name extension of the object. If the object doesn't have a file name extension, this value is "".
* @return Returns a reference to this object so that method calls can be chained together.
*/
public S3Object withExtension(String extension) {
setExtension(extension);
return this;
}
/**
*
* The full name (key) of the object, including the object's prefix if applicable.
*
*
* @param key
* The full name (key) of the object, including the object's prefix if applicable.
*/
public void setKey(String key) {
this.key = key;
}
/**
*
* The full name (key) of the object, including the object's prefix if applicable.
*
*
* @return The full name (key) of the object, including the object's prefix if applicable.
*/
public String getKey() {
return this.key;
}
/**
*
* The full name (key) of the object, including the object's prefix if applicable.
*
*
* @param key
* The full name (key) of the object, including the object's prefix if applicable.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public S3Object withKey(String key) {
setKey(key);
return this;
}
/**
*
* The date and time, in UTC and extended ISO 8601 format, when the object was last modified.
*
*
* @param lastModified
* The date and time, in UTC and extended ISO 8601 format, when the object was last modified.
*/
public void setLastModified(java.util.Date lastModified) {
this.lastModified = lastModified;
}
/**
*
* The date and time, in UTC and extended ISO 8601 format, when the object was last modified.
*
*
* @return The date and time, in UTC and extended ISO 8601 format, when the object was last modified.
*/
public java.util.Date getLastModified() {
return this.lastModified;
}
/**
*
* The date and time, in UTC and extended ISO 8601 format, when the object was last modified.
*
*
* @param lastModified
* The date and time, in UTC and extended ISO 8601 format, when the object was last modified.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public S3Object withLastModified(java.util.Date lastModified) {
setLastModified(lastModified);
return this;
}
/**
*
* The full path to the affected object, including the name of the affected bucket and the object's name (key).
*
*
* @param path
* The full path to the affected object, including the name of the affected bucket and the object's name
* (key).
*/
public void setPath(String path) {
this.path = path;
}
/**
*
* The full path to the affected object, including the name of the affected bucket and the object's name (key).
*
*
* @return The full path to the affected object, including the name of the affected bucket and the object's name
* (key).
*/
public String getPath() {
return this.path;
}
/**
*
* The full path to the affected object, including the name of the affected bucket and the object's name (key).
*
*
* @param path
* The full path to the affected object, including the name of the affected bucket and the object's name
* (key).
* @return Returns a reference to this object so that method calls can be chained together.
*/
public S3Object withPath(String path) {
setPath(path);
return this;
}
/**
*
* Specifies whether the object is publicly accessible due to the combination of permissions settings that apply to
* the object.
*
*
* @param publicAccess
* Specifies whether the object is publicly accessible due to the combination of permissions settings that
* apply to the object.
*/
public void setPublicAccess(Boolean publicAccess) {
this.publicAccess = publicAccess;
}
/**
*
* Specifies whether the object is publicly accessible due to the combination of permissions settings that apply to
* the object.
*
*
* @return Specifies whether the object is publicly accessible due to the combination of permissions settings that
* apply to the object.
*/
public Boolean getPublicAccess() {
return this.publicAccess;
}
/**
*
* Specifies whether the object is publicly accessible due to the combination of permissions settings that apply to
* the object.
*
*
* @param publicAccess
* Specifies whether the object is publicly accessible due to the combination of permissions settings that
* apply to the object.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public S3Object withPublicAccess(Boolean publicAccess) {
setPublicAccess(publicAccess);
return this;
}
/**
*
* Specifies whether the object is publicly accessible due to the combination of permissions settings that apply to
* the object.
*
*
* @return Specifies whether the object is publicly accessible due to the combination of permissions settings that
* apply to the object.
*/
public Boolean isPublicAccess() {
return this.publicAccess;
}
/**
*
* The type of server-side encryption that was used to encrypt the object.
*
*
* @param serverSideEncryption
* The type of server-side encryption that was used to encrypt the object.
*/
public void setServerSideEncryption(ServerSideEncryption serverSideEncryption) {
this.serverSideEncryption = serverSideEncryption;
}
/**
*
* The type of server-side encryption that was used to encrypt the object.
*
*
* @return The type of server-side encryption that was used to encrypt the object.
*/
public ServerSideEncryption getServerSideEncryption() {
return this.serverSideEncryption;
}
/**
*
* The type of server-side encryption that was used to encrypt the object.
*
*
* @param serverSideEncryption
* The type of server-side encryption that was used to encrypt the object.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public S3Object withServerSideEncryption(ServerSideEncryption serverSideEncryption) {
setServerSideEncryption(serverSideEncryption);
return this;
}
/**
*
* The total storage size, in bytes, of the object.
*
*
* @param size
* The total storage size, in bytes, of the object.
*/
public void setSize(Long size) {
this.size = size;
}
/**
*
* The total storage size, in bytes, of the object.
*
*
* @return The total storage size, in bytes, of the object.
*/
public Long getSize() {
return this.size;
}
/**
*
* The total storage size, in bytes, of the object.
*
*
* @param size
* The total storage size, in bytes, of the object.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public S3Object withSize(Long size) {
setSize(size);
return this;
}
/**
*
* The storage class of the object.
*
*
* @param storageClass
* The storage class of the object.
* @see StorageClass
*/
public void setStorageClass(String storageClass) {
this.storageClass = storageClass;
}
/**
*
* The storage class of the object.
*
*
* @return The storage class of the object.
* @see StorageClass
*/
public String getStorageClass() {
return this.storageClass;
}
/**
*
* The storage class of the object.
*
*
* @param storageClass
* The storage class of the object.
* @return Returns a reference to this object so that method calls can be chained together.
* @see StorageClass
*/
public S3Object withStorageClass(String storageClass) {
setStorageClass(storageClass);
return this;
}
/**
*
* The storage class of the object.
*
*
* @param storageClass
* The storage class of the object.
* @return Returns a reference to this object so that method calls can be chained together.
* @see StorageClass
*/
public S3Object withStorageClass(StorageClass storageClass) {
this.storageClass = storageClass.toString();
return this;
}
/**
*
* The tags that are associated with the object.
*
*
* @return The tags that are associated with the object.
*/
public java.util.List getTags() {
return tags;
}
/**
*
* The tags that are associated with the object.
*
*
* @param tags
* The tags that are associated with the object.
*/
public void setTags(java.util.Collection tags) {
if (tags == null) {
this.tags = null;
return;
}
this.tags = new java.util.ArrayList(tags);
}
/**
*
* The tags that are associated with the object.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setTags(java.util.Collection)} or {@link #withTags(java.util.Collection)} if you want to override the
* existing values.
*
*
* @param tags
* The tags that are associated with the object.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public S3Object withTags(KeyValuePair... tags) {
if (this.tags == null) {
setTags(new java.util.ArrayList(tags.length));
}
for (KeyValuePair ele : tags) {
this.tags.add(ele);
}
return this;
}
/**
*
* The tags that are associated with the object.
*
*
* @param tags
* The tags that are associated with the object.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public S3Object withTags(java.util.Collection tags) {
setTags(tags);
return this;
}
/**
*
* The identifier for the affected version of the object.
*
*
* @param versionId
* The identifier for the affected version of the object.
*/
public void setVersionId(String versionId) {
this.versionId = versionId;
}
/**
*
* The identifier for the affected version of the object.
*
*
* @return The identifier for the affected version of the object.
*/
public String getVersionId() {
return this.versionId;
}
/**
*
* The identifier for the affected version of the object.
*
*
* @param versionId
* The identifier for the affected version of the object.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public S3Object withVersionId(String versionId) {
setVersionId(versionId);
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 (getBucketArn() != null)
sb.append("BucketArn: ").append(getBucketArn()).append(",");
if (getETag() != null)
sb.append("ETag: ").append(getETag()).append(",");
if (getExtension() != null)
sb.append("Extension: ").append(getExtension()).append(",");
if (getKey() != null)
sb.append("Key: ").append(getKey()).append(",");
if (getLastModified() != null)
sb.append("LastModified: ").append(getLastModified()).append(",");
if (getPath() != null)
sb.append("Path: ").append(getPath()).append(",");
if (getPublicAccess() != null)
sb.append("PublicAccess: ").append(getPublicAccess()).append(",");
if (getServerSideEncryption() != null)
sb.append("ServerSideEncryption: ").append(getServerSideEncryption()).append(",");
if (getSize() != null)
sb.append("Size: ").append(getSize()).append(",");
if (getStorageClass() != null)
sb.append("StorageClass: ").append(getStorageClass()).append(",");
if (getTags() != null)
sb.append("Tags: ").append(getTags()).append(",");
if (getVersionId() != null)
sb.append("VersionId: ").append(getVersionId());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof S3Object == false)
return false;
S3Object other = (S3Object) obj;
if (other.getBucketArn() == null ^ this.getBucketArn() == null)
return false;
if (other.getBucketArn() != null && other.getBucketArn().equals(this.getBucketArn()) == false)
return false;
if (other.getETag() == null ^ this.getETag() == null)
return false;
if (other.getETag() != null && other.getETag().equals(this.getETag()) == false)
return false;
if (other.getExtension() == null ^ this.getExtension() == null)
return false;
if (other.getExtension() != null && other.getExtension().equals(this.getExtension()) == false)
return false;
if (other.getKey() == null ^ this.getKey() == null)
return false;
if (other.getKey() != null && other.getKey().equals(this.getKey()) == false)
return false;
if (other.getLastModified() == null ^ this.getLastModified() == null)
return false;
if (other.getLastModified() != null && other.getLastModified().equals(this.getLastModified()) == false)
return false;
if (other.getPath() == null ^ this.getPath() == null)
return false;
if (other.getPath() != null && other.getPath().equals(this.getPath()) == false)
return false;
if (other.getPublicAccess() == null ^ this.getPublicAccess() == null)
return false;
if (other.getPublicAccess() != null && other.getPublicAccess().equals(this.getPublicAccess()) == false)
return false;
if (other.getServerSideEncryption() == null ^ this.getServerSideEncryption() == null)
return false;
if (other.getServerSideEncryption() != null && other.getServerSideEncryption().equals(this.getServerSideEncryption()) == false)
return false;
if (other.getSize() == null ^ this.getSize() == null)
return false;
if (other.getSize() != null && other.getSize().equals(this.getSize()) == false)
return false;
if (other.getStorageClass() == null ^ this.getStorageClass() == null)
return false;
if (other.getStorageClass() != null && other.getStorageClass().equals(this.getStorageClass()) == 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.getVersionId() == null ^ this.getVersionId() == null)
return false;
if (other.getVersionId() != null && other.getVersionId().equals(this.getVersionId()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getBucketArn() == null) ? 0 : getBucketArn().hashCode());
hashCode = prime * hashCode + ((getETag() == null) ? 0 : getETag().hashCode());
hashCode = prime * hashCode + ((getExtension() == null) ? 0 : getExtension().hashCode());
hashCode = prime * hashCode + ((getKey() == null) ? 0 : getKey().hashCode());
hashCode = prime * hashCode + ((getLastModified() == null) ? 0 : getLastModified().hashCode());
hashCode = prime * hashCode + ((getPath() == null) ? 0 : getPath().hashCode());
hashCode = prime * hashCode + ((getPublicAccess() == null) ? 0 : getPublicAccess().hashCode());
hashCode = prime * hashCode + ((getServerSideEncryption() == null) ? 0 : getServerSideEncryption().hashCode());
hashCode = prime * hashCode + ((getSize() == null) ? 0 : getSize().hashCode());
hashCode = prime * hashCode + ((getStorageClass() == null) ? 0 : getStorageClass().hashCode());
hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode());
hashCode = prime * hashCode + ((getVersionId() == null) ? 0 : getVersionId().hashCode());
return hashCode;
}
@Override
public S3Object clone() {
try {
return (S3Object) 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.macie2.model.transform.S3ObjectMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}