Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2010-2015 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;
 
 
Container for the parameters to the UploadArchive operation.

This operation adds an archive to a vault. This is a synchronous operation, and for a successful upload, your data is durably persisted. Amazon Glacier returns the archive ID in the x-amz-archive-id header of the response.

You must use the archive ID to access your data in Amazon Glacier. After you upload an archive, you should save the archive ID returned so that you can retrieve or delete the archive later. Besides saving the archive ID, you can also index it and give it a friendly name to allow for better searching. You can also use the optional archive description field to specify how the archive is referred to in an external index of archives, such as you might create in Amazon DynamoDB. You can also get the vault inventory to obtain a list of archive IDs in a vault. For more information, see InitiateJob.

You must provide a SHA256 tree hash of the data you are uploading. For information about computing a SHA256 tree hash, see Computing Checksums .

You can optionally specify an archive description of up to 1,024 printable ASCII characters. You can get the archive description when you either retrieve the archive or get the vault inventory. For more information, see InitiateJob. Amazon Glacier does not interpret the description in any way. An archive description does not need to be unique. You cannot use the description to retrieve or sort the archive list.

Archives are immutable. After you upload an archive, you cannot edit the archive or its description.

An AWS account has full permission to perform all operations (actions). However, AWS Identity and Access Management (IAM) users don't have any permissions by default. You must grant them explicit permission to perform specific actions. For more information, see Access Control Using AWS Identity and Access Management (IAM) .

For conceptual information and underlying REST API, go to Uploading an Archive in Amazon Glacier and Upload Archive in the Amazon Glacier Developer Guide .

 
 public class UploadArchiveRequest extends AmazonWebServiceRequest implements SerializableCloneable {
 
     private Long contentLength;

    
The name of the vault.
 
     private String vaultName;

    
The AccountId is the AWS Account ID. You can specify either the AWS Account ID or optionally a '-', in which case Amazon Glacier uses the AWS Account ID associated with the credentials used to sign the request. If you specify your Account ID, do not include hyphens in it.
 
     private String accountId;

    
The optional description of the archive you are uploading.
 
     private String archiveDescription;

    
The SHA256 tree hash of the data being uploaded.
    private String checksum;

    
The data to upload. This stream must implement mark/reset in order for signature calculation to be performed before this data is read for the request payload.
    private java.io.InputStream body;

    
Default constructor for a new UploadArchiveRequest object. Callers should use the setter or fluent setter (with...) methods to initialize this object after creating it.
    public UploadArchiveRequest() {}
    
    
Constructs a new UploadArchiveRequest object. Callers should use the setter or fluent setter (with...) methods to initialize any additional object members.

Parameters:
vaultName The name of the vault.
archiveDescription The optional description of the archive you are uploading.
checksum The SHA256 tree hash of the data being uploaded.
body The data to upload.
    public UploadArchiveRequest(String vaultNameString archiveDescriptionString checksumjava.io.InputStream body) {
        setVaultName(vaultName);
        setArchiveDescription(archiveDescription);
        setChecksum(checksum);
        setBody(body);
    }

    
Constructs a new UploadArchiveRequest object. Callers should use the setter or fluent setter (with...) methods to initialize any additional object members.

Parameters:
vaultName The name of the vault.
accountId The AccountId is the AWS Account ID. You can specify either the AWS Account ID or optionally a '-', in which case Amazon Glacier uses the AWS Account ID associated with the credentials used to sign the request. If you specify your Account ID, do not include hyphens in it.
archiveDescription The optional description of the archive you are uploading.
checksum The SHA256 tree hash of the data being uploaded.
body The data to upload.
    public UploadArchiveRequest(String vaultNameString accountIdString archiveDescriptionString checksumjava.io.InputStream body) {
        setVaultName(vaultName);
        setAccountId(accountId);
        setArchiveDescription(archiveDescription);
        setChecksum(checksum);
        setBody(body);
    }

    
Returns the value of the ContentLength property for this object.

Returns:
The value of the ContentLength property for this object.
    public Long getContentLength() {
        return ;
    }
    
    
Sets the value of the ContentLength property for this object.

Parameters:
contentLength The new value for the ContentLength property for this object.
    public void setContentLength(Long contentLength) {
        this. = contentLength;
    }
    
    
Sets the value of the ContentLength property for this object.

Returns a reference to this object so that method calls can be chained together.

Parameters:
contentLength The new value for the ContentLength property for this object.
Returns:
A reference to this updated object so that method calls can be chained together.
    public UploadArchiveRequest withContentLength(Long contentLength) {
        this. = contentLength;
        return this;
    }

    
The name of the vault.

Returns:
The name of the vault.
    public String getVaultName() {
        return ;
    }
    
    
The name of the vault.

Parameters:
vaultName The name of the vault.
    public void setVaultName(String vaultName) {
        this. = vaultName;
    }
    
    
The name of the vault.

Returns a reference to this object so that method calls can be chained together.

Parameters:
vaultName The name of the vault.
Returns:
A reference to this updated object so that method calls can be chained together.
    public UploadArchiveRequest withVaultName(String vaultName) {
        this. = vaultName;
        return this;
    }

    
The AccountId is the AWS Account ID. You can specify either the AWS Account ID or optionally a '-', in which case Amazon Glacier uses the AWS Account ID associated with the credentials used to sign the request. If you specify your Account ID, do not include hyphens in it.

Returns:
The AccountId is the AWS Account ID. You can specify either the AWS Account ID or optionally a '-', in which case Amazon Glacier uses the AWS Account ID associated with the credentials used to sign the request. If you specify your Account ID, do not include hyphens in it.
    public String getAccountId() {
        return ;
    }
    
    
The AccountId is the AWS Account ID. You can specify either the AWS Account ID or optionally a '-', in which case Amazon Glacier uses the AWS Account ID associated with the credentials used to sign the request. If you specify your Account ID, do not include hyphens in it.

Parameters:
accountId The AccountId is the AWS Account ID. You can specify either the AWS Account ID or optionally a '-', in which case Amazon Glacier uses the AWS Account ID associated with the credentials used to sign the request. If you specify your Account ID, do not include hyphens in it.
    public void setAccountId(String accountId) {
        this. = accountId;
    }
    
    
The AccountId is the AWS Account ID. You can specify either the AWS Account ID or optionally a '-', in which case Amazon Glacier uses the AWS Account ID associated with the credentials used to sign the request. If you specify your Account ID, do not include hyphens in it.

Returns a reference to this object so that method calls can be chained together.

Parameters:
accountId The AccountId is the AWS Account ID. You can specify either the AWS Account ID or optionally a '-', in which case Amazon Glacier uses the AWS Account ID associated with the credentials used to sign the request. If you specify your Account ID, do not include hyphens in it.
Returns:
A reference to this updated object so that method calls can be chained together.
    public UploadArchiveRequest withAccountId(String accountId) {
        this. = accountId;
        return this;
    }

    
The optional description of the archive you are uploading.

Returns:
The optional description of the archive you are uploading.
    public String getArchiveDescription() {
        return ;
    }
    
    
The optional description of the archive you are uploading.

Parameters:
archiveDescription The optional description of the archive you are uploading.
    public void setArchiveDescription(String archiveDescription) {
        this. = archiveDescription;
    }
    
    
The optional description of the archive you are uploading.

Returns a reference to this object so that method calls can be chained together.

Parameters:
archiveDescription The optional description of the archive you are uploading.
Returns:
A reference to this updated object so that method calls can be chained together.
    public UploadArchiveRequest withArchiveDescription(String archiveDescription) {
        this. = archiveDescription;
        return this;
    }

    
The SHA256 tree hash of the data being uploaded.

Returns:
The SHA256 tree hash of the data being uploaded.
    public String getChecksum() {
        return ;
    }
    
    
The SHA256 tree hash of the data being uploaded.

Parameters:
checksum The SHA256 tree hash of the data being uploaded.
    public void setChecksum(String checksum) {
        this. = checksum;
    }
    
    
The SHA256 tree hash of the data being uploaded.

Returns a reference to this object so that method calls can be chained together.

Parameters:
checksum The SHA256 tree hash of the data being uploaded.
Returns:
A reference to this updated object so that method calls can be chained together.
    public UploadArchiveRequest withChecksum(String checksum) {
        this. = checksum;
        return this;
    }

    
The data to upload. This stream must implement mark/reset in order for signature calculation to be performed before this data is read for the request payload.

Returns:
The data to upload.
    public java.io.InputStream getBody() {
        return ;
    }
    
    
The data to upload. This stream must implement mark/reset in order for signature calculation to be performed before this data is read for the request payload.

Parameters:
body The data to upload.
    public void setBody(java.io.InputStream body) {
        this. = body;
    }
    
    
The data to upload. This stream must implement mark/reset in order for signature calculation to be performed before this data is read for the request payload.

Returns a reference to this object so that method calls can be chained together.

Parameters:
body The data to upload.
Returns:
A reference to this updated object so that method calls can be chained together.
        this. = body;
        return this;
    }

    
Returns a string representation of this object; useful for testing and debugging.

Returns:
A string representation of this object.
See also:
java.lang.Object.toString()
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getContentLength() != nullsb.append("ContentLength: " + getContentLength() + ",");
        if (getVaultName() != nullsb.append("VaultName: " + getVaultName() + ",");
        if (getAccountId() != nullsb.append("AccountId: " + getAccountId() + ",");
        if (getArchiveDescription() != nullsb.append("ArchiveDescription: " + getArchiveDescription() + ",");
        if (getChecksum() != nullsb.append("Checksum: " + getChecksum() + ",");
        if (getBody() != nullsb.append("Body: " + getBody() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getContentLength() == null) ? 0 : getContentLength().hashCode()); 
        hashCode = prime * hashCode + ((getVaultName() == null) ? 0 : getVaultName().hashCode()); 
        hashCode = prime * hashCode + ((getAccountId() == null) ? 0 : getAccountId().hashCode()); 
        hashCode = prime * hashCode + ((getArchiveDescription() == null) ? 0 : getArchiveDescription().hashCode()); 
        hashCode = prime * hashCode + ((getChecksum() == null) ? 0 : getChecksum().hashCode()); 
        hashCode = prime * hashCode + ((getBody() == null) ? 0 : getBody().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof UploadArchiveRequest == falsereturn false;
        UploadArchiveRequest other = (UploadArchiveRequest)obj;
        
        if (other.getContentLength() == null ^ this.getContentLength() == nullreturn false;
        if (other.getContentLength() != null && other.getContentLength().equals(this.getContentLength()) == falsereturn false
        if (other.getVaultName() == null ^ this.getVaultName() == nullreturn false;
        if (other.getVaultName() != null && other.getVaultName().equals(this.getVaultName()) == falsereturn false
        if (other.getAccountId() == null ^ this.getAccountId() == nullreturn false;
        if (other.getAccountId() != null && other.getAccountId().equals(this.getAccountId()) == falsereturn false
        if (other.getArchiveDescription() == null ^ this.getArchiveDescription() == nullreturn false;
        if (other.getArchiveDescription() != null && other.getArchiveDescription().equals(this.getArchiveDescription()) == falsereturn false
        if (other.getChecksum() == null ^ this.getChecksum() == nullreturn false;
        if (other.getChecksum() != null && other.getChecksum().equals(this.getChecksum()) == falsereturn false
        if (other.getBody() == null ^ this.getBody() == nullreturn false;
        if (other.getBody() != null && other.getBody().equals(this.getBody()) == falsereturn false
        return true;
    }
    
    @Override
    public UploadArchiveRequest clone() {
        
            return (UploadArchiveRequestsuper.clone();
    }
}
    
New to GrepCode? Check out our FAQ X