{-# 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.RDSData.ExecuteStatement
-- 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)
--
-- 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.
--
-- The response size limit is 1 MB. If the call returns more than 1 MB of
-- response data, the call is terminated.
module Amazonka.RDSData.ExecuteStatement
  ( -- * Creating a Request
    ExecuteStatement (..),
    newExecuteStatement,

    -- * Request Lenses
    executeStatement_database,
    executeStatement_transactionId,
    executeStatement_schema,
    executeStatement_parameters,
    executeStatement_includeResultMetadata,
    executeStatement_resultSetOptions,
    executeStatement_continueAfterTimeout,
    executeStatement_resourceArn,
    executeStatement_secretArn,
    executeStatement_sql,

    -- * Destructuring the Response
    ExecuteStatementResponse (..),
    newExecuteStatementResponse,

    -- * Response Lenses
    executeStatementResponse_records,
    executeStatementResponse_columnMetadata,
    executeStatementResponse_generatedFields,
    executeStatementResponse_numberOfRecordsUpdated,
    executeStatementResponse_httpStatus,
  )
where

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

-- | The request parameters represent the input of a request to run a SQL
-- statement against a database.
--
-- /See:/ 'newExecuteStatement' smart constructor.
data ExecuteStatement = ExecuteStatement'
  { -- | The name of the database.
    ExecuteStatement -> Maybe Text
database :: Prelude.Maybe Prelude.Text,
    -- | The identifier of a transaction that was started by using the
    -- @BeginTransaction@ operation. Specify the transaction ID of the
    -- transaction that you want to include the SQL statement in.
    --
    -- If the SQL statement is not part of a transaction, don\'t set this
    -- parameter.
    ExecuteStatement -> Maybe Text
transactionId :: Prelude.Maybe Prelude.Text,
    -- | The name of the database schema.
    --
    -- Currently, the @schema@ parameter isn\'t supported.
    ExecuteStatement -> Maybe Text
schema :: Prelude.Maybe Prelude.Text,
    -- | The parameters for the SQL statement.
    --
    -- Array parameters are not supported.
    ExecuteStatement -> Maybe [SqlParameter]
parameters :: Prelude.Maybe [SqlParameter],
    -- | A value that indicates whether to include metadata in the results.
    ExecuteStatement -> Maybe Bool
includeResultMetadata :: Prelude.Maybe Prelude.Bool,
    -- | Options that control how the result set is returned.
    ExecuteStatement -> Maybe ResultSetOptions
resultSetOptions :: Prelude.Maybe ResultSetOptions,
    -- | A value that indicates whether to continue running the statement after
    -- the call times out. By default, the statement stops running when the
    -- call times out.
    --
    -- For DDL statements, we recommend continuing to run the statement after
    -- the call times out. When a DDL statement terminates before it is
    -- finished running, it can result in errors and possibly corrupted data
    -- structures.
    ExecuteStatement -> Maybe Bool
continueAfterTimeout :: Prelude.Maybe Prelude.Bool,
    -- | The Amazon Resource Name (ARN) of the Aurora Serverless DB cluster.
    ExecuteStatement -> Text
resourceArn :: Prelude.Text,
    -- | The name or ARN of the secret that enables access to the DB cluster.
    ExecuteStatement -> Text
secretArn :: Prelude.Text,
    -- | The SQL statement to run.
    ExecuteStatement -> Text
sql :: Prelude.Text
  }
  deriving (ExecuteStatement -> ExecuteStatement -> Bool
(ExecuteStatement -> ExecuteStatement -> Bool)
-> (ExecuteStatement -> ExecuteStatement -> Bool)
-> Eq ExecuteStatement
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExecuteStatement -> ExecuteStatement -> Bool
$c/= :: ExecuteStatement -> ExecuteStatement -> Bool
== :: ExecuteStatement -> ExecuteStatement -> Bool
$c== :: ExecuteStatement -> ExecuteStatement -> Bool
Prelude.Eq, ReadPrec [ExecuteStatement]
ReadPrec ExecuteStatement
Int -> ReadS ExecuteStatement
ReadS [ExecuteStatement]
(Int -> ReadS ExecuteStatement)
-> ReadS [ExecuteStatement]
-> ReadPrec ExecuteStatement
-> ReadPrec [ExecuteStatement]
-> Read ExecuteStatement
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExecuteStatement]
$creadListPrec :: ReadPrec [ExecuteStatement]
readPrec :: ReadPrec ExecuteStatement
$creadPrec :: ReadPrec ExecuteStatement
readList :: ReadS [ExecuteStatement]
$creadList :: ReadS [ExecuteStatement]
readsPrec :: Int -> ReadS ExecuteStatement
$creadsPrec :: Int -> ReadS ExecuteStatement
Prelude.Read, Int -> ExecuteStatement -> ShowS
[ExecuteStatement] -> ShowS
ExecuteStatement -> String
(Int -> ExecuteStatement -> ShowS)
-> (ExecuteStatement -> String)
-> ([ExecuteStatement] -> ShowS)
-> Show ExecuteStatement
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExecuteStatement] -> ShowS
$cshowList :: [ExecuteStatement] -> ShowS
show :: ExecuteStatement -> String
$cshow :: ExecuteStatement -> String
showsPrec :: Int -> ExecuteStatement -> ShowS
$cshowsPrec :: Int -> ExecuteStatement -> ShowS
Prelude.Show, (forall x. ExecuteStatement -> Rep ExecuteStatement x)
-> (forall x. Rep ExecuteStatement x -> ExecuteStatement)
-> Generic ExecuteStatement
forall x. Rep ExecuteStatement x -> ExecuteStatement
forall x. ExecuteStatement -> Rep ExecuteStatement x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ExecuteStatement x -> ExecuteStatement
$cfrom :: forall x. ExecuteStatement -> Rep ExecuteStatement x
Prelude.Generic)

-- |
-- Create a value of 'ExecuteStatement' 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:
--
-- 'database', 'executeStatement_database' - The name of the database.
--
-- 'transactionId', 'executeStatement_transactionId' - The identifier of a transaction that was started by using the
-- @BeginTransaction@ operation. Specify the transaction ID of the
-- transaction that you want to include the SQL statement in.
--
-- If the SQL statement is not part of a transaction, don\'t set this
-- parameter.
--
-- 'schema', 'executeStatement_schema' - The name of the database schema.
--
-- Currently, the @schema@ parameter isn\'t supported.
--
-- 'parameters', 'executeStatement_parameters' - The parameters for the SQL statement.
--
-- Array parameters are not supported.
--
-- 'includeResultMetadata', 'executeStatement_includeResultMetadata' - A value that indicates whether to include metadata in the results.
--
-- 'resultSetOptions', 'executeStatement_resultSetOptions' - Options that control how the result set is returned.
--
-- 'continueAfterTimeout', 'executeStatement_continueAfterTimeout' - A value that indicates whether to continue running the statement after
-- the call times out. By default, the statement stops running when the
-- call times out.
--
-- For DDL statements, we recommend continuing to run the statement after
-- the call times out. When a DDL statement terminates before it is
-- finished running, it can result in errors and possibly corrupted data
-- structures.
--
-- 'resourceArn', 'executeStatement_resourceArn' - The Amazon Resource Name (ARN) of the Aurora Serverless DB cluster.
--
-- 'secretArn', 'executeStatement_secretArn' - The name or ARN of the secret that enables access to the DB cluster.
--
-- 'sql', 'executeStatement_sql' - The SQL statement to run.
newExecuteStatement ::
  -- | 'resourceArn'
  Prelude.Text ->
  -- | 'secretArn'
  Prelude.Text ->
  -- | 'sql'
  Prelude.Text ->
  ExecuteStatement
newExecuteStatement :: Text -> Text -> Text -> ExecuteStatement
newExecuteStatement Text
pResourceArn_ Text
pSecretArn_ Text
pSql_ =
  ExecuteStatement' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [SqlParameter]
-> Maybe Bool
-> Maybe ResultSetOptions
-> Maybe Bool
-> Text
-> Text
-> Text
-> ExecuteStatement
ExecuteStatement'
    { $sel:database:ExecuteStatement' :: Maybe Text
database = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:transactionId:ExecuteStatement' :: Maybe Text
transactionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:schema:ExecuteStatement' :: Maybe Text
schema = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:parameters:ExecuteStatement' :: Maybe [SqlParameter]
parameters = Maybe [SqlParameter]
forall a. Maybe a
Prelude.Nothing,
      $sel:includeResultMetadata:ExecuteStatement' :: Maybe Bool
includeResultMetadata = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:resultSetOptions:ExecuteStatement' :: Maybe ResultSetOptions
resultSetOptions = Maybe ResultSetOptions
forall a. Maybe a
Prelude.Nothing,
      $sel:continueAfterTimeout:ExecuteStatement' :: Maybe Bool
continueAfterTimeout = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceArn:ExecuteStatement' :: Text
resourceArn = Text
pResourceArn_,
      $sel:secretArn:ExecuteStatement' :: Text
secretArn = Text
pSecretArn_,
      $sel:sql:ExecuteStatement' :: Text
sql = Text
pSql_
    }

-- | The name of the database.
executeStatement_database :: Lens.Lens' ExecuteStatement (Prelude.Maybe Prelude.Text)
executeStatement_database :: (Maybe Text -> f (Maybe Text))
-> ExecuteStatement -> f ExecuteStatement
executeStatement_database = (ExecuteStatement -> Maybe Text)
-> (ExecuteStatement -> Maybe Text -> ExecuteStatement)
-> Lens ExecuteStatement ExecuteStatement (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecuteStatement' {Maybe Text
database :: Maybe Text
$sel:database:ExecuteStatement' :: ExecuteStatement -> Maybe Text
database} -> Maybe Text
database) (\s :: ExecuteStatement
s@ExecuteStatement' {} Maybe Text
a -> ExecuteStatement
s {$sel:database:ExecuteStatement' :: Maybe Text
database = Maybe Text
a} :: ExecuteStatement)

