com.amazonaws.services.keyspaces.AmazonKeyspacesClient Maven / Gradle / Ivy
Show all versions of aws-java-sdk-keyspaces Show documentation
/*
* Copyright 2019-2024 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 com.amazonaws.services.keyspaces;
import org.w3c.dom.*;
import java.net.*;
import java.util.*;
import javax.annotation.Generated;
import org.apache.commons.logging.*;
import com.amazonaws.*;
import com.amazonaws.annotation.SdkInternalApi;
import com.amazonaws.auth.*;
import com.amazonaws.handlers.*;
import com.amazonaws.http.*;
import com.amazonaws.internal.*;
import com.amazonaws.internal.auth.*;
import com.amazonaws.metrics.*;
import com.amazonaws.regions.*;
import com.amazonaws.transform.*;
import com.amazonaws.util.*;
import com.amazonaws.protocol.json.*;
import com.amazonaws.util.AWSRequestMetrics.Field;
import com.amazonaws.annotation.ThreadSafe;
import com.amazonaws.client.AwsSyncClientParams;
import com.amazonaws.client.builder.AdvancedConfig;
import com.amazonaws.services.keyspaces.AmazonKeyspacesClientBuilder;
import com.amazonaws.AmazonServiceException;
import com.amazonaws.services.keyspaces.model.*;
import com.amazonaws.services.keyspaces.model.transform.*;
/**
* Client for accessing Amazon Keyspaces. All service calls made using this client are blocking, and will not return
* until the service call completes.
*
*
* Amazon Keyspaces (for Apache Cassandra) is a scalable, highly available, and managed Apache Cassandra-compatible
* database service. Amazon Keyspaces makes it easy to migrate, run, and scale Cassandra workloads in the Amazon Web
* Services Cloud. With just a few clicks on the Amazon Web Services Management Console or a few lines of code, you can
* create keyspaces and tables in Amazon Keyspaces, without deploying any infrastructure or installing software.
*
*
* In addition to supporting Cassandra Query Language (CQL) requests via open-source Cassandra drivers, Amazon Keyspaces
* supports data definition language (DDL) operations to manage keyspaces and tables using the Amazon Web Services SDK
* and CLI, as well as infrastructure as code (IaC) services and tools such as CloudFormation and Terraform. This API
* reference describes the supported DDL operations in detail.
*
*
* For the list of all supported CQL APIs, see Supported Cassandra APIs,
* operations, and data types in Amazon Keyspaces in the Amazon Keyspaces Developer Guide.
*
*
* To learn how Amazon Keyspaces API actions are recorded with CloudTrail, see Amazon Keyspaces information in CloudTrail in the Amazon Keyspaces Developer Guide.
*
*
* For more information about Amazon Web Services APIs, for example how to implement retry logic or how to sign Amazon
* Web Services API requests, see Amazon Web
* Services APIs in the General Reference.
*
*/
@ThreadSafe
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AmazonKeyspacesClient extends AmazonWebServiceClient implements AmazonKeyspaces {
/** Provider for AWS credentials. */
private final AWSCredentialsProvider awsCredentialsProvider;
private static final Log log = LogFactory.getLog(AmazonKeyspaces.class);
/** Default signing name for the service. */
private static final String DEFAULT_SIGNING_NAME = "cassandra";
/** Client configuration factory providing ClientConfigurations tailored to this client */
protected static final ClientConfigurationFactory configFactory = new ClientConfigurationFactory();
private final AdvancedConfig advancedConfig;
private static final com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory = new com.amazonaws.protocol.json.SdkJsonProtocolFactory(
new JsonClientMetadata()
.withProtocolVersion("1.0")
.withSupportsCbor(false)
.withSupportsIon(false)
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("AccessDeniedException").withExceptionUnmarshaller(
com.amazonaws.services.keyspaces.model.transform.AccessDeniedExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("ConflictException").withExceptionUnmarshaller(
com.amazonaws.services.keyspaces.model.transform.ConflictExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("ResourceNotFoundException").withExceptionUnmarshaller(
com.amazonaws.services.keyspaces.model.transform.ResourceNotFoundExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("ValidationException").withExceptionUnmarshaller(
com.amazonaws.services.keyspaces.model.transform.ValidationExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("ServiceQuotaExceededException").withExceptionUnmarshaller(
com.amazonaws.services.keyspaces.model.transform.ServiceQuotaExceededExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("InternalServerException").withExceptionUnmarshaller(
com.amazonaws.services.keyspaces.model.transform.InternalServerExceptionUnmarshaller.getInstance()))
.withBaseServiceExceptionClass(com.amazonaws.services.keyspaces.model.AmazonKeyspacesException.class));
public static AmazonKeyspacesClientBuilder builder() {
return AmazonKeyspacesClientBuilder.standard();
}
/**
* Constructs a new client to invoke service methods on Amazon Keyspaces using the specified parameters.
*
*
* All service calls made using this new client object are blocking, and will not return until the service call
* completes.
*
* @param clientParams
* Object providing client parameters.
*/
AmazonKeyspacesClient(AwsSyncClientParams clientParams) {
this(clientParams, false);
}
/**
* Constructs a new client to invoke service methods on Amazon Keyspaces using the specified parameters.
*
*
* All service calls made using this new client object are blocking, and will not return until the service call
* completes.
*
* @param clientParams
* Object providing client parameters.
*/
AmazonKeyspacesClient(AwsSyncClientParams clientParams, boolean endpointDiscoveryEnabled) {
super(clientParams);
this.awsCredentialsProvider = clientParams.getCredentialsProvider();
this.advancedConfig = clientParams.getAdvancedConfig();
init();
}
private void init() {
setServiceNameIntern(DEFAULT_SIGNING_NAME);
setEndpointPrefix(ENDPOINT_PREFIX);
// calling this.setEndPoint(...) will also modify the signer accordingly
setEndpoint("cassandra.us-east-1.amazonaws.com");
HandlerChainFactory chainFactory = new HandlerChainFactory();
requestHandler2s.addAll(chainFactory.newRequestHandlerChain("/com/amazonaws/services/keyspaces/request.handlers"));
requestHandler2s.addAll(chainFactory.newRequestHandler2Chain("/com/amazonaws/services/keyspaces/request.handler2s"));
requestHandler2s.addAll(chainFactory.getGlobalHandlers());
}
/**
*
* The CreateKeyspace
operation adds a new keyspace to your account. In an Amazon Web Services account,
* keyspace names must be unique within each Region.
*
*
* CreateKeyspace
is an asynchronous operation. You can monitor the creation status of the new keyspace
* by using the GetKeyspace
operation.
*
*
* For more information, see Creating keyspaces in the Amazon Keyspaces Developer Guide.
*
*
* @param createKeyspaceRequest
* @return Result of the CreateKeyspace operation returned by the service.
* @throws ValidationException
* The operation failed due to an invalid or malformed request.
* @throws ServiceQuotaExceededException
* The operation exceeded the service quota for this resource. For more information on service quotas, see
* Quotas in the Amazon
* Keyspaces Developer Guide.
* @throws InternalServerException
* Amazon Keyspaces was unable to fully process this request because of an internal server error.
* @throws ConflictException
* Amazon Keyspaces couldn't complete the requested action. This error may occur if you try to perform an
* action and the same or a different action is already in progress, or if you try to create a resource that
* already exists.
* @throws AccessDeniedException
* You don't have sufficient access permissions to perform this action.
* @sample AmazonKeyspaces.CreateKeyspace
* @see AWS API
* Documentation
*/
@Override
public CreateKeyspaceResult createKeyspace(CreateKeyspaceRequest request) {
request = beforeClientExecution(request);
return executeCreateKeyspace(request);
}
@SdkInternalApi
final CreateKeyspaceResult executeCreateKeyspace(CreateKeyspaceRequest createKeyspaceRequest) {
ExecutionContext executionContext = createExecutionContext(createKeyspaceRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CreateKeyspaceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createKeyspaceRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Keyspaces");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateKeyspace");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateKeyspaceResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* The CreateTable
operation adds a new table to the specified keyspace. Within a keyspace, table names
* must be unique.
*
*
* CreateTable
is an asynchronous operation. When the request is received, the status of the table is
* set to CREATING
. You can monitor the creation status of the new table by using the
* GetTable
operation, which returns the current status
of the table. You can start using
* a table when the status is ACTIVE
.
*
*
* For more information, see Creating
* tables in the Amazon Keyspaces Developer Guide.
*
*
* @param createTableRequest
* @return Result of the CreateTable operation returned by the service.
* @throws ValidationException
* The operation failed due to an invalid or malformed request.
* @throws ServiceQuotaExceededException
* The operation exceeded the service quota for this resource. For more information on service quotas, see
* Quotas in the Amazon
* Keyspaces Developer Guide.
* @throws InternalServerException
* Amazon Keyspaces was unable to fully process this request because of an internal server error.
* @throws ConflictException
* Amazon Keyspaces couldn't complete the requested action. This error may occur if you try to perform an
* action and the same or a different action is already in progress, or if you try to create a resource that
* already exists.
* @throws AccessDeniedException
* You don't have sufficient access permissions to perform this action.
* @throws ResourceNotFoundException
* The operation tried to access a keyspace or table that doesn't exist. The resource might not be specified
* correctly, or its status might not be ACTIVE
.
* @sample AmazonKeyspaces.CreateTable
* @see AWS API
* Documentation
*/
@Override
public CreateTableResult createTable(CreateTableRequest request) {
request = beforeClientExecution(request);
return executeCreateTable(request);
}
@SdkInternalApi
final CreateTableResult executeCreateTable(CreateTableRequest createTableRequest) {
ExecutionContext executionContext = createExecutionContext(createTableRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CreateTableRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createTableRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Keyspaces");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateTable");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateTableResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* The DeleteKeyspace
operation deletes a keyspace and all of its tables.
*
*
* @param deleteKeyspaceRequest
* @return Result of the DeleteKeyspace operation returned by the service.
* @throws ValidationException
* The operation failed due to an invalid or malformed request.
* @throws ServiceQuotaExceededException
* The operation exceeded the service quota for this resource. For more information on service quotas, see
* Quotas in the Amazon
* Keyspaces Developer Guide.
* @throws InternalServerException
* Amazon Keyspaces was unable to fully process this request because of an internal server error.
* @throws ConflictException
* Amazon Keyspaces couldn't complete the requested action. This error may occur if you try to perform an
* action and the same or a different action is already in progress, or if you try to create a resource that
* already exists.
* @throws AccessDeniedException
* You don't have sufficient access permissions to perform this action.
* @throws ResourceNotFoundException
* The operation tried to access a keyspace or table that doesn't exist. The resource might not be specified
* correctly, or its status might not be ACTIVE
.
* @sample AmazonKeyspaces.DeleteKeyspace
* @see AWS API
* Documentation
*/
@Override
public DeleteKeyspaceResult deleteKeyspace(DeleteKeyspaceRequest request) {
request = beforeClientExecution(request);
return executeDeleteKeyspace(request);
}
@SdkInternalApi
final DeleteKeyspaceResult executeDeleteKeyspace(DeleteKeyspaceRequest deleteKeyspaceRequest) {
ExecutionContext executionContext = createExecutionContext(deleteKeyspaceRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DeleteKeyspaceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteKeyspaceRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Keyspaces");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteKeyspace");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteKeyspaceResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* The DeleteTable
operation deletes a table and all of its data. After a DeleteTable
* request is received, the specified table is in the DELETING
state until Amazon Keyspaces completes
* the deletion. If the table is in the ACTIVE
state, you can delete it. If a table is either in the
* CREATING
or UPDATING
states, then Amazon Keyspaces returns a
* ResourceInUseException
. If the specified table does not exist, Amazon Keyspaces returns a
* ResourceNotFoundException
. If the table is already in the DELETING
state, no error is
* returned.
*
*
* @param deleteTableRequest
* @return Result of the DeleteTable operation returned by the service.
* @throws ValidationException
* The operation failed due to an invalid or malformed request.
* @throws ServiceQuotaExceededException
* The operation exceeded the service quota for this resource. For more information on service quotas, see
* Quotas in the Amazon
* Keyspaces Developer Guide.
* @throws InternalServerException
* Amazon Keyspaces was unable to fully process this request because of an internal server error.
* @throws ConflictException
* Amazon Keyspaces couldn't complete the requested action. This error may occur if you try to perform an
* action and the same or a different action is already in progress, or if you try to create a resource that
* already exists.
* @throws AccessDeniedException
* You don't have sufficient access permissions to perform this action.
* @throws ResourceNotFoundException
* The operation tried to access a keyspace or table that doesn't exist. The resource might not be specified
* correctly, or its status might not be ACTIVE
.
* @sample AmazonKeyspaces.DeleteTable
* @see AWS API
* Documentation
*/
@Override
public DeleteTableResult deleteTable(DeleteTableRequest request) {
request = beforeClientExecution(request);
return executeDeleteTable(request);
}
@SdkInternalApi
final DeleteTableResult executeDeleteTable(DeleteTableRequest deleteTableRequest) {
ExecutionContext executionContext = createExecutionContext(deleteTableRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DeleteTableRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteTableRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Keyspaces");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteTable");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteTableResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Returns the name and the Amazon Resource Name (ARN) of the specified table.
*
*
* @param getKeyspaceRequest
* @return Result of the GetKeyspace operation returned by the service.
* @throws ValidationException
* The operation failed due to an invalid or malformed request.
* @throws ServiceQuotaExceededException
* The operation exceeded the service quota for this resource. For more information on service quotas, see
* Quotas in the Amazon
* Keyspaces Developer Guide.
* @throws InternalServerException
* Amazon Keyspaces was unable to fully process this request because of an internal server error.
* @throws AccessDeniedException
* You don't have sufficient access permissions to perform this action.
* @throws ResourceNotFoundException
* The operation tried to access a keyspace or table that doesn't exist. The resource might not be specified
* correctly, or its status might not be ACTIVE
.
* @sample AmazonKeyspaces.GetKeyspace
* @see AWS API
* Documentation
*/
@Override
public GetKeyspaceResult getKeyspace(GetKeyspaceRequest request) {
request = beforeClientExecution(request);
return executeGetKeyspace(request);
}
@SdkInternalApi
final GetKeyspaceResult executeGetKeyspace(GetKeyspaceRequest getKeyspaceRequest) {
ExecutionContext executionContext = createExecutionContext(getKeyspaceRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetKeyspaceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getKeyspaceRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Keyspaces");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetKeyspace");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetKeyspaceResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Returns information about the table, including the table's name and current status, the keyspace name,
* configuration settings, and metadata.
*
*
* To read table metadata using GetTable
, Select
action permissions for the table and
* system tables are required to complete the operation.
*
*
* @param getTableRequest
* @return Result of the GetTable operation returned by the service.
* @throws ValidationException
* The operation failed due to an invalid or malformed request.
* @throws ServiceQuotaExceededException
* The operation exceeded the service quota for this resource. For more information on service quotas, see
* Quotas in the Amazon
* Keyspaces Developer Guide.
* @throws InternalServerException
* Amazon Keyspaces was unable to fully process this request because of an internal server error.
* @throws AccessDeniedException
* You don't have sufficient access permissions to perform this action.
* @throws ResourceNotFoundException
* The operation tried to access a keyspace or table that doesn't exist. The resource might not be specified
* correctly, or its status might not be ACTIVE
.
* @sample AmazonKeyspaces.GetTable
* @see AWS API
* Documentation
*/
@Override
public GetTableResult getTable(GetTableRequest request) {
request = beforeClientExecution(request);
return executeGetTable(request);
}
@SdkInternalApi
final GetTableResult executeGetTable(GetTableRequest getTableRequest) {
ExecutionContext executionContext = createExecutionContext(getTableRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetTableRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getTableRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Keyspaces");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetTable");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetTableResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Returns auto scaling related settings of the specified table in JSON format. If the table is a multi-Region
* table, the Amazon Web Services Region specific auto scaling settings of the table are included.
*
*
* Amazon Keyspaces auto scaling helps you provision throughput capacity for variable workloads efficiently by
* increasing and decreasing your table's read and write capacity automatically in response to application traffic.
* For more information, see Managing throughput capacity
* automatically with Amazon Keyspaces auto scaling in the Amazon Keyspaces Developer Guide.
*
*
*
* GetTableAutoScalingSettings
can't be used as an action in an IAM policy.
*
*
*
* To define permissions for GetTableAutoScalingSettings
, you must allow the following two actions in
* the IAM policy statement's Action
element:
*
*
* -
*
* application-autoscaling:DescribeScalableTargets
*
*
* -
*
* application-autoscaling:DescribeScalingPolicies
*
*
*
*
* @param getTableAutoScalingSettingsRequest
* @return Result of the GetTableAutoScalingSettings operation returned by the service.
* @throws ValidationException
* The operation failed due to an invalid or malformed request.
* @throws ServiceQuotaExceededException
* The operation exceeded the service quota for this resource. For more information on service quotas, see
* Quotas in the Amazon
* Keyspaces Developer Guide.
* @throws InternalServerException
* Amazon Keyspaces was unable to fully process this request because of an internal server error.
* @throws AccessDeniedException
* You don't have sufficient access permissions to perform this action.
* @throws ResourceNotFoundException
* The operation tried to access a keyspace or table that doesn't exist. The resource might not be specified
* correctly, or its status might not be ACTIVE
.
* @sample AmazonKeyspaces.GetTableAutoScalingSettings
* @see AWS API Documentation
*/
@Override
public GetTableAutoScalingSettingsResult getTableAutoScalingSettings(GetTableAutoScalingSettingsRequest request) {
request = beforeClientExecution(request);
return executeGetTableAutoScalingSettings(request);
}
@SdkInternalApi
final GetTableAutoScalingSettingsResult executeGetTableAutoScalingSettings(GetTableAutoScalingSettingsRequest getTableAutoScalingSettingsRequest) {
ExecutionContext executionContext = createExecutionContext(getTableAutoScalingSettingsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetTableAutoScalingSettingsRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(getTableAutoScalingSettingsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Keyspaces");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetTableAutoScalingSettings");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new GetTableAutoScalingSettingsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Returns a list of keyspaces.
*
*
* @param listKeyspacesRequest
* @return Result of the ListKeyspaces operation returned by the service.
* @throws ValidationException
* The operation failed due to an invalid or malformed request.
* @throws ServiceQuotaExceededException
* The operation exceeded the service quota for this resource. For more information on service quotas, see
* Quotas in the Amazon
* Keyspaces Developer Guide.
* @throws InternalServerException
* Amazon Keyspaces was unable to fully process this request because of an internal server error.
* @throws AccessDeniedException
* You don't have sufficient access permissions to perform this action.
* @throws ResourceNotFoundException
* The operation tried to access a keyspace or table that doesn't exist. The resource might not be specified
* correctly, or its status might not be ACTIVE
.
* @sample AmazonKeyspaces.ListKeyspaces
* @see AWS API
* Documentation
*/
@Override
public ListKeyspacesResult listKeyspaces(ListKeyspacesRequest request) {
request = beforeClientExecution(request);
return executeListKeyspaces(request);
}
@SdkInternalApi
final ListKeyspacesResult executeListKeyspaces(ListKeyspacesRequest listKeyspacesRequest) {
ExecutionContext executionContext = createExecutionContext(listKeyspacesRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListKeyspacesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listKeyspacesRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Keyspaces");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListKeyspaces");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListKeyspacesResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Returns a list of tables for a specified keyspace.
*
*
* @param listTablesRequest
* @return Result of the ListTables operation returned by the service.
* @throws ValidationException
* The operation failed due to an invalid or malformed request.
* @throws ServiceQuotaExceededException
* The operation exceeded the service quota for this resource. For more information on service quotas, see
* Quotas in the Amazon
* Keyspaces Developer Guide.
* @throws InternalServerException
* Amazon Keyspaces was unable to fully process this request because of an internal server error.
* @throws AccessDeniedException
* You don't have sufficient access permissions to perform this action.
* @throws ResourceNotFoundException
* The operation tried to access a keyspace or table that doesn't exist. The resource might not be specified
* correctly, or its status might not be ACTIVE
.
* @sample AmazonKeyspaces.ListTables
* @see AWS API
* Documentation
*/
@Override
public ListTablesResult listTables(ListTablesRequest request) {
request = beforeClientExecution(request);
return executeListTables(request);
}
@SdkInternalApi
final ListTablesResult executeListTables(ListTablesRequest listTablesRequest) {
ExecutionContext executionContext = createExecutionContext(listTablesRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListTablesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listTablesRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Keyspaces");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListTables");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListTablesResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Returns a list of all tags associated with the specified Amazon Keyspaces resource.
*
*
* @param listTagsForResourceRequest
* @return Result of the ListTagsForResource operation returned by the service.
* @throws ValidationException
* The operation failed due to an invalid or malformed request.
* @throws ServiceQuotaExceededException
* The operation exceeded the service quota for this resource. For more information on service quotas, see
* Quotas in the Amazon
* Keyspaces Developer Guide.
* @throws InternalServerException
* Amazon Keyspaces was unable to fully process this request because of an internal server error.
* @throws AccessDeniedException
* You don't have sufficient access permissions to perform this action.
* @throws ResourceNotFoundException
* The operation tried to access a keyspace or table that doesn't exist. The resource might not be specified
* correctly, or its status might not be ACTIVE
.
* @sample AmazonKeyspaces.ListTagsForResource
* @see AWS
* API Documentation
*/
@Override
public ListTagsForResourceResult listTagsForResource(ListTagsForResourceRequest request) {
request = beforeClientExecution(request);
return executeListTagsForResource(request);
}
@SdkInternalApi
final ListTagsForResourceResult executeListTagsForResource(ListTagsForResourceRequest listTagsForResourceRequest) {
ExecutionContext executionContext = createExecutionContext(listTagsForResourceRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListTagsForResourceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listTagsForResourceRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Keyspaces");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListTagsForResource");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListTagsForResourceResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Restores the table to the specified point in time within the earliest_restorable_timestamp
and the
* current time. For more information about restore points, see Time window for PITR continuous backups in the Amazon Keyspaces Developer Guide.
*
*
* Any number of users can execute up to 4 concurrent restores (any type of restore) in a given account.
*
*
* When you restore using point in time recovery, Amazon Keyspaces restores your source table's schema and data to
* the state based on the selected timestamp (day:hour:minute:second)
to a new table. The Time to Live
* (TTL) settings are also restored to the state based on the selected timestamp.
*
*
* In addition to the table's schema, data, and TTL settings, RestoreTable
restores the capacity mode,
* auto scaling settings, encryption settings, and point-in-time recovery settings from the source table. Unlike the
* table's schema data and TTL settings, which are restored based on the selected timestamp, these settings are
* always restored based on the table's settings as of the current time or when the table was deleted.
*
*
* You can also overwrite these settings during restore:
*
*
* -
*
* Read/write capacity mode
*
*
* -
*
* Provisioned throughput capacity units
*
*
* -
*
* Auto scaling settings
*
*
* -
*
* Point-in-time (PITR) settings
*
*
* -
*
* Tags
*
*
*
*
* For more information, see PITR restore settings in the Amazon Keyspaces Developer Guide.
*
*
* Note that the following settings are not restored, and you must configure them manually for the new table:
*
*
* -
*
* Identity and Access Management (IAM) policies
*
*
* -
*
* Amazon CloudWatch metrics and alarms
*
*
*
*
* @param restoreTableRequest
* @return Result of the RestoreTable operation returned by the service.
* @throws ValidationException
* The operation failed due to an invalid or malformed request.
* @throws ServiceQuotaExceededException
* The operation exceeded the service quota for this resource. For more information on service quotas, see
* Quotas in the Amazon
* Keyspaces Developer Guide.
* @throws InternalServerException
* Amazon Keyspaces was unable to fully process this request because of an internal server error.
* @throws ConflictException
* Amazon Keyspaces couldn't complete the requested action. This error may occur if you try to perform an
* action and the same or a different action is already in progress, or if you try to create a resource that
* already exists.
* @throws AccessDeniedException
* You don't have sufficient access permissions to perform this action.
* @throws ResourceNotFoundException
* The operation tried to access a keyspace or table that doesn't exist. The resource might not be specified
* correctly, or its status might not be ACTIVE
.
* @sample AmazonKeyspaces.RestoreTable
* @see AWS API
* Documentation
*/
@Override
public RestoreTableResult restoreTable(RestoreTableRequest request) {
request = beforeClientExecution(request);
return executeRestoreTable(request);
}
@SdkInternalApi
final RestoreTableResult executeRestoreTable(RestoreTableRequest restoreTableRequest) {
ExecutionContext executionContext = createExecutionContext(restoreTableRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new RestoreTableRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(restoreTableRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Keyspaces");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "RestoreTable");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new RestoreTableResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Associates a set of tags with a Amazon Keyspaces resource. You can then activate these user-defined tags so that
* they appear on the Cost Management Console for cost allocation tracking. For more information, see Adding tags and labels to
* Amazon Keyspaces resources in the Amazon Keyspaces Developer Guide.
*
*
* For IAM policy examples that show how to control access to Amazon Keyspaces resources based on tags, see Amazon Keyspaces resource access based on tags in the Amazon Keyspaces Developer Guide.
*
*
* @param tagResourceRequest
* @return Result of the TagResource operation returned by the service.
* @throws ValidationException
* The operation failed due to an invalid or malformed request.
* @throws ServiceQuotaExceededException
* The operation exceeded the service quota for this resource. For more information on service quotas, see
* Quotas in the Amazon
* Keyspaces Developer Guide.
* @throws InternalServerException
* Amazon Keyspaces was unable to fully process this request because of an internal server error.
* @throws AccessDeniedException
* You don't have sufficient access permissions to perform this action.
* @throws ResourceNotFoundException
* The operation tried to access a keyspace or table that doesn't exist. The resource might not be specified
* correctly, or its status might not be ACTIVE
.
* @sample AmazonKeyspaces.TagResource
* @see AWS API
* Documentation
*/
@Override
public TagResourceResult tagResource(TagResourceRequest request) {
request = beforeClientExecution(request);
return executeTagResource(request);
}
@SdkInternalApi
final TagResourceResult executeTagResource(TagResourceRequest tagResourceRequest) {
ExecutionContext executionContext = createExecutionContext(tagResourceRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new TagResourceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(tagResourceRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Keyspaces");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "TagResource");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new TagResourceResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Removes the association of tags from a Amazon Keyspaces resource.
*
*
* @param untagResourceRequest
* @return Result of the UntagResource operation returned by the service.
* @throws ValidationException
* The operation failed due to an invalid or malformed request.
* @throws ServiceQuotaExceededException
* The operation exceeded the service quota for this resource. For more information on service quotas, see
* Quotas in the Amazon
* Keyspaces Developer Guide.
* @throws InternalServerException
* Amazon Keyspaces was unable to fully process this request because of an internal server error.
* @throws ConflictException
* Amazon Keyspaces couldn't complete the requested action. This error may occur if you try to perform an
* action and the same or a different action is already in progress, or if you try to create a resource that
* already exists.
* @throws AccessDeniedException
* You don't have sufficient access permissions to perform this action.
* @throws ResourceNotFoundException
* The operation tried to access a keyspace or table that doesn't exist. The resource might not be specified
* correctly, or its status might not be ACTIVE
.
* @sample AmazonKeyspaces.UntagResource
* @see AWS API
* Documentation
*/
@Override
public UntagResourceResult untagResource(UntagResourceRequest request) {
request = beforeClientExecution(request);
return executeUntagResource(request);
}
@SdkInternalApi
final UntagResourceResult executeUntagResource(UntagResourceRequest untagResourceRequest) {
ExecutionContext executionContext = createExecutionContext(untagResourceRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new UntagResourceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(untagResourceRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Keyspaces");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UntagResource");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UntagResourceResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Adds new columns to the table or updates one of the table's settings, for example capacity mode, auto scaling,
* encryption, point-in-time recovery, or ttl settings. Note that you can only update one specific table setting per
* update operation.
*
*
* @param updateTableRequest
* @return Result of the UpdateTable operation returned by the service.
* @throws ValidationException
* The operation failed due to an invalid or malformed request.
* @throws ServiceQuotaExceededException
* The operation exceeded the service quota for this resource. For more information on service quotas, see
* Quotas in the Amazon
* Keyspaces Developer Guide.
* @throws InternalServerException
* Amazon Keyspaces was unable to fully process this request because of an internal server error.
* @throws ConflictException
* Amazon Keyspaces couldn't complete the requested action. This error may occur if you try to perform an
* action and the same or a different action is already in progress, or if you try to create a resource that
* already exists.
* @throws AccessDeniedException
* You don't have sufficient access permissions to perform this action.
* @throws ResourceNotFoundException
* The operation tried to access a keyspace or table that doesn't exist. The resource might not be specified
* correctly, or its status might not be ACTIVE
.
* @sample AmazonKeyspaces.UpdateTable
* @see AWS API
* Documentation
*/
@Override
public UpdateTableResult updateTable(UpdateTableRequest request) {
request = beforeClientExecution(request);
return executeUpdateTable(request);
}
@SdkInternalApi
final UpdateTableResult executeUpdateTable(UpdateTableRequest updateTableRequest) {
ExecutionContext executionContext = createExecutionContext(updateTableRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new UpdateTableRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updateTableRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Keyspaces");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateTable");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdateTableResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* Returns additional metadata for a previously executed successful, request, typically used for debugging issues
* where a service isn't acting as expected. This data isn't considered part of the result data returned by an
* operation, so it's available through this separate, diagnostic interface.
*
* Response metadata is only cached for a limited period of time, so if you need to access this extra diagnostic
* information for an executed request, you should use this method to retrieve it as soon as possible after
* executing the request.
*
* @param request
* The originally executed request
*
* @return The response metadata for the specified request, or null if none is available.
*/
public ResponseMetadata getCachedResponseMetadata(AmazonWebServiceRequest request) {
return client.getResponseMetadataForRequest(request);
}
/**
* Normal invoke with authentication. Credentials are required and may be overriden at the request level.
**/
private Response invoke(Request request, HttpResponseHandler> responseHandler,
ExecutionContext executionContext) {
return invoke(request, responseHandler, executionContext, null, null);
}
/**
* Normal invoke with authentication. Credentials are required and may be overriden at the request level.
**/
private Response invoke(Request request, HttpResponseHandler> responseHandler,
ExecutionContext executionContext, URI cachedEndpoint, URI uriFromEndpointTrait) {
executionContext.setCredentialsProvider(CredentialUtils.getCredentialsProvider(request.getOriginalRequest(), awsCredentialsProvider));
return doInvoke(request, responseHandler, executionContext, cachedEndpoint, uriFromEndpointTrait);
}
/**
* Invoke with no authentication. Credentials are not required and any credentials set on the client or request will
* be ignored for this operation.
**/
private Response anonymousInvoke(Request request,
HttpResponseHandler> responseHandler, ExecutionContext executionContext) {
return doInvoke(request, responseHandler, executionContext, null, null);
}
/**
* Invoke the request using the http client. Assumes credentials (or lack thereof) have been configured in the
* ExecutionContext beforehand.
**/
private Response doInvoke(Request request, HttpResponseHandler> responseHandler,
ExecutionContext executionContext, URI discoveredEndpoint, URI uriFromEndpointTrait) {
if (discoveredEndpoint != null) {
request.setEndpoint(discoveredEndpoint);
request.getOriginalRequest().getRequestClientOptions().appendUserAgent("endpoint-discovery");
} else if (uriFromEndpointTrait != null) {
request.setEndpoint(uriFromEndpointTrait);
} else {
request.setEndpoint(endpoint);
}
request.setTimeOffset(timeOffset);
HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(new JsonErrorResponseMetadata());
return client.execute(request, responseHandler, errorResponseHandler, executionContext);
}
@com.amazonaws.annotation.SdkInternalApi
static com.amazonaws.protocol.json.SdkJsonProtocolFactory getProtocolFactory() {
return protocolFactory;
}
@Override
public void shutdown() {
super.shutdown();
}
}