Search in sources :

Example 1 with GetObjectMetadataRequest

use of com.amazonaws.services.s3.model.GetObjectMetadataRequest in project hadoop by apache.

the class S3AFileSystem method getObjectMetadata.

/**
   * Request object metadata; increments counters in the process.
   * @param key key
   * @return the metadata
   */
protected ObjectMetadata getObjectMetadata(String key) {
    incrementStatistic(OBJECT_METADATA_REQUESTS);
    GetObjectMetadataRequest request = new GetObjectMetadataRequest(bucket, key);
    //SSE-C requires to be filled in if enabled for object metadata
    if (S3AEncryptionMethods.SSE_C.equals(serverSideEncryptionAlgorithm) && StringUtils.isNotBlank(getServerSideEncryptionKey(getConf()))) {
        request.setSSECustomerKey(generateSSECustomerKey());
    }
    ObjectMetadata meta = s3.getObjectMetadata(request);
    incrementReadOperations();
    return meta;
}
Also used : GetObjectMetadataRequest(com.amazonaws.services.s3.model.GetObjectMetadataRequest) ObjectMetadata(com.amazonaws.services.s3.model.ObjectMetadata)

Example 2 with GetObjectMetadataRequest

use of com.amazonaws.services.s3.model.GetObjectMetadataRequest in project YCSB by brianfrankcooper.

the class S3Client method getS3ObjectAndMetadata.

private Map.Entry<S3Object, ObjectMetadata> getS3ObjectAndMetadata(String bucket, String key, SSECustomerKey ssecLocal) {
    GetObjectRequest getObjectRequest;
    GetObjectMetadataRequest getObjectMetadataRequest;
    if (ssecLocal != null) {
        getObjectRequest = new GetObjectRequest(bucket, key).withSSECustomerKey(ssecLocal);
        getObjectMetadataRequest = new GetObjectMetadataRequest(bucket, key).withSSECustomerKey(ssecLocal);
    } else {
        getObjectRequest = new GetObjectRequest(bucket, key);
        getObjectMetadataRequest = new GetObjectMetadataRequest(bucket, key);
    }
    return new AbstractMap.SimpleEntry<>(s3Client.getObject(getObjectRequest), s3Client.getObjectMetadata(getObjectMetadataRequest));
}
Also used : GetObjectMetadataRequest(com.amazonaws.services.s3.model.GetObjectMetadataRequest) GetObjectRequest(com.amazonaws.services.s3.model.GetObjectRequest)

Aggregations

GetObjectMetadataRequest (com.amazonaws.services.s3.model.GetObjectMetadataRequest)2 GetObjectRequest (com.amazonaws.services.s3.model.GetObjectRequest)1 ObjectMetadata (com.amazonaws.services.s3.model.ObjectMetadata)1