{-# 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 #-}
module Amazonka.RDSData.ExecuteStatement
(
ExecuteStatement (..),
newExecuteStatement,
executeStatement_database,
executeStatement_transactionId,
executeStatement_schema,
executeStatement_parameters,
executeStatement_includeResultMetadata,
executeStatement_resultSetOptions,
executeStatement_continueAfterTimeout,
executeStatement_resourceArn,
executeStatement_secretArn,
executeStatement_sql,
ExecuteStatementResponse (..),
newExecuteStatementResponse,
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
data ExecuteStatement = ExecuteStatement'
{
ExecuteStatement -> Maybe Text
database :: Prelude.Maybe Prelude.Text,
ExecuteStatement -> Maybe Text
transactionId :: Prelude.Maybe Prelude.Text,
ExecuteStatement -> Maybe Text
schema :: Prelude.Maybe Prelude.Text,
ExecuteStatement -> Maybe [SqlParameter]
parameters :: Prelude.Maybe [SqlParameter],
ExecuteStatement -> Maybe Bool
includeResultMetadata :: Prelude.Maybe Prelude.Bool,
ExecuteStatement -> Maybe ResultSetOptions
resultSetOptions :: Prelude.Maybe ResultSetOptions,
ExecuteStatement -> Maybe Bool
continueAfterTimeout :: Prelude.Maybe Prelude.Bool,
ExecuteStatement -> Text
resourceArn :: Prelude.Text,
ExecuteStatement -> Text
secretArn :: Prelude.Text,
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)
newExecuteStatement ::
Prelude.Text ->
Prelude.Text ->
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_
}
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)
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)
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)
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
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)
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)
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)
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)
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)
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
data ExecuteStatementResponse = ExecuteStatementResponse'
{
ExecuteStatementResponse -> Maybe [[Field]]
records :: Prelude.Maybe [[Field]],
ExecuteStatementResponse -> Maybe [ColumnMetadata]
columnMetadata :: Prelude.Maybe [ColumnMetadata],
ExecuteStatementResponse -> Maybe [Field]
generatedFields :: Prelude.Maybe [Field],
ExecuteStatementResponse -> Maybe Integer
numberOfRecordsUpdated :: Prelude.Maybe Prelude.Integer,
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)
newExecuteStatementResponse ::
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_
}
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
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
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
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)
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