Example usage for com.amazonaws Response getAwsResponse

List of usage examples for com.amazonaws Response getAwsResponse

Introduction

In this page you can find the example usage for com.amazonaws Response getAwsResponse.

Prototype

public T getAwsResponse() 

Source Link

Usage

From source file:com.github.sjones4.youcan.youtoken.YouTokenClient.java

License:Open Source License

@Override
public GetImpersonationTokenResult getImpersonationToken(
        final GetImpersonationTokenRequest getImpersonationTokenRequest)
        throws AmazonServiceException, AmazonClientException {
    ExecutionContext executionContext = createExecutionContext(getImpersonationTokenRequest);
    AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
    Request<GetImpersonationTokenRequest> request = null;
    Response<GetImpersonationTokenResult> response = null;
    awsRequestMetrics.startEvent(AWSRequestMetrics.Field.ClientExecuteTime);
    try {/*from w ww.  ja v  a2s  .c  o  m*/
        request = new GetImpersonationTokenRequestMarshaller().marshall(getImpersonationTokenRequest);
        // Binds the request metrics to the current request.
        request.setAWSRequestMetrics(awsRequestMetrics);
        response = invoke(request, new GetImpersonationTokenResultStaxUnmarshaller(), executionContext);
        return response.getAwsResponse();
    } finally {
        endClientExecution(awsRequestMetrics, request, response);
    }
}

From source file:com.github.sjones4.youcan.youtwo.YouTwoClient.java

License:Open Source License

public DescribeInstanceTypesResult describeInstanceTypes(
        DescribeInstanceTypesRequest describeInstanceTypesRequest) throws AmazonClientException {
    ExecutionContext executionContext = createExecutionContext(describeInstanceTypesRequest);
    AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
    Request<DescribeInstanceTypesRequest> request = null;
    Response<DescribeInstanceTypesResult> response = null;
    awsRequestMetrics.startEvent(AWSRequestMetrics.Field.ClientExecuteTime);
    try {//from w  w  w  .  j  ava  2  s. c om
        request = new DescribeInstanceTypesRequestMarshaller().marshall(describeInstanceTypesRequest);
        // Binds the request metrics to the current request.
        request.setAWSRequestMetrics(awsRequestMetrics);
        response = invoke(request, new DescribeInstanceTypesResultStaxUnmarshaller(), executionContext);
        return response.getAwsResponse();
    } finally {
        endClientExecution(awsRequestMetrics, request, response);
    }
}

From source file:com.ivona.services.tts.IvonaSpeechCloudClient.java

License:Open Source License

@Override
public CreateSpeechResult createSpeech(CreateSpeechRequest createSpeechRequest)
        throws AmazonServiceException, AmazonClientException {

    ExecutionContext executionContext = createExecutionContext(createSpeechRequest);
    Request<CreateSpeechRequest> request = CreateSpeechRequestMarshallerFactory
            .getMarshaller(createSpeechRequest.getMethodType()).marshall(createSpeechRequest);
    CreateSpeechResultUnmarshaller unmarshaller = new CreateSpeechResultUnmarshaller();
    StreamResponseHandler<CreateSpeechResult> responseHandler = new StreamResponseHandler<CreateSpeechResult>(
            unmarshaller);//from   w  w w . j ava2 s.c om
    Response<CreateSpeechResult> response = invoke(request, responseHandler, executionContext);
    return response.getAwsResponse();
}

From source file:com.ivona.services.tts.IvonaSpeechCloudClient.java

License:Open Source License

@Override
public ListVoicesResult listVoices(ListVoicesRequest listVoicesRequest)
        throws AmazonServiceException, AmazonClientException {

    ExecutionContext executionContext = createExecutionContext(listVoicesRequest);
    Request<ListVoicesRequest> request = ListVoicesRequestMarshallerFactory
            .getMarshaller(listVoicesRequest.getMethodType()).marshall(listVoicesRequest);
    Unmarshaller<ListVoicesResult, JsonUnmarshallerContext> unmarshaller = new ListVoicesResultJsonUnmarshaller();
    JsonResponseHandler<ListVoicesResult> responseHandler = new JsonResponseHandler<ListVoicesResult>(
            unmarshaller);/*from w  ww  .j  a  v a2  s. c o  m*/
    Response<ListVoicesResult> response = invoke(request, responseHandler, executionContext);
    return response.getAwsResponse();
}

From source file:com.ivona.services.tts.IvonaSpeechCloudClient.java

License:Open Source License

@Override
public GetLexiconResult getLexicon(GetLexiconRequest getLexiconRequest)
        throws AmazonServiceException, AmazonClientException {

    ExecutionContext executionContext = createExecutionContext(getLexiconRequest);
    GetLexiconRequestMarshaller marshaller = new GetLexiconPostRequestMarshaller();
    Request<GetLexiconRequest> request = marshaller.marshall(getLexiconRequest);
    Unmarshaller<GetLexiconResult, JsonUnmarshallerContext> unmarshaller = new GetLexiconResultJsonUnmarshaller();
    JsonResponseHandler<GetLexiconResult> responseHandler = new JsonResponseHandler<GetLexiconResult>(
            unmarshaller);//from w w  w . ja  va 2 s. co m

    Response<GetLexiconResult> response = invoke(request, responseHandler, executionContext);
    return response.getAwsResponse();
}

From source file:com.ivona.services.tts.IvonaSpeechCloudClient.java

License:Open Source License

@Override
public ListLexiconsResult listLexicons() {
    ListLexiconsRequest listLexiconsRequest = new ListLexiconsRequest();
    ExecutionContext executionContext = createExecutionContext(listLexiconsRequest);
    ListLexiconsRequestMarshaller marshaller = new ListLexiconsPostRequestMarshaller();
    Request<ListLexiconsRequest> request = marshaller.marshall(listLexiconsRequest);
    Unmarshaller<ListLexiconsResult, JsonUnmarshallerContext> unmarshaller = new ListLexiconsResultJsonUnmarshaller();
    JsonResponseHandler<ListLexiconsResult> responseHandler = new JsonResponseHandler<ListLexiconsResult>(
            unmarshaller);//w  ww .j a  v  a  2s. c om

    Response<ListLexiconsResult> response = invoke(request, responseHandler, executionContext);
    return response.getAwsResponse();
}

From source file:smartthings.brave.sns.PublishRequestTracingHandler.java

License:Apache License

@Override
public void afterResponse(Request<?> request, Response<?> response) {
    if (response.getAwsResponse() instanceof PublishResult) {
        PublishResult publishResult = (PublishResult) response.getAwsResponse();

        Span span = tracing.tracer().currentSpan();

        if (publishResult != null && publishResult.getMessageId() != null) {
            span.tag(SNS_MESSAGE_ID, publishResult.getMessageId());
            span.flush();/*from w  w  w.  java 2 s . c  o m*/
        }
    }
}