software.amazon.awssdk.services.protocolrestxml.DefaultProtocolRestXmlClient Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of protocol-tests Show documentation
Show all versions of protocol-tests Show documentation
Contains functional tests for all supported protocols.
/*
* Copyright 2013-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package software.amazon.awssdk.services.protocolrestxml;
import java.util.ArrayList;
import java.util.List;
import org.w3c.dom.Node;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler;
import software.amazon.awssdk.awscore.exception.AwsServiceException;
import software.amazon.awssdk.awscore.http.response.DefaultErrorResponseHandler;
import software.amazon.awssdk.awscore.http.response.StaxResponseHandler;
import software.amazon.awssdk.awscore.protocol.xml.StandardErrorUnmarshaller;
import software.amazon.awssdk.core.client.handler.ClientExecutionParams;
import software.amazon.awssdk.core.client.handler.SyncClientHandler;
import software.amazon.awssdk.core.exception.SdkClientException;
import software.amazon.awssdk.core.internal.client.config.SdkClientConfiguration;
import software.amazon.awssdk.core.runtime.transform.Unmarshaller;
import software.amazon.awssdk.services.protocolrestxml.model.AllTypesRequest;
import software.amazon.awssdk.services.protocolrestxml.model.AllTypesResponse;
import software.amazon.awssdk.services.protocolrestxml.model.DeleteOperationRequest;
import software.amazon.awssdk.services.protocolrestxml.model.DeleteOperationResponse;
import software.amazon.awssdk.services.protocolrestxml.model.EmptyModeledException;
import software.amazon.awssdk.services.protocolrestxml.model.IdempotentOperationRequest;
import software.amazon.awssdk.services.protocolrestxml.model.IdempotentOperationResponse;
import software.amazon.awssdk.services.protocolrestxml.model.MapOfStringToListOfStringInQueryParamsRequest;
import software.amazon.awssdk.services.protocolrestxml.model.MapOfStringToListOfStringInQueryParamsResponse;
import software.amazon.awssdk.services.protocolrestxml.model.MembersInHeadersRequest;
import software.amazon.awssdk.services.protocolrestxml.model.MembersInHeadersResponse;
import software.amazon.awssdk.services.protocolrestxml.model.MembersInQueryParamsRequest;
import software.amazon.awssdk.services.protocolrestxml.model.MembersInQueryParamsResponse;
import software.amazon.awssdk.services.protocolrestxml.model.MultiLocationOperationRequest;
import software.amazon.awssdk.services.protocolrestxml.model.MultiLocationOperationResponse;
import software.amazon.awssdk.services.protocolrestxml.model.OperationWithExplicitPayloadBlobRequest;
import software.amazon.awssdk.services.protocolrestxml.model.OperationWithExplicitPayloadBlobResponse;
import software.amazon.awssdk.services.protocolrestxml.model.OperationWithGreedyLabelRequest;
import software.amazon.awssdk.services.protocolrestxml.model.OperationWithGreedyLabelResponse;
import software.amazon.awssdk.services.protocolrestxml.model.OperationWithModeledContentTypeRequest;
import software.amazon.awssdk.services.protocolrestxml.model.OperationWithModeledContentTypeResponse;
import software.amazon.awssdk.services.protocolrestxml.model.ProtocolRestXmlException;
import software.amazon.awssdk.services.protocolrestxml.model.QueryParamWithoutValueRequest;
import software.amazon.awssdk.services.protocolrestxml.model.QueryParamWithoutValueResponse;
import software.amazon.awssdk.services.protocolrestxml.model.RestXmlTypesRequest;
import software.amazon.awssdk.services.protocolrestxml.model.RestXmlTypesResponse;
import software.amazon.awssdk.services.protocolrestxml.transform.AllTypesRequestMarshaller;
import software.amazon.awssdk.services.protocolrestxml.transform.AllTypesResponseUnmarshaller;
import software.amazon.awssdk.services.protocolrestxml.transform.DeleteOperationRequestMarshaller;
import software.amazon.awssdk.services.protocolrestxml.transform.DeleteOperationResponseUnmarshaller;
import software.amazon.awssdk.services.protocolrestxml.transform.EmptyModeledExceptionUnmarshaller;
import software.amazon.awssdk.services.protocolrestxml.transform.IdempotentOperationRequestMarshaller;
import software.amazon.awssdk.services.protocolrestxml.transform.IdempotentOperationResponseUnmarshaller;
import software.amazon.awssdk.services.protocolrestxml.transform.MapOfStringToListOfStringInQueryParamsRequestMarshaller;
import software.amazon.awssdk.services.protocolrestxml.transform.MapOfStringToListOfStringInQueryParamsResponseUnmarshaller;
import software.amazon.awssdk.services.protocolrestxml.transform.MembersInHeadersRequestMarshaller;
import software.amazon.awssdk.services.protocolrestxml.transform.MembersInHeadersResponseUnmarshaller;
import software.amazon.awssdk.services.protocolrestxml.transform.MembersInQueryParamsRequestMarshaller;
import software.amazon.awssdk.services.protocolrestxml.transform.MembersInQueryParamsResponseUnmarshaller;
import software.amazon.awssdk.services.protocolrestxml.transform.MultiLocationOperationRequestMarshaller;
import software.amazon.awssdk.services.protocolrestxml.transform.MultiLocationOperationResponseUnmarshaller;
import software.amazon.awssdk.services.protocolrestxml.transform.OperationWithExplicitPayloadBlobRequestMarshaller;
import software.amazon.awssdk.services.protocolrestxml.transform.OperationWithExplicitPayloadBlobResponseUnmarshaller;
import software.amazon.awssdk.services.protocolrestxml.transform.OperationWithGreedyLabelRequestMarshaller;
import software.amazon.awssdk.services.protocolrestxml.transform.OperationWithGreedyLabelResponseUnmarshaller;
import software.amazon.awssdk.services.protocolrestxml.transform.OperationWithModeledContentTypeRequestMarshaller;
import software.amazon.awssdk.services.protocolrestxml.transform.OperationWithModeledContentTypeResponseUnmarshaller;
import software.amazon.awssdk.services.protocolrestxml.transform.QueryParamWithoutValueRequestMarshaller;
import software.amazon.awssdk.services.protocolrestxml.transform.QueryParamWithoutValueResponseUnmarshaller;
import software.amazon.awssdk.services.protocolrestxml.transform.RestXmlTypesRequestMarshaller;
import software.amazon.awssdk.services.protocolrestxml.transform.RestXmlTypesResponseUnmarshaller;
/**
* Internal implementation of {@link ProtocolRestXmlClient}.
*
* @see ProtocolRestXmlClient#builder()
*/
@Generated("software.amazon.awssdk:codegen")
@SdkInternalApi
final class DefaultProtocolRestXmlClient implements ProtocolRestXmlClient {
private final SyncClientHandler clientHandler;
private final List> exceptionUnmarshallers;
private final SdkClientConfiguration clientConfiguration;
protected DefaultProtocolRestXmlClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsSyncClientHandler(clientConfiguration);
this.clientConfiguration = clientConfiguration;
this.exceptionUnmarshallers = init();
}
@Override
public final String serviceName() {
return SERVICE_NAME;
}
/**
* Invokes the AllTypes operation.
*
* @param allTypesRequest
* @return Result of the AllTypes operation returned by the service.
* @throws EmptyModeledException
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ProtocolRestXmlException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ProtocolRestXmlClient.AllTypes
*/
@Override
public AllTypesResponse allTypes(AllTypesRequest allTypesRequest) throws EmptyModeledException, AwsServiceException,
SdkClientException, ProtocolRestXmlException {
StaxResponseHandler responseHandler = new StaxResponseHandler(
new AllTypesResponseUnmarshaller());
DefaultErrorResponseHandler errorResponseHandler = new DefaultErrorResponseHandler(exceptionUnmarshallers);
return clientHandler.execute(new ClientExecutionParams()
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler).withInput(allTypesRequest)
.withMarshaller(new AllTypesRequestMarshaller()));
}
/**
* Invokes the DeleteOperation operation.
*
* @param deleteOperationRequest
* @return Result of the DeleteOperation operation returned by the service.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ProtocolRestXmlException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ProtocolRestXmlClient.DeleteOperation
*/
@Override
public DeleteOperationResponse deleteOperation(DeleteOperationRequest deleteOperationRequest) throws AwsServiceException,
SdkClientException, ProtocolRestXmlException {
StaxResponseHandler responseHandler = new StaxResponseHandler(
new DeleteOperationResponseUnmarshaller());
DefaultErrorResponseHandler errorResponseHandler = new DefaultErrorResponseHandler(exceptionUnmarshallers);
return clientHandler.execute(new ClientExecutionParams()
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withInput(deleteOperationRequest).withMarshaller(new DeleteOperationRequestMarshaller()));
}
/**
* Invokes the IdempotentOperation operation.
*
* @param idempotentOperationRequest
* @return Result of the IdempotentOperation operation returned by the service.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ProtocolRestXmlException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ProtocolRestXmlClient.IdempotentOperation
*/
@Override
public IdempotentOperationResponse idempotentOperation(IdempotentOperationRequest idempotentOperationRequest)
throws AwsServiceException, SdkClientException, ProtocolRestXmlException {
StaxResponseHandler responseHandler = new StaxResponseHandler(
new IdempotentOperationResponseUnmarshaller());
DefaultErrorResponseHandler errorResponseHandler = new DefaultErrorResponseHandler(exceptionUnmarshallers);
return clientHandler.execute(new ClientExecutionParams()
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withInput(idempotentOperationRequest).withMarshaller(new IdempotentOperationRequestMarshaller()));
}
/**
* Invokes the MapOfStringToListOfStringInQueryParams operation.
*
* @param mapOfStringToListOfStringInQueryParamsRequest
* @return Result of the MapOfStringToListOfStringInQueryParams operation returned by the service.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ProtocolRestXmlException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ProtocolRestXmlClient.MapOfStringToListOfStringInQueryParams
*/
@Override
public MapOfStringToListOfStringInQueryParamsResponse mapOfStringToListOfStringInQueryParams(
MapOfStringToListOfStringInQueryParamsRequest mapOfStringToListOfStringInQueryParamsRequest)
throws AwsServiceException, SdkClientException, ProtocolRestXmlException {
StaxResponseHandler responseHandler = new StaxResponseHandler(
new MapOfStringToListOfStringInQueryParamsResponseUnmarshaller());
DefaultErrorResponseHandler errorResponseHandler = new DefaultErrorResponseHandler(exceptionUnmarshallers);
return clientHandler
.execute(new ClientExecutionParams()
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withInput(mapOfStringToListOfStringInQueryParamsRequest)
.withMarshaller(new MapOfStringToListOfStringInQueryParamsRequestMarshaller()));
}
/**
* Invokes the MembersInHeaders operation.
*
* @param membersInHeadersRequest
* @return Result of the MembersInHeaders operation returned by the service.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ProtocolRestXmlException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ProtocolRestXmlClient.MembersInHeaders
*/
@Override
public MembersInHeadersResponse membersInHeaders(MembersInHeadersRequest membersInHeadersRequest) throws AwsServiceException,
SdkClientException, ProtocolRestXmlException {
StaxResponseHandler responseHandler = new StaxResponseHandler(
new MembersInHeadersResponseUnmarshaller());
DefaultErrorResponseHandler errorResponseHandler = new DefaultErrorResponseHandler(exceptionUnmarshallers);
return clientHandler.execute(new ClientExecutionParams()
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withInput(membersInHeadersRequest).withMarshaller(new MembersInHeadersRequestMarshaller()));
}
/**
* Invokes the MembersInQueryParams operation.
*
* @param membersInQueryParamsRequest
* @return Result of the MembersInQueryParams operation returned by the service.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ProtocolRestXmlException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ProtocolRestXmlClient.MembersInQueryParams
*/
@Override
public MembersInQueryParamsResponse membersInQueryParams(MembersInQueryParamsRequest membersInQueryParamsRequest)
throws AwsServiceException, SdkClientException, ProtocolRestXmlException {
StaxResponseHandler responseHandler = new StaxResponseHandler(
new MembersInQueryParamsResponseUnmarshaller());
DefaultErrorResponseHandler errorResponseHandler = new DefaultErrorResponseHandler(exceptionUnmarshallers);
return clientHandler.execute(new ClientExecutionParams()
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withInput(membersInQueryParamsRequest).withMarshaller(new MembersInQueryParamsRequestMarshaller()));
}
/**
* Invokes the MultiLocationOperation operation.
*
* @param multiLocationOperationRequest
* @return Result of the MultiLocationOperation operation returned by the service.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ProtocolRestXmlException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ProtocolRestXmlClient.MultiLocationOperation
*/
@Override
public MultiLocationOperationResponse multiLocationOperation(MultiLocationOperationRequest multiLocationOperationRequest)
throws AwsServiceException, SdkClientException, ProtocolRestXmlException {
StaxResponseHandler responseHandler = new StaxResponseHandler(
new MultiLocationOperationResponseUnmarshaller());
DefaultErrorResponseHandler errorResponseHandler = new DefaultErrorResponseHandler(exceptionUnmarshallers);
return clientHandler.execute(new ClientExecutionParams()
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withInput(multiLocationOperationRequest).withMarshaller(new MultiLocationOperationRequestMarshaller()));
}
/**
* Invokes the OperationWithExplicitPayloadBlob operation.
*
* @param operationWithExplicitPayloadBlobRequest
* @return Result of the OperationWithExplicitPayloadBlob operation returned by the service.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ProtocolRestXmlException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ProtocolRestXmlClient.OperationWithExplicitPayloadBlob
*/
@Override
public OperationWithExplicitPayloadBlobResponse operationWithExplicitPayloadBlob(
OperationWithExplicitPayloadBlobRequest operationWithExplicitPayloadBlobRequest) throws AwsServiceException,
SdkClientException, ProtocolRestXmlException {
StaxResponseHandler responseHandler = new StaxResponseHandler(
new OperationWithExplicitPayloadBlobResponseUnmarshaller());
DefaultErrorResponseHandler errorResponseHandler = new DefaultErrorResponseHandler(exceptionUnmarshallers);
return clientHandler
.execute(new ClientExecutionParams()
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withInput(operationWithExplicitPayloadBlobRequest)
.withMarshaller(new OperationWithExplicitPayloadBlobRequestMarshaller()));
}
/**
* Invokes the OperationWithGreedyLabel operation.
*
* @param operationWithGreedyLabelRequest
* @return Result of the OperationWithGreedyLabel operation returned by the service.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ProtocolRestXmlException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ProtocolRestXmlClient.OperationWithGreedyLabel
*/
@Override
public OperationWithGreedyLabelResponse operationWithGreedyLabel(
OperationWithGreedyLabelRequest operationWithGreedyLabelRequest) throws AwsServiceException, SdkClientException,
ProtocolRestXmlException {
StaxResponseHandler responseHandler = new StaxResponseHandler(
new OperationWithGreedyLabelResponseUnmarshaller());
DefaultErrorResponseHandler errorResponseHandler = new DefaultErrorResponseHandler(exceptionUnmarshallers);
return clientHandler
.execute(new ClientExecutionParams()
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withInput(operationWithGreedyLabelRequest)
.withMarshaller(new OperationWithGreedyLabelRequestMarshaller()));
}
/**
* Invokes the OperationWithModeledContentType operation.
*
* @param operationWithModeledContentTypeRequest
* @return Result of the OperationWithModeledContentType operation returned by the service.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ProtocolRestXmlException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ProtocolRestXmlClient.OperationWithModeledContentType
*/
@Override
public OperationWithModeledContentTypeResponse operationWithModeledContentType(
OperationWithModeledContentTypeRequest operationWithModeledContentTypeRequest) throws AwsServiceException,
SdkClientException, ProtocolRestXmlException {
StaxResponseHandler responseHandler = new StaxResponseHandler(
new OperationWithModeledContentTypeResponseUnmarshaller());
DefaultErrorResponseHandler errorResponseHandler = new DefaultErrorResponseHandler(exceptionUnmarshallers);
return clientHandler
.execute(new ClientExecutionParams()
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withInput(operationWithModeledContentTypeRequest)
.withMarshaller(new OperationWithModeledContentTypeRequestMarshaller()));
}
/**
* Invokes the QueryParamWithoutValue operation.
*
* @param queryParamWithoutValueRequest
* @return Result of the QueryParamWithoutValue operation returned by the service.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ProtocolRestXmlException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ProtocolRestXmlClient.QueryParamWithoutValue
*/
@Override
public QueryParamWithoutValueResponse queryParamWithoutValue(QueryParamWithoutValueRequest queryParamWithoutValueRequest)
throws AwsServiceException, SdkClientException, ProtocolRestXmlException {
StaxResponseHandler responseHandler = new StaxResponseHandler(
new QueryParamWithoutValueResponseUnmarshaller());
DefaultErrorResponseHandler errorResponseHandler = new DefaultErrorResponseHandler(exceptionUnmarshallers);
return clientHandler.execute(new ClientExecutionParams()
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withInput(queryParamWithoutValueRequest).withMarshaller(new QueryParamWithoutValueRequestMarshaller()));
}
/**
* Invokes the RestXmlTypes operation.
*
* @param restXmlTypesRequest
* @return Result of the RestXmlTypes operation returned by the service.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ProtocolRestXmlException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ProtocolRestXmlClient.RestXmlTypes
*/
@Override
public RestXmlTypesResponse restXmlTypes(RestXmlTypesRequest restXmlTypesRequest) throws AwsServiceException,
SdkClientException, ProtocolRestXmlException {
StaxResponseHandler responseHandler = new StaxResponseHandler(
new RestXmlTypesResponseUnmarshaller());
DefaultErrorResponseHandler errorResponseHandler = new DefaultErrorResponseHandler(exceptionUnmarshallers);
return clientHandler.execute(new ClientExecutionParams()
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withInput(restXmlTypesRequest).withMarshaller(new RestXmlTypesRequestMarshaller()));
}
private List> init() {
List> unmarshallers = new ArrayList<>();
unmarshallers.add(new EmptyModeledExceptionUnmarshaller());
unmarshallers.add(new StandardErrorUnmarshaller(ProtocolRestXmlException.class));
return unmarshallers;
}
@Override
public void close() {
clientHandler.close();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy