/*
* 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 qldb-session-2019-07-11.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.QLDBSession.Model;
using Amazon.QLDBSession.Model.Internal.MarshallTransformations;
using Amazon.QLDBSession.Internal;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Auth;
using Amazon.Runtime.Internal.Transform;
namespace Amazon.QLDBSession
{
///
/// Implementation for accessing QLDBSession
///
/// The transactional data APIs for Amazon QLDB
///
///
///
/// Instead of interacting directly with this API, we recommend using the QLDB driver
/// or the QLDB shell to execute data transactions on a ledger.
///
/// -
///
/// If you are working with an AWS SDK, use the QLDB driver. The driver provides a high-level
/// abstraction layer above this QLDB Session data plane and manages
SendCommand
/// API calls for you. For information and a list of supported programming languages,
/// see Getting
/// started with the driver in the Amazon QLDB Developer Guide.
///
/// -
///
/// If you are working with the AWS Command Line Interface (AWS CLI), use the QLDB shell.
/// The shell is a command line interface that uses the QLDB driver to interact with a
/// ledger. For information, see Accessing
/// Amazon QLDB using the QLDB shell.
///
///
///
public partial class AmazonQLDBSessionClient : AmazonServiceClient, IAmazonQLDBSession
{
private static IServiceMetadata serviceMetadata = new AmazonQLDBSessionMetadata();
#region Constructors
///
/// Constructs AmazonQLDBSessionClient 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 AmazonQLDBSessionClient()
: base(FallbackCredentialsFactory.GetCredentials(), new AmazonQLDBSessionConfig()) { }
///
/// Constructs AmazonQLDBSessionClient 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 AmazonQLDBSessionClient(RegionEndpoint region)
: base(FallbackCredentialsFactory.GetCredentials(), new AmazonQLDBSessionConfig{RegionEndpoint = region}) { }
///
/// Constructs AmazonQLDBSessionClient 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 AmazonQLDBSessionClient Configuration Object
public AmazonQLDBSessionClient(AmazonQLDBSessionConfig config)
: base(FallbackCredentialsFactory.GetCredentials(config), config){}
///
/// Constructs AmazonQLDBSessionClient with AWS Credentials
///
/// AWS Credentials
public AmazonQLDBSessionClient(AWSCredentials credentials)
: this(credentials, new AmazonQLDBSessionConfig())
{
}
///
/// Constructs AmazonQLDBSessionClient with AWS Credentials
///
/// AWS Credentials
/// The region to connect.
public AmazonQLDBSessionClient(AWSCredentials credentials, RegionEndpoint region)
: this(credentials, new AmazonQLDBSessionConfig{RegionEndpoint = region})
{
}
///
/// Constructs AmazonQLDBSessionClient with AWS Credentials and an
/// AmazonQLDBSessionClient Configuration object.
///
/// AWS Credentials
/// The AmazonQLDBSessionClient Configuration Object
public AmazonQLDBSessionClient(AWSCredentials credentials, AmazonQLDBSessionConfig clientConfig)
: base(credentials, clientConfig)
{
}
///
/// Constructs AmazonQLDBSessionClient with AWS Access Key ID and AWS Secret Key
///
/// AWS Access Key ID
/// AWS Secret Access Key
public AmazonQLDBSessionClient(string awsAccessKeyId, string awsSecretAccessKey)
: this(awsAccessKeyId, awsSecretAccessKey, new AmazonQLDBSessionConfig())
{
}
///
/// Constructs AmazonQLDBSessionClient with AWS Access Key ID and AWS Secret Key
///
/// AWS Access Key ID
/// AWS Secret Access Key
/// The region to connect.
public AmazonQLDBSessionClient(string awsAccessKeyId, string awsSecretAccessKey, RegionEndpoint region)
: this(awsAccessKeyId, awsSecretAccessKey, new AmazonQLDBSessionConfig() {RegionEndpoint=region})
{
}
///
/// Constructs AmazonQLDBSessionClient with AWS Access Key ID, AWS Secret Key and an
/// AmazonQLDBSessionClient Configuration object.
///
/// AWS Access Key ID
/// AWS Secret Access Key
/// The AmazonQLDBSessionClient Configuration Object
public AmazonQLDBSessionClient(string awsAccessKeyId, string awsSecretAccessKey, AmazonQLDBSessionConfig clientConfig)
: base(awsAccessKeyId, awsSecretAccessKey, clientConfig)
{
}
///
/// Constructs AmazonQLDBSessionClient with AWS Access Key ID and AWS Secret Key
///
/// AWS Access Key ID
/// AWS Secret Access Key
/// AWS Session Token
public AmazonQLDBSessionClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken)
: this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonQLDBSessionConfig())
{
}
///
/// Constructs AmazonQLDBSessionClient 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 AmazonQLDBSessionClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, RegionEndpoint region)
: this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonQLDBSessionConfig{RegionEndpoint = region})
{
}
///
/// Constructs AmazonQLDBSessionClient with AWS Access Key ID, AWS Secret Key and an
/// AmazonQLDBSessionClient Configuration object.
///
/// AWS Access Key ID
/// AWS Secret Access Key
/// AWS Session Token
/// The AmazonQLDBSessionClient Configuration Object
public AmazonQLDBSessionClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, AmazonQLDBSessionConfig 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 AmazonQLDBSessionEndpointResolver());
}
///
/// 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 SendCommand
internal virtual SendCommandResponse SendCommand(SendCommandRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = SendCommandRequestMarshaller.Instance;
options.ResponseUnmarshaller = SendCommandResponseUnmarshaller.Instance;
return Invoke(request, options);
}
///
/// Sends a command to an Amazon QLDB ledger.
///
///
///
/// Instead of interacting directly with this API, we recommend using the QLDB driver
/// or the QLDB shell to execute data transactions on a ledger.
///
/// -
///
/// If you are working with an AWS SDK, use the QLDB driver. The driver provides a high-level
/// abstraction layer above this QLDB Session data plane and manages
SendCommand
/// API calls for you. For information and a list of supported programming languages,
/// see Getting
/// started with the driver in the Amazon QLDB Developer Guide.
///
/// -
///
/// If you are working with the AWS Command Line Interface (AWS CLI), use the QLDB shell.
/// The shell is a command line interface that uses the QLDB driver to interact with a
/// ledger. For information, see Accessing
/// Amazon QLDB using the QLDB shell.
///
///
///
/// Container for the necessary parameters to execute the SendCommand service method.
///
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
///
///
/// The response from the SendCommand service method, as returned by QLDBSession.
///
/// Returned if the request is malformed or contains an error such as an invalid parameter
/// value or a missing required parameter.
///
///
/// Returned when the request exceeds the processing capacity of the ledger.
///
///
/// Returned if the session doesn't exist anymore because it timed out or expired.
///
///
/// Returned if a resource limit such as number of active sessions is exceeded.
///
///
/// Returned when a transaction cannot be written to the journal due to a failure in the
/// verification phase of optimistic concurrency control (OCC).
///
///
/// Returned when the rate of requests exceeds the allowed throughput.
///
/// REST API Reference for SendCommand Operation
public virtual Task SendCommandAsync(SendCommandRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = SendCommandRequestMarshaller.Instance;
options.ResponseUnmarshaller = SendCommandResponseUnmarshaller.Instance;
return InvokeAsync(request, options, cancellationToken);
}
#endregion
}
}