Search in sources :

Example 1 with DeleteBucketResponse

use of software.amazon.awssdk.services.s3.model.DeleteBucketResponse in project newrelic-java-agent by newrelic.

the class S3AsyncClient_Instrumentation method deleteBucket.

public CompletableFuture<DeleteBucketResponse> deleteBucket(DeleteBucketRequest deleteBucketRequest) {
    String uri = "s3://" + deleteBucketRequest.bucket();
    Segment segment = NewRelic.getAgent().getTransaction().startSegment("S3", "deleteBucket");
    AgentBridge.getAgent().getTracedMethod().setTrackChildThreads(false);
    CompletableFuture<DeleteBucketResponse> result = Weaver.callOriginal();
    return result.whenComplete(new S3ResponseResultWrapper<>(segment, uri, "deleteBucket"));
}
Also used : DeleteBucketResponse(software.amazon.awssdk.services.s3.model.DeleteBucketResponse) Segment(com.newrelic.api.agent.Segment)

Example 2 with DeleteBucketResponse

use of software.amazon.awssdk.services.s3.model.DeleteBucketResponse in project newrelic-java-agent by newrelic.

the class S3Client_Instrumentation method deleteBucket.

@Trace
public DeleteBucketResponse deleteBucket(DeleteBucketRequest deleteBucketRequest) {
    String uri = "s3://" + deleteBucketRequest.bucket();
    try {
        DeleteBucketResponse deleteBucketResponse = Weaver.callOriginal();
        S3MetricUtil.reportExternalMetrics(NewRelic.getAgent().getTracedMethod(), uri, deleteBucketResponse, "deleteBucket");
        return deleteBucketResponse;
    } catch (Exception e) {
        S3MetricUtil.reportExternalMetrics(NewRelic.getAgent().getTracedMethod(), uri, "deleteBucket");
        throw e;
    }
}
Also used : DeleteBucketResponse(software.amazon.awssdk.services.s3.model.DeleteBucketResponse) NoSuchKeyException(software.amazon.awssdk.services.s3.model.NoSuchKeyException) S3Exception(software.amazon.awssdk.services.s3.model.S3Exception) AwsServiceException(software.amazon.awssdk.awscore.exception.AwsServiceException) SdkClientException(software.amazon.awssdk.core.exception.SdkClientException) Trace(com.newrelic.api.agent.Trace)

Example 3 with DeleteBucketResponse

use of software.amazon.awssdk.services.s3.model.DeleteBucketResponse in project jeesuite-libs by vakinge.

the class AwsProvider method delete.

@Override
public boolean delete(String bucketName, String fileKey) {
    try {
        DeleteBucketRequest deleteBucketRequest = DeleteBucketRequest.builder().bucket(bucketName).build();
        DeleteBucketResponse deleteBucketResponse = s3Client.deleteBucket(deleteBucketRequest);
        return deleteBucketResponse.sdkHttpResponse().isSuccessful();
    } catch (Exception e) {
        LOGGER.error("删除Bucket[{}]出错, e={}", bucketName, ExceptionUtils.getMessage(e), e);
    }
    return false;
}
Also used : DeleteBucketResponse(software.amazon.awssdk.services.s3.model.DeleteBucketResponse) DeleteBucketRequest(software.amazon.awssdk.services.s3.model.DeleteBucketRequest) JeesuiteBaseException(com.mendmix.common.JeesuiteBaseException)

Aggregations

DeleteBucketResponse (software.amazon.awssdk.services.s3.model.DeleteBucketResponse)3 JeesuiteBaseException (com.mendmix.common.JeesuiteBaseException)1 Segment (com.newrelic.api.agent.Segment)1 Trace (com.newrelic.api.agent.Trace)1 AwsServiceException (software.amazon.awssdk.awscore.exception.AwsServiceException)1 SdkClientException (software.amazon.awssdk.core.exception.SdkClientException)1 DeleteBucketRequest (software.amazon.awssdk.services.s3.model.DeleteBucketRequest)1 NoSuchKeyException (software.amazon.awssdk.services.s3.model.NoSuchKeyException)1 S3Exception (software.amazon.awssdk.services.s3.model.S3Exception)1