{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.QLDBSession.SendCommand
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- 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
--     <https://docs.aws.amazon.com/qldb/latest/developerguide/getting-started-driver.html 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
--     <https://docs.aws.amazon.com/qldb/latest/developerguide/data-shell.html Accessing Amazon QLDB using the QLDB shell>.
module Amazonka.QLDBSession.SendCommand
  ( -- * Creating a Request
    SendCommand (..),
    newSendCommand,

    -- * Request Lenses
    sendCommand_fetchPage,
    sendCommand_sessionToken,
    sendCommand_abortTransaction,
    sendCommand_endSession,
    sendCommand_startTransaction,
    sendCommand_executeStatement,
    sendCommand_commitTransaction,
    sendCommand_startSession,

    -- * Destructuring the Response
    SendCommandResponse (..),
    newSendCommandResponse,

    -- * Response Lenses
    sendCommandResponse_fetchPage,
    sendCommandResponse_abortTransaction,
    sendCommandResponse_endSession,
    sendCommandResponse_startTransaction,
    sendCommandResponse_executeStatement,
    sendCommandResponse_commitTransaction,
    sendCommandResponse_startSession,
    sendCommandResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.QLDBSession.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newSendCommand' smart constructor.
data SendCommand = SendCommand'
  { -- | Command to fetch a page.
    SendCommand -> Maybe FetchPageRequest
fetchPage :: Prelude.Maybe FetchPageRequest,
    -- | 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.
    SendCommand -> Maybe Text
sessionToken :: Prelude.Maybe Prelude.Text,
    -- | Command to abort the current transaction.
    SendCommand -> Maybe AbortTransactionRequest
abortTransaction :: Prelude.Maybe AbortTransactionRequest,
    -- | Command to end the current session.
    SendCommand -> Maybe EndSessionRequest
endSession :: Prelude.Maybe EndSessionRequest,
    -- | Command to start a new transaction.
    SendCommand -> Maybe StartTransactionRequest
startTransaction :: Prelude.Maybe StartTransactionRequest,
    -- | Command to execute a statement in the specified transaction.
    SendCommand -> Maybe ExecuteStatementRequest
executeStatement :: Prelude.Maybe ExecuteStatementRequest,
    -- | Command to commit the specified transaction.
    SendCommand -> Maybe CommitTransactionRequest
commitTransaction :: Prelude.Maybe CommitTransactionRequest,
    -- | Command to start a new session. A session token is obtained as part of
    -- the response.
    SendCommand -> Maybe StartSessionRequest
startSession :: Prelude.Maybe StartSessionRequest
  }
  deriving (SendCommand -> SendCommand -> Bool
(SendCommand -> SendCommand -> Bool)
-> (SendCommand -> SendCommand -> Bool) -> Eq SendCommand
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SendCommand -> SendCommand -> Bool
$c/= :: SendCommand -> SendCommand -> Bool
== :: SendCommand -> SendCommand -> Bool
$c== :: SendCommand -> SendCommand -> Bool
Prelude.Eq, ReadPrec [SendCommand]
ReadPrec SendCommand
Int -> ReadS SendCommand
ReadS [SendCommand]
(Int -> ReadS SendCommand)
-> ReadS [SendCommand]
-> ReadPrec SendCommand
-> ReadPrec [SendCommand]
-> Read SendCommand
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SendCommand]
$creadListPrec :: ReadPrec [SendCommand]
readPrec :: ReadPrec SendCommand
$creadPrec :: ReadPrec SendCommand
readList :: ReadS [SendCommand]
$creadList :: ReadS [SendCommand]
readsPrec :: Int -> ReadS SendCommand
$creadsPrec :: Int -> ReadS SendCommand
Prelude.Read, Int -> SendCommand -> ShowS
[SendCommand] -> ShowS
SendCommand -> String
(Int -> SendCommand -> ShowS)
-> (SendCommand -> String)
-> ([SendCommand] -> ShowS)
-> Show SendCommand
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SendCommand] -> ShowS
$cshowList :: [SendCommand] -> ShowS
show :: SendCommand -> String
$cshow :: SendCommand -> String
showsPrec :: Int -> SendCommand -> ShowS
$cshowsPrec :: Int -> SendCommand -> ShowS
Prelude.Show, (forall x. SendCommand -> Rep SendCommand x)
-> (forall x. Rep SendCommand x -> SendCommand)
-> Generic SendCommand
forall x. Rep SendCommand x -> SendCommand
forall x. SendCommand -> Rep SendCommand x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SendCommand x -> SendCommand
$cfrom :: forall x. SendCommand -> Rep SendCommand x
Prelude.Generic)

-- |
-- Create a value of 'SendCommand' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'fetchPage', 'sendCommand_fetchPage' - Command to fetch a page.
--
-- 'sessionToken', 'sendCommand_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.
--
-- 'abortTransaction', 'sendCommand_abortTransaction' - Command to abort the current transaction.
--
-- 'endSession', 'sendCommand_endSession' - Command to end the current session.
--
-- 'startTransaction', 'sendCommand_startTransaction' - Command to start a new transaction.
--
-- 'executeStatement', 'sendCommand_executeStatement' - Command to execute a statement in the specified transaction.
--
-- 'commitTransaction', 'sendCommand_commitTransaction' - Command to commit the specified transaction.
--
-- 'startSession', 'sendCommand_startSession' - Command to start a new session. A session token is obtained as part of
-- the response.
newSendCommand ::
  SendCommand
