/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include #include #include #include #include #include namespace Aws { namespace RDSDataService { /** *

Amazon RDS Data Service

Amazon RDS provides an HTTP * endpoint to run SQL statements on an Amazon Aurora Serverless v1 DB cluster. To * run these statements, you work with the Data Service API.

The Data * Service API isn't supported on Amazon Aurora Serverless v2 DB clusters.

*

For more information about the Data Service API, see Using * the Data API in the Amazon Aurora User Guide.

*/ class AWS_RDSDATASERVICE_API RDSDataServiceClient : public Aws::Client::AWSJsonClient, public Aws::Client::ClientWithAsyncTemplateMethods { public: typedef Aws::Client::AWSJsonClient BASECLASS; static const char* SERVICE_NAME; static const char* ALLOCATION_TAG; typedef RDSDataServiceClientConfiguration ClientConfigurationType; typedef RDSDataServiceEndpointProvider EndpointProviderType; /** * Initializes client to use DefaultCredentialProviderChain, with default http client factory, and optional client config. If client config * is not specified, it will be initialized to default values. */ RDSDataServiceClient(const Aws::RDSDataService::RDSDataServiceClientConfiguration& clientConfiguration = Aws::RDSDataService::RDSDataServiceClientConfiguration(), std::shared_ptr endpointProvider = Aws::MakeShared(ALLOCATION_TAG)); /** * Initializes client to use SimpleAWSCredentialsProvider, with default http client factory, and optional client config. If client config * is not specified, it will be initialized to default values. */ RDSDataServiceClient(const Aws::Auth::AWSCredentials& credentials, std::shared_ptr endpointProvider = Aws::MakeShared(ALLOCATION_TAG), const Aws::RDSDataService::RDSDataServiceClientConfiguration& clientConfiguration = Aws::RDSDataService::RDSDataServiceClientConfiguration()); /** * Initializes client to use specified credentials provider with specified client config. If http client factory is not supplied, * the default http client factory will be used */ RDSDataServiceClient(const std::shared_ptr& credentialsProvider, std::shared_ptr endpointProvider = Aws::MakeShared(ALLOCATION_TAG), const Aws::RDSDataService::RDSDataServiceClientConfiguration& clientConfiguration = Aws::RDSDataService::RDSDataServiceClientConfiguration()); /* Legacy constructors due deprecation */ /** * Initializes client to use DefaultCredentialProviderChain, with default http client factory, and optional client config. If client config * is not specified, it will be initialized to default values. */ RDSDataServiceClient(const Aws::Client::ClientConfiguration& clientConfiguration); /** * Initializes client to use SimpleAWSCredentialsProvider, with default http client factory, and optional client config. If client config * is not specified, it will be initialized to default values. */ RDSDataServiceClient(const Aws::Auth::AWSCredentials& credentials, const Aws::Client::ClientConfiguration& clientConfiguration); /** * Initializes client to use specified credentials provider with specified client config. If http client factory is not supplied, * the default http client factory will be used */ RDSDataServiceClient(const std::shared_ptr& credentialsProvider, const Aws::Client::ClientConfiguration& clientConfiguration); /* End of legacy constructors due deprecation */ virtual ~RDSDataServiceClient(); /** *

Runs a batch SQL statement over an array of data.

You can run bulk * update and insert operations for multiple records using a DML statement with * different parameter sets. Bulk operations can provide a significant performance * improvement over individual insert and update operations.

If a * call isn't part of a transaction because it doesn't include the * transactionID parameter, changes that result from the call are * committed automatically.

There isn't a fixed upper limit on the number of * parameter sets. However, the maximum size of the HTTP request submitted through * the Data API is 4 MiB. If the request exceeds this limit, the Data API returns * an error and doesn't process the request. This 4-MiB limit includes the size of * the HTTP headers and the JSON notation in the request. Thus, the number of * parameter sets that you can include depends on a combination of factors, such as * the size of the SQL statement and the size of each parameter set.

The * response size limit is 1 MiB. If the call returns more than 1 MiB of response * data, the call is terminated.

See Also:

AWS * API Reference

*/ virtual Model::BatchExecuteStatementOutcome BatchExecuteStatement(const Model::BatchExecuteStatementRequest& request) const; /** * A Callable wrapper for BatchExecuteStatement that returns a future to the operation so that it can be executed in parallel to other requests. */ template Model::BatchExecuteStatementOutcomeCallable BatchExecuteStatementCallable(const BatchExecuteStatementRequestT& request) const { return SubmitCallable(&RDSDataServiceClient::BatchExecuteStatement, request); } /** * An Async wrapper for BatchExecuteStatement that queues the request into a thread executor and triggers associated callback when operation has finished. */ template void BatchExecuteStatementAsync(const BatchExecuteStatementRequestT& request, const BatchExecuteStatementResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const { return SubmitAsync(&RDSDataServiceClient::BatchExecuteStatement, request, handler, context); } /** *

Starts a SQL transaction.

A transaction can run for a maximum * of 24 hours. A transaction is terminated and rolled back automatically after 24 * hours.

A transaction times out if no calls use its transaction ID in * three minutes. If a transaction times out before it's committed, it's rolled * back automatically.

DDL statements inside a transaction cause an implicit * commit. We recommend that you run each DDL statement in a separate * ExecuteStatement call with continueAfterTimeout * enabled.

See Also:

AWS * API Reference

*/ virtual Model::BeginTransactionOutcome BeginTransaction(const Model::BeginTransactionRequest& request) const; /** * A Callable wrapper for BeginTransaction that returns a future to the operation so that it can be executed in parallel to other requests. */ template Model::BeginTransactionOutcomeCallable BeginTransactionCallable(const BeginTransactionRequestT& request) const { return SubmitCallable(&RDSDataServiceClient::BeginTransaction, request); } /** * An Async wrapper for BeginTransaction that queues the request into a thread executor and triggers associated callback when operation has finished. */ template void BeginTransactionAsync(const BeginTransactionRequestT& request, const BeginTransactionResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const { return SubmitAsync(&RDSDataServiceClient::BeginTransaction, request, handler, context); } /** *

Ends a SQL transaction started with the BeginTransaction * operation and commits the changes.

See Also:

AWS * API Reference

*/ virtual Model::CommitTransactionOutcome CommitTransaction(const Model::CommitTransactionRequest& request) const; /** * A Callable wrapper for CommitTransaction that returns a future to the operation so that it can be executed in parallel to other requests. */ template Model::CommitTransactionOutcomeCallable CommitTransactionCallable(const CommitTransactionRequestT& request) const { return SubmitCallable(&RDSDataServiceClient::CommitTransaction, request); } /** * An Async wrapper for CommitTransaction that queues the request into a thread executor and triggers associated callback when operation has finished. */ template void CommitTransactionAsync(const CommitTransactionRequestT& request, const CommitTransactionResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const { return SubmitAsync(&RDSDataServiceClient::CommitTransaction, request, handler, context); } /** *

Runs a SQL statement against a database.

If a call isn't part * of a transaction because it doesn't include the transactionID * parameter, changes that result from the call are committed automatically.

*

If the binary response data from the database is more than 1 MB, the call is * terminated.

See Also:

AWS * API Reference

*/ virtual Model::ExecuteStatementOutcome ExecuteStatement(const Model::ExecuteStatementRequest& request) const; /** * A Callable wrapper for ExecuteStatement that returns a future to the operation so that it can be executed in parallel to other requests. */ template Model::ExecuteStatementOutcomeCallable ExecuteStatementCallable(const ExecuteStatementRequestT& request) const { return SubmitCallable(&RDSDataServiceClient::ExecuteStatement, request); } /** * An Async wrapper for ExecuteStatement that queues the request into a thread executor and triggers associated callback when operation has finished. */ template void ExecuteStatementAsync(const ExecuteStatementRequestT& request, const ExecuteStatementResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const { return SubmitAsync(&RDSDataServiceClient::ExecuteStatement, request, handler, context); } /** *

Performs a rollback of a transaction. Rolling back a transaction cancels its * changes.

See Also:

AWS * API Reference

*/ virtual Model::RollbackTransactionOutcome RollbackTransaction(const Model::RollbackTransactionRequest& request) const; /** * A Callable wrapper for RollbackTransaction that returns a future to the operation so that it can be executed in parallel to other requests. */ template Model::RollbackTransactionOutcomeCallable RollbackTransactionCallable(const RollbackTransactionRequestT& request) const { return SubmitCallable(&RDSDataServiceClient::RollbackTransaction, request); } /** * An Async wrapper for RollbackTransaction that queues the request into a thread executor and triggers associated callback when operation has finished. */ template void RollbackTransactionAsync(const RollbackTransactionRequestT& request, const RollbackTransactionResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const { return SubmitAsync(&RDSDataServiceClient::RollbackTransaction, request, handler, context); } void OverrideEndpoint(const Aws::String& endpoint); std::shared_ptr& accessEndpointProvider(); private: friend class Aws::Client::ClientWithAsyncTemplateMethods; void init(const RDSDataServiceClientConfiguration& clientConfiguration); RDSDataServiceClientConfiguration m_clientConfiguration; std::shared_ptr m_executor; std::shared_ptr m_endpointProvider; }; } // namespace RDSDataService } // namespace Aws