-- | The identifier of a transaction that was started by using the
-- @BeginTransaction@ operation. Specify the transaction ID of the
-- transaction that you want to include the SQL statement in.
--
-- If the SQL statement is not part of a transaction, don\'t set this
-- parameter.
executeStatement_transactionId :: Lens.Lens' ExecuteStatement (Prelude.Maybe Prelude.Text)
executeStatement_transactionId :: (Maybe Text -> f (Maybe Text))
-> ExecuteStatement -> f ExecuteStatement
executeStatement_transactionId = (ExecuteStatement -> Maybe Text)
-> (ExecuteStatement -> Maybe Text -> ExecuteStatement)
-> Lens ExecuteStatement ExecuteStatement (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecuteStatement' {Maybe Text
transactionId :: Maybe Text
$sel:transactionId:ExecuteStatement' :: ExecuteStatement -> Maybe Text
transactionId} -> Maybe Text
transactionId) (\s :: ExecuteStatement
s@ExecuteStatement' {} Maybe Text
a -> ExecuteStatement
s {$sel:transactionId:ExecuteStatement' :: Maybe Text
transactionId = Maybe Text
a} :: ExecuteStatement)

-- | The name of the database schema.
--
-- Currently, the @schema@ parameter isn\'t supported.
executeStatement_schema :: Lens.Lens' ExecuteStatement (Prelude.Maybe Prelude.Text)
executeStatement_schema :: (Maybe Text -> f (Maybe Text))
-> ExecuteStatement -> f ExecuteStatement
executeStatement_schema = (ExecuteStatement -> Maybe Text)
-> (ExecuteStatement -> Maybe Text -> ExecuteStatement)
-> Lens ExecuteStatement ExecuteStatement (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecuteStatement' {Maybe Text
schema :: Maybe Text
$sel:schema:ExecuteStatement' :: ExecuteStatement -> Maybe Text
schema} -> Maybe Text
schema) (\s :: ExecuteStatement
s@ExecuteStatement' {} Maybe Text
a -> ExecuteStatement
s {$sel:schema:ExecuteStatement' :: Maybe Text
schema = Maybe Text
a} :: ExecuteStatement)

-- | The parameters for the SQL statement.
--
-- Array parameters are not supported.
executeStatement_parameters :: Lens.Lens' ExecuteStatement (Prelude.Maybe [SqlParameter])
executeStatement_parameters :: (Maybe [SqlParameter] -> f (Maybe [SqlParameter]))
-> ExecuteStatement -> f ExecuteStatement
executeStatement_parameters = (ExecuteStatement -> Maybe [SqlParameter])
-> (ExecuteStatement -> Maybe [SqlParameter] -> ExecuteStatement)
-> Lens
     ExecuteStatement
     ExecuteStatement
     (Maybe [SqlParameter])
     (Maybe [SqlParameter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecuteStatement' {Maybe [SqlParameter]
parameters :: Maybe [SqlParameter]
$sel:parameters:ExecuteStatement' :: ExecuteStatement -> Maybe [SqlParameter]
parameters} -> Maybe [SqlParameter]
parameters) (\s :: ExecuteStatement
s@ExecuteStatement' {} Maybe [SqlParameter]
a -> ExecuteStatement
s {$sel:parameters:ExecuteStatement' :: Maybe [SqlParameter]
parameters = Maybe [SqlParameter]
a} :: ExecuteStatement) ((Maybe [SqlParameter] -> f (Maybe [SqlParameter]))
 -> ExecuteStatement -> f ExecuteStatement)
-> ((Maybe [SqlParameter] -> f (Maybe [SqlParameter]))
    -> Maybe [SqlParameter] -> f (Maybe [SqlParameter]))
-> (Maybe [SqlParameter] -> f (Maybe [SqlParameter]))
-> ExecuteStatement
-> f ExecuteStatement
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [SqlParameter] [SqlParameter] [SqlParameter] [SqlParameter]
-> Iso
     (Maybe [SqlParameter])
     (Maybe [SqlParameter])
     (Maybe [SqlParameter])
     (Maybe [SqlParameter])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [SqlParameter] [SqlParameter] [SqlParameter] [SqlParameter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A value that indicates whether to include metadata in the results.
executeStatement_includeResultMetadata :: Lens.Lens' ExecuteStatement (Prelude.Maybe Prelude.Bool)
executeStatement_includeResultMetadata :: (Maybe Bool -> f (Maybe Bool))
-> ExecuteStatement -> f ExecuteStatement
executeStatement_includeResultMetadata = (ExecuteStatement -> Maybe Bool)
-> (ExecuteStatement -> Maybe Bool -> ExecuteStatement)
-> Lens ExecuteStatement ExecuteStatement (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecuteStatement' {Maybe Bool
includeResultMetadata :: Maybe Bool
$sel:includeResultMetadata:ExecuteStatement' :: ExecuteStatement -> Maybe Bool
includeResultMetadata} -> Maybe Bool
includeResultMetadata) (\s :: ExecuteStatement
s@ExecuteStatement' {} Maybe Bool
a -> ExecuteStatement
s {$sel:includeResultMetadata:ExecuteStatement' :: Maybe Bool
includeResultMetadata = Maybe Bool
a} :: ExecuteStatement)