newSendCommand :: SendCommand
newSendCommand =
  SendCommand' :: Maybe FetchPageRequest
-> Maybe Text
-> Maybe AbortTransactionRequest
-> Maybe EndSessionRequest
-> Maybe StartTransactionRequest
-> Maybe ExecuteStatementRequest
-> Maybe CommitTransactionRequest
-> Maybe StartSessionRequest
-> SendCommand
SendCommand'
    { $sel:fetchPage:SendCommand' :: Maybe FetchPageRequest
fetchPage = Maybe FetchPageRequest
forall a. Maybe a
Prelude.Nothing,
      $sel:sessionToken:SendCommand' :: Maybe Text
sessionToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:abortTransaction:SendCommand' :: Maybe AbortTransactionRequest
abortTransaction = Maybe AbortTransactionRequest
forall a. Maybe a
Prelude.Nothing,
      $sel:endSession:SendCommand' :: Maybe EndSessionRequest
endSession = Maybe EndSessionRequest
forall a. Maybe a
Prelude.Nothing,
      $sel:startTransaction:SendCommand' :: Maybe StartTransactionRequest
startTransaction = Maybe StartTransactionRequest
forall a. Maybe a
Prelude.Nothing,
      $sel:executeStatement:SendCommand' :: Maybe ExecuteStatementRequest
executeStatement = Maybe ExecuteStatementRequest
forall a. Maybe a
Prelude.Nothing,
      $sel:commitTransaction:SendCommand' :: Maybe CommitTransactionRequest
commitTransaction = Maybe CommitTransactionRequest
forall a. Maybe a
Prelude.Nothing,
      $sel:startSession:SendCommand' :: Maybe StartSessionRequest
startSession = Maybe StartSessionRequest
forall a. Maybe a
Prelude.Nothing
    }

-- | Command to fetch a page.
sendCommand_fetchPage :: Lens.Lens' SendCommand (Prelude.Maybe FetchPageRequest)
sendCommand_fetchPage :: (Maybe FetchPageRequest -> f (Maybe FetchPageRequest))
-> SendCommand -> f SendCommand
sendCommand_fetchPage = (SendCommand -> Maybe FetchPageRequest)
-> (SendCommand -> Maybe FetchPageRequest -> SendCommand)
-> Lens
     SendCommand
     SendCommand
     (Maybe FetchPageRequest)
     (Maybe FetchPageRequest)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendCommand' {Maybe FetchPageRequest
fetchPage :: Maybe FetchPageRequest
$sel:fetchPage:SendCommand' :: SendCommand -> Maybe FetchPageRequest
fetchPage} -> Maybe FetchPageRequest
fetchPage) (\s :: SendCommand
s@SendCommand' {} Maybe FetchPageRequest
a -> SendCommand
s {$sel:fetchPage:SendCommand' :: Maybe FetchPageRequest
fetchPage = Maybe FetchPageRequest
a} :: SendCommand)

-- | 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.
sendCommand_sessionToken :: Lens.Lens' SendCommand (Prelude.Maybe Prelude.Text)
sendCommand_sessionToken :: (Maybe Text -> f (Maybe Text)) -> SendCommand -> f SendCommand
sendCommand_sessionToken = (SendCommand -> Maybe Text)
-> (SendCommand -> Maybe Text -> SendCommand)
-> Lens SendCommand SendCommand (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendCommand' {Maybe Text
sessionToken :: Maybe Text
$sel:sessionToken:SendCommand' :: SendCommand -> Maybe Text
sessionToken} -> Maybe Text
sessionToken) (\s :: SendCommand
s@SendCommand' {} Maybe Text
a -> SendCommand
s {$sel:sessionToken:SendCommand' :: Maybe Text
sessionToken = Maybe Text
a} :: SendCommand)

-- | Command to abort the current transaction.
sendCommand_abortTransaction :: Lens.Lens' SendCommand (Prelude.Maybe AbortTransactionRequest)
sendCommand_abortTransaction :: (Maybe AbortTransactionRequest
 -> f (Maybe AbortTransactionRequest))
-> SendCommand -> f SendCommand
sendCommand_abortTransaction = (SendCommand -> Maybe AbortTransactionRequest)
-> (SendCommand -> Maybe AbortTransactionRequest -> SendCommand)
-> Lens
     SendCommand
     SendCommand
     (Maybe AbortTransactionRequest)
     (Maybe AbortTransactionRequest)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendCommand' {Maybe AbortTransactionRequest
