software.amazon.awssdk.services.globalaccelerator.DefaultGlobalAcceleratorClient Maven / Gradle / Ivy
Show all versions of globalaccelerator Show documentation
/*
* Copyright 2014-2019 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.globalaccelerator;
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.core.client.config.SdkClientConfiguration;
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.http.HttpResponseHandler;
import software.amazon.awssdk.protocols.core.ExceptionMetadata;
import software.amazon.awssdk.protocols.json.AwsJsonProtocol;
import software.amazon.awssdk.protocols.json.AwsJsonProtocolFactory;
import software.amazon.awssdk.protocols.json.BaseAwsJsonProtocolFactory;
import software.amazon.awssdk.protocols.json.JsonOperationMetadata;
import software.amazon.awssdk.services.globalaccelerator.model.AcceleratorNotDisabledException;
import software.amazon.awssdk.services.globalaccelerator.model.AcceleratorNotFoundException;
import software.amazon.awssdk.services.globalaccelerator.model.AssociatedEndpointGroupFoundException;
import software.amazon.awssdk.services.globalaccelerator.model.AssociatedListenerFoundException;
import software.amazon.awssdk.services.globalaccelerator.model.CreateAcceleratorRequest;
import software.amazon.awssdk.services.globalaccelerator.model.CreateAcceleratorResponse;
import software.amazon.awssdk.services.globalaccelerator.model.CreateEndpointGroupRequest;
import software.amazon.awssdk.services.globalaccelerator.model.CreateEndpointGroupResponse;
import software.amazon.awssdk.services.globalaccelerator.model.CreateListenerRequest;
import software.amazon.awssdk.services.globalaccelerator.model.CreateListenerResponse;
import software.amazon.awssdk.services.globalaccelerator.model.DeleteAcceleratorRequest;
import software.amazon.awssdk.services.globalaccelerator.model.DeleteAcceleratorResponse;
import software.amazon.awssdk.services.globalaccelerator.model.DeleteEndpointGroupRequest;
import software.amazon.awssdk.services.globalaccelerator.model.DeleteEndpointGroupResponse;
import software.amazon.awssdk.services.globalaccelerator.model.DeleteListenerRequest;
import software.amazon.awssdk.services.globalaccelerator.model.DeleteListenerResponse;
import software.amazon.awssdk.services.globalaccelerator.model.DescribeAcceleratorAttributesRequest;
import software.amazon.awssdk.services.globalaccelerator.model.DescribeAcceleratorAttributesResponse;
import software.amazon.awssdk.services.globalaccelerator.model.DescribeAcceleratorRequest;
import software.amazon.awssdk.services.globalaccelerator.model.DescribeAcceleratorResponse;
import software.amazon.awssdk.services.globalaccelerator.model.DescribeEndpointGroupRequest;
import software.amazon.awssdk.services.globalaccelerator.model.DescribeEndpointGroupResponse;
import software.amazon.awssdk.services.globalaccelerator.model.DescribeListenerRequest;
import software.amazon.awssdk.services.globalaccelerator.model.DescribeListenerResponse;
import software.amazon.awssdk.services.globalaccelerator.model.EndpointGroupAlreadyExistsException;
import software.amazon.awssdk.services.globalaccelerator.model.EndpointGroupNotFoundException;
import software.amazon.awssdk.services.globalaccelerator.model.GlobalAcceleratorException;
import software.amazon.awssdk.services.globalaccelerator.model.InternalServiceErrorException;
import software.amazon.awssdk.services.globalaccelerator.model.InvalidArgumentException;
import software.amazon.awssdk.services.globalaccelerator.model.InvalidNextTokenException;
import software.amazon.awssdk.services.globalaccelerator.model.InvalidPortRangeException;
import software.amazon.awssdk.services.globalaccelerator.model.LimitExceededException;
import software.amazon.awssdk.services.globalaccelerator.model.ListAcceleratorsRequest;
import software.amazon.awssdk.services.globalaccelerator.model.ListAcceleratorsResponse;
import software.amazon.awssdk.services.globalaccelerator.model.ListEndpointGroupsRequest;
import software.amazon.awssdk.services.globalaccelerator.model.ListEndpointGroupsResponse;
import software.amazon.awssdk.services.globalaccelerator.model.ListListenersRequest;
import software.amazon.awssdk.services.globalaccelerator.model.ListListenersResponse;
import software.amazon.awssdk.services.globalaccelerator.model.ListenerNotFoundException;
import software.amazon.awssdk.services.globalaccelerator.model.UpdateAcceleratorAttributesRequest;
import software.amazon.awssdk.services.globalaccelerator.model.UpdateAcceleratorAttributesResponse;
import software.amazon.awssdk.services.globalaccelerator.model.UpdateAcceleratorRequest;
import software.amazon.awssdk.services.globalaccelerator.model.UpdateAcceleratorResponse;
import software.amazon.awssdk.services.globalaccelerator.model.UpdateEndpointGroupRequest;
import software.amazon.awssdk.services.globalaccelerator.model.UpdateEndpointGroupResponse;
import software.amazon.awssdk.services.globalaccelerator.model.UpdateListenerRequest;
import software.amazon.awssdk.services.globalaccelerator.model.UpdateListenerResponse;
import software.amazon.awssdk.services.globalaccelerator.transform.CreateAcceleratorRequestMarshaller;
import software.amazon.awssdk.services.globalaccelerator.transform.CreateEndpointGroupRequestMarshaller;
import software.amazon.awssdk.services.globalaccelerator.transform.CreateListenerRequestMarshaller;
import software.amazon.awssdk.services.globalaccelerator.transform.DeleteAcceleratorRequestMarshaller;
import software.amazon.awssdk.services.globalaccelerator.transform.DeleteEndpointGroupRequestMarshaller;
import software.amazon.awssdk.services.globalaccelerator.transform.DeleteListenerRequestMarshaller;
import software.amazon.awssdk.services.globalaccelerator.transform.DescribeAcceleratorAttributesRequestMarshaller;
import software.amazon.awssdk.services.globalaccelerator.transform.DescribeAcceleratorRequestMarshaller;
import software.amazon.awssdk.services.globalaccelerator.transform.DescribeEndpointGroupRequestMarshaller;
import software.amazon.awssdk.services.globalaccelerator.transform.DescribeListenerRequestMarshaller;
import software.amazon.awssdk.services.globalaccelerator.transform.ListAcceleratorsRequestMarshaller;
import software.amazon.awssdk.services.globalaccelerator.transform.ListEndpointGroupsRequestMarshaller;
import software.amazon.awssdk.services.globalaccelerator.transform.ListListenersRequestMarshaller;
import software.amazon.awssdk.services.globalaccelerator.transform.UpdateAcceleratorAttributesRequestMarshaller;
import software.amazon.awssdk.services.globalaccelerator.transform.UpdateAcceleratorRequestMarshaller;
import software.amazon.awssdk.services.globalaccelerator.transform.UpdateEndpointGroupRequestMarshaller;
import software.amazon.awssdk.services.globalaccelerator.transform.UpdateListenerRequestMarshaller;
/**
* Internal implementation of {@link GlobalAcceleratorClient}.
*
* @see GlobalAcceleratorClient#builder()
*/
@Generated("software.amazon.awssdk:codegen")
@SdkInternalApi
final class DefaultGlobalAcceleratorClient implements GlobalAcceleratorClient {
private final SyncClientHandler clientHandler;
private final AwsJsonProtocolFactory protocolFactory;
private final SdkClientConfiguration clientConfiguration;
protected DefaultGlobalAcceleratorClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsSyncClientHandler(clientConfiguration);
this.clientConfiguration = clientConfiguration;
this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
}
@Override
public final String serviceName() {
return SERVICE_NAME;
}
/**
*
* Create an accelerator. An accelerator includes one or more listeners that process inbound connections and direct
* traffic to one or more endpoint groups, each of which includes endpoints, such as Network Load Balancers. To see
* an AWS CLI example of creating an accelerator, scroll down to Example.
*
*
* @param createAcceleratorRequest
* @return Result of the CreateAccelerator operation returned by the service.
* @throws InternalServiceErrorException
* There was an internal error for AWS Global Accelerator.
* @throws InvalidArgumentException
* An argument that you specified is invalid.
* @throws LimitExceededException
* Processing your request would cause you to exceed an AWS Global Accelerator limit.
* @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 GlobalAcceleratorException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample GlobalAcceleratorClient.CreateAccelerator
* @see AWS API Documentation
*/
@Override
public CreateAcceleratorResponse createAccelerator(CreateAcceleratorRequest createAcceleratorRequest)
throws InternalServiceErrorException, InvalidArgumentException, LimitExceededException, AwsServiceException,
SdkClientException, GlobalAcceleratorException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CreateAcceleratorResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("CreateAccelerator").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(createAcceleratorRequest)
.withMarshaller(new CreateAcceleratorRequestMarshaller(protocolFactory)));
}
/**
*
* Create an endpoint group for the specified listener. An endpoint group is a collection of endpoints in one AWS
* Region. To see an AWS CLI example of creating an endpoint group, scroll down to Example.
*
*
* @param createEndpointGroupRequest
* @return Result of the CreateEndpointGroup operation returned by the service.
* @throws AcceleratorNotFoundException
* The accelerator that you specified doesn't exist.
* @throws EndpointGroupAlreadyExistsException
* The endpoint group that you specified already exists.
* @throws ListenerNotFoundException
* The listener that you specified doesn't exist.
* @throws InternalServiceErrorException
* There was an internal error for AWS Global Accelerator.
* @throws InvalidArgumentException
* An argument that you specified is invalid.
* @throws LimitExceededException
* Processing your request would cause you to exceed an AWS Global Accelerator limit.
* @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 GlobalAcceleratorException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample GlobalAcceleratorClient.CreateEndpointGroup
* @see AWS API Documentation
*/
@Override
public CreateEndpointGroupResponse createEndpointGroup(CreateEndpointGroupRequest createEndpointGroupRequest)
throws AcceleratorNotFoundException, EndpointGroupAlreadyExistsException, ListenerNotFoundException,
InternalServiceErrorException, InvalidArgumentException, LimitExceededException, AwsServiceException,
SdkClientException, GlobalAcceleratorException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateEndpointGroupResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("CreateEndpointGroup").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(createEndpointGroupRequest)
.withMarshaller(new CreateEndpointGroupRequestMarshaller(protocolFactory)));
}
/**
*
* Create a listener to process inbound connections from clients to an accelerator. Connections arrive to assigned
* static IP addresses on a port, port range, or list of port ranges that you specify. To see an AWS CLI example of
* creating a listener, scroll down to Example.
*
*
* @param createListenerRequest
* @return Result of the CreateListener operation returned by the service.
* @throws InvalidArgumentException
* An argument that you specified is invalid.
* @throws AcceleratorNotFoundException
* The accelerator that you specified doesn't exist.
* @throws InvalidPortRangeException
* The port numbers that you specified are not valid numbers or are not unique for this accelerator.
* @throws InternalServiceErrorException
* There was an internal error for AWS Global Accelerator.
* @throws LimitExceededException
* Processing your request would cause you to exceed an AWS Global Accelerator limit.
* @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 GlobalAcceleratorException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample GlobalAcceleratorClient.CreateListener
* @see AWS API Documentation
*/
@Override
public CreateListenerResponse createListener(CreateListenerRequest createListenerRequest) throws InvalidArgumentException,
AcceleratorNotFoundException, InvalidPortRangeException, InternalServiceErrorException, LimitExceededException,
AwsServiceException, SdkClientException, GlobalAcceleratorException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CreateListenerResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("CreateListener").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(createListenerRequest)
.withMarshaller(new CreateListenerRequestMarshaller(protocolFactory)));
}
/**
*
* Delete an accelerator. Note: before you can delete an accelerator, you must disable it and remove all dependent
* resources (listeners and endpoint groups).
*
*
* @param deleteAcceleratorRequest
* @return Result of the DeleteAccelerator operation returned by the service.
* @throws AcceleratorNotFoundException
* The accelerator that you specified doesn't exist.
* @throws AcceleratorNotDisabledException
* The accelerator that you specified could not be disabled.
* @throws AssociatedListenerFoundException
* The accelerator that you specified has a listener associated with it. You must remove all dependent
* resources from an accelerator before you can delete it.
* @throws InternalServiceErrorException
* There was an internal error for AWS Global Accelerator.
* @throws InvalidArgumentException
* An argument that you specified is invalid.
* @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 GlobalAcceleratorException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample GlobalAcceleratorClient.DeleteAccelerator
* @see AWS API Documentation
*/
@Override
public DeleteAcceleratorResponse deleteAccelerator(DeleteAcceleratorRequest deleteAcceleratorRequest)
throws AcceleratorNotFoundException, AcceleratorNotDisabledException, AssociatedListenerFoundException,
InternalServiceErrorException, InvalidArgumentException, AwsServiceException, SdkClientException,
GlobalAcceleratorException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DeleteAcceleratorResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DeleteAccelerator").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(deleteAcceleratorRequest)
.withMarshaller(new DeleteAcceleratorRequestMarshaller(protocolFactory)));
}
/**
*
* Delete an endpoint group from a listener.
*
*
* @param deleteEndpointGroupRequest
* @return Result of the DeleteEndpointGroup operation returned by the service.
* @throws EndpointGroupNotFoundException
* The endpoint group that you specified doesn't exist.
* @throws InternalServiceErrorException
* There was an internal error for AWS Global Accelerator.
* @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 GlobalAcceleratorException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample GlobalAcceleratorClient.DeleteEndpointGroup
* @see AWS API Documentation
*/
@Override
public DeleteEndpointGroupResponse deleteEndpointGroup(DeleteEndpointGroupRequest deleteEndpointGroupRequest)
throws EndpointGroupNotFoundException, InternalServiceErrorException, AwsServiceException, SdkClientException,
GlobalAcceleratorException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteEndpointGroupResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DeleteEndpointGroup").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(deleteEndpointGroupRequest)
.withMarshaller(new DeleteEndpointGroupRequestMarshaller(protocolFactory)));
}
/**
*
* Delete a listener from an accelerator.
*
*
* @param deleteListenerRequest
* @return Result of the DeleteListener operation returned by the service.
* @throws ListenerNotFoundException
* The listener that you specified doesn't exist.
* @throws AssociatedEndpointGroupFoundException
* The listener that you specified has an endpoint group associated with it. You must remove all dependent
* resources from a listener before you can delete it.
* @throws InternalServiceErrorException
* There was an internal error for AWS Global Accelerator.
* @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 GlobalAcceleratorException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample GlobalAcceleratorClient.DeleteListener
* @see AWS API Documentation
*/
@Override
public DeleteListenerResponse deleteListener(DeleteListenerRequest deleteListenerRequest) throws ListenerNotFoundException,
AssociatedEndpointGroupFoundException, InternalServiceErrorException, AwsServiceException, SdkClientException,
GlobalAcceleratorException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DeleteListenerResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DeleteListener").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(deleteListenerRequest)
.withMarshaller(new DeleteListenerRequestMarshaller(protocolFactory)));
}
/**
*
* Describe an accelerator. To see an AWS CLI example of describing an accelerator, scroll down to Example.
*
*
* @param describeAcceleratorRequest
* @return Result of the DescribeAccelerator operation returned by the service.
* @throws AcceleratorNotFoundException
* The accelerator that you specified doesn't exist.
* @throws InternalServiceErrorException
* There was an internal error for AWS Global Accelerator.
* @throws InvalidArgumentException
* An argument that you specified is invalid.
* @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 GlobalAcceleratorException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample GlobalAcceleratorClient.DescribeAccelerator
* @see AWS API Documentation
*/
@Override
public DescribeAcceleratorResponse describeAccelerator(DescribeAcceleratorRequest describeAcceleratorRequest)
throws AcceleratorNotFoundException, InternalServiceErrorException, InvalidArgumentException, AwsServiceException,
SdkClientException, GlobalAcceleratorException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DescribeAcceleratorResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DescribeAccelerator").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(describeAcceleratorRequest)
.withMarshaller(new DescribeAcceleratorRequestMarshaller(protocolFactory)));
}
/**
*
* Describe the attributes of an accelerator.
*
*
* @param describeAcceleratorAttributesRequest
* @return Result of the DescribeAcceleratorAttributes operation returned by the service.
* @throws AcceleratorNotFoundException
* The accelerator that you specified doesn't exist.
* @throws InternalServiceErrorException
* There was an internal error for AWS Global Accelerator.
* @throws InvalidArgumentException
* An argument that you specified is invalid.
* @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 GlobalAcceleratorException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample GlobalAcceleratorClient.DescribeAcceleratorAttributes
* @see AWS API Documentation
*/
@Override
public DescribeAcceleratorAttributesResponse describeAcceleratorAttributes(
DescribeAcceleratorAttributesRequest describeAcceleratorAttributesRequest) throws AcceleratorNotFoundException,
InternalServiceErrorException, InvalidArgumentException, AwsServiceException, SdkClientException,
GlobalAcceleratorException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DescribeAcceleratorAttributesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeAcceleratorAttributes").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(describeAcceleratorAttributesRequest)
.withMarshaller(new DescribeAcceleratorAttributesRequestMarshaller(protocolFactory)));
}
/**
*
* Describe an endpoint group.
*
*
* @param describeEndpointGroupRequest
* @return Result of the DescribeEndpointGroup operation returned by the service.
* @throws EndpointGroupNotFoundException
* The endpoint group that you specified doesn't exist.
* @throws InternalServiceErrorException
* There was an internal error for AWS Global Accelerator.
* @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 GlobalAcceleratorException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample GlobalAcceleratorClient.DescribeEndpointGroup
* @see AWS API Documentation
*/
@Override
public DescribeEndpointGroupResponse describeEndpointGroup(DescribeEndpointGroupRequest describeEndpointGroupRequest)
throws EndpointGroupNotFoundException, InternalServiceErrorException, AwsServiceException, SdkClientException,
GlobalAcceleratorException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DescribeEndpointGroupResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DescribeEndpointGroup").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(describeEndpointGroupRequest)
.withMarshaller(new DescribeEndpointGroupRequestMarshaller(protocolFactory)));
}
/**
*
* Describe a listener.
*
*
* @param describeListenerRequest
* @return Result of the DescribeListener operation returned by the service.
* @throws InvalidArgumentException
* An argument that you specified is invalid.
* @throws ListenerNotFoundException
* The listener that you specified doesn't exist.
* @throws InternalServiceErrorException
* There was an internal error for AWS Global Accelerator.
* @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 GlobalAcceleratorException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample GlobalAcceleratorClient.DescribeListener
* @see AWS API Documentation
*/
@Override
public DescribeListenerResponse describeListener(DescribeListenerRequest describeListenerRequest)
throws InvalidArgumentException, ListenerNotFoundException, InternalServiceErrorException, AwsServiceException,
SdkClientException, GlobalAcceleratorException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DescribeListenerResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DescribeListener").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(describeListenerRequest)
.withMarshaller(new DescribeListenerRequestMarshaller(protocolFactory)));
}
/**
*
* List the accelerators for an AWS account.
*
*
* @param listAcceleratorsRequest
* @return Result of the ListAccelerators operation returned by the service.
* @throws InvalidNextTokenException
* There isn't another item to return.
* @throws InternalServiceErrorException
* There was an internal error for AWS Global Accelerator.
* @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 GlobalAcceleratorException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample GlobalAcceleratorClient.ListAccelerators
* @see AWS API Documentation
*/
@Override
public ListAcceleratorsResponse listAccelerators(ListAcceleratorsRequest listAcceleratorsRequest)
throws InvalidNextTokenException, InternalServiceErrorException, AwsServiceException, SdkClientException,
GlobalAcceleratorException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListAcceleratorsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListAccelerators").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(listAcceleratorsRequest)
.withMarshaller(new ListAcceleratorsRequestMarshaller(protocolFactory)));
}
/**
*
* List the endpoint groups that are associated with a listener.
*
*
* @param listEndpointGroupsRequest
* @return Result of the ListEndpointGroups operation returned by the service.
* @throws ListenerNotFoundException
* The listener that you specified doesn't exist.
* @throws InvalidNextTokenException
* There isn't another item to return.
* @throws InvalidArgumentException
* An argument that you specified is invalid.
* @throws InternalServiceErrorException
* There was an internal error for AWS Global Accelerator.
* @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 GlobalAcceleratorException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample GlobalAcceleratorClient.ListEndpointGroups
* @see AWS API Documentation
*/
@Override
public ListEndpointGroupsResponse listEndpointGroups(ListEndpointGroupsRequest listEndpointGroupsRequest)
throws ListenerNotFoundException, InvalidNextTokenException, InvalidArgumentException, InternalServiceErrorException,
AwsServiceException, SdkClientException, GlobalAcceleratorException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListEndpointGroupsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListEndpointGroups").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(listEndpointGroupsRequest)
.withMarshaller(new ListEndpointGroupsRequestMarshaller(protocolFactory)));
}
/**
*
* List the listeners for an accelerator.
*
*
* @param listListenersRequest
* @return Result of the ListListeners operation returned by the service.
* @throws AcceleratorNotFoundException
* The accelerator that you specified doesn't exist.
* @throws InvalidNextTokenException
* There isn't another item to return.
* @throws InternalServiceErrorException
* There was an internal error for AWS Global Accelerator.
* @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 GlobalAcceleratorException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample GlobalAcceleratorClient.ListListeners
* @see AWS API Documentation
*/
@Override
public ListListenersResponse listListeners(ListListenersRequest listListenersRequest) throws AcceleratorNotFoundException,
InvalidNextTokenException, InternalServiceErrorException, AwsServiceException, SdkClientException,
GlobalAcceleratorException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListListenersResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListListeners").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(listListenersRequest)
.withMarshaller(new ListListenersRequestMarshaller(protocolFactory)));
}
/**
*
* Update an accelerator.
*
*
* @param updateAcceleratorRequest
* @return Result of the UpdateAccelerator operation returned by the service.
* @throws AcceleratorNotFoundException
* The accelerator that you specified doesn't exist.
* @throws InternalServiceErrorException
* There was an internal error for AWS Global Accelerator.
* @throws InvalidArgumentException
* An argument that you specified is invalid.
* @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 GlobalAcceleratorException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample GlobalAcceleratorClient.UpdateAccelerator
* @see AWS API Documentation
*/
@Override
public UpdateAcceleratorResponse updateAccelerator(UpdateAcceleratorRequest updateAcceleratorRequest)
throws AcceleratorNotFoundException, InternalServiceErrorException, InvalidArgumentException, AwsServiceException,
SdkClientException, GlobalAcceleratorException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
UpdateAcceleratorResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("UpdateAccelerator").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(updateAcceleratorRequest)
.withMarshaller(new UpdateAcceleratorRequestMarshaller(protocolFactory)));
}
/**
*
* Update the attributes for an accelerator. To see an AWS CLI example of updating an accelerator to enable flow
* logs, scroll down to Example.
*
*
* @param updateAcceleratorAttributesRequest
* @return Result of the UpdateAcceleratorAttributes operation returned by the service.
* @throws AcceleratorNotFoundException
* The accelerator that you specified doesn't exist.
* @throws InternalServiceErrorException
* There was an internal error for AWS Global Accelerator.
* @throws InvalidArgumentException
* An argument that you specified is invalid.
* @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 GlobalAcceleratorException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample GlobalAcceleratorClient.UpdateAcceleratorAttributes
* @see AWS API Documentation
*/
@Override
public UpdateAcceleratorAttributesResponse updateAcceleratorAttributes(
UpdateAcceleratorAttributesRequest updateAcceleratorAttributesRequest) throws AcceleratorNotFoundException,
InternalServiceErrorException, InvalidArgumentException, AwsServiceException, SdkClientException,
GlobalAcceleratorException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, UpdateAcceleratorAttributesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("UpdateAcceleratorAttributes").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(updateAcceleratorAttributesRequest)
.withMarshaller(new UpdateAcceleratorAttributesRequestMarshaller(protocolFactory)));
}
/**
*
* Update an endpoint group. To see an AWS CLI example of updating an endpoint group, scroll down to Example.
*
*
* @param updateEndpointGroupRequest
* @return Result of the UpdateEndpointGroup operation returned by the service.
* @throws InvalidArgumentException
* An argument that you specified is invalid.
* @throws EndpointGroupNotFoundException
* The endpoint group that you specified doesn't exist.
* @throws InternalServiceErrorException
* There was an internal error for AWS Global Accelerator.
* @throws LimitExceededException
* Processing your request would cause you to exceed an AWS Global Accelerator limit.
* @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 GlobalAcceleratorException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample GlobalAcceleratorClient.UpdateEndpointGroup
* @see AWS API Documentation
*/
@Override
public UpdateEndpointGroupResponse updateEndpointGroup(UpdateEndpointGroupRequest updateEndpointGroupRequest)
throws InvalidArgumentException, EndpointGroupNotFoundException, InternalServiceErrorException,
LimitExceededException, AwsServiceException, SdkClientException, GlobalAcceleratorException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, UpdateEndpointGroupResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("UpdateEndpointGroup").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(updateEndpointGroupRequest)
.withMarshaller(new UpdateEndpointGroupRequestMarshaller(protocolFactory)));
}
/**
*
* Update a listener.
*
*
* @param updateListenerRequest
* @return Result of the UpdateListener operation returned by the service.
* @throws InvalidArgumentException
* An argument that you specified is invalid.
* @throws InvalidPortRangeException
* The port numbers that you specified are not valid numbers or are not unique for this accelerator.
* @throws ListenerNotFoundException
* The listener that you specified doesn't exist.
* @throws InternalServiceErrorException
* There was an internal error for AWS Global Accelerator.
* @throws LimitExceededException
* Processing your request would cause you to exceed an AWS Global Accelerator limit.
* @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 GlobalAcceleratorException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample GlobalAcceleratorClient.UpdateListener
* @see AWS API Documentation
*/
@Override
public UpdateListenerResponse updateListener(UpdateListenerRequest updateListenerRequest) throws InvalidArgumentException,
InvalidPortRangeException, ListenerNotFoundException, InternalServiceErrorException, LimitExceededException,
AwsServiceException, SdkClientException, GlobalAcceleratorException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
UpdateListenerResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("UpdateListener").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(updateListenerRequest)
.withMarshaller(new UpdateListenerRequestMarshaller(protocolFactory)));
}
private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory,
JsonOperationMetadata operationMetadata) {
return protocolFactory.createErrorResponseHandler(operationMetadata);
}
private > T init(T builder) {
return builder
.clientConfiguration(clientConfiguration)
.defaultServiceExceptionSupplier(GlobalAcceleratorException::builder)
.protocol(AwsJsonProtocol.AWS_JSON)
.protocolVersion("1.1")
.registerModeledException(
ExceptionMetadata.builder().errorCode("InvalidArgumentException")
.exceptionBuilderSupplier(InvalidArgumentException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ListenerNotFoundException")
.exceptionBuilderSupplier(ListenerNotFoundException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("AcceleratorNotFoundException")
.exceptionBuilderSupplier(AcceleratorNotFoundException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("AssociatedListenerFoundException")
.exceptionBuilderSupplier(AssociatedListenerFoundException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("InternalServiceErrorException")
.exceptionBuilderSupplier(InternalServiceErrorException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("AssociatedEndpointGroupFoundException")
.exceptionBuilderSupplier(AssociatedEndpointGroupFoundException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("EndpointGroupNotFoundException")
.exceptionBuilderSupplier(EndpointGroupNotFoundException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("AcceleratorNotDisabledException")
.exceptionBuilderSupplier(AcceleratorNotDisabledException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("InvalidNextTokenException")
.exceptionBuilderSupplier(InvalidNextTokenException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("EndpointGroupAlreadyExistsException")
.exceptionBuilderSupplier(EndpointGroupAlreadyExistsException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("InvalidPortRangeException")
.exceptionBuilderSupplier(InvalidPortRangeException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("LimitExceededException")
.exceptionBuilderSupplier(LimitExceededException::builder).build());
}
@Override
public void close() {
clientHandler.close();
}
}