com.amazonaws.services.macie2.model.S3Bucket Maven / Gradle / Ivy
Show all versions of aws-java-sdk-macie2 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.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 bucket that a finding applies to.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class S3Bucket implements Serializable, Cloneable, StructuredPojo {
/**
*
* Specifies whether the bucket policy for the bucket requires server-side encryption of objects when objects are
* added to the bucket. Possible values are:
*
*
* -
*
* FALSE - The bucket policy requires server-side encryption of new objects. PutObject requests must include a valid
* server-side encryption header.
*
*
* -
*
* TRUE - The bucket doesn't have a bucket policy or it has a bucket policy that doesn't require server-side
* encryption of new objects. If a bucket policy exists, it doesn't require PutObject requests to include a valid
* server-side encryption header.
*
*
* -
*
* UNKNOWN - Amazon Macie can't determine whether the bucket policy requires server-side encryption of new objects.
*
*
*
*
* Valid server-side encryption headers are: x-amz-server-side-encryption with a value of AES256 or aws:kms, and
* x-amz-server-side-encryption-customer-algorithm with a value of AES256.
*
*/
private String allowsUnencryptedObjectUploads;
/**
*
* The Amazon Resource Name (ARN) of the bucket.
*
*/
private String arn;
/**
*
* The date and time, in UTC and extended ISO 8601 format, when the bucket was created. This value can also indicate
* when changes such as edits to the bucket's policy were most recently made to the bucket, relative to when the
* finding was created or last updated.
*
*/
private java.util.Date createdAt;
/**
*
* The default server-side encryption settings for the bucket.
*
*/
private ServerSideEncryption defaultServerSideEncryption;
/**
*
* The name of the bucket.
*
*/
private String name;
/**
*
* The display name and canonical user ID for the Amazon Web Services account that owns the bucket.
*
*/
private S3BucketOwner owner;
/**
*
* The permissions settings that determine whether the bucket is publicly accessible.
*
*/
private BucketPublicAccess publicAccess;
/**
*
* The tags that are associated with the bucket.
*
*/
private java.util.List tags;
/**
*
* Specifies whether the bucket policy for the bucket requires server-side encryption of objects when objects are
* added to the bucket. Possible values are:
*
*
* -
*
* FALSE - The bucket policy requires server-side encryption of new objects. PutObject requests must include a valid
* server-side encryption header.
*
*
* -
*
* TRUE - The bucket doesn't have a bucket policy or it has a bucket policy that doesn't require server-side
* encryption of new objects. If a bucket policy exists, it doesn't require PutObject requests to include a valid
* server-side encryption header.
*
*
* -
*
* UNKNOWN - Amazon Macie can't determine whether the bucket policy requires server-side encryption of new objects.
*
*
*
*
* Valid server-side encryption headers are: x-amz-server-side-encryption with a value of AES256 or aws:kms, and
* x-amz-server-side-encryption-customer-algorithm with a value of AES256.
*
*
* @param allowsUnencryptedObjectUploads
* Specifies whether the bucket policy for the bucket requires server-side encryption of objects when objects
* are added to the bucket. Possible values are:
*
* -
*
* FALSE - The bucket policy requires server-side encryption of new objects. PutObject requests must include
* a valid server-side encryption header.
*
*
* -
*
* TRUE - The bucket doesn't have a bucket policy or it has a bucket policy that doesn't require server-side
* encryption of new objects. If a bucket policy exists, it doesn't require PutObject requests to include a
* valid server-side encryption header.
*
*
* -
*
* UNKNOWN - Amazon Macie can't determine whether the bucket policy requires server-side encryption of new
* objects.
*
*
*
*
* Valid server-side encryption headers are: x-amz-server-side-encryption with a value of AES256 or aws:kms,
* and x-amz-server-side-encryption-customer-algorithm with a value of AES256.
* @see AllowsUnencryptedObjectUploads
*/
public void setAllowsUnencryptedObjectUploads(String allowsUnencryptedObjectUploads) {
this.allowsUnencryptedObjectUploads = allowsUnencryptedObjectUploads;
}
/**
*
* Specifies whether the bucket policy for the bucket requires server-side encryption of objects when objects are
* added to the bucket. Possible values are:
*
*
* -
*
* FALSE - The bucket policy requires server-side encryption of new objects. PutObject requests must include a valid
* server-side encryption header.
*
*
* -
*
* TRUE - The bucket doesn't have a bucket policy or it has a bucket policy that doesn't require server-side
* encryption of new objects. If a bucket policy exists, it doesn't require PutObject requests to include a valid
* server-side encryption header.
*
*
* -
*
* UNKNOWN - Amazon Macie can't determine whether the bucket policy requires server-side encryption of new objects.
*
*
*
*
* Valid server-side encryption headers are: x-amz-server-side-encryption with a value of AES256 or aws:kms, and
* x-amz-server-side-encryption-customer-algorithm with a value of AES256.
*
*
* @return Specifies whether the bucket policy for the bucket requires server-side encryption of objects when
* objects are added to the bucket. Possible values are:
*
* -
*
* FALSE - The bucket policy requires server-side encryption of new objects. PutObject requests must include
* a valid server-side encryption header.
*
*
* -
*
* TRUE - The bucket doesn't have a bucket policy or it has a bucket policy that doesn't require server-side
* encryption of new objects. If a bucket policy exists, it doesn't require PutObject requests to include a
* valid server-side encryption header.
*
*
* -
*
* UNKNOWN - Amazon Macie can't determine whether the bucket policy requires server-side encryption of new
* objects.
*
*
*
*
* Valid server-side encryption headers are: x-amz-server-side-encryption with a value of AES256 or aws:kms,
* and x-amz-server-side-encryption-customer-algorithm with a value of AES256.
* @see AllowsUnencryptedObjectUploads
*/
public String getAllowsUnencryptedObjectUploads() {
return this.allowsUnencryptedObjectUploads;
}
/**
*
* Specifies whether the bucket policy for the bucket requires server-side encryption of objects when objects are
* added to the bucket. Possible values are:
*
*
* -
*
* FALSE - The bucket policy requires server-side encryption of new objects. PutObject requests must include a valid
* server-side encryption header.
*
*
* -
*
* TRUE - The bucket doesn't have a bucket policy or it has a bucket policy that doesn't require server-side
* encryption of new objects. If a bucket policy exists, it doesn't require PutObject requests to include a valid
* server-side encryption header.
*
*
* -
*
* UNKNOWN - Amazon Macie can't determine whether the bucket policy requires server-side encryption of new objects.
*
*
*
*
* Valid server-side encryption headers are: x-amz-server-side-encryption with a value of AES256 or aws:kms, and
* x-amz-server-side-encryption-customer-algorithm with a value of AES256.
*
*
* @param allowsUnencryptedObjectUploads
* Specifies whether the bucket policy for the bucket requires server-side encryption of objects when objects
* are added to the bucket. Possible values are:
*
* -
*
* FALSE - The bucket policy requires server-side encryption of new objects. PutObject requests must include
* a valid server-side encryption header.
*
*
* -
*
* TRUE - The bucket doesn't have a bucket policy or it has a bucket policy that doesn't require server-side
* encryption of new objects. If a bucket policy exists, it doesn't require PutObject requests to include a
* valid server-side encryption header.
*
*
* -
*
* UNKNOWN - Amazon Macie can't determine whether the bucket policy requires server-side encryption of new
* objects.
*
*
*
*
* Valid server-side encryption headers are: x-amz-server-side-encryption with a value of AES256 or aws:kms,
* and x-amz-server-side-encryption-customer-algorithm with a value of AES256.
* @return Returns a reference to this object so that method calls can be chained together.
* @see AllowsUnencryptedObjectUploads
*/
public S3Bucket withAllowsUnencryptedObjectUploads(String allowsUnencryptedObjectUploads) {
setAllowsUnencryptedObjectUploads(allowsUnencryptedObjectUploads);
return this;
}
/**
*
* Specifies whether the bucket policy for the bucket requires server-side encryption of objects when objects are
* added to the bucket. Possible values are:
*
*
* -
*
* FALSE - The bucket policy requires server-side encryption of new objects. PutObject requests must include a valid
* server-side encryption header.
*
*
* -
*
* TRUE - The bucket doesn't have a bucket policy or it has a bucket policy that doesn't require server-side
* encryption of new objects. If a bucket policy exists, it doesn't require PutObject requests to include a valid
* server-side encryption header.
*
*
* -
*
* UNKNOWN - Amazon Macie can't determine whether the bucket policy requires server-side encryption of new objects.
*
*
*
*
* Valid server-side encryption headers are: x-amz-server-side-encryption with a value of AES256 or aws:kms, and
* x-amz-server-side-encryption-customer-algorithm with a value of AES256.
*
*
* @param allowsUnencryptedObjectUploads
* Specifies whether the bucket policy for the bucket requires server-side encryption of objects when objects
* are added to the bucket. Possible values are:
*
* -
*
* FALSE - The bucket policy requires server-side encryption of new objects. PutObject requests must include
* a valid server-side encryption header.
*
*
* -
*
* TRUE - The bucket doesn't have a bucket policy or it has a bucket policy that doesn't require server-side
* encryption of new objects. If a bucket policy exists, it doesn't require PutObject requests to include a
* valid server-side encryption header.
*
*
* -
*
* UNKNOWN - Amazon Macie can't determine whether the bucket policy requires server-side encryption of new
* objects.
*
*
*
*
* Valid server-side encryption headers are: x-amz-server-side-encryption with a value of AES256 or aws:kms,
* and x-amz-server-side-encryption-customer-algorithm with a value of AES256.
* @return Returns a reference to this object so that method calls can be chained together.
* @see AllowsUnencryptedObjectUploads
*/
public S3Bucket withAllowsUnencryptedObjectUploads(AllowsUnencryptedObjectUploads allowsUnencryptedObjectUploads) {
this.allowsUnencryptedObjectUploads = allowsUnencryptedObjectUploads.toString();
return this;
}
/**
*
* The Amazon Resource Name (ARN) of the bucket.
*
*
* @param arn
* The Amazon Resource Name (ARN) of the bucket.
*/
public void setArn(String arn) {
this.arn = arn;
}
/**
*
* The Amazon Resource Name (ARN) of the bucket.
*
*
* @return The Amazon Resource Name (ARN) of the bucket.
*/
public String getArn() {
return this.arn;
}
/**
*
* The Amazon Resource Name (ARN) of the bucket.
*
*
* @param arn
* The Amazon Resource Name (ARN) of the bucket.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public S3Bucket withArn(String arn) {
setArn(arn);
return this;
}
/**
*
* The date and time, in UTC and extended ISO 8601 format, when the bucket was created. This value can also indicate
* when changes such as edits to the bucket's policy were most recently made to the bucket, relative to when the
* finding was created or last updated.
*
*
* @param createdAt
* The date and time, in UTC and extended ISO 8601 format, when the bucket was created. This value can also
* indicate when changes such as edits to the bucket's policy were most recently made to the bucket, relative
* to when the finding was created or last updated.
*/
public void setCreatedAt(java.util.Date createdAt) {
this.createdAt = createdAt;
}
/**
*
* The date and time, in UTC and extended ISO 8601 format, when the bucket was created. This value can also indicate
* when changes such as edits to the bucket's policy were most recently made to the bucket, relative to when the
* finding was created or last updated.
*
*
* @return The date and time, in UTC and extended ISO 8601 format, when the bucket was created. This value can also
* indicate when changes such as edits to the bucket's policy were most recently made to the bucket,
* relative to when the finding was created or last updated.
*/
public java.util.Date getCreatedAt() {
return this.createdAt;
}
/**
*
* The date and time, in UTC and extended ISO 8601 format, when the bucket was created. This value can also indicate
* when changes such as edits to the bucket's policy were most recently made to the bucket, relative to when the
* finding was created or last updated.
*
*
* @param createdAt
* The date and time, in UTC and extended ISO 8601 format, when the bucket was created. This value can also
* indicate when changes such as edits to the bucket's policy were most recently made to the bucket, relative
* to when the finding was created or last updated.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public S3Bucket withCreatedAt(java.util.Date createdAt) {
setCreatedAt(createdAt);
return this;
}
/**
*
* The default server-side encryption settings for the bucket.
*
*
* @param defaultServerSideEncryption
* The default server-side encryption settings for the bucket.
*/
public void setDefaultServerSideEncryption(ServerSideEncryption defaultServerSideEncryption) {
this.defaultServerSideEncryption = defaultServerSideEncryption;
}
/**
*
* The default server-side encryption settings for the bucket.
*
*
* @return The default server-side encryption settings for the bucket.
*/
public ServerSideEncryption getDefaultServerSideEncryption() {
return this.defaultServerSideEncryption;
}
/**
*
* The default server-side encryption settings for the bucket.
*
*
* @param defaultServerSideEncryption
* The default server-side encryption settings for the bucket.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public S3Bucket withDefaultServerSideEncryption(ServerSideEncryption defaultServerSideEncryption) {
setDefaultServerSideEncryption(defaultServerSideEncryption);
return this;
}
/**
*
* The name of the bucket.
*
*
* @param name
* The name of the bucket.
*/
public void setName(String name) {
this.name = name;
}
/**
*
* The name of the bucket.
*
*
* @return The name of the bucket.
*/
public String getName() {
return this.name;
}
/**
*
* The name of the bucket.
*
*
* @param name
* The name of the bucket.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public S3Bucket withName(String name) {
setName(name);
return this;
}
/**
*
* The display name and canonical user ID for the Amazon Web Services account that owns the bucket.
*
*
* @param owner
* The display name and canonical user ID for the Amazon Web Services account that owns the bucket.
*/
public void setOwner(S3BucketOwner owner) {
this.owner = owner;
}
/**
*
* The display name and canonical user ID for the Amazon Web Services account that owns the bucket.
*
*
* @return The display name and canonical user ID for the Amazon Web Services account that owns the bucket.
*/
public S3BucketOwner getOwner() {
return this.owner;
}
/**
*
* The display name and canonical user ID for the Amazon Web Services account that owns the bucket.
*
*
* @param owner
* The display name and canonical user ID for the Amazon Web Services account that owns the bucket.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public S3Bucket withOwner(S3BucketOwner owner) {
setOwner(owner);
return this;
}
/**
*
* The permissions settings that determine whether the bucket is publicly accessible.
*
*
* @param publicAccess
* The permissions settings that determine whether the bucket is publicly accessible.
*/
public void setPublicAccess(BucketPublicAccess publicAccess) {
this.publicAccess = publicAccess;
}
/**
*
* The permissions settings that determine whether the bucket is publicly accessible.
*
*
* @return The permissions settings that determine whether the bucket is publicly accessible.
*/
public BucketPublicAccess getPublicAccess() {
return this.publicAccess;
}
/**
*
* The permissions settings that determine whether the bucket is publicly accessible.
*
*
* @param publicAccess
* The permissions settings that determine whether the bucket is publicly accessible.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public S3Bucket withPublicAccess(BucketPublicAccess publicAccess) {
setPublicAccess(publicAccess);
return this;
}
/**
*
* The tags that are associated with the bucket.
*
*
* @return The tags that are associated with the bucket.
*/
public java.util.List getTags() {
return tags;
}
/**
*
* The tags that are associated with the bucket.
*
*
* @param tags
* The tags that are associated with the bucket.
*/
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 bucket.
*
*
* 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 bucket.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public S3Bucket 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 bucket.
*
*
* @param tags
* The tags that are associated with the bucket.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public S3Bucket withTags(java.util.Collection tags) {
setTags(tags);
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 (getAllowsUnencryptedObjectUploads() != null)
sb.append("AllowsUnencryptedObjectUploads: ").append(getAllowsUnencryptedObjectUploads()).append(",");
if (getArn() != null)
sb.append("Arn: ").append(getArn()).append(",");
if (getCreatedAt() != null)
sb.append("CreatedAt: ").append(getCreatedAt()).append(",");
if (getDefaultServerSideEncryption() != null)
sb.append("DefaultServerSideEncryption: ").append(getDefaultServerSideEncryption()).append(",");
if (getName() != null)
sb.append("Name: ").append(getName()).append(",");
if (getOwner() != null)
sb.append("Owner: ").append(getOwner()).append(",");
if (getPublicAccess() != null)
sb.append("PublicAccess: ").append(getPublicAccess()).append(",");
if (getTags() != null)
sb.append("Tags: ").append(getTags());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof S3Bucket == false)
return false;
S3Bucket other = (S3Bucket) obj;
if (other.getAllowsUnencryptedObjectUploads() == null ^ this.getAllowsUnencryptedObjectUploads() == null)
return false;
if (other.getAllowsUnencryptedObjectUploads() != null
&& other.getAllowsUnencryptedObjectUploads().equals(this.getAllowsUnencryptedObjectUploads()) == false)
return false;
if (other.getArn() == null ^ this.getArn() == null)
return false;
if (other.getArn() != null && other.getArn().equals(this.getArn()) == false)
return false;
if (other.getCreatedAt() == null ^ this.getCreatedAt() == null)
return false;
if (other.getCreatedAt() != null && other.getCreatedAt().equals(this.getCreatedAt()) == false)
return false;
if (other.getDefaultServerSideEncryption() == null ^ this.getDefaultServerSideEncryption() == null)
return false;
if (other.getDefaultServerSideEncryption() != null && other.getDefaultServerSideEncryption().equals(this.getDefaultServerSideEncryption()) == 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.getOwner() == null ^ this.getOwner() == null)
return false;
if (other.getOwner() != null && other.getOwner().equals(this.getOwner()) == 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.getTags() == null ^ this.getTags() == null)
return false;
if (other.getTags() != null && other.getTags().equals(this.getTags()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getAllowsUnencryptedObjectUploads() == null) ? 0 : getAllowsUnencryptedObjectUploads().hashCode());
hashCode = prime * hashCode + ((getArn() == null) ? 0 : getArn().hashCode());
hashCode = prime * hashCode + ((getCreatedAt() == null) ? 0 : getCreatedAt().hashCode());
hashCode = prime * hashCode + ((getDefaultServerSideEncryption() == null) ? 0 : getDefaultServerSideEncryption().hashCode());
hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode());
hashCode = prime * hashCode + ((getOwner() == null) ? 0 : getOwner().hashCode());
hashCode = prime * hashCode + ((getPublicAccess() == null) ? 0 : getPublicAccess().hashCode());
hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode());
return hashCode;
}
@Override
public S3Bucket clone() {
try {
return (S3Bucket) 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.S3BucketMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}