abortTransaction :: Maybe AbortTransactionRequest
$sel:abortTransaction:SendCommand' :: SendCommand -> Maybe AbortTransactionRequest
abortTransaction} -> Maybe AbortTransactionRequest
abortTransaction) (\s :: SendCommand
s@SendCommand' {} Maybe AbortTransactionRequest
a -> SendCommand
s {$sel:abortTransaction:SendCommand' :: Maybe AbortTransactionRequest
abortTransaction = Maybe AbortTransactionRequest
a} :: SendCommand)

-- | Command to end the current session.
sendCommand_endSession :: Lens.Lens' SendCommand (Prelude.Maybe EndSessionRequest)
sendCommand_endSession :: (Maybe EndSessionRequest -> f (Maybe EndSessionRequest))
-> SendCommand -> f SendCommand
sendCommand_endSession = (SendCommand -> Maybe EndSessionRequest)
-> (SendCommand -> Maybe EndSessionRequest -> SendCommand)
-> Lens
     SendCommand
     SendCommand
     (Maybe EndSessionRequest)
     (Maybe EndSessionRequest)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendCommand' {Maybe EndSessionRequest
endSession :: Maybe EndSessionRequest
$sel:endSession:SendCommand' :: SendCommand -> Maybe EndSessionRequest
endSession} -> Maybe EndSessionRequest
endSession) (\s :: SendCommand
s@SendCommand' {} Maybe EndSessionRequest
a -> SendCommand
s {$sel:endSession:SendCommand' :: Maybe EndSessionRequest
endSession = Maybe EndSessionRequest
a} :: SendCommand)

-- | Command to start a new transaction.
sendCommand_startTransaction :: Lens.Lens' SendCommand (Prelude.Maybe StartTransactionRequest)
sendCommand_startTransaction :: (Maybe StartTransactionRequest
 -> f (Maybe StartTransactionRequest))
-> SendCommand -> f SendCommand
sendCommand_startTransaction = (SendCommand -> Maybe StartTransactionRequest)
-> (SendCommand -> Maybe StartTransactionRequest -> SendCommand)
-> Lens
     SendCommand
     SendCommand
     (Maybe StartTransactionRequest)
     (Maybe StartTransactionRequest)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendCommand' {Maybe StartTransactionRequest
startTransaction :: Maybe StartTransactionRequest
$sel:startTransaction:SendCommand' :: SendCommand -> Maybe StartTransactionRequest
startTransaction} -> Maybe StartTransactionRequest
startTransaction) (\s :: SendCommand
s@SendCommand' {} Maybe StartTransactionRequest
a -> SendCommand
s {$sel:startTransaction:SendCommand' :: Maybe StartTransactionRequest
startTransaction = Maybe StartTransactionRequest
a} :: SendCommand)

-- | Command to execute a statement in the specified transaction.
sendCommand_executeStatement :: Lens.Lens' SendCommand (Prelude.Maybe ExecuteStatementRequest)
sendCommand_executeStatement :: (Maybe ExecuteStatementRequest
 -> f (Maybe ExecuteStatementRequest))
-> SendCommand -> f SendCommand
sendCommand_executeStatement = (SendCommand -> Maybe ExecuteStatementRequest)
-> (SendCommand -> Maybe ExecuteStatementRequest -> SendCommand)
-> Lens
     SendCommand
     SendCommand
     (Maybe ExecuteStatementRequest)
     (Maybe ExecuteStatementRequest)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendCommand' {Maybe ExecuteStatementRequest
executeStatement :: Maybe ExecuteStatementRequest
$sel:executeStatement:SendCommand' :: SendCommand -> Maybe ExecuteStatementRequest
executeStatement} -> Maybe ExecuteStatementRequest
executeStatement) (\s :: SendCommand
s@SendCommand' {} Maybe ExecuteStatementRequest
a -> SendCommand
s {$sel:executeStatement:SendCommand' :: Maybe ExecuteStatementRequest
executeStatement = Maybe ExecuteStatementRequest
a} :: SendCommand)

-- | Command to commit the specified transaction.
sendCommand_commitTransaction :: Lens.Lens' SendCommand (Prelude.Maybe CommitTransactionRequest)
sendCommand_commitTransaction :: (Maybe CommitTransactionRequest
 -> f (Maybe CommitTransactionRequest))
-> SendCommand -> f SendCommand
sendCommand_commitTransaction = (SendCommand -> Maybe CommitTransactionRequest)
-> (SendCommand -> Maybe CommitTransactionRequest -> SendCommand)
-> Lens
     SendCommand
     SendCommand
     (Maybe CommitTransactionRequest)
     (Maybe CommitTransactionRequest)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendCommand' {Maybe CommitTransactionRequest
commitTransaction :: Maybe CommitTransactionRequest
$sel:commitTransaction:SendCommand' :: SendCommand -> Maybe CommitTransactionRequest
commitTransaction} -> Maybe CommitTransactionRequest
commitTransaction) (\s :: SendCommand
s@SendCommand' {} Maybe CommitTransactionRequest
a -> SendCommand
s {$sel:commitTransaction:SendCommand' :: Maybe CommitTransactionRequest
commitTransaction = Maybe CommitTransactionRequest
a} :: SendCommand)

-- | Command to start a new session. A session token is obtained as part of
-- the response.
sendCommand_startSession :: Lens.Lens' SendCommand (Prelude.Maybe StartSessionRequest)
sendCommand_startSession :: (Maybe StartSessionRequest -> f (Maybe StartSessionRequest))
-> SendCommand -> f SendCommand
sendCommand_startSession = (SendCommand -> Maybe StartSessionRequest)
-> (SendCommand -> Maybe StartSessionRequest -> SendCommand)
-> Lens
     SendCommand
     SendCommand
     (Maybe StartSessionRequest)
     (Maybe StartSessionRequest)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendCommand' {Maybe StartSessionRequest
startSession :: Maybe StartSessionRequest
$sel:startSession:SendCommand' :: SendCommand -> Maybe StartSessionRequest
startSession} -> Maybe StartSessionRequest
startSession) (\s :: SendCommand
s@SendCommand' {} Maybe StartSessionRequest
a -> SendCommand
s {$sel:startSession:SendCommand' :: Maybe StartSessionRequest
startSession = Maybe StartSessionRequest
a} :: SendCommand)

instance Core.AWSRequest SendCommand where
  type AWSResponse SendCommand = SendCommandResponse
  request :: SendCommand -> Request SendCommand
request = Service -> SendCommand -> Request SendCommand
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy SendCommand
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse SendCommand)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse SendCommand))
-> Logger
-> Service
-> Proxy SendCommand
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse SendCommand)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe FetchPageResult
-> Maybe AbortTransactionResult
-> Maybe EndSessionResult
-> Maybe StartTransactionResult
-> Maybe ExecuteStatementResult
-> Maybe CommitTransactionResult
-> Maybe StartSessionResult
-> Int
-> SendCommandResponse
SendCommandResponse'
            (Maybe FetchPageResult
 -> Maybe AbortTransactionResult
 -> Maybe EndSessionResult
 -> Maybe StartTransactionResult
 -> Maybe ExecuteStatementResult
 -> Maybe CommitTransactionResult
 -> Maybe StartSessionResult
 -> Int
 -> SendCommandResponse)
-> Either String (Maybe FetchPageResult)
-> Either
     String
     (Maybe AbortTransactionResult
      -> Maybe EndSessionResult
      -> Maybe StartTransactionResult
      -> Maybe ExecuteStatementResult
      -> Maybe CommitTransactionResult
      -> Maybe StartSessionResult
      -> Int
      -> SendCommandResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe FetchPageResult)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"FetchPage")
            Either
  String
  (Maybe AbortTransactionResult
   -> Maybe EndSessionResult
   -> Maybe StartTransactionResult
   -> Maybe ExecuteStatementResult
   -> Maybe CommitTransactionResult
   -> Maybe StartSessionResult
   -> Int
   -> SendCommandResponse)
-> Either String (Maybe AbortTransactionResult)
-> Either
     String
     (Maybe EndSessionResult
      -> Maybe StartTransactionResult
      -> Maybe ExecuteStatementResult
      -> Maybe CommitTransactionResult
      -> Maybe StartSessionResult
      -> Int
      -> SendCommandResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe AbortTransactionResult)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"AbortTransaction")
            Either
  String
  (Maybe EndSessionResult
   -> Maybe StartTransactionResult
   -> Maybe ExecuteStatementResult
   -> Maybe CommitTransactionResult
   -> Maybe StartSessionResult
   -> Int
   -> SendCommandResponse)
-> Either String (Maybe EndSessionResult)
-> Either
     String
     (Maybe StartTransactionResult
      -> Maybe ExecuteStatementResult
      -> Maybe CommitTransactionResult
      -> Maybe StartSessionResult
      -> Int
      -> SendCommandResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe EndSessionResult)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"EndSession")
            Either
  String
  (Maybe StartTransactionResult
   -> Maybe ExecuteStatementResult
   -> Maybe CommitTransactionResult
   -> Maybe StartSessionResult
   -> Int
   -> SendCommandResponse)
-> Either String (Maybe StartTransactionResult)
-> Either
     String
     (Maybe ExecuteStatementResult
      -> Maybe CommitTransactionResult
      -> Maybe StartSessionResult
      -> Int
      -> SendCommandResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe StartTransactionResult)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"StartTransaction")
            Either
  String
  (Maybe ExecuteStatementResult
   -> Maybe CommitTransactionResult
   -> Maybe StartSessionResult
   -> Int
   -> SendCommandResponse)
-> Either String (Maybe ExecuteStatementResult)
-> Either
     String
     (Maybe CommitTransactionResult
      -> Maybe StartSessionResult -> Int -> SendCommandResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe ExecuteStatementResult)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ExecuteStatement")
            Either
  String
  (Maybe CommitTransactionResult
   -> Maybe StartSessionResult -> Int -> SendCommandResponse)
-> Either String (Maybe CommitTransactionResult)
-> Either
     String (Maybe StartSessionResult -> Int -> SendCommandResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe CommitTransactionResult)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"CommitTransaction")
            Either
  String (Maybe StartSessionResult -> Int -> SendCommandResponse)
