com.qcloud.cos.model.EncryptedInitiateMultipartUploadRequest Maven / Gradle / Ivy
Show all versions of cos_api Show documentation
package com.qcloud.cos.model;
import java.io.Serializable;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
/**
* This class is an extension of {@link InitiateMultipartUploadRequest} to allow
* additional crypto related attributes to be specified.
*
* In particular, this includes the options to
*
* - specify encryption material description on a per-request basis;
* - specify whether a new set of encryption material is to be created for the
* upload or not;
*
* In particular, {@link EncryptedInitiateMultipartUploadRequest} is only
* recognized by {@link COSEncryptionClient}.
*
*
* If {@link EncryptedInitiateMultipartUploadRequest} is used against the
* non-encrypting {@link COSClient}, these additional attributes will be
* ignored.
*/
public class EncryptedInitiateMultipartUploadRequest extends
InitiateMultipartUploadRequest implements MaterialsDescriptionProvider, Serializable {
/**
* description of encryption materials to be used with this request.
*/
private Map materialsDescription;
/**
* True if a new set of encryption material is to be created; false
* otherwise. Default is true.
*/
private boolean createEncryptionMaterial = true;
public EncryptedInitiateMultipartUploadRequest(String bucketName, String key) {
super(bucketName, key);
}
public EncryptedInitiateMultipartUploadRequest(String bucketName, String key, ObjectMetadata objectMetadata) {
super(bucketName, key, objectMetadata);
}
@Override
public Map getMaterialsDescription() {
return materialsDescription;
}
/**
* sets the materials description for the encryption materials to be used with the current Multi Part Upload Request.
* @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 Multi Part Upload Request.
* @param materialsDescription the materialsDescription to set
*/
public EncryptedInitiateMultipartUploadRequest withMaterialsDescription(Map materialsDescription) {
setMaterialsDescription(materialsDescription);
return this;
}
/**
* Returns true if a new set of encryption material is to be created; false
* otherwise. Default is true.
*/
public boolean isCreateEncryptionMaterial() {
return createEncryptionMaterial;
}
/**
* @param createEncryptionMaterial
* true if a new set of encryption material is to be created;
* false otherwise.
*/
public void setCreateEncryptionMaterial(boolean createEncryptionMaterial) {
this.createEncryptionMaterial = createEncryptionMaterial;
}
/**
* @param createEncryptionMaterial
* true if a new set of encryption material is to be created;
* false otherwise.
*/
public EncryptedInitiateMultipartUploadRequest withCreateEncryptionMaterial(
boolean createEncryptionMaterial) {
this.createEncryptionMaterial = createEncryptionMaterial;
return this;
}
}