@SuppressWarnings("unchecked") private void createErrorUnmarshallers() { for (JsonErrorShapeMetadata errorMetadata : metadata.getErrorShapeMetadata()) { errorUnmarshallers.add(new JsonErrorUnmarshaller( (Class<? extends AmazonServiceException>) errorMetadata.getModeledClass(), errorMetadata.getErrorCode())); } errorUnmarshallers.add(new JsonErrorUnmarshaller( (Class<? extends AmazonServiceException>) metadata.getBaseServiceExceptionClass(), null)); }
@SuppressWarnings("unchecked") private ApiGatewayErrorUnmarshaller createErrorUnmarshaller(JsonErrorShapeMetadata errorShape) { return new ApiGatewayErrorUnmarshaller( (Class<? extends BaseException>) errorShape.getModeledClass(), Optional.of(errorShape.getHttpStatusCode())); } }
/** * @param describeEnvironmentRequest * @return Result of the describeEnvironment operation returned by the service. * @throws ResourceNotFoundException * @sample Blox.describeEnvironment * @see <a href="http://docs.aws.amazon.com/goto/WebAPI/ecs-blox-v2017-07-11/describeEnvironment" * target="_top">AWS API Documentation</a> */ @Override public DescribeEnvironmentResult describeEnvironment(DescribeEnvironmentRequest describeEnvironmentRequest) { HttpResponseHandler<DescribeEnvironmentResult> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata() .withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeEnvironmentResultJsonUnmarshaller()); HttpResponseHandler<SdkBaseException> errorResponseHandler = createErrorResponseHandler(new JsonErrorShapeMetadata().withModeledClass( ResourceNotFoundException.class).withHttpStatusCode(404)); return clientHandler.execute(new ClientExecutionParams<DescribeEnvironmentRequest, DescribeEnvironmentResult>() .withMarshaller(new DescribeEnvironmentRequestProtocolMarshaller(protocolFactory)).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(describeEnvironmentRequest)); }
@SuppressWarnings("unchecked") private void createErrorUnmarshallers() { for (JsonErrorShapeMetadata errorMetadata : metadata.getErrorShapeMetadata()) { errorUnmarshallers.add(new JsonErrorUnmarshaller( (Class<? extends AmazonServiceException>) errorMetadata.getModeledClass(), errorMetadata.getErrorCode())); } errorUnmarshallers.add(new JsonErrorUnmarshaller( (Class<? extends AmazonServiceException>) metadata.getBaseServiceExceptionClass(), null)); }
@SuppressWarnings("unchecked") private void createErrorUnmarshallers() { for (JsonErrorShapeMetadata errorMetadata : metadata.getErrorShapeMetadata()) { errorUnmarshallers.add(new JsonErrorUnmarshaller( (Class<? extends AmazonServiceException>) errorMetadata.getModeledClass(), errorMetadata.getErrorCode())); } errorUnmarshallers.add(new JsonErrorUnmarshaller( (Class<? extends AmazonServiceException>) metadata.getBaseServiceExceptionClass(), null)); }