sendCommand method

Future<SendCommandResult> sendCommand({
  1. AbortTransactionRequest? abortTransaction,
  2. CommitTransactionRequest? commitTransaction,
  3. EndSessionRequest? endSession,
  4. ExecuteStatementRequest? executeStatement,
  5. FetchPageRequest? fetchPage,
  6. String? sessionToken,
  7. StartSessionRequest? startSession,
  8. StartTransactionRequest? startTransaction,
})

Sends a command to an Amazon QLDB 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.

May throw BadRequestException. May throw InvalidSessionException. May throw OccConflictException. May throw RateExceededException. May throw LimitExceededException.

Parameter abortTransaction : Command to abort the current transaction.

Parameter commitTransaction : Command to commit the specified transaction.

Parameter endSession : Command to end the current session.

Parameter executeStatement : Command to execute a statement in the specified transaction.

Parameter fetchPage : Command to fetch a page.

Parameter sessionToken : Specifies the session token for the current command. A session token is constant throughout the life of the session.

To obtain a session token, run the StartSession command. This SessionToken is required for every subsequent command that is issued during the current session.

Parameter startSession : Command to start a new session. A session token is obtained as part of the response.

Parameter startTransaction : Command to start a new transaction.

Implementation

Future<SendCommandResult> sendCommand({
  AbortTransactionRequest? abortTransaction,
  CommitTransactionRequest? commitTransaction,
  EndSessionRequest? endSession,
  ExecuteStatementRequest? executeStatement,
  FetchPageRequest? fetchPage,
  String? sessionToken,
  StartSessionRequest? startSession,
  StartTransactionRequest? startTransaction,
}) async {
  _s.validateStringLength(
    'sessionToken',
    sessionToken,
    4,
    1024,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'QLDBSession.SendCommand'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (abortTransaction != null) 'AbortTransaction': abortTransaction,
      if (commitTransaction != null) 'CommitTransaction': commitTransaction,
      if (endSession != null) 'EndSession': endSession,
      if (executeStatement != null) 'ExecuteStatement': executeStatement,
      if (fetchPage != null) 'FetchPage': fetchPage,
      if (sessionToken != null) 'SessionToken': sessionToken,
      if (startSession != null) 'StartSession': startSession,
      if (startTransaction != null) 'StartTransaction': startTransaction,
    },
  );

  return SendCommandResult.fromJson(jsonResponse.body);
}