com.amazonaws.transform.Unmarshaller Java Examples

The following examples show how to use com.amazonaws.transform.Unmarshaller. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GenericApiGatewayClient.java    From apigateway-generic-java-sdk with Apache License 2.0 5 votes vote down vote up
GenericApiGatewayClient(ClientConfiguration clientConfiguration, String endpoint, Region region,
                        AWSCredentialsProvider credentials, String apiKey, AmazonHttpClient httpClient) {
    super(clientConfiguration);
    setRegion(region);
    setEndpoint(endpoint);
    this.credentials = credentials;
    this.apiKey = apiKey;
    this.signer = new AWS4Signer();
    this.signer.setServiceName(API_GATEWAY_SERVICE_NAME);
    this.signer.setRegionName(region.getName());

    final JsonOperationMetadata metadata = new JsonOperationMetadata().withHasStreamingSuccessResponse(false).withPayloadJson(false);
    final Unmarshaller<GenericApiGatewayResponse, JsonUnmarshallerContext> responseUnmarshaller = in -> new GenericApiGatewayResponse(in.getHttpResponse());
    this.responseHandler = SdkStructuredPlainJsonFactory.SDK_JSON_FACTORY.createResponseHandler(metadata, responseUnmarshaller);
    JsonErrorUnmarshaller defaultErrorUnmarshaller = new JsonErrorUnmarshaller(GenericApiGatewayException.class, null) {
        @Override
        public AmazonServiceException unmarshall(JsonNode jsonContent) throws Exception {
            return new GenericApiGatewayException(jsonContent.toString());
        }
    };
    this.errorResponseHandler = SdkStructuredPlainJsonFactory.SDK_JSON_FACTORY.createErrorResponseHandler(
            Collections.singletonList(defaultErrorUnmarshaller), null);

    if (httpClient != null) {
        super.client = httpClient;
    }
}
 
Example #2
Source File: IvonaSpeechCloudClient.java    From ivona-speechcloud-sdk-java with Apache License 2.0 5 votes vote down vote up
@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);
    Response<ListVoicesResult> response = invoke(request, responseHandler, executionContext);
    return response.getAwsResponse();
}
 
Example #3
Source File: IvonaSpeechCloudClient.java    From ivona-speechcloud-sdk-java with Apache License 2.0 5 votes vote down vote up
@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);

    Response<GetLexiconResult> response = invoke(request, responseHandler, executionContext);
    return response.getAwsResponse();
}
 
Example #4
Source File: IvonaSpeechCloudClient.java    From ivona-speechcloud-sdk-java with Apache License 2.0 5 votes vote down vote up
@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);

    Response<ListLexiconsResult> response = invoke(request, responseHandler, executionContext);
    return response.getAwsResponse();
}
 
Example #5
Source File: GenericApiGatewayClient.java    From nifi with Apache License 2.0 5 votes vote down vote up
GenericApiGatewayClient(ClientConfiguration clientConfiguration, String endpoint, Region region,
                        AWSCredentialsProvider credentials, String apiKey, AmazonHttpClient httpClient) {
    super(clientConfiguration);
    setRegion(region);
    setEndpoint(endpoint);
    this.credentials = credentials;
    this.apiKey = apiKey;
    this.signer = new AWS4Signer();
    this.signer.setServiceName(API_GATEWAY_SERVICE_NAME);
    this.signer.setRegionName(region.getName());

    final JsonOperationMetadata metadata = new JsonOperationMetadata().withHasStreamingSuccessResponse(false).withPayloadJson(false);
    final Unmarshaller<GenericApiGatewayResponse, JsonUnmarshallerContext> responseUnmarshaller = in -> new GenericApiGatewayResponse(in.getHttpResponse());
    this.responseHandler = SdkStructuredPlainJsonFactory.SDK_JSON_FACTORY.createResponseHandler(metadata, responseUnmarshaller);
    JsonErrorUnmarshaller defaultErrorUnmarshaller = new JsonErrorUnmarshaller(GenericApiGatewayException.class, null) {
        @Override
        public AmazonServiceException unmarshall(JsonNode jsonContent) throws Exception {
            return new GenericApiGatewayException(jsonContent.toString());
        }
    };
    this.errorResponseHandler = SdkStructuredPlainJsonFactory.SDK_JSON_FACTORY.createErrorResponseHandler(
            Collections.singletonList(defaultErrorUnmarshaller), null);

    if (httpClient != null) {
        super.client = httpClient;
    }
}
 
Example #6
Source File: StreamResponseHandler.java    From ivona-speechcloud-sdk-java with Apache License 2.0 4 votes vote down vote up
public StreamResponseHandler(Unmarshaller<T, HttpResponse> responseUnmarshaller) {
    this.responseUnmarshaller = responseUnmarshaller;
}