-> Either String (Maybe StartSessionResult)
-> Either String (Int -> SendCommandResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe StartSessionResult)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"StartSession")
            Either String (Int -> SendCommandResponse)
-> Either String Int -> Either String SendCommandResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable SendCommand

instance Prelude.NFData SendCommand

instance Core.ToHeaders SendCommand where
  toHeaders :: SendCommand -> ResponseHeaders
toHeaders =
    ResponseHeaders -> SendCommand -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# (ByteString
"QLDBSession.SendCommand" :: Prelude.ByteString),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON SendCommand where
  toJSON :: SendCommand -> Value
toJSON SendCommand' {Maybe Text
Maybe AbortTransactionRequest
Maybe CommitTransactionRequest
Maybe EndSessionRequest
Maybe FetchPageRequest
Maybe StartSessionRequest
Maybe StartTransactionRequest
Maybe ExecuteStatementRequest
startSession :: Maybe StartSessionRequest
commitTransaction :: Maybe CommitTransactionRequest
executeStatement :: Maybe ExecuteStatementRequest
startTransaction :: Maybe StartTransactionRequest
endSession :: Maybe EndSessionRequest
abortTransaction :: Maybe AbortTransactionRequest
sessionToken :: Maybe Text
fetchPage :: Maybe FetchPageRequest
$sel:startSession:SendCommand' :: SendCommand -> Maybe StartSessionRequest
$sel:commitTransaction:SendCommand' :: SendCommand -> Maybe CommitTransactionRequest
$sel:executeStatement:SendCommand' :: SendCommand -> Maybe ExecuteStatementRequest
$sel:startTransaction:SendCommand' :: SendCommand -> Maybe StartTransactionRequest
$sel:endSession:SendCommand' :: SendCommand -> Maybe EndSessionRequest
$sel:abortTransaction:SendCommand' :: SendCommand -> Maybe AbortTransactionRequest
$sel:sessionToken:SendCommand' :: SendCommand -> Maybe Text
$sel:fetchPage:SendCommand' :: SendCommand -> Maybe FetchPageRequest
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"FetchPage" Text -> FetchPageRequest -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (FetchPageRequest -> Pair) -> Maybe FetchPageRequest -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe FetchPageRequest
fetchPage,
            (Text
"SessionToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
sessionToken,
            (Text
"AbortTransaction" Text -> AbortTransactionRequest -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (AbortTransactionRequest -> Pair)
-> Maybe AbortTransactionRequest -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AbortTransactionRequest
abortTransaction,
            (Text
"EndSession" Text -> EndSessionRequest -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (EndSessionRequest -> Pair)
-> Maybe EndSessionRequest -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe EndSessionRequest
endSession,
            (Text
"StartTransaction" Text -> StartTransactionRequest -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (StartTransactionRequest -> Pair)
-> Maybe StartTransactionRequest -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe StartTransactionRequest
startTransaction,
            (Text
"ExecuteStatement" Text -> ExecuteStatementRequest -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ExecuteStatementRequest -> Pair)
-> Maybe ExecuteStatementRequest -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ExecuteStatementRequest
executeStatement,
            (Text
"CommitTransaction" Text -> CommitTransactionRequest -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (CommitTransactionRequest -> Pair)
-> Maybe CommitTransactionRequest -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CommitTransactionRequest
commitTransaction,
            (Text
"StartSession" Text -> StartSessionRequest -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (StartSessionRequest -> Pair)
-> Maybe StartSessionRequest -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe StartSessionRequest
startSession
          ]
      )

instance Core.ToPath SendCommand where
  toPath :: SendCommand -> ByteString
toPath = ByteString -> SendCommand -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery SendCommand where
  toQuery :: SendCommand -> QueryString
toQuery = QueryString -> SendCommand -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newSendCommandResponse' smart constructor.
data SendCommandResponse = SendCommandResponse'
  { -- | Contains the details of the fetched page.
    SendCommandResponse -> Maybe FetchPageResult
fetchPage :: Prelude.Maybe FetchPageResult,
    -- | Contains the details of the aborted transaction.
    SendCommandResponse -> Maybe AbortTransactionResult
abortTransaction :: Prelude.Maybe AbortTransactionResult,
    -- | Contains the details of the ended session.
    SendCommandResponse -> Maybe EndSessionResult
endSession :: Prelude.Maybe EndSessionResult,
    -- | Contains the details of the started transaction.
    SendCommandResponse -> Maybe StartTransactionResult
startTransaction :: Prelude.Maybe StartTransactionResult,
    -- | Contains the details of the executed statement.
    SendCommandResponse -> Maybe ExecuteStatementResult
executeStatement :: Prelude.Maybe ExecuteStatementResult,
    -- | Contains the details of the committed transaction.
    SendCommandResponse -> Maybe CommitTransactionResult
commitTransaction :: Prelude.Maybe CommitTransactionResult,
    -- | Contains the details of the started session that includes a session
    -- token. This @SessionToken@ is required for every subsequent command that
    -- is issued during the current session.
    SendCommandResponse -> Maybe StartSessionResult
startSession :: Prelude.Maybe StartSessionResult,
    -- | The response's http status code.
    SendCommandResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (SendCommandResponse -> SendCommandResponse -> Bool
(SendCommandResponse -> SendCommandResponse -> Bool)
-> (SendCommandResponse -> SendCommandResponse -> Bool)
-> Eq SendCommandResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SendCommandResponse -> SendCommandResponse -> Bool
$c/= :: SendCommandResponse -> SendCommandResponse -> Bool
== :: SendCommandResponse -> SendCommandResponse -> Bool
$c== :: SendCommandResponse -> SendCommandResponse -> Bool
Prelude.Eq, ReadPrec [SendCommandResponse]
ReadPrec SendCommandResponse
Int -> ReadS SendCommandResponse
ReadS [SendCommandResponse]
(Int -> ReadS SendCommandResponse)
-> ReadS [SendCommandResponse]
-> ReadPrec SendCommandResponse
-> ReadPrec [SendCommandResponse]
-> Read SendCommandResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SendCommandResponse]
$creadListPrec :: ReadPrec [SendCommandResponse]
readPrec :: ReadPrec SendCommandResponse
$creadPrec :: ReadPrec SendCommandResponse
readList :: ReadS [SendCommandResponse]
$creadList :: ReadS [SendCommandResponse]
readsPrec :: Int -> ReadS SendCommandResponse
$creadsPrec :: Int -> ReadS SendCommandResponse
Prelude.Read, Int -> SendCommandResponse -> ShowS
[SendCommandResponse] -> ShowS
SendCommandResponse -> String
(Int -> SendCommandResponse -> ShowS)
-> (SendCommandResponse -> String)
-> ([SendCommandResponse] -> ShowS)
-> Show SendCommandResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SendCommandResponse] -> ShowS
$cshowList :: [SendCommandResponse] -> ShowS
show :: SendCommandResponse -> String
$cshow :: SendCommandResponse -> String
showsPrec :: Int -> SendCommandResponse -> ShowS
$cshowsPrec :: Int -> SendCommandResponse -> ShowS
Prelude.Show, (forall x. SendCommandResponse -> Rep SendCommandResponse x)
-> (forall x. Rep SendCommandResponse x -> SendCommandResponse)
-> Generic SendCommandResponse
forall x. Rep SendCommandResponse x -> SendCommandResponse
forall x. SendCommandResponse -> Rep SendCommandResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SendCommandResponse x -> SendCommandResponse
$cfrom :: forall x. SendCommandResponse -> Rep SendCommandResponse x
Prelude.Generic)

-- |
-- Create a value of 'SendCommandResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'fetchPage', 'sendCommandResponse_fetchPage' - Contains the details of the fetched page.
--
-- 'abortTransaction', 'sendCommandResponse_abortTransaction' - Contains the details of the aborted transaction.
--
-- 'endSession', 'sendCommandResponse_endSession' - Contains the details of the ended session.
--
-- 'startTransaction', 'sendCommandResponse_startTransaction' - Contains the details of the started transaction.
--
-- 'executeStatement', 'sendCommandResponse_executeStatement' - Contains the details of the executed statement.
--
-- 'commitTransaction', 'sendCommandResponse_commitTransaction' - Contains the details of the committed transaction.
--
-- 'startSession', 'sendCommandResponse_startSession' - Contains the details of the started session that includes a session
-- token. This @SessionToken@ is required for every subsequent command that
-- is issued during the current session.
--
-- 'httpStatus', 'sendCommandResponse_httpStatus' - The response's http status code.
newSendCommandResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  SendCommandResponse
newSendCommandResponse :: Int -> SendCommandResponse
newSendCommandResponse Int
pHttpStatus_ =
  SendCommandResponse' :: Maybe FetchPageResult
-> Maybe AbortTransactionResult
-> Maybe EndSessionResult
-> Maybe StartTransactionResult
-> Maybe ExecuteStatementResult
-> Maybe CommitTransactionResult
-> Maybe StartSessionResult
-> Int
-> SendCommandResponse
SendCommandResponse'
    { $sel:fetchPage:SendCommandResponse' :: Maybe FetchPageResult
fetchPage = Maybe FetchPageResult
forall a. Maybe a
Prelude.Nothing,
      $sel:abortTransaction:SendCommandResponse' :: Maybe AbortTransactionResult
abortTransaction = Maybe AbortTransactionResult
forall a. Maybe a
Prelude.Nothing,
      $sel:endSession:SendCommandResponse' :: Maybe EndSessionResult
endSession = Maybe EndSessionResult
forall a. Maybe a
Prelude.Nothing,
      $sel:startTransaction:SendCommandResponse' :: Maybe StartTransactionResult
startTransaction = Maybe StartTransactionResult
forall a. Maybe a
Prelude.Nothing,
      $sel:executeStatement:SendCommandResponse' :: Maybe ExecuteStatementResult
executeStatement = Maybe ExecuteStatementResult
forall a. Maybe a
Prelude.Nothing,
      $sel:commitTransaction:SendCommandResponse' :: Maybe CommitTransactionResult
commitTransaction = Maybe CommitTransactionResult
forall a. Maybe a
Prelude.Nothing,
      $sel:startSession:SendCommandResponse' :: Maybe StartSessionResult
startSession = Maybe StartSessionResult
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:SendCommandResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Contains the details of the fetched page.
sendCommandResponse_fetchPage :: Lens.Lens' SendCommandResponse (Prelude.Maybe FetchPageResult)
sendCommandResponse_fetchPage :: (Maybe FetchPageResult -> f (Maybe FetchPageResult))
-> SendCommandResponse -> f SendCommandResponse
sendCommandResponse_fetchPage = (SendCommandResponse -> Maybe FetchPageResult)
-> (SendCommandResponse
    -> Maybe FetchPageResult -> SendCommandResponse)
-> Lens
     SendCommandResponse
     SendCommandResponse
     (Maybe FetchPageResult)
     (Maybe FetchPageResult)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendCommandResponse' {Maybe FetchPageResult
fetchPage :: Maybe FetchPageResult
$sel:fetchPage:SendCommandResponse' :: SendCommandResponse -> Maybe FetchPageResult
fetchPage} -> Maybe FetchPageResult
fetchPage) (\s :: SendCommandResponse
s@SendCommandResponse' {} Maybe FetchPageResult
a -> SendCommandResponse
s {$sel:fetchPage:SendCommandResponse' :: Maybe FetchPageResult
fetchPage = Maybe FetchPageResult
a} :: SendCommandResponse)

-- | Contains the details of the aborted transaction.
sendCommandResponse_abortTransaction :: Lens.Lens' SendCommandResponse (Prelude.Maybe AbortTransactionResult)
sendCommandResponse_abortTransaction :: (Maybe AbortTransactionResult -> f (Maybe AbortTransactionResult))
-> SendCommandResponse -> f SendCommandResponse
sendCommandResponse_abortTransaction = (SendCommandResponse -> Maybe AbortTransactionResult)
-> (SendCommandResponse
    -> Maybe AbortTransactionResult -> SendCommandResponse)
-> Lens
     SendCommandResponse
     SendCommandResponse
     (Maybe AbortTransactionResult)
     (Maybe AbortTransactionResult)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendCommandResponse' {Maybe AbortTransactionResult
abortTransaction :: Maybe AbortTransactionResult
$sel:abortTransaction:SendCommandResponse' :: SendCommandResponse -> Maybe AbortTransactionResult
abortTransaction} -> Maybe AbortTransactionResult
abortTransaction) (\s :: SendCommandResponse
s@SendCommandResponse' {} Maybe AbortTransactionResult
a -> SendCommandResponse
s {$sel:abortTransaction:SendCommandResponse' :: Maybe AbortTransactionResult
abortTransaction = Maybe AbortTransactionResult
a} :: SendCommandResponse)

-- | Contains the details of the ended session.
sendCommandResponse_endSession :: Lens.Lens' SendCommandResponse (Prelude.Maybe EndSessionResult)
sendCommandResponse_endSession :: (Maybe EndSessionResult -> f (Maybe EndSessionResult))
-> SendCommandResponse -> f SendCommandResponse
sendCommandResponse_endSession = (SendCommandResponse -> Maybe EndSessionResult)
-> (SendCommandResponse
    -> Maybe EndSessionResult -> SendCommandResponse)
-> Lens
     SendCommandResponse
     SendCommandResponse
     (Maybe EndSessionResult)
     (Maybe EndSessionResult)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendCommandResponse' {Maybe EndSessionResult
endSession :: Maybe EndSessionResult
$sel:endSession:SendCommandResponse' :: SendCommandResponse -> Maybe EndSessionResult
endSession} -> Maybe EndSessionResult
endSession) (\s :: SendCommandResponse
s@SendCommandResponse' {} Maybe EndSessionResult
a -> SendCommandResponse
s {$sel:endSession:SendCommandResponse' :: Maybe EndSessionResult
endSession = Maybe EndSessionResult
a} :: SendCommandResponse)

-- | Contains the details of the started transaction.
sendCommandResponse_startTransaction :: Lens.Lens' SendCommandResponse (Prelude.Maybe StartTransactionResult)
sendCommandResponse_startTransaction :: (Maybe StartTransactionResult -> f (Maybe StartTransactionResult))
-> SendCommandResponse -> f SendCommandResponse
sendCommandResponse_startTransaction = (SendCommandResponse -> Maybe StartTransactionResult)
-> (SendCommandResponse
    -> Maybe StartTransactionResult -> SendCommandResponse)
-> Lens
     SendCommandResponse
     SendCommandResponse
     (Maybe StartTransactionResult)
     (Maybe StartTransactionResult)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendCommandResponse' {Maybe StartTransactionResult
startTransaction :: Maybe StartTransactionResult
$sel:startTransaction:SendCommandResponse' :: SendCommandResponse -> Maybe StartTransactionResult
startTransaction} -> Maybe StartTransactionResult
startTransaction) (\s :: SendCommandResponse
s@SendCommandResponse' {} Maybe StartTransactionResult
a -> SendCommandResponse
s {$sel:startTransaction:SendCommandResponse' :: Maybe StartTransactionResult
startTransaction = Maybe StartTransactionResult
a} :: SendCommandResponse)

-- | Contains the details of the executed statement.
sendCommandResponse_executeStatement :: Lens.Lens' SendCommandResponse (Prelude.Maybe ExecuteStatementResult)
sendCommandResponse_executeStatement :: (Maybe ExecuteStatementResult -> f (Maybe ExecuteStatementResult))
-> SendCommandResponse -> f SendCommandResponse
sendCommandResponse_executeStatement = (SendCommandResponse -> Maybe ExecuteStatementResult)
-> (SendCommandResponse
    -> Maybe ExecuteStatementResult -> SendCommandResponse)
