
com.amazonaws.services.s3.model.EncryptedPutObjectRequest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aws-java-sdk-osgi Show documentation
Show all versions of aws-java-sdk-osgi Show documentation
The AWS SDK for Java with support for OSGi. The AWS SDK for Java provides Java APIs for building software on AWS' cost-effective, scalable, and reliable infrastructure products. The AWS Java SDK allows developers to code against APIs for all of Amazon's infrastructure web services (Amazon S3, Amazon EC2, Amazon SQS, Amazon Relational Database Service, Amazon AutoScaling, etc).
/*
* Copyright 2014-2016 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.s3.model;
import java.io.File;
import java.io.InputStream;
import java.io.Serializable;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import com.amazonaws.services.s3.AmazonS3Client;
import com.amazonaws.services.s3.AmazonS3EncryptionClient;
/**
*
* This class is an extension of {@link PutObjectRequest} to allow additional
* encryption material description to be specified on a per-request basis.In
* particular, {@link EncryptedPutObjectRequest} is only recognized by
* {@link AmazonS3EncryptionClient}.
*
*
* If {@link EncryptedPutObjectRequest} is used against the non-encrypting
* {@link AmazonS3Client}, the additional attributes will be ignored.
*
*/
public class EncryptedPutObjectRequest extends PutObjectRequest implements
MaterialsDescriptionProvider, Serializable {
/**
* description of encryption materials to be used with this request.
*/
private Map materialsDescription;
public EncryptedPutObjectRequest(String bucketName, String key, File file) {
super(bucketName, key, file);
}
public EncryptedPutObjectRequest(String bucketName, String key, String redirectLocation) {
super(bucketName, key, redirectLocation);
}
public EncryptedPutObjectRequest(String bucketName, String key, InputStream input, ObjectMetadata metadata) {
super(bucketName, key, input, metadata);
}
@Override
public Map getMaterialsDescription() {
return materialsDescription;
}
/**
* sets the materials description for the encryption materials to be used with the current PutObjectRequest.
* @param materialsDescription the materialsDescription to set
*/
public void setMaterialsDescription(Map materialsDescription) {
this.materialsDescription = materialsDescription == null
? null
: Collections.unmodifiableMap(new HashMap(materialsDescription))
;
}
/**
* sets the materials description for the encryption materials to be used with the current PutObjectRequest.
* @param materialsDescription the materialsDescription to set
*/
public EncryptedPutObjectRequest withMaterialsDescription(Map materialsDescription) {
setMaterialsDescription(materialsDescription);
return this;
}
/**
* Returns a clone (as deep as possible) of this request object.
*/
@Override
public EncryptedPutObjectRequest clone() {
final EncryptedPutObjectRequest cloned =
new EncryptedPutObjectRequest(
getBucketName(), getKey(), getFile());
super.copyPutObjectBaseTo(cloned);
final Map materialsDescription = getMaterialsDescription();
cloned.withMaterialsDescription(materialsDescription == null
? null
: new HashMap(materialsDescription))
;
return cloned;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy