com.amazonaws.RequestClientOptions Java Examples

The following examples show how to use com.amazonaws.RequestClientOptions. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: S3Repository.java    From hawkbit-extensions with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected AbstractDbArtifact store(final String tenant, final DbArtifactHash base16Hashes, final String contentType,
        final String tempFile) throws IOException {
    final File file = new File(tempFile);

    final S3Artifact s3Artifact = createS3Artifact(tenant, base16Hashes, contentType, file);
    final String key = objectKey(tenant, base16Hashes.getSha1());

    LOG.info("Storing file {} with length {} to AWS S3 bucket {} with key {}", file.getName(), file.length(),
            s3Properties.getBucketName(), key);

    if (existsByTenantAndSha1(tenant, base16Hashes.getSha1())) {
        LOG.debug("Artifact {} already exists on S3 bucket {}, don't need to upload twice", key,
                s3Properties.getBucketName());
        return s3Artifact;
    }

    try (final InputStream inputStream = new BufferedInputStream(new FileInputStream(file),
            RequestClientOptions.DEFAULT_STREAM_BUFFER_SIZE)) {
        final ObjectMetadata objectMetadata = createObjectMetadata(base16Hashes.getMd5(), contentType, file);
        final PutObjectResult result = amazonS3.putObject(s3Properties.getBucketName(), key, inputStream,
                objectMetadata);

        LOG.debug("Artifact {} stored on S3 bucket {} with server side Etag {} and MD5 hash {}", key,
                s3Properties.getBucketName(), result.getETag(), result.getContentMd5());

        return s3Artifact;
    } catch (final AmazonClientException e) {
        throw new ArtifactStoreException("Failed to store artifact into S3 ", e);
    }
}
 
Example #2
Source File: KMSProviderBuilderMockTests.java    From aws-encryption-sdk-java with Apache License 2.0 4 votes vote down vote up
private String getUA(AmazonWebServiceRequest request) {
    // Note: This test may break in future versions of the AWS SDK, as Marker is documented as being for internal
    // use only.
    return request.getRequestClientOptions().getClientMarker(RequestClientOptions.Marker.USER_AGENT);
}
 
Example #3
Source File: Request.java    From dynamodb-transactions with Apache License 2.0 4 votes vote down vote up
@JsonIgnore
public abstract RequestClientOptions getRequestClientOptions();
 
Example #4
Source File: Request.java    From dynamodb-transactions with Apache License 2.0 4 votes vote down vote up
@JsonIgnore
public abstract RequestClientOptions getRequestClientOptions();