-> Lens
     SendCommandResponse
     SendCommandResponse
     (Maybe ExecuteStatementResult)
     (Maybe ExecuteStatementResult)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendCommandResponse' {Maybe ExecuteStatementResult
executeStatement :: Maybe ExecuteStatementResult
$sel:executeStatement:SendCommandResponse' :: SendCommandResponse -> Maybe ExecuteStatementResult
executeStatement} -> Maybe ExecuteStatementResult
executeStatement) (\s :: SendCommandResponse
s@SendCommandResponse' {} Maybe ExecuteStatementResult
a -> SendCommandResponse
s {$sel:executeStatement:SendCommandResponse' :: Maybe ExecuteStatementResult
executeStatement = Maybe ExecuteStatementResult
a} :: SendCommandResponse)

-- | Contains the details of the committed transaction.
sendCommandResponse_commitTransaction :: Lens.Lens' SendCommandResponse (Prelude.Maybe CommitTransactionResult)
sendCommandResponse_commitTransaction :: (Maybe CommitTransactionResult
 -> f (Maybe CommitTransactionResult))
-> SendCommandResponse -> f SendCommandResponse
sendCommandResponse_commitTransaction = (SendCommandResponse -> Maybe CommitTransactionResult)
-> (SendCommandResponse
    -> Maybe CommitTransactionResult -> SendCommandResponse)
-> Lens
     SendCommandResponse
     SendCommandResponse
     (Maybe CommitTransactionResult)
     (Maybe CommitTransactionResult)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendCommandResponse' {Maybe CommitTransactionResult
commitTransaction :: Maybe CommitTransactionResult
$sel:commitTransaction:SendCommandResponse' :: SendCommandResponse -> Maybe CommitTransactionResult
commitTransaction} -> Maybe CommitTransactionResult
commitTransaction) (\s :: SendCommandResponse
s@SendCommandResponse' {} Maybe CommitTransactionResult
a -> SendCommandResponse
s {$sel:commitTransaction:SendCommandResponse' :: Maybe CommitTransactionResult
commitTransaction = Maybe CommitTransactionResult
a} :: SendCommandResponse)

-- | Contains the details of the started session that includes a session
-- token. This @SessionToken@ is required for every subsequent command that
-- is issued during the current session.
sendCommandResponse_startSession :: Lens.Lens' SendCommandResponse (Prelude.Maybe StartSessionResult)
sendCommandResponse_startSession :: (Maybe StartSessionResult -> f (Maybe StartSessionResult))
-> SendCommandResponse -> f SendCommandResponse
sendCommandResponse_startSession = (SendCommandResponse -> Maybe StartSessionResult)
-> (SendCommandResponse
    -> Maybe StartSessionResult -> SendCommandResponse)
-> Lens
     SendCommandResponse
     SendCommandResponse
     (Maybe StartSessionResult)
     (Maybe StartSessionResult)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendCommandResponse' {Maybe StartSessionResult
startSession :: Maybe StartSessionResult
$sel:startSession:SendCommandResponse' :: SendCommandResponse -> Maybe StartSessionResult
startSession} -> Maybe StartSessionResult
startSession) (\s :: SendCommandResponse
s@SendCommandResponse' {} Maybe StartSessionResult
a -> SendCommandResponse
s {$sel:startSession:SendCommandResponse' :: Maybe StartSessionResult
startSession = Maybe StartSessionResult
a} :: SendCommandResponse)

-- | The response's http status code.
sendCommandResponse_httpStatus :: Lens.Lens' SendCommandResponse Prelude.Int
sendCommandResponse_httpStatus :: (Int -> f Int) -> SendCommandResponse -> f SendCommandResponse
sendCommandResponse_httpStatus = (SendCommandResponse -> Int)
-> (SendCommandResponse -> Int -> SendCommandResponse)
-> Lens SendCommandResponse SendCommandResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendCommandResponse' {Int
httpStatus :: Int
$sel:httpStatus:SendCommandResponse' :: SendCommandResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: SendCommandResponse
s@SendCommandResponse' {} Int
a -> SendCommandResponse
s {$sel:httpStatus:SendCommandResponse' :: Int
httpStatus = Int
a} :: SendCommandResponse)

instance Prelude.NFData SendCommandResponse