/*
* Copyright 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.
*/
/*
* Do not modify this file. This file is generated from the rds-data-2018-08-01.normal.json service model.
*/
using System;
using System.Runtime.ExceptionServices;
using System.Threading;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Net;
using Amazon.RDSDataService.Model;
using Amazon.RDSDataService.Model.Internal.MarshallTransformations;
using Amazon.RDSDataService.Internal;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Auth;
using Amazon.Runtime.Internal.Transform;
namespace Amazon.RDSDataService
{
///
/// Implementation for accessing 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.
///
///
///
///
public partial class AmazonRDSDataServiceClient : AmazonServiceClient, IAmazonRDSDataService
{
private static IServiceMetadata serviceMetadata = new AmazonRDSDataServiceMetadata();
#region Constructors
///
/// Constructs AmazonRDSDataServiceClient with the credentials loaded from the application's
/// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance.
///
/// Example App.config with credentials set.
///
/// <?xml version="1.0" encoding="utf-8" ?>
/// <configuration>
/// <appSettings>
/// <add key="AWSProfileName" value="AWS Default"/>
/// </appSettings>
/// </configuration>
///
///
///
public AmazonRDSDataServiceClient()
: base(FallbackCredentialsFactory.GetCredentials(), new AmazonRDSDataServiceConfig()) { }
///
/// Constructs AmazonRDSDataServiceClient with the credentials loaded from the application's
/// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance.
///
/// Example App.config with credentials set.
///
/// <?xml version="1.0" encoding="utf-8" ?>
/// <configuration>
/// <appSettings>
/// <add key="AWSProfileName" value="AWS Default"/>
/// </appSettings>
/// </configuration>
///
///
///
/// The region to connect.
public AmazonRDSDataServiceClient(RegionEndpoint region)
: base(FallbackCredentialsFactory.GetCredentials(), new AmazonRDSDataServiceConfig{RegionEndpoint = region}) { }
///
/// Constructs AmazonRDSDataServiceClient with the credentials loaded from the application's
/// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance.
///
/// Example App.config with credentials set.
///
/// <?xml version="1.0" encoding="utf-8" ?>
/// <configuration>
/// <appSettings>
/// <add key="AWSProfileName" value="AWS Default"/>
/// </appSettings>
/// </configuration>
///
///
///
/// The AmazonRDSDataServiceClient Configuration Object
public AmazonRDSDataServiceClient(AmazonRDSDataServiceConfig config)
: base(FallbackCredentialsFactory.GetCredentials(config), config){}
///
/// Constructs AmazonRDSDataServiceClient with AWS Credentials
///
/// AWS Credentials
public AmazonRDSDataServiceClient(AWSCredentials credentials)
: this(credentials, new AmazonRDSDataServiceConfig())
{
}
///
/// Constructs AmazonRDSDataServiceClient with AWS Credentials
///
/// AWS Credentials
/// The region to connect.
public AmazonRDSDataServiceClient(AWSCredentials credentials, RegionEndpoint region)
: this(credentials, new AmazonRDSDataServiceConfig{RegionEndpoint = region})
{
}
///
/// Constructs AmazonRDSDataServiceClient with AWS Credentials and an
/// AmazonRDSDataServiceClient Configuration object.
///
/// AWS Credentials
/// The AmazonRDSDataServiceClient Configuration Object
public AmazonRDSDataServiceClient(AWSCredentials credentials, AmazonRDSDataServiceConfig clientConfig)
: base(credentials, clientConfig)
{
}
///
/// Constructs AmazonRDSDataServiceClient with AWS Access Key ID and AWS Secret Key
///
/// AWS Access Key ID
/// AWS Secret Access Key
public AmazonRDSDataServiceClient(string awsAccessKeyId, string awsSecretAccessKey)
: this(awsAccessKeyId, awsSecretAccessKey, new AmazonRDSDataServiceConfig())
{
}
///
/// Constructs AmazonRDSDataServiceClient with AWS Access Key ID and AWS Secret Key
///
/// AWS Access Key ID
/// AWS Secret Access Key
/// The region to connect.
public AmazonRDSDataServiceClient(string awsAccessKeyId, string awsSecretAccessKey, RegionEndpoint region)
: this(awsAccessKeyId, awsSecretAccessKey, new AmazonRDSDataServiceConfig() {RegionEndpoint=region})
{
}
///
/// Constructs AmazonRDSDataServiceClient with AWS Access Key ID, AWS Secret Key and an
/// AmazonRDSDataServiceClient Configuration object.
///
/// AWS Access Key ID
/// AWS Secret Access Key
/// The AmazonRDSDataServiceClient Configuration Object
public AmazonRDSDataServiceClient(string awsAccessKeyId, string awsSecretAccessKey, AmazonRDSDataServiceConfig clientConfig)
: base(awsAccessKeyId, awsSecretAccessKey, clientConfig)
{
}
///
/// Constructs AmazonRDSDataServiceClient with AWS Access Key ID and AWS Secret Key
///
/// AWS Access Key ID
/// AWS Secret Access Key
/// AWS Session Token
public AmazonRDSDataServiceClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken)
: this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonRDSDataServiceConfig())
{
}
///
/// Constructs AmazonRDSDataServiceClient with AWS Access Key ID and AWS Secret Key
///
/// AWS Access Key ID
/// AWS Secret Access Key
/// AWS Session Token
/// The region to connect.
public AmazonRDSDataServiceClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, RegionEndpoint region)
: this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonRDSDataServiceConfig{RegionEndpoint = region})
{
}
///
/// Constructs AmazonRDSDataServiceClient with AWS Access Key ID, AWS Secret Key and an
/// AmazonRDSDataServiceClient Configuration object.
///
/// AWS Access Key ID
/// AWS Secret Access Key
/// AWS Session Token
/// The AmazonRDSDataServiceClient Configuration Object
public AmazonRDSDataServiceClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, AmazonRDSDataServiceConfig clientConfig)
: base(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, clientConfig)
{
}
#endregion
#region Overrides
///
/// Creates the signer for the service.
///
protected override AbstractAWSSigner CreateSigner()
{
return new AWS4Signer();
}
///
/// Customizes the runtime pipeline.
///
/// Runtime pipeline for the current client.
protected override void CustomizeRuntimePipeline(RuntimePipeline pipeline)
{
pipeline.RemoveHandler();
pipeline.AddHandlerAfter(new AmazonRDSDataServiceEndpointResolver());
}
///
/// Capture metadata for the service.
///
protected override IServiceMetadata ServiceMetadata
{
get
{
return serviceMetadata;
}
}
#endregion
#region Dispose
///
/// Disposes the service client.
///
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
}
#endregion
#region BatchExecuteStatement
internal virtual BatchExecuteStatementResponse BatchExecuteStatement(BatchExecuteStatementRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = BatchExecuteStatementRequestMarshaller.Instance;
options.ResponseUnmarshaller = BatchExecuteStatementResponseUnmarshaller.Instance;
return Invoke(request, options);
}
///
/// 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.
///
///
///
/// Container for the necessary parameters to execute the BatchExecuteStatement service method.
///
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
///
///
/// The response from the BatchExecuteStatement service method, as returned by RDSDataService.
///
/// You do not have sufficient access to perform this action.
///
///
/// There is an error in the call or in a SQL statement.
///
///
/// There are insufficient privileges to make the call.
///
///
/// An internal error occurred.
///
///
/// The service specified by the resourceArn
parameter is not available.
///
///
/// The execution of the SQL statement timed out.
///
/// REST API Reference for BatchExecuteStatement Operation
public virtual Task BatchExecuteStatementAsync(BatchExecuteStatementRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = BatchExecuteStatementRequestMarshaller.Instance;
options.ResponseUnmarshaller = BatchExecuteStatementResponseUnmarshaller.Instance;
return InvokeAsync(request, options, cancellationToken);
}
#endregion
#region BeginTransaction
internal virtual BeginTransactionResponse BeginTransaction(BeginTransactionRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = BeginTransactionRequestMarshaller.Instance;
options.ResponseUnmarshaller = BeginTransactionResponseUnmarshaller.Instance;
return Invoke(request, options);
}
///
/// 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.
///
///
///
/// Container for the necessary parameters to execute the BeginTransaction service method.
///
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
///
///
/// The response from the BeginTransaction service method, as returned by RDSDataService.
///
/// You do not have sufficient access to perform this action.
///
///
/// There is an error in the call or in a SQL statement.
///
///
/// There are insufficient privileges to make the call.
///
///
/// An internal error occurred.
///
///
/// The service specified by the resourceArn
parameter is not available.
///
///
/// The execution of the SQL statement timed out.
///
/// REST API Reference for BeginTransaction Operation
public virtual Task BeginTransactionAsync(BeginTransactionRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = BeginTransactionRequestMarshaller.Instance;
options.ResponseUnmarshaller = BeginTransactionResponseUnmarshaller.Instance;
return InvokeAsync(request, options, cancellationToken);
}
#endregion
#region CommitTransaction
internal virtual CommitTransactionResponse CommitTransaction(CommitTransactionRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = CommitTransactionRequestMarshaller.Instance;
options.ResponseUnmarshaller = CommitTransactionResponseUnmarshaller.Instance;
return Invoke(request, options);
}
///
/// Ends a SQL transaction started with the BeginTransaction
operation and
/// commits the changes.
///
/// Container for the necessary parameters to execute the CommitTransaction service method.
///
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
///
///
/// The response from the CommitTransaction service method, as returned by RDSDataService.
///
/// You do not have sufficient access to perform this action.
///
///
/// There is an error in the call or in a SQL statement.
///
///
/// There are insufficient privileges to make the call.
///
///
/// An internal error occurred.
///
///
/// The resourceArn
, secretArn
, or transactionId
/// value can't be found.
///
///
/// The service specified by the resourceArn
parameter is not available.
///
///
/// The execution of the SQL statement timed out.
///
/// REST API Reference for CommitTransaction Operation
public virtual Task CommitTransactionAsync(CommitTransactionRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = CommitTransactionRequestMarshaller.Instance;
options.ResponseUnmarshaller = CommitTransactionResponseUnmarshaller.Instance;
return InvokeAsync(request, options, cancellationToken);
}
#endregion
#region ExecuteSql
[Obsolete("ExecuteSql has been deprecated. Please use ExecuteStatement or BatchExecuteStatement instead.")]
internal virtual ExecuteSqlResponse ExecuteSql(ExecuteSqlRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ExecuteSqlRequestMarshaller.Instance;
options.ResponseUnmarshaller = ExecuteSqlResponseUnmarshaller.Instance;
return Invoke(request, options);
}
///
/// Runs one or more SQL statements.
///
///
///
/// This operation is deprecated. Use the BatchExecuteStatement
or ExecuteStatement
/// operation.
///
///
///
/// Container for the necessary parameters to execute the ExecuteSql service method.
///
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
///
///
/// The response from the ExecuteSql service method, as returned by RDSDataService.
///
/// You do not have sufficient access to perform this action.
///
///
/// There is an error in the call or in a SQL statement.
///
///
/// There are insufficient privileges to make the call.
///
///
/// An internal error occurred.
///
///
/// The service specified by the resourceArn
parameter is not available.
///
/// REST API Reference for ExecuteSql Operation
[Obsolete("ExecuteSql has been deprecated. Please use ExecuteStatement or BatchExecuteStatement instead.")]
public virtual Task ExecuteSqlAsync(ExecuteSqlRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = ExecuteSqlRequestMarshaller.Instance;
options.ResponseUnmarshaller = ExecuteSqlResponseUnmarshaller.Instance;
return InvokeAsync(request, options, cancellationToken);
}
#endregion
#region ExecuteStatement
internal virtual ExecuteStatementResponse ExecuteStatement(ExecuteStatementRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ExecuteStatementRequestMarshaller.Instance;
options.ResponseUnmarshaller = ExecuteStatementResponseUnmarshaller.Instance;
return Invoke(request, options);
}
///
/// 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.
///
///
///
/// Container for the necessary parameters to execute the ExecuteStatement service method.
///
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
///
///
/// The response from the ExecuteStatement service method, as returned by RDSDataService.
///
/// You do not have sufficient access to perform this action.
///
///
/// There is an error in the call or in a SQL statement.
///
///
/// There are insufficient privileges to make the call.
///
///
/// An internal error occurred.
///
///
/// The service specified by the resourceArn
parameter is not available.
///
///
/// The execution of the SQL statement timed out.
///
/// REST API Reference for ExecuteStatement Operation
public virtual Task ExecuteStatementAsync(ExecuteStatementRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = ExecuteStatementRequestMarshaller.Instance;
options.ResponseUnmarshaller = ExecuteStatementResponseUnmarshaller.Instance;
return InvokeAsync(request, options, cancellationToken);
}
#endregion
#region RollbackTransaction
internal virtual RollbackTransactionResponse RollbackTransaction(RollbackTransactionRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = RollbackTransactionRequestMarshaller.Instance;
options.ResponseUnmarshaller = RollbackTransactionResponseUnmarshaller.Instance;
return Invoke(request, options);
}
///
/// Performs a rollback of a transaction. Rolling back a transaction cancels its changes.
///
/// Container for the necessary parameters to execute the RollbackTransaction service method.
///
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
///
///
/// The response from the RollbackTransaction service method, as returned by RDSDataService.
///
/// You do not have sufficient access to perform this action.
///
///
/// There is an error in the call or in a SQL statement.
///
///
/// There are insufficient privileges to make the call.
///
///
/// An internal error occurred.
///
///
/// The resourceArn
, secretArn
, or transactionId
/// value can't be found.
///
///
/// The service specified by the resourceArn
parameter is not available.
///
///
/// The execution of the SQL statement timed out.
///
/// REST API Reference for RollbackTransaction Operation
public virtual Task RollbackTransactionAsync(RollbackTransactionRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = RollbackTransactionRequestMarshaller.Instance;
options.ResponseUnmarshaller = RollbackTransactionResponseUnmarshaller.Instance;
return InvokeAsync(request, options, cancellationToken);
}
#endregion
}
}