/** * Creates and returns a {@link PutObjectRequest} for the instruction file * with the specified suffix. */ public PutObjectRequest createPutObjectRequest(S3Object s3Object) { if (!s3Object.getBucketName().equals(s3ObjectId.getBucket()) || !s3Object.getKey().equals(s3ObjectId.getKey())) { throw new IllegalArgumentException("s3Object passed inconsistent with the instruction file being created"); } InstructionFileId ifid= s3ObjectId.instructionFileId(suffix); // ObjectMetadata metadata = s3Object.getObjectMetadata(); return new PutObjectRequest(ifid.getBucket(), ifid.getKey(), redirectLocation) .withAccessControlList(accessControlList) .withCannedAcl(cannedAcl) // .withFile(file) // .withInputStream(inputStream) // don't want the metadata for the new instruction file // .withMetadata(metadata == null ? null : metadata.clone()) .withStorageClass(storageClass) .withGeneralProgressListener(getGeneralProgressListener()) .withRequestMetricCollector(getRequestMetricCollector()) ; } }
.withRequestMetricCollector(req.getRequestMetricCollector())
.withRequesterPays(origReq.isRequesterPays()) .withGeneralProgressListener(origReq.getGeneralProgressListener()) .withRequestMetricCollector(origReq.getRequestMetricCollector())
keyGenReq .withGeneralProgressListener(req.getGeneralProgressListener()) .withRequestMetricCollector(req.getRequestMetricCollector())
.withRequestMetricCollector(origReq.getRequestMetricCollector())
protected InitiateMultipartUploadRequest newInitiateMultipartUploadRequest( UploadObjectRequest req) { return new EncryptedInitiateMultipartUploadRequest( req.getBucketName(), req.getKey(), req.getMetadata()) .withMaterialsDescription(req.getMaterialsDescription()) .withRedirectLocation(req.getRedirectLocation()) .withSSEAwsKeyManagementParams(req.getSSEAwsKeyManagementParams()) .withSSECustomerKey(req.getSSECustomerKey()) .withStorageClass(req.getStorageClass()) .withAccessControlList(req.getAccessControlList()) .withCannedACL(req.getCannedAcl()) .withGeneralProgressListener(req.getGeneralProgressListener()) .withRequestMetricCollector(req.getRequestMetricCollector()) ; }
/** * Creates and returns a multi-part upload initiation request from the given upload-object * request. */ protected final InitiateMultipartUploadRequest newInitiateMultipartUploadRequest( UploadObjectRequest req) { return new InitiateMultipartUploadRequest( req.getBucketName(), req.getKey(), req.getMetadata()) .withRedirectLocation(req.getRedirectLocation()) .withSSEAwsKeyManagementParams(req.getSSEAwsKeyManagementParams()) .withSSECustomerKey(req.getSSECustomerKey()) .withStorageClass(req.getStorageClass()) .withAccessControlList(req.getAccessControlList()) .withCannedACL(req.getCannedAcl()) .withGeneralProgressListener(req.getGeneralProgressListener()) .withRequestMetricCollector(req.getRequestMetricCollector()) ; }
@Override public UploadResult call() throws Exception { CompleteMultipartUploadResult res; try { CompleteMultipartUploadRequest req = new CompleteMultipartUploadRequest( origReq.getBucketName(), origReq.getKey(), uploadId, collectPartETags()) .withRequesterPays(origReq.isRequesterPays()) .withGeneralProgressListener(origReq.getGeneralProgressListener()) .withRequestMetricCollector(origReq.getRequestMetricCollector()) ; res = s3.completeMultipartUpload(req); } catch (Exception e) { monitor.uploadFailure(); publishProgress(listener, ProgressEventType.TRANSFER_FAILED_EVENT); throw e; } UploadResult uploadResult = new UploadResult(); uploadResult.setBucketName(origReq .getBucketName()); uploadResult.setKey(origReq.getKey()); uploadResult.setETag(res.getETag()); uploadResult.setVersionId(res.getVersionId()); monitor.uploadComplete(); return uploadResult; }
.withSSEAwsKeyManagementParams(origReq.getSSEAwsKeyManagementParams()) .withGeneralProgressListener(origReq.getGeneralProgressListener()) .withRequestMetricCollector(origReq.getRequestMetricCollector())
@Override public CopyResult call() throws Exception { CompleteMultipartUploadResult res; try { CompleteMultipartUploadRequest req = new CompleteMultipartUploadRequest( origReq.getDestinationBucketName(), origReq.getDestinationKey(), uploadId, collectPartETags()) .withRequesterPays(origReq.isRequesterPays()) .withGeneralProgressListener(origReq.getGeneralProgressListener()) .withRequestMetricCollector(origReq.getRequestMetricCollector()) ; res = s3.completeMultipartUpload(req); } catch (Exception e) { monitor.reportFailure(); publishProgress(listener, ProgressEventType.TRANSFER_FAILED_EVENT); throw e; } CopyResult copyResult = new CopyResult(); copyResult.setSourceBucketName(origReq.getSourceBucketName()); copyResult.setSourceKey(origReq.getSourceKey()); copyResult.setDestinationBucketName(res .getBucketName()); copyResult.setDestinationKey(res.getKey()); copyResult.setETag(res.getETag()); copyResult.setVersionId(res.getVersionId()); monitor.copyComplete(); return copyResult; }
.withSSEAwsKeyManagementParams(origReq.getSSEAwsKeyManagementParams()) .withGeneralProgressListener(origReq.getGeneralProgressListener()) .withRequestMetricCollector(origReq.getRequestMetricCollector())
.withRequestMetricCollector(origReq.getRequestMetricCollector())
encryptRequest .withGeneralProgressListener(req.getGeneralProgressListener()) .withRequestMetricCollector(req.getRequestMetricCollector()); final EncryptResult encryptResult = kms.encrypt(encryptRequest); final byte[] keyBlob = copyAllBytesFrom(encryptResult.getCiphertextBlob());
keyGenReq .withGeneralProgressListener(req.getGeneralProgressListener()) .withRequestMetricCollector(req.getRequestMetricCollector()); final GenerateDataKeyResult keyGenRes = kms.generateDataKey(keyGenReq); final SecretKey cek =
@SuppressWarnings("checkstyle:hiddenfield") protected InitiateMultipartUploadRequest newInitiateMultipartUploadRequest( UploadObjectRequest req) { return new EncryptedInitiateMultipartUploadRequest( req.getBucketName(), req.getKey(), req.getMetadata()) .withMaterialsDescription(req.getMaterialsDescription()) .withRedirectLocation(req.getRedirectLocation()) .withSSEAwsKeyManagementParams(req.getSSEAwsKeyManagementParams()) .withSSECustomerKey(req.getSSECustomerKey()) .withStorageClass(req.getStorageClass()) .withAccessControlList(req.getAccessControlList()) .withCannedACL(req.getCannedAcl()) .withGeneralProgressListener(req.getGeneralProgressListener()) .withRequestMetricCollector(req.getRequestMetricCollector()); }
/** * Creates and returns a {@link PutObjectRequest} for the instruction file * with the specified suffix. */ public PutObjectRequest createPutObjectRequest(S3Object s3Object) { if (!s3Object.getBucketName().equals(s3ObjectId.getBucket()) || !s3Object.getKey().equals(s3ObjectId.getKey())) { throw new IllegalArgumentException("s3Object passed inconsistent with the instruction file being created"); } InstructionFileId ifid= s3ObjectId.instructionFileId(suffix); // ObjectMetadata metadata = s3Object.getObjectMetadata(); return new PutObjectRequest(ifid.getBucket(), ifid.getKey(), redirectLocation) .withAccessControlList(accessControlList) .withCannedAcl(cannedAcl) // .withFile(file) // .withInputStream(inputStream) // don't want the metadata for the new instruction file // .withMetadata(metadata == null ? null : metadata.clone()) .withStorageClass(storageClass) .withGeneralProgressListener(getGeneralProgressListener()) .withRequestMetricCollector(getRequestMetricCollector()) ; } }
protected InitiateMultipartUploadRequest newInitiateMultipartUploadRequest( UploadObjectRequest req) { return new EncryptedInitiateMultipartUploadRequest( req.getBucketName(), req.getKey(), req.getMetadata()) .withMaterialsDescription(req.getMaterialsDescription()) .withRedirectLocation(req.getRedirectLocation()) .withSSEAwsKeyManagementParams(req.getSSEAwsKeyManagementParams()) .withSSECustomerKey(req.getSSECustomerKey()) .withStorageClass(req.getStorageClass()) .withAccessControlList(req.getAccessControlList()) .withCannedACL(req.getCannedAcl()) .withGeneralProgressListener(req.getGeneralProgressListener()) .withRequestMetricCollector(req.getRequestMetricCollector()) ; }
@SuppressWarnings("checkstyle:hiddenfield") protected InitiateMultipartUploadRequest newInitiateMultipartUploadRequest( UploadObjectRequest req) { return new EncryptedInitiateMultipartUploadRequest( req.getBucketName(), req.getKey(), req.getMetadata()) .withMaterialsDescription(req.getMaterialsDescription()) .withRedirectLocation(req.getRedirectLocation()) .withSSEAwsKeyManagementParams(req.getSSEAwsKeyManagementParams()) .withSSECustomerKey(req.getSSECustomerKey()) .withStorageClass(req.getStorageClass()) .withAccessControlList(req.getAccessControlList()) .withCannedACL(req.getCannedAcl()) .withGeneralProgressListener(req.getGeneralProgressListener()) .withRequestMetricCollector(req.getRequestMetricCollector()); }
/** * Creates and returns a multi-part upload initiation request from the given upload-object * request. */ protected final InitiateMultipartUploadRequest newInitiateMultipartUploadRequest( UploadObjectRequest req) { return new InitiateMultipartUploadRequest( req.getBucketName(), req.getKey(), req.getMetadata()) .withRedirectLocation(req.getRedirectLocation()) .withSSEAwsKeyManagementParams(req.getSSEAwsKeyManagementParams()) .withSSECustomerKey(req.getSSECustomerKey()) .withStorageClass(req.getStorageClass()) .withAccessControlList(req.getAccessControlList()) .withCannedACL(req.getCannedAcl()) .withGeneralProgressListener(req.getGeneralProgressListener()) .withRequestMetricCollector(req.getRequestMetricCollector()) ; }
@Override public UploadResult call() throws Exception { CompleteMultipartUploadResult res; try { CompleteMultipartUploadRequest req = new CompleteMultipartUploadRequest( origReq.getBucketName(), origReq.getKey(), uploadId, collectPartETags()) .withRequesterPays(origReq.isRequesterPays()) .withGeneralProgressListener(origReq.getGeneralProgressListener()) .withRequestMetricCollector(origReq.getRequestMetricCollector()) ; res = s3.completeMultipartUpload(req); } catch (Exception e) { publishProgress(listener, ProgressEventType.TRANSFER_FAILED_EVENT); throw e; } UploadResult uploadResult = new UploadResult(); uploadResult.setBucketName(origReq .getBucketName()); uploadResult.setKey(origReq.getKey()); uploadResult.setETag(res.getETag()); uploadResult.setVersionId(res.getVersionId()); monitor.uploadComplete(); return uploadResult; }