com.amazonaws.services.glacier.model.S3Location Maven / Gradle / Ivy
Show all versions of aws-java-sdk-glacier 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.glacier.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* Contains information about the location in Amazon S3 where the select job results are stored.
*
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class S3Location implements Serializable, Cloneable, StructuredPojo {
/**
*
* The name of the Amazon S3 bucket where the job results are stored.
*
*/
private String bucketName;
/**
*
* The prefix that is prepended to the results for this request.
*
*/
private String prefix;
/**
*
* Contains information about the encryption used to store the job results in Amazon S3.
*
*/
private Encryption encryption;
/**
*
* The canned access control list (ACL) to apply to the job results.
*
*/
private String cannedACL;
/**
*
* A list of grants that control access to the staged results.
*
*/
private java.util.List accessControlList;
/**
*
* The tag-set that is applied to the job results.
*
*/
private java.util.Map tagging;
/**
*
* A map of metadata to store with the job results in Amazon S3.
*
*/
private java.util.Map userMetadata;
/**
*
* The storage class used to store the job results.
*
*/
private String storageClass;
/**
*
* The name of the Amazon S3 bucket where the job results are stored.
*
*
* @param bucketName
* The name of the Amazon S3 bucket where the job results are stored.
*/
public void setBucketName(String bucketName) {
this.bucketName = bucketName;
}
/**
*
* The name of the Amazon S3 bucket where the job results are stored.
*
*
* @return The name of the Amazon S3 bucket where the job results are stored.
*/
public String getBucketName() {
return this.bucketName;
}
/**
*
* The name of the Amazon S3 bucket where the job results are stored.
*
*
* @param bucketName
* The name of the Amazon S3 bucket where the job results are stored.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public S3Location withBucketName(String bucketName) {
setBucketName(bucketName);
return this;
}
/**
*
* The prefix that is prepended to the results for this request.
*
*
* @param prefix
* The prefix that is prepended to the results for this request.
*/
public void setPrefix(String prefix) {
this.prefix = prefix;
}
/**
*
* The prefix that is prepended to the results for this request.
*
*
* @return The prefix that is prepended to the results for this request.
*/
public String getPrefix() {
return this.prefix;
}
/**
*
* The prefix that is prepended to the results for this request.
*
*
* @param prefix
* The prefix that is prepended to the results for this request.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public S3Location withPrefix(String prefix) {
setPrefix(prefix);
return this;
}
/**
*
* Contains information about the encryption used to store the job results in Amazon S3.
*
*
* @param encryption
* Contains information about the encryption used to store the job results in Amazon S3.
*/
public void setEncryption(Encryption encryption) {
this.encryption = encryption;
}
/**
*
* Contains information about the encryption used to store the job results in Amazon S3.
*
*
* @return Contains information about the encryption used to store the job results in Amazon S3.
*/
public Encryption getEncryption() {
return this.encryption;
}
/**
*
* Contains information about the encryption used to store the job results in Amazon S3.
*
*
* @param encryption
* Contains information about the encryption used to store the job results in Amazon S3.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public S3Location withEncryption(Encryption encryption) {
setEncryption(encryption);
return this;
}
/**
*
* The canned access control list (ACL) to apply to the job results.
*
*
* @param cannedACL
* The canned access control list (ACL) to apply to the job results.
* @see CannedACL
*/
public void setCannedACL(String cannedACL) {
this.cannedACL = cannedACL;
}
/**
*
* The canned access control list (ACL) to apply to the job results.
*
*
* @return The canned access control list (ACL) to apply to the job results.
* @see CannedACL
*/
public String getCannedACL() {
return this.cannedACL;
}
/**
*
* The canned access control list (ACL) to apply to the job results.
*
*
* @param cannedACL
* The canned access control list (ACL) to apply to the job results.
* @return Returns a reference to this object so that method calls can be chained together.
* @see CannedACL
*/
public S3Location withCannedACL(String cannedACL) {
setCannedACL(cannedACL);
return this;
}
/**
*
* The canned access control list (ACL) to apply to the job results.
*
*
* @param cannedACL
* The canned access control list (ACL) to apply to the job results.
* @return Returns a reference to this object so that method calls can be chained together.
* @see CannedACL
*/
public S3Location withCannedACL(CannedACL cannedACL) {
this.cannedACL = cannedACL.toString();
return this;
}
/**
*
* A list of grants that control access to the staged results.
*
*
* @return A list of grants that control access to the staged results.
*/
public java.util.List getAccessControlList() {
return accessControlList;
}
/**
*
* A list of grants that control access to the staged results.
*
*
* @param accessControlList
* A list of grants that control access to the staged results.
*/
public void setAccessControlList(java.util.Collection accessControlList) {
if (accessControlList == null) {
this.accessControlList = null;
return;
}
this.accessControlList = new java.util.ArrayList(accessControlList);
}
/**
*
* A list of grants that control access to the staged results.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setAccessControlList(java.util.Collection)} or {@link #withAccessControlList(java.util.Collection)} if
* you want to override the existing values.
*
*
* @param accessControlList
* A list of grants that control access to the staged results.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public S3Location withAccessControlList(Grant... accessControlList) {
if (this.accessControlList == null) {
setAccessControlList(new java.util.ArrayList(accessControlList.length));
}
for (Grant ele : accessControlList) {
this.accessControlList.add(ele);
}
return this;
}
/**
*
* A list of grants that control access to the staged results.
*
*
* @param accessControlList
* A list of grants that control access to the staged results.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public S3Location withAccessControlList(java.util.Collection accessControlList) {
setAccessControlList(accessControlList);
return this;
}
/**
*
* The tag-set that is applied to the job results.
*
*
* @return The tag-set that is applied to the job results.
*/
public java.util.Map getTagging() {
return tagging;
}
/**
*
* The tag-set that is applied to the job results.
*
*
* @param tagging
* The tag-set that is applied to the job results.
*/
public void setTagging(java.util.Map tagging) {
this.tagging = tagging;
}
/**
*
* The tag-set that is applied to the job results.
*
*
* @param tagging
* The tag-set that is applied to the job results.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public S3Location withTagging(java.util.Map tagging) {
setTagging(tagging);
return this;
}
/**
* Add a single Tagging entry
*
* @see S3Location#withTagging
* @returns a reference to this object so that method calls can be chained together.
*/
public S3Location addTaggingEntry(String key, String value) {
if (null == this.tagging) {
this.tagging = new java.util.HashMap();
}
if (this.tagging.containsKey(key))
throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided.");
this.tagging.put(key, value);
return this;
}
/**
* Removes all the entries added into Tagging.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public S3Location clearTaggingEntries() {
this.tagging = null;
return this;
}
/**
*
* A map of metadata to store with the job results in Amazon S3.
*
*
* @return A map of metadata to store with the job results in Amazon S3.
*/
public java.util.Map getUserMetadata() {
return userMetadata;
}
/**
*
* A map of metadata to store with the job results in Amazon S3.
*
*
* @param userMetadata
* A map of metadata to store with the job results in Amazon S3.
*/
public void setUserMetadata(java.util.Map userMetadata) {
this.userMetadata = userMetadata;
}
/**
*
* A map of metadata to store with the job results in Amazon S3.
*
*
* @param userMetadata
* A map of metadata to store with the job results in Amazon S3.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public S3Location withUserMetadata(java.util.Map userMetadata) {
setUserMetadata(userMetadata);
return this;
}
/**
* Add a single UserMetadata entry
*
* @see S3Location#withUserMetadata
* @returns a reference to this object so that method calls can be chained together.
*/
public S3Location addUserMetadataEntry(String key, String value) {
if (null == this.userMetadata) {
this.userMetadata = new java.util.HashMap();
}
if (this.userMetadata.containsKey(key))
throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided.");
this.userMetadata.put(key, value);
return this;
}
/**
* Removes all the entries added into UserMetadata.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public S3Location clearUserMetadataEntries() {
this.userMetadata = null;
return this;
}
/**
*
* The storage class used to store the job results.
*
*
* @param storageClass
* The storage class used to store the job results.
* @see StorageClass
*/
public void setStorageClass(String storageClass) {
this.storageClass = storageClass;
}
/**
*
* The storage class used to store the job results.
*
*
* @return The storage class used to store the job results.
* @see StorageClass
*/
public String getStorageClass() {
return this.storageClass;
}
/**
*
* The storage class used to store the job results.
*
*
* @param storageClass
* The storage class used to store the job results.
* @return Returns a reference to this object so that method calls can be chained together.
* @see StorageClass
*/
public S3Location withStorageClass(String storageClass) {
setStorageClass(storageClass);
return this;
}
/**
*
* The storage class used to store the job results.
*
*
* @param storageClass
* The storage class used to store the job results.
* @return Returns a reference to this object so that method calls can be chained together.
* @see StorageClass
*/
public S3Location withStorageClass(StorageClass storageClass) {
this.storageClass = storageClass.toString();
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 (getBucketName() != null)
sb.append("BucketName: ").append(getBucketName()).append(",");
if (getPrefix() != null)
sb.append("Prefix: ").append(getPrefix()).append(",");
if (getEncryption() != null)
sb.append("Encryption: ").append(getEncryption()).append(",");
if (getCannedACL() != null)
sb.append("CannedACL: ").append(getCannedACL()).append(",");
if (getAccessControlList() != null)
sb.append("AccessControlList: ").append(getAccessControlList()).append(",");
if (getTagging() != null)
sb.append("Tagging: ").append(getTagging()).append(",");
if (getUserMetadata() != null)
sb.append("UserMetadata: ").append(getUserMetadata()).append(",");
if (getStorageClass() != null)
sb.append("StorageClass: ").append(getStorageClass());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof S3Location == false)
return false;
S3Location other = (S3Location) obj;
if (other.getBucketName() == null ^ this.getBucketName() == null)
return false;
if (other.getBucketName() != null && other.getBucketName().equals(this.getBucketName()) == false)
return false;
if (other.getPrefix() == null ^ this.getPrefix() == null)
return false;
if (other.getPrefix() != null && other.getPrefix().equals(this.getPrefix()) == false)
return false;
if (other.getEncryption() == null ^ this.getEncryption() == null)
return false;
if (other.getEncryption() != null && other.getEncryption().equals(this.getEncryption()) == false)
return false;
if (other.getCannedACL() == null ^ this.getCannedACL() == null)
return false;
if (other.getCannedACL() != null && other.getCannedACL().equals(this.getCannedACL()) == false)
return false;
if (other.getAccessControlList() == null ^ this.getAccessControlList() == null)
return false;
if (other.getAccessControlList() != null && other.getAccessControlList().equals(this.getAccessControlList()) == false)
return false;
if (other.getTagging() == null ^ this.getTagging() == null)
return false;
if (other.getTagging() != null && other.getTagging().equals(this.getTagging()) == false)
return false;
if (other.getUserMetadata() == null ^ this.getUserMetadata() == null)
return false;
if (other.getUserMetadata() != null && other.getUserMetadata().equals(this.getUserMetadata()) == false)
return false;
if (other.getStorageClass() == null ^ this.getStorageClass() == null)
return false;
if (other.getStorageClass() != null && other.getStorageClass().equals(this.getStorageClass()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getBucketName() == null) ? 0 : getBucketName().hashCode());
hashCode = prime * hashCode + ((getPrefix() == null) ? 0 : getPrefix().hashCode());
hashCode = prime * hashCode + ((getEncryption() == null) ? 0 : getEncryption().hashCode());
hashCode = prime * hashCode + ((getCannedACL() == null) ? 0 : getCannedACL().hashCode());
hashCode = prime * hashCode + ((getAccessControlList() == null) ? 0 : getAccessControlList().hashCode());
hashCode = prime * hashCode + ((getTagging() == null) ? 0 : getTagging().hashCode());
hashCode = prime * hashCode + ((getUserMetadata() == null) ? 0 : getUserMetadata().hashCode());
hashCode = prime * hashCode + ((getStorageClass() == null) ? 0 : getStorageClass().hashCode());
return hashCode;
}
@Override
public S3Location clone() {
try {
return (S3Location) 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.glacier.model.transform.S3LocationMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}