-- | Options that control how the result set is returned.
executeStatement_resultSetOptions :: Lens.Lens' ExecuteStatement (Prelude.Maybe ResultSetOptions)
executeStatement_resultSetOptions :: (Maybe ResultSetOptions -> f (Maybe ResultSetOptions))
-> ExecuteStatement -> f ExecuteStatement
executeStatement_resultSetOptions = (ExecuteStatement -> Maybe ResultSetOptions)
-> (ExecuteStatement -> Maybe ResultSetOptions -> ExecuteStatement)
-> Lens
     ExecuteStatement
     ExecuteStatement
     (Maybe ResultSetOptions)
     (Maybe ResultSetOptions)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecuteStatement' {Maybe ResultSetOptions
resultSetOptions :: Maybe ResultSetOptions
$sel:resultSetOptions:ExecuteStatement' :: ExecuteStatement -> Maybe ResultSetOptions
resultSetOptions} -> Maybe ResultSetOptions
resultSetOptions) (\s :: ExecuteStatement
s@ExecuteStatement' {} Maybe ResultSetOptions
a -> ExecuteStatement
s {$sel:resultSetOptions:ExecuteStatement' :: Maybe ResultSetOptions
resultSetOptions = Maybe ResultSetOptions
a} :: ExecuteStatement)

-- | A value that indicates whether to continue running the statement after
-- the call times out. By default, the statement stops running when the
-- call times out.
--
-- For DDL statements, we recommend continuing to run the statement after
-- the call times out. When a DDL statement terminates before it is
-- finished running, it can result in errors and possibly corrupted data
-- structures.
executeStatement_continueAfterTimeout :: Lens.Lens' ExecuteStatement (Prelude.Maybe Prelude.Bool)
executeStatement_continueAfterTimeout :: (Maybe Bool -> f (Maybe Bool))
-> ExecuteStatement -> f ExecuteStatement
executeStatement_continueAfterTimeout = (ExecuteStatement -> Maybe Bool)
-> (ExecuteStatement -> Maybe Bool -> ExecuteStatement)
-> Lens ExecuteStatement ExecuteStatement (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecuteStatement' {Maybe Bool
continueAfterTimeout :: Maybe Bool
$sel:continueAfterTimeout:ExecuteStatement' :: ExecuteStatement -> Maybe Bool
continueAfterTimeout} -> Maybe Bool
continueAfterTimeout) (\s :: ExecuteStatement
s@ExecuteStatement' {} Maybe Bool
a -> ExecuteStatement
s {$sel:continueAfterTimeout:ExecuteStatement' :: Maybe Bool
continueAfterTimeout = Maybe Bool
a} :: ExecuteStatement)

-- | The Amazon Resource Name (ARN) of the Aurora Serverless DB cluster.
executeStatement_resourceArn :: Lens.Lens' ExecuteStatement Prelude.Text
executeStatement_resourceArn :: (Text -> f Text) -> ExecuteStatement -> f ExecuteStatement
executeStatement_resourceArn = (ExecuteStatement -> Text)
-> (ExecuteStatement -> Text -> ExecuteStatement)
-> Lens ExecuteStatement ExecuteStatement Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecuteStatement' {Text
resourceArn :: Text
$sel:resourceArn:ExecuteStatement' :: ExecuteStatement -> Text
resourceArn} -> Text
resourceArn) (\s :: ExecuteStatement
s@ExecuteStatement' {} Text
a -> ExecuteStatement
s {$sel:resourceArn:ExecuteStatement' :: Text
resourceArn = Text
a} :: ExecuteStatement)

-- | The name or ARN of the secret that enables access to the DB cluster.
executeStatement_secretArn :: Lens.Lens' ExecuteStatement Prelude.Text
executeStatement_secretArn :: (Text -> f Text) -> ExecuteStatement -> f ExecuteStatement
executeStatement_secretArn = (ExecuteStatement -> Text)
-> (ExecuteStatement -> Text -> ExecuteStatement)
-> Lens ExecuteStatement ExecuteStatement Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecuteStatement' {Text
secretArn :: Text
$sel:secretArn:ExecuteStatement' :: ExecuteStatement -> Text
secretArn} -> Text
secretArn) (\s :: ExecuteStatement
s@ExecuteStatement' {} Text
a -> ExecuteStatement
s {$sel:secretArn:ExecuteStatement' :: Text
secretArn = Text
a} :: ExecuteStatement)

-- | The SQL statement to run.
executeStatement_sql :: Lens.Lens' ExecuteStatement Prelude.Text
executeStatement_sql :: (Text -> f Text) -> ExecuteStatement -> f ExecuteStatement
executeStatement_sql = (ExecuteStatement -> Text)
-> (ExecuteStatement -> Text -> ExecuteStatement)
-> Lens ExecuteStatement ExecuteStatement Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecuteStatement' {Text
sql :: Text
$sel:sql:ExecuteStatement' :: ExecuteStatement -> Text
sql} -> Text
sql) (\s :: ExecuteStatement
s@ExecuteStatement' {} Text
a -> ExecuteStatement
s {$sel:sql:ExecuteStatement' :: Text
sql = Text
a} :: ExecuteStatement)

instance Core.AWSRequest ExecuteStatement where
  type
    AWSResponse ExecuteStatement =
      ExecuteStatementResponse
  request :: ExecuteStatement -> Request ExecuteStatement
request = Service -> ExecuteStatement -> Request ExecuteStatement
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ExecuteStatement
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ExecuteStatement)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ExecuteStatement))
-> Logger
-> Service
-> Proxy ExecuteStatement
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ExecuteStatement)))
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 [[Field]]
-> Maybe [ColumnMetadata]
-> Maybe [Field]
-> Maybe Integer
-> Int
-> ExecuteStatementResponse
ExecuteStatementResponse'
            (Maybe [[Field]]
 -> Maybe [ColumnMetadata]
 -> Maybe [Field]
 -> Maybe Integer
 -> Int
 -> ExecuteStatementResponse)
-> Either String (Maybe [[Field]])
-> Either
     String
     (Maybe [ColumnMetadata]
      -> Maybe [Field]
      -> Maybe Integer
      -> Int
      -> ExecuteStatementResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [[Field]]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"records" Either String (Maybe (Maybe [[Field]]))
-> Maybe [[Field]] -> Either String (Maybe [[Field]])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [[Field]]
forall a. Monoid a => a
Prelude.mempty)
            Either
  String
  (Maybe [ColumnMetadata]
   -> Maybe [Field]
   -> Maybe Integer
   -> Int
   -> ExecuteStatementResponse)
-> Either String (Maybe [ColumnMetadata])
-> Either
     String
     (Maybe [Field] -> Maybe Integer -> Int -> ExecuteStatementResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [ColumnMetadata]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"columnMetadata" Either String (Maybe (Maybe [ColumnMetadata]))
-> Maybe [ColumnMetadata] -> Either String (Maybe [ColumnMetadata])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ColumnMetadata]
forall a. Monoid a => a
Prelude.mempty)
            Either
  String
  (Maybe [Field] -> Maybe Integer -> Int -> ExecuteStatementResponse)
-> Either String (Maybe [Field])
-> Either String (Maybe Integer -> Int -> ExecuteStatementResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Either String (Maybe (Maybe [Field]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"generatedFields"
                            Either String (Maybe (Maybe [Field]))
-> Maybe [Field] -> Either String (Maybe [Field])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Field]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either String (Maybe Integer -> Int -> ExecuteStatementResponse)
-> Either String (Maybe Integer)
-> Either String (Int -> ExecuteStatementResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"numberOfRecordsUpdated")
            Either String (Int -> ExecuteStatementResponse)
-> Either String Int -> Either String ExecuteStatementResponse
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 ExecuteStatement

instance Prelude.NFData ExecuteStatement

instance Core.ToHeaders ExecuteStatement where
  toHeaders :: ExecuteStatement -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ExecuteStatement -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON ExecuteStatement where
  toJSON :: ExecuteStatement -> Value
toJSON ExecuteStatement' {Maybe Bool
Maybe [SqlParameter]
Maybe Text
Maybe ResultSetOptions
Text
sql :: Text
secretArn :: Text
resourceArn :: Text
continueAfterTimeout :: Maybe Bool
resultSetOptions :: Maybe ResultSetOptions
includeResultMetadata :: Maybe Bool
parameters :: Maybe [SqlParameter]
schema :: Maybe Text
transactionId :: Maybe Text
database :: Maybe Text
$sel:sql:ExecuteStatement' :: ExecuteStatement -> Text
$sel:secretArn:ExecuteStatement' :: ExecuteStatement -> Text
$sel:resourceArn:ExecuteStatement' :: ExecuteStatement -> Text
$sel:continueAfterTimeout:ExecuteStatement' :: ExecuteStatement -> Maybe Bool
$sel:resultSetOptions:ExecuteStatement' :: ExecuteStatement -> Maybe ResultSetOptions
$sel:includeResultMetadata:ExecuteStatement' :: ExecuteStatement -> Maybe Bool
$sel:parameters:ExecuteStatement' :: ExecuteStatement -> Maybe [SqlParameter]
$sel:schema:ExecuteStatement' :: ExecuteStatement -> Maybe Text
$sel:transactionId:ExecuteStatement' :: ExecuteStatement -> Maybe Text
$sel:database:ExecuteStatement' :: ExecuteStatement -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"database" 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
database,
            (Text
"transactionId" 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
transactionId,
            (Text
"schema" 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
schema,
            (Text
"parameters" Text -> [SqlParameter] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([SqlParameter] -> Pair) -> Maybe [SqlParameter] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [SqlParameter]
parameters,
            (Text
"includeResultMetadata" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
includeResultMetadata,
            (Text
"resultSetOptions" Text -> ResultSetOptions -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ResultSetOptions -> Pair) -> Maybe ResultSetOptions -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ResultSetOptions
resultSetOptions,
            (Text
"continueAfterTimeout" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
continueAfterTimeout,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"resourceArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resourceArn),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"secretArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
secretArn),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"sql" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
sql)
          ]
      )

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

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

-- | The response elements represent the output of a request to run a SQL
-- statement against a database.
--
-- /See:/ 'newExecuteStatementResponse' smart constructor.
data ExecuteStatementResponse = ExecuteStatementResponse'
  { -- | The records returned by the SQL statement.
    ExecuteStatementResponse -> Maybe [[Field]]
records :: Prelude.Maybe [[Field]],
    -- | Metadata for the columns included in the results.
    ExecuteStatementResponse -> Maybe [ColumnMetadata]
columnMetadata :: Prelude.Maybe [ColumnMetadata],
    -- | Values for fields generated during the request.
    --
    -- >  <note> <p>The <code>generatedFields</code> data isn't supported by Aurora PostgreSQL. To get the values of generated fields, use the <code>RETURNING</code> clause. For more information, see <a href="https://www.postgresql.org/docs/10/dml-returning.html">Returning Data From Modified Rows</a> in the PostgreSQL documentation.</p> </note>
    ExecuteStatementResponse -> Maybe [Field]
generatedFields :: Prelude.Maybe [Field],
    -- | The number of records updated by the request.
    ExecuteStatementResponse -> Maybe Integer
numberOfRecordsUpdated :: Prelude.Maybe Prelude.Integer,
    -- | The response's http status code.
    ExecuteStatementResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ExecuteStatementResponse -> ExecuteStatementResponse -> Bool
(ExecuteStatementResponse -> ExecuteStatementResponse -> Bool)
-> (ExecuteStatementResponse -> ExecuteStatementResponse -> Bool)
-> Eq ExecuteStatementResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExecuteStatementResponse -> ExecuteStatementResponse -> Bool
$c/= :: ExecuteStatementResponse -> ExecuteStatementResponse -> Bool
== :: ExecuteStatementResponse -> ExecuteStatementResponse -> Bool
$c== :: ExecuteStatementResponse -> ExecuteStatementResponse -> Bool
Prelude.Eq, ReadPrec [ExecuteStatementResponse]
ReadPrec ExecuteStatementResponse
Int -> ReadS ExecuteStatementResponse
ReadS [ExecuteStatementResponse]
(Int -> ReadS ExecuteStatementResponse)
-> ReadS [ExecuteStatementResponse]
-> ReadPrec ExecuteStatementResponse
-> ReadPrec [ExecuteStatementResponse]
-> Read ExecuteStatementResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExecuteStatementResponse]
$creadListPrec :: ReadPrec [ExecuteStatementResponse]
readPrec :: ReadPrec ExecuteStatementResponse
$creadPrec :: ReadPrec ExecuteStatementResponse
readList :: ReadS [ExecuteStatementResponse]
$creadList :: ReadS [ExecuteStatementResponse]
readsPrec :: Int -> ReadS ExecuteStatementResponse
$creadsPrec :: Int -> ReadS ExecuteStatementResponse
Prelude.Read, Int -> ExecuteStatementResponse -> ShowS
[ExecuteStatementResponse] -> ShowS
ExecuteStatementResponse -> String
(Int -> ExecuteStatementResponse -> ShowS)
-> (ExecuteStatementResponse -> String)
-> ([ExecuteStatementResponse] -> ShowS)
-> Show ExecuteStatementResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExecuteStatementResponse] -> ShowS
$cshowList :: [ExecuteStatementResponse] -> ShowS
show :: ExecuteStatementResponse -> String
$cshow :: ExecuteStatementResponse -> String
showsPrec :: Int -> ExecuteStatementResponse -> ShowS
$cshowsPrec :: Int -> ExecuteStatementResponse -> ShowS
Prelude.Show, (forall x.
 ExecuteStatementResponse -> Rep ExecuteStatementResponse x)
-> (forall x.
    Rep ExecuteStatementResponse x -> ExecuteStatementResponse)
-> Generic ExecuteStatementResponse
forall x.
Rep ExecuteStatementResponse x -> ExecuteStatementResponse
forall x.
ExecuteStatementResponse -> Rep ExecuteStatementResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ExecuteStatementResponse x -> ExecuteStatementResponse
$cfrom :: forall x.
ExecuteStatementResponse -> Rep ExecuteStatementResponse x
Prelude.Generic)

-- |
-- Create a value of 'ExecuteStatementResponse' 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:
--
-- 'records', 'executeStatementResponse_records' - The records returned by the SQL statement.
--
-- 'columnMetadata', 'executeStatementResponse_columnMetadata' - Metadata for the columns included in the results.
--
-- 'generatedFields', 'executeStatementResponse_generatedFields' - Values for fields generated during the request.
--
-- >  <note> <p>The <code>generatedFields</code> data isn't supported by Aurora PostgreSQL. To get the values of generated fields, use the <code>RETURNING</code> clause. For more information, see <a href="https://www.postgresql.org/docs/10/dml-returning.html">Returning Data From Modified Rows</a> in the PostgreSQL documentation.</p> </note>
--
-- 'numberOfRecordsUpdated', 'executeStatementResponse_numberOfRecordsUpdated' - The number of records updated by the request.
--
-- 'httpStatus', 'executeStatementResponse_httpStatus' - The response's http status code.
newExecuteStatementResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ExecuteStatementResponse
newExecuteStatementResponse :: Int -> ExecuteStatementResponse
newExecuteStatementResponse Int
pHttpStatus_ =
  ExecuteStatementResponse' :: Maybe [[Field]]
-> Maybe [ColumnMetadata]
-> Maybe [Field]
-> Maybe Integer
-> Int
-> ExecuteStatementResponse
ExecuteStatementResponse'
    { $sel:records:ExecuteStatementResponse' :: Maybe [[Field]]
records =
        Maybe [[Field]]
forall a. Maybe a
Prelude.Nothing,
      $sel:columnMetadata:ExecuteStatementResponse' :: Maybe [ColumnMetadata]
columnMetadata = Maybe [ColumnMetadata]
forall a. Maybe a
Prelude.Nothing,
      $sel:generatedFields:ExecuteStatementResponse' :: Maybe [Field]
generatedFields = Maybe [Field]
forall a. Maybe a
Prelude.Nothing,
      $sel:numberOfRecordsUpdated:ExecuteStatementResponse' :: Maybe Integer
numberOfRecordsUpdated = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ExecuteStatementResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The records returned by the SQL statement.
executeStatementResponse_records :: Lens.Lens' ExecuteStatementResponse (Prelude.Maybe [[Field]])
executeStatementResponse_records :: (Maybe [[Field]] -> f (Maybe [[Field]]))
-> ExecuteStatementResponse -> f ExecuteStatementResponse
executeStatementResponse_records = (ExecuteStatementResponse -> Maybe [[Field]])
-> (ExecuteStatementResponse
    -> Maybe [[Field]] -> ExecuteStatementResponse)
-> Lens
     ExecuteStatementResponse
     ExecuteStatementResponse
     (Maybe [[Field]])
     (Maybe [[Field]])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecuteStatementResponse' {Maybe [[Field]]
records :: Maybe [[Field]]
$sel:records:ExecuteStatementResponse' :: ExecuteStatementResponse -> Maybe [[Field]]
records} -> Maybe [[Field]]
records) (\s :: ExecuteStatementResponse
s@ExecuteStatementResponse' {} Maybe [[Field]]
a -> ExecuteStatementResponse
s {$sel:records:ExecuteStatementResponse' :: Maybe [[Field]]
records = Maybe [[Field]]
a} :: ExecuteStatementResponse) ((Maybe [[Field]] -> f (Maybe [[Field]]))
 -> ExecuteStatementResponse -> f ExecuteStatementResponse)
-> ((Maybe [[Field]] -> f (Maybe [[Field]]))
    -> Maybe [[Field]] -> f (Maybe [[Field]]))
-> (Maybe [[Field]] -> f (Maybe [[Field]]))
-> ExecuteStatementResponse
-> f ExecuteStatementResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [[Field]] [[Field]] [[Field]] [[Field]]
-> Iso
     (Maybe [[Field]])
     (Maybe [[Field]])
     (Maybe [[Field]])
     (Maybe [[Field]])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [[Field]] [[Field]] [[Field]] [[Field]]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Metadata for the columns included in the results.
executeStatementResponse_columnMetadata :: Lens.Lens' ExecuteStatementResponse (Prelude.Maybe [ColumnMetadata])
executeStatementResponse_columnMetadata :: (Maybe [ColumnMetadata] -> f (Maybe [ColumnMetadata]))
-> ExecuteStatementResponse -> f ExecuteStatementResponse
executeStatementResponse_columnMetadata = (ExecuteStatementResponse -> Maybe [ColumnMetadata])
-> (ExecuteStatementResponse
    -> Maybe [ColumnMetadata] -> ExecuteStatementResponse)
-> Lens
     ExecuteStatementResponse
     ExecuteStatementResponse
     (Maybe [ColumnMetadata])
     (Maybe [ColumnMetadata])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecuteStatementResponse' {Maybe [ColumnMetadata]
columnMetadata :: Maybe [ColumnMetadata]
$sel:columnMetadata:ExecuteStatementResponse' :: ExecuteStatementResponse -> Maybe [ColumnMetadata]
columnMetadata} -> Maybe [ColumnMetadata]
columnMetadata) (\s :: ExecuteStatementResponse
s@ExecuteStatementResponse' {} Maybe [ColumnMetadata]
a -> ExecuteStatementResponse
s {$sel:columnMetadata:ExecuteStatementResponse' :: Maybe [ColumnMetadata]
columnMetadata = Maybe [ColumnMetadata]
a} :: ExecuteStatementResponse) ((Maybe [ColumnMetadata] -> f (Maybe [ColumnMetadata]))
 -> ExecuteStatementResponse -> f ExecuteStatementResponse)
-> ((Maybe [ColumnMetadata] -> f (Maybe [ColumnMetadata]))
    -> Maybe [ColumnMetadata] -> f (Maybe [ColumnMetadata]))
-> (Maybe [ColumnMetadata] -> f (Maybe [ColumnMetadata]))
-> ExecuteStatementResponse
-> f ExecuteStatementResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ColumnMetadata] [ColumnMetadata] [ColumnMetadata] [ColumnMetadata]
-> Iso
     (Maybe [ColumnMetadata])
     (Maybe [ColumnMetadata])
     (Maybe [ColumnMetadata])
     (Maybe [ColumnMetadata])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [ColumnMetadata] [ColumnMetadata] [ColumnMetadata] [ColumnMetadata]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Values for fields generated during the request.
--
-- >  <note> <p>The <code>generatedFields</code> data isn't supported by Aurora PostgreSQL. To get the values of generated fields, use the <code>RETURNING</code> clause. For more information, see <a href="https://www.postgresql.org/docs/10/dml-returning.html">Returning Data From Modified Rows</a> in the PostgreSQL documentation.</p> </note>
executeStatementResponse_generatedFields :: Lens.Lens' ExecuteStatementResponse (Prelude.Maybe [Field])
executeStatementResponse_generatedFields :: (Maybe [Field] -> f (Maybe [Field]))
-> ExecuteStatementResponse -> f ExecuteStatementResponse
executeStatementResponse_generatedFields = (ExecuteStatementResponse -> Maybe [Field])
-> (ExecuteStatementResponse
    -> Maybe [Field] -> ExecuteStatementResponse)
-> Lens
     ExecuteStatementResponse
     ExecuteStatementResponse
     (Maybe [Field])
     (Maybe [Field])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecuteStatementResponse' {Maybe [Field]
generatedFields :: Maybe [Field]
$sel:generatedFields:ExecuteStatementResponse' :: ExecuteStatementResponse -> Maybe [Field]
generatedFields} -> Maybe [Field]
generatedFields) (\s :: ExecuteStatementResponse
s@ExecuteStatementResponse' {} Maybe [Field]
a -> ExecuteStatementResponse
s {$sel:generatedFields:ExecuteStatementResponse' :: Maybe [Field]
generatedFields = Maybe [Field]
a} :: ExecuteStatementResponse) ((Maybe [Field] -> f (Maybe [Field]))
 -> ExecuteStatementResponse -> f ExecuteStatementResponse)
-> ((Maybe [Field] -> f (Maybe [Field]))
    -> Maybe [Field] -> f (Maybe [Field]))
-> (Maybe [Field] -> f (Maybe [Field]))
-> ExecuteStatementResponse
-> f ExecuteStatementResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Field] [Field] [Field] [Field]
-> Iso
     (Maybe [Field]) (Maybe [Field]) (Maybe [Field]) (Maybe [Field])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Field] [Field] [Field] [Field]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The number of records updated by the request.
executeStatementResponse_numberOfRecordsUpdated :: Lens.Lens' ExecuteStatementResponse (Prelude.Maybe Prelude.Integer)
executeStatementResponse_numberOfRecordsUpdated :: (Maybe Integer -> f (Maybe Integer))
-> ExecuteStatementResponse -> f ExecuteStatementResponse
executeStatementResponse_numberOfRecordsUpdated = (ExecuteStatementResponse -> Maybe Integer)
-> (ExecuteStatementResponse
    -> Maybe Integer -> ExecuteStatementResponse)
-> Lens
     ExecuteStatementResponse
     ExecuteStatementResponse
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecuteStatementResponse' {Maybe Integer
numberOfRecordsUpdated :: Maybe Integer
$sel:numberOfRecordsUpdated:ExecuteStatementResponse' :: ExecuteStatementResponse -> Maybe Integer
numberOfRecordsUpdated} -> Maybe Integer
numberOfRecordsUpdated) (\s :: ExecuteStatementResponse
s@ExecuteStatementResponse' {} Maybe Integer
a -> ExecuteStatementResponse
s {$sel:numberOfRecordsUpdated:ExecuteStatementResponse' :: Maybe Integer
numberOfRecordsUpdated = Maybe Integer
a} :: ExecuteStatementResponse)

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

instance Prelude.NFData ExecuteStatementResponse