Java 类com.amazonaws.services.s3.model.SetObjectAclRequest 实例源码

项目:ibm-cos-sdk-java    文件:AmazonS3Client.java   
/**
 * Same as {@link #setObjectAcl(String, String, String, AccessControlList)}
 * but allows specifying a request metric collector.
 */
public void setObjectAcl(String bucketName, String key, String versionId,
        AccessControlList acl, RequestMetricCollector requestMetricCollector)
        throws SdkClientException, AmazonServiceException {
    setObjectAcl(new SetObjectAclRequest(bucketName, key, versionId, acl)
            .<SetObjectAclRequest> withRequestMetricCollector(requestMetricCollector));
}
项目:ibm-cos-sdk-java    文件:AmazonS3Client.java   
/**
 * Same as {@link #setObjectAcl(String, String, String, CannedAccessControlList)}
 * but allows specifying a request metric collector.
 */
public void setObjectAcl(String bucketName, String key, String versionId,
        CannedAccessControlList acl,
        RequestMetricCollector requestMetricCollector) {
    setObjectAcl(new SetObjectAclRequest(bucketName, key, versionId, acl)
            .<SetObjectAclRequest> withRequestMetricCollector(requestMetricCollector));
}
项目:ibm-cos-sdk-java    文件:AmazonS3Client.java   
@Override
public void setObjectAcl(SetObjectAclRequest setObjectAclRequest)
        throws SdkClientException, AmazonServiceException {
    setObjectAclRequest = beforeClientExecution(setObjectAclRequest);
    rejectNull(setObjectAclRequest,
            "The request must not be null.");
    rejectNull(setObjectAclRequest.getBucketName(),
            "The bucket name parameter must be specified when setting an object's ACL");
    rejectNull(setObjectAclRequest.getKey(),
            "The key parameter must be specified when setting an object's ACL");

    if (setObjectAclRequest.getAcl() != null && setObjectAclRequest.getCannedAcl() != null) {
        throw new IllegalArgumentException(
                "Only one of the ACL and CannedACL parameters can be specified, not both.");
    }

    if (setObjectAclRequest.getAcl() != null) {
        setAcl(setObjectAclRequest.getBucketName(),
               setObjectAclRequest.getKey(),
               setObjectAclRequest.getVersionId(),
               setObjectAclRequest.getAcl(),
               setObjectAclRequest.isRequesterPays(),
               setObjectAclRequest);

    } else if (setObjectAclRequest.getCannedAcl() != null) {
        setAcl(setObjectAclRequest.getBucketName(),
               setObjectAclRequest.getKey(),
               setObjectAclRequest.getVersionId(),
               setObjectAclRequest.getCannedAcl(),
               setObjectAclRequest.isRequesterPays(),
               setObjectAclRequest);

    } else {
        throw new IllegalArgumentException(
                "At least one of the ACL and CannedACL parameters should be specified");
    }
}
项目:elasticsearch_my    文件:AmazonS3Wrapper.java   
@Override
public void setObjectAcl(SetObjectAclRequest setObjectAclRequest) throws AmazonClientException, AmazonServiceException {
    delegate.setObjectAcl(setObjectAclRequest);
}
项目:ibm-cos-sdk-java    文件:AmazonS3Client.java   
@Override
public void setObjectAcl(String bucketName, String key, String versionId, AccessControlList acl)
        throws SdkClientException, AmazonServiceException {
    setObjectAcl(new SetObjectAclRequest(bucketName, key, versionId, acl));
}
项目:ibm-cos-sdk-java    文件:AmazonS3Client.java   
@Override
public void setObjectAcl(String bucketName, String key, String versionId, CannedAccessControlList acl)
        throws SdkClientException, AmazonServiceException {
    setObjectAcl(new SetObjectAclRequest(bucketName, key, versionId, acl));
}
项目:S3Decorators    文件:S3Decorator.java   
@Override
public void setObjectAcl(SetObjectAclRequest setObjectAclRequest) throws SdkClientException, AmazonServiceException {
  run(() -> getDelegate().setObjectAcl(setObjectAclRequest));
}
项目:spring-cloud-stream-app-starters    文件:AmazonS3SinkMockTests.java   
@Test
@Override
public void test() throws Exception {
    AmazonS3 amazonS3Client = TestUtils.getPropertyValue(this.s3MessageHandler, "transferManager.s3",
            AmazonS3.class);

    File file = this.temporaryFolder.newFile("foo.mp3");
    Message<?> message = MessageBuilder.withPayload(file)
            .build();

    this.channels.input().send(message);

    ArgumentCaptor<PutObjectRequest> putObjectRequestArgumentCaptor =
            ArgumentCaptor.forClass(PutObjectRequest.class);
    verify(amazonS3Client, atLeastOnce()).putObject(putObjectRequestArgumentCaptor.capture());

    PutObjectRequest putObjectRequest = putObjectRequestArgumentCaptor.getValue();
    assertThat(putObjectRequest.getBucketName(), equalTo(S3_BUCKET));
    assertThat(putObjectRequest.getKey(), equalTo("foo.mp3"));
    assertNotNull(putObjectRequest.getFile());
    assertNull(putObjectRequest.getInputStream());

    ObjectMetadata metadata = putObjectRequest.getMetadata();
    assertThat(metadata.getContentMD5(), equalTo(Md5Utils.md5AsBase64(file)));
    assertThat(metadata.getContentLength(), equalTo(0L));
    assertThat(metadata.getContentType(), equalTo("audio/mpeg"));

    ProgressListener listener = putObjectRequest.getGeneralProgressListener();
    S3ProgressPublisher.publishProgress(listener, ProgressEventType.TRANSFER_COMPLETED_EVENT);

    assertTrue(this.transferCompletedLatch.await(10, TimeUnit.SECONDS));
    assertTrue(this.aclLatch.await(10, TimeUnit.SECONDS));

    ArgumentCaptor<SetObjectAclRequest> setObjectAclRequestArgumentCaptor =
            ArgumentCaptor.forClass(SetObjectAclRequest.class);
    verify(amazonS3Client).setObjectAcl(setObjectAclRequestArgumentCaptor.capture());

    SetObjectAclRequest setObjectAclRequest = setObjectAclRequestArgumentCaptor.getValue();

    assertThat(setObjectAclRequest.getBucketName(), equalTo(S3_BUCKET));
    assertThat(setObjectAclRequest.getKey(), equalTo("foo.mp3"));
    assertNull(setObjectAclRequest.getAcl());
    assertThat(setObjectAclRequest.getCannedAcl(), equalTo(CannedAccessControlList.PublicReadWrite));
}
项目:presto    文件:MockAmazonS3.java   
@Override
public void setObjectAcl(SetObjectAclRequest setObjectAclRequest)
        throws AmazonClientException
{
}