public class COSEncryptionClient extends COSClient implements COSEncryption
clientConfig| 构造器和说明 |
|---|
COSEncryptionClient(COSCredentialsProvider credentialsProvider,
EncryptionMaterialsProvider kekMaterialsProvider,
ClientConfig clientConfig,
CryptoConfiguration cryptoConfig) |
COSEncryptionClient(QCLOUDKMS kms,
COSCredentialsProvider credentialsProvider,
EncryptionMaterialsProvider kekMaterialsProvider,
ClientConfig clientConfig,
CryptoConfiguration cryptoConfig) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
abortMultipartUpload(AbortMultipartUploadRequest req)
Aborts a multipart upload.
|
CompleteMultipartUploadResult |
completeMultipartUpload(CompleteMultipartUploadRequest req)
Completes a multipart upload by assembling previously uploaded parts.
|
CopyPartResult |
copyPart(CopyPartRequest copyPartRequest)
Copies a source object to a part of a multipart upload.
|
void |
deleteObject(DeleteObjectRequest req)
Deletes the specified object in the specified bucket.
|
COSObject |
getObject(GetObjectRequest req)
Gets the object stored in under the specified bucket and key.
|
ObjectMetadata |
getObject(GetObjectRequest req,
File dest)
Gets the object metadata for the object stored in under the specified bucket and key, and
saves the object contents to the specified file.
|
InitiateMultipartUploadResult |
initiateMultipartUpload(InitiateMultipartUploadRequest req)
Initiates a multipart upload and returns an InitiateMultipartUploadResult which contains an
upload ID.
|
PutObjectResult |
putInstructionFile(PutInstructionFileRequest req)
Creates a new crypto instruction file by re-encrypting the CEK of an existing encrypted COS
object with a new encryption material identifiable via a new set of material description.
|
PutObjectResult |
putObject(PutObjectRequest req)
Uploads a new object to the specified bucket.
|
void |
shutdown()
If the a default internal KMS client has been constructed, it will also be shut down by
calling this method.
|
UploadPartResult |
uploadPart(UploadPartRequest uploadPartRequest)
Uploads a part in a multipart upload.
|
appendObject, copyObject, copyObject, createBucket, createBucket, createRequest, deleteBucket, deleteBucket, deleteBucketCrossOriginConfiguration, deleteBucketCrossOriginConfiguration, deleteBucketInventoryConfiguration, deleteBucketInventoryConfiguration, deleteBucketLifecycleConfiguration, deleteBucketLifecycleConfiguration, deleteBucketPolicy, deleteBucketPolicy, deleteBucketReplicationConfiguration, deleteBucketReplicationConfiguration, deleteBucketTaggingConfiguration, deleteBucketTaggingConfiguration, deleteBucketWebsiteConfiguration, deleteBucketWebsiteConfiguration, deleteObject, deleteObjects, deleteVersion, deleteVersion, doesBucketExist, doesObjectExist, generatePresignedUrl, generatePresignedUrl, generatePresignedUrl, getBucketAcl, getBucketAcl, getBucketCrossOriginConfiguration, getBucketCrossOriginConfiguration, getBucketDomainConfiguration, getBucketDomainConfiguration, getBucketInventoryConfiguration, getBucketInventoryConfiguration, getBucketLifecycleConfiguration, getBucketLifecycleConfiguration, getBucketLocation, getBucketLocation, getBucketLoggingConfiguration, getBucketLoggingConfiguration, getBucketPolicy, getBucketPolicy, getBucketReplicationConfiguration, getBucketReplicationConfiguration, getBucketTaggingConfiguration, getBucketTaggingConfiguration, getBucketVersioningConfiguration, getBucketVersioningConfiguration, getBucketWebsiteConfiguration, getBucketWebsiteConfiguration, getClientConfig, getObject, getObjectAcl, getObjectAcl, getObjectMetadata, getObjectMetadata, headBucket, listBucketInventoryConfigurations, listBuckets, listBuckets, listMultipartUploads, listNextBatchOfObjects, listNextBatchOfObjects, listNextBatchOfVersions, listNextBatchOfVersions, listObjects, listObjects, listObjects, listParts, listVersions, listVersions, listVersions, populateRequestMetadata, putObject, putObject, putObject, restoreObject, restoreObject, setBucketAcl, setBucketAcl, setBucketAcl, setBucketCrossOriginConfiguration, setBucketCrossOriginConfiguration, setBucketDomainConfiguration, setBucketDomainConfiguration, setBucketInventoryConfiguration, setBucketInventoryConfiguration, setBucketLifecycleConfiguration, setBucketLifecycleConfiguration, setBucketLoggingConfiguration, setBucketPolicy, setBucketPolicy, setBucketReplicationConfiguration, setBucketReplicationConfiguration, setBucketTaggingConfiguration, setBucketTaggingConfiguration, setBucketVersioningConfiguration, setBucketWebsiteConfiguration, setBucketWebsiteConfiguration, setCOSCredentials, setCOSCredentialsProvider, setObjectAcl, setObjectAcl, setObjectAcl, updateObjectMetaData, uploadObjectInternalpublic COSEncryptionClient(COSCredentialsProvider credentialsProvider, EncryptionMaterialsProvider kekMaterialsProvider, ClientConfig clientConfig, CryptoConfiguration cryptoConfig)
public COSEncryptionClient(QCLOUDKMS kms, COSCredentialsProvider credentialsProvider, EncryptionMaterialsProvider kekMaterialsProvider, ClientConfig clientConfig, CryptoConfiguration cryptoConfig)
public PutObjectResult putObject(PutObjectRequest req)
COS
Uploads a new object to the specified bucket. The PutObjectRequest contains all
the details of the request, including the bucket to upload to, the key the object will be
uploaded under, and the file or input stream containing the data to upload.
never stores partial objects; if during this call an exception wasn't thrown, the entire object was stored.
Depending on whether a file or input stream is being uploaded, this method has slightly different behavior.
When uploading a file:
When uploading directly from an input stream:
The specified bucket must already exist and the caller must have Permission#Write
permission to the bucket to upload an object.
putObject 在接口中 COSputObject 在接口中 COSDirectSpiputObject 在类中 COSClientreq - The request object containing all the parameters to upload a new
object to .PutObjectResult object containing the information returned by for the newly
created object.COS.putObject(String, String, File),
COS.putObject(String, String, InputStream, ObjectMetadata)public COSObject getObject(GetObjectRequest req)
COS
Gets the object stored in under the specified bucket and key. Returns null if
the specified constraints weren't met.
Be extremely careful when using this method; the returned COS object contains a direct stream of data from the HTTP connection. The underlying HTTP connection cannot be closed until the user finishes reading the data and closes the stream. Therefore:
If callers do not follow those rules, then the client can run out of resources if allocating too many open, but unused, HTTP connections.
To get an object from , the caller must have Permission#Read access to the object.
If the object fetched is publicly readable, it can also read it by pasting its URL into a browser.
When specifying constraints in the request object, the client needs to be prepared to handle
this method returning null if the provided constraints aren't met when Qcloud
COS receives the request.
If the advanced options provided in GetObjectRequest aren't needed, use the simpler
COS.getObject(String bucketName, String key) method.
getObject 在接口中 COSgetObject 在接口中 COSDirectSpigetObject 在类中 COSClientreq - The request object containing all the options on how to download the
object.null if
constraints were specified but not met.COS.getObject(String, String),
COS.getObject(GetObjectRequest, File)public ObjectMetadata getObject(GetObjectRequest req, File dest)
COS
Gets the object metadata for the object stored in under the specified bucket and key, and
saves the object contents to the specified file. Returns null if the specified
constraints weren't met.
Instead of using COS.getObject(GetObjectRequest), use this method to ensure that the
underlying HTTP stream resources are automatically closed as soon as possible. The clients
handles immediate storage of the object contents to the specified file.
To get an object from , the caller must have Permission#Read access to the object.
If the object fetched is publicly readable, it can also read it by pasting its URL into a browser.
When specifying constraints in the request object, the client needs to be prepared to handle
this method returning null if the provided constraints aren't met when Qcloud
COS receives the request.
getObject 在接口中 COSgetObject 在接口中 COSDirectSpigetObject 在类中 COSClientreq - The request object containing all the options on how to download the
object content.dest - Indicates the file (which might already exist) where to save the
object content being downloading from .null if
constraints were specified but not met.COS.getObject(String, String),
COS.getObject(GetObjectRequest)public void deleteObject(DeleteObjectRequest req)
COSDeletes the specified object in the specified bucket. Once deleted, the object can only be restored if versioning was enabled when the object was deleted.
If attempting to delete an object that does not exist, will return a success message instead of an error message.
deleteObject 在接口中 COSdeleteObject 在类中 COSClientreq - The request object containing all options for deleting an Qcloud
COS object.COSClient.deleteObject(String, String)public CompleteMultipartUploadResult completeMultipartUpload(CompleteMultipartUploadRequest req)
COS
You first upload all parts using the COS.uploadPart(UploadPartRequest) method. After
successfully uploading all individual parts of an upload, you call this operation to complete
the upload. Upon receiving this request, concatenates all the parts in ascending order by
part number to create a new object. In the CompleteMultipartUpload request, you must provide
the parts list. For each part in the list, you provide the part number and the ETag header
value, returned after that part was uploaded.
Processing of a CompleteMultipartUpload request may take several minutes to complete.
completeMultipartUpload 在接口中 COScompleteMultipartUpload 在接口中 COSDirectSpicompleteMultipartUpload 在类中 COSClientreq - The CompleteMultipartUploadRequest object that specifies all the parameters of
this operation.public InitiateMultipartUploadResult initiateMultipartUpload(InitiateMultipartUploadRequest req)
COSCOS.uploadPart(UploadPartRequest) requests. You also include this
upload ID in the final request to either complete, or abort the multipart upload request.
Note: After you initiate a multipart upload and upload one or more parts, you must either complete or abort the multipart upload in order to stop getting charged for storage of the uploaded parts. Once you complete or abort the multipart upload will release the stored parts and stop charging you for their storage.
initiateMultipartUpload 在接口中 COSinitiateMultipartUpload 在接口中 COSDirectSpiinitiateMultipartUpload 在类中 COSClientreq - The InitiateMultipartUploadRequest object that specifies all the parameters of
this operation.public UploadPartResult uploadPart(UploadPartRequest uploadPartRequest) throws CosClientException, CosServiceException
Your UploadPart request must include an upload ID and a part number. The upload ID is the ID returned by in response to your Initiate Multipart Upload request. Part number can be any number between 1 and 10,000, inclusive. A part number uniquely identifies a part and also defines its position within the object being uploaded. If you upload a new part using the same part number that was specified in uploading a previous part, the previously uploaded part is overwritten.
To ensure data is not corrupted traversing the network, specify the Content-MD5 header in the Upload Part request. checks the part data against the provided MD5 value. If they do not match, returns an error.
When you upload a part, the returned UploadPartResult contains an ETag property. You should record this ETag property value and the part number. After uploading all parts, you must send a CompleteMultipartUpload request. At that time constructs a complete object by concatenating all the parts you uploaded, in ascending order based on the part numbers. The CompleteMultipartUpload request requires you to send all the part numbers and the corresponding ETag values.
Note: After you initiate a multipart upload and upload one or more parts, you must either complete or abort the multipart upload in order to stop getting charged for storage of the uploaded parts. Once you complete or abort the multipart upload will release the stored parts and stop charging you for their storage.
Because the encryption process requires context from block N-1 in order to encrypt block N, parts uploaded with the COSEncryptionClient (as opposed to the normal COSClient) must be uploaded serially, and in order. Otherwise, the previous encryption context isn't available to use when encrypting the current part.
uploadPart 在接口中 COSuploadPart 在接口中 COSDirectSpiuploadPart 在类中 COSClientCosClientException - If any errors are encountered in the client while making the
request or handling the response.CosServiceException - If any errors occurred in while processing the request.public CopyPartResult copyPart(CopyPartRequest copyPartRequest)
COScopyPart 在接口中 COScopyPart 在接口中 COSDirectSpicopyPart 在类中 COSClientcopyPartRequest - The request object containing all the options for copying an object.null if constraints were specified that weren't met when COS
attempted to copy the object.public void abortMultipartUpload(AbortMultipartUploadRequest req)
COSabortMultipartUpload 在接口中 COSabortMultipartUpload 在接口中 COSDirectSpiabortMultipartUpload 在类中 COSClientreq - The AbortMultipartUploadRequest object that specifies all the parameters of
this operation.public PutObjectResult putInstructionFile(PutInstructionFileRequest req)
User of this method is responsible for explicitly deleting/updating the instruction file so created should the corresponding COS object is deleted/created.
Copyright © 2020. All rights reserved.