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

项目:ibm-cos-sdk-java    文件:AmazonS3Client.java   
/**
 * Retrieves the region of the bucket by making a HeadBucket request to us-west-1 region.
 *
 * Currently S3 doesn't return region in a HEAD Bucket request if the bucket
 * owner has enabled bucket to accept only SigV4 requests via bucket
 * policies.
 */
private String getBucketRegionViaHeadRequest(String bucketName) {
    String bucketRegion = null;

    try {
        Request<HeadBucketRequest> request = createRequest(bucketName, null,
                new HeadBucketRequest(bucketName), HttpMethodName.HEAD);

        HeadBucketResult result = invoke(request, new HeadBucketResultHandler(), bucketName, null, true);
        bucketRegion = result.getBucketRegion();
    } catch (AmazonS3Exception exception) {
        if (exception.getAdditionalDetails() != null) {
            bucketRegion = exception.getAdditionalDetails().get(
                Headers.S3_BUCKET_REGION);
        }
    }

    if (bucketRegion == null && log.isDebugEnabled()) {
        log.debug("Not able to derive region of the " + bucketName + " from the HEAD Bucket requests.");
    }

    return bucketRegion;
}
项目:ibm-cos-sdk-java    文件:HeadBucketResultHandler.java   
@Override
public AmazonWebServiceResponse<HeadBucketResult> handle(HttpResponse response)
        throws Exception {
    final AmazonWebServiceResponse<HeadBucketResult> awsResponse = new AmazonWebServiceResponse<HeadBucketResult>();
    final HeadBucketResult result = new HeadBucketResult();
    result.setBucketRegion(response.getHeaders().get(Headers.S3_BUCKET_REGION));

    if (!StringUtils.isNullOrEmpty(response.getHeaders().get(Headers.IBM_SSE_KP_ENABLED))){
        result.setIBMSSEKPEnabled(Boolean.parseBoolean(response.getHeaders().get(Headers.IBM_SSE_KP_ENABLED)));
    }
    if (!StringUtils.isNullOrEmpty(response.getHeaders().get(Headers.IBM_SSE_KP_CUSTOMER_ROOT_KEY_CRN))){
        result.setIBMSSEKPCrk(response.getHeaders().get(Headers.IBM_SSE_KP_CUSTOMER_ROOT_KEY_CRN));
    }
    awsResponse.setResult(result);

    return awsResponse;
}
项目:ibm-cos-sdk-java    文件:AmazonS3Client.java   
@Override
public HeadBucketResult headBucket(HeadBucketRequest headBucketRequest)
        throws SdkClientException, AmazonServiceException {
    headBucketRequest = beforeClientExecution(headBucketRequest);
    String bucketName = headBucketRequest.getBucketName();

    rejectNull(bucketName,
            "The bucketName parameter must be specified.");

    Request<HeadBucketRequest> request = createRequest(bucketName, null,
            headBucketRequest, HttpMethodName.HEAD);

    return invoke(request, new HeadBucketResultHandler(), bucketName, null);
}
项目:elasticsearch_my    文件:AmazonS3Wrapper.java   
@Override
public HeadBucketResult headBucket(HeadBucketRequest headBucketRequest) throws AmazonClientException, AmazonServiceException {
    return delegate.headBucket(headBucketRequest);
}
项目:S3Decorators    文件:S3Decorator.java   
@Override
public HeadBucketResult headBucket(HeadBucketRequest headBucketRequest) throws SdkClientException, AmazonServiceException {
  return call(() -> getDelegate().headBucket(headBucketRequest));
}
项目:ibm-cos-sdk-java    文件:HeadBucketFunction.java   
/**
 * Makes a call to the operation specified by the waiter by taking the
 * corresponding request and returns the corresponding result
 * 
 * @param headBucketRequest
 *        Corresponding request for the operation
 * @return Corresponding result of the operation
 */
@Override
public HeadBucketResult apply(HeadBucketRequest headBucketRequest) {
    return client.headBucket(headBucketRequest);
}