{-# 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.RedshiftData.DescribeStatement
-- 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)
--
-- Describes the details about a specific instance when a query was run by
-- the Amazon Redshift Data API. The information includes when the query
-- started, when it finished, the query status, the number of rows
-- returned, and the SQL statement.
module Amazonka.RedshiftData.DescribeStatement
  ( -- * Creating a Request
    DescribeStatement (..),
    newDescribeStatement,

    -- * Request Lenses
    describeStatement_id,

    -- * Destructuring the Response
    DescribeStatementResponse (..),
    newDescribeStatementResponse,

    -- * Response Lenses
    describeStatementResponse_status,
    describeStatementResponse_redshiftQueryId,
    describeStatementResponse_resultSize,
    describeStatementResponse_dbUser,
    describeStatementResponse_subStatements,
    describeStatementResponse_database,
    describeStatementResponse_createdAt,
    describeStatementResponse_queryParameters,
    describeStatementResponse_error,
    describeStatementResponse_resultRows,
    describeStatementResponse_redshiftPid,
    describeStatementResponse_clusterIdentifier,
    describeStatementResponse_hasResultSet,
    describeStatementResponse_queryString,
    describeStatementResponse_updatedAt,
    describeStatementResponse_secretArn,
    describeStatementResponse_duration,
    describeStatementResponse_httpStatus,
    describeStatementResponse_id,
  )
where

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

-- | /See:/ 'newDescribeStatement' smart constructor.
data DescribeStatement = DescribeStatement'
  { -- | The identifier of the SQL statement to describe. This value is a
    -- universally unique identifier (UUID) generated by Amazon Redshift Data
    -- API. A suffix indicates the number of the SQL statement. For example,
    -- @d9b6c0c9-0747-4bf4-b142-e8883122f766:2@ has a suffix of @:2@ that
    -- indicates the second SQL statement of a batch query. This identifier is
    -- returned by @BatchExecuteStatment@, @ExecuteStatement@, and
    -- @ListStatements@.
    DescribeStatement -> Text
id :: Prelude.Text
  }
  deriving (DescribeStatement -> DescribeStatement -> Bool
(DescribeStatement -> DescribeStatement -> Bool)
-> (DescribeStatement -> DescribeStatement -> Bool)
-> Eq DescribeStatement
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeStatement -> DescribeStatement -> Bool
$c/= :: DescribeStatement -> DescribeStatement -> Bool
== :: DescribeStatement -> DescribeStatement -> Bool
$c== :: DescribeStatement -> DescribeStatement -> Bool
Prelude.Eq, ReadPrec [DescribeStatement]
ReadPrec DescribeStatement
Int -> ReadS DescribeStatement
ReadS [DescribeStatement]
(Int -> ReadS DescribeStatement)
-> ReadS [DescribeStatement]
-> ReadPrec DescribeStatement
-> ReadPrec [DescribeStatement]
-> Read DescribeStatement
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeStatement]
$creadListPrec :: ReadPrec [DescribeStatement]
readPrec :: ReadPrec DescribeStatement
$creadPrec :: ReadPrec DescribeStatement
readList :: ReadS [DescribeStatement]
$creadList :: ReadS [DescribeStatement]
readsPrec :: Int -> ReadS DescribeStatement
$creadsPrec :: Int -> ReadS DescribeStatement
Prelude.Read, Int -> DescribeStatement -> ShowS
[DescribeStatement] -> ShowS
DescribeStatement -> String
(Int -> DescribeStatement -> ShowS)
-> (DescribeStatement -> String)
-> ([DescribeStatement] -> ShowS)
-> Show DescribeStatement
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeStatement] -> ShowS
$cshowList :: [DescribeStatement] -> ShowS
show :: DescribeStatement -> String
$cshow :: DescribeStatement -> String
showsPrec :: Int -> DescribeStatement -> ShowS
$cshowsPrec :: Int -> DescribeStatement -> ShowS
Prelude.Show, (forall x. DescribeStatement -> Rep DescribeStatement x)
-> (forall x. Rep DescribeStatement x -> DescribeStatement)
-> Generic DescribeStatement
forall x. Rep DescribeStatement x -> DescribeStatement
forall x. DescribeStatement -> Rep DescribeStatement x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeStatement x -> DescribeStatement
$cfrom :: forall x. DescribeStatement -> Rep DescribeStatement x
Prelude.Generic)

-- |
-- Create a value of 'DescribeStatement' 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:
--
-- 'id', 'describeStatement_id' - The identifier of the SQL statement to describe. This value is a
-- universally unique identifier (UUID) generated by Amazon Redshift Data
-- API. A suffix indicates the number of the SQL statement. For example,
-- @d9b6c0c9-0747-4bf4-b142-e8883122f766:2@ has a suffix of @:2@ that
-- indicates the second SQL statement of a batch query. This identifier is
-- returned by @BatchExecuteStatment@, @ExecuteStatement@, and
-- @ListStatements@.
newDescribeStatement ::
  -- | 'id'
  Prelude.Text ->
  DescribeStatement
newDescribeStatement :: Text -> DescribeStatement
newDescribeStatement Text
pId_ =
  DescribeStatement' :: Text -> DescribeStatement
DescribeStatement' {$sel:id:DescribeStatement' :: Text
id = Text
pId_}

-- | The identifier of the SQL statement to describe. This value is a
-- universally unique identifier (UUID) generated by Amazon Redshift Data
-- API. A suffix indicates the number of the SQL statement. For example,
-- @d9b6c0c9-0747-4bf4-b142-e8883122f766:2@ has a suffix of @:2@ that
-- indicates the second SQL statement of a batch query. This identifier is
-- returned by @BatchExecuteStatment@, @ExecuteStatement@, and
-- @ListStatements@.
describeStatement_id :: Lens.Lens' DescribeStatement Prelude.Text
describeStatement_id :: (Text -> f Text) -> DescribeStatement -> f DescribeStatement
describeStatement_id = (DescribeStatement -> Text)
-> (DescribeStatement -> Text -> DescribeStatement)
-> Lens DescribeStatement DescribeStatement Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeStatement' {Text
id :: Text
$sel:id:DescribeStatement' :: DescribeStatement -> Text
id} -> Text
id) (\s :: DescribeStatement
s@DescribeStatement' {} Text
a -> DescribeStatement
s {$sel:id:DescribeStatement' :: Text
id = Text
a} :: DescribeStatement)

instance Core.AWSRequest DescribeStatement where
  type
    AWSResponse DescribeStatement =
      DescribeStatementResponse
  request :: DescribeStatement -> Request DescribeStatement
request = Service -> DescribeStatement -> Request DescribeStatement
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeStatement
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeStatement)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeStatement))
-> Logger
-> Service
-> Proxy DescribeStatement
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeStatement)))
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 StatusString
-> Maybe Integer
-> Maybe Integer
-> Maybe Text
-> Maybe [SubStatementData]
-> Maybe Text
-> Maybe POSIX
-> Maybe (NonEmpty SqlParameter)
-> Maybe Text
-> Maybe Integer
-> Maybe Integer
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Integer
-> Int
-> Text
-> DescribeStatementResponse
DescribeStatementResponse'
            (Maybe StatusString
 -> Maybe Integer
 -> Maybe Integer
 -> Maybe Text
 -> Maybe [SubStatementData]
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe (NonEmpty SqlParameter)
 -> Maybe Text
 -> Maybe Integer
 -> Maybe Integer
 -> Maybe Text
 -> Maybe Bool
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Integer
 -> Int
 -> Text
 -> DescribeStatementResponse)
-> Either String (Maybe StatusString)
-> Either
     String
     (Maybe Integer
      -> Maybe Integer
      -> Maybe Text
      -> Maybe [SubStatementData]
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe (NonEmpty SqlParameter)
      -> Maybe Text
      -> Maybe Integer
      -> Maybe Integer
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Integer
      -> Int
      -> Text
      -> DescribeStatementResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe StatusString)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Status")
            Either
  String
  (Maybe Integer
   -> Maybe Integer
   -> Maybe Text
   -> Maybe [SubStatementData]
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe (NonEmpty SqlParameter)
   -> Maybe Text
   -> Maybe Integer
   -> Maybe Integer
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Integer
   -> Int
   -> Text
   -> DescribeStatementResponse)
-> Either String (Maybe Integer)
-> Either
     String
     (Maybe Integer
      -> Maybe Text
      -> Maybe [SubStatementData]
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe (NonEmpty SqlParameter)
      -> Maybe Text
      -> Maybe Integer
      -> Maybe Integer
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Integer
      -> Int
      -> Text
      -> DescribeStatementResponse)
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
"RedshiftQueryId")
            Either
  String
  (Maybe Integer
   -> Maybe Text
   -> Maybe [SubStatementData]
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe (NonEmpty SqlParameter)
   -> Maybe Text
   -> Maybe Integer
   -> Maybe Integer
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Integer
   -> Int
   -> Text
   -> DescribeStatementResponse)
-> Either String (Maybe Integer)
-> Either
     String
     (Maybe Text
      -> Maybe [SubStatementData]
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe (NonEmpty SqlParameter)
      -> Maybe Text
      -> Maybe Integer
      -> Maybe Integer
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Integer
      -> Int
      -> Text
      -> DescribeStatementResponse)
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
"ResultSize")
            Either
  String
  (Maybe Text
   -> Maybe [SubStatementData]
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe (NonEmpty SqlParameter)
   -> Maybe Text
   -> Maybe Integer
   -> Maybe Integer
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Integer
   -> Int
   -> Text
   -> DescribeStatementResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [SubStatementData]
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe (NonEmpty SqlParameter)
      -> Maybe Text
      -> Maybe Integer
      -> Maybe Integer
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Integer
      -> Int
      -> Text
      -> DescribeStatementResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"DbUser")
            Either
  String
  (Maybe [SubStatementData]
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe (NonEmpty SqlParameter)
   -> Maybe Text
   -> Maybe Integer
   -> Maybe Integer
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Integer
   -> Int
   -> Text
   -> DescribeStatementResponse)
-> Either String (Maybe [SubStatementData])
-> Either
     String
     (Maybe Text
      -> Maybe POSIX
      -> Maybe (NonEmpty SqlParameter)
      -> Maybe Text
      -> Maybe Integer
      -> Maybe Integer
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Integer
      -> Int
      -> Text
      -> DescribeStatementResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [SubStatementData]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"SubStatements" Either String (Maybe (Maybe [SubStatementData]))
-> Maybe [SubStatementData]
-> Either String (Maybe [SubStatementData])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [SubStatementData]
forall a. Monoid a => a
Prelude.mempty)
            Either
  String
  (Maybe Text
   -> Maybe POSIX
   -> Maybe (NonEmpty SqlParameter)
   -> Maybe Text
   -> Maybe Integer
   -> Maybe Integer
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Integer
   -> Int
   -> Text
   -> DescribeStatementResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe POSIX
      -> Maybe (NonEmpty SqlParameter)
      -> Maybe Text
      -> Maybe Integer
      -> Maybe Integer
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Integer
      -> Int
      -> Text
      -> DescribeStatementResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Database")
            Either
  String
  (Maybe POSIX
   -> Maybe (NonEmpty SqlParameter)
   -> Maybe Text
   -> Maybe Integer
   -> Maybe Integer
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Integer
   -> Int
   -> Text
   -> DescribeStatementResponse)
-> Either String (Maybe POSIX)
-> Either
     String
     (Maybe (NonEmpty SqlParameter)
      -> Maybe Text
      -> Maybe Integer
      -> Maybe Integer
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Integer
      -> Int
      -> Text
      -> DescribeStatementResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"CreatedAt")
            Either
  String
  (Maybe (NonEmpty SqlParameter)
   -> Maybe Text
   -> Maybe Integer
   -> Maybe Integer
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Integer
   -> Int
   -> Text
   -> DescribeStatementResponse)
-> Either String (Maybe (NonEmpty SqlParameter))
-> Either
     String
     (Maybe Text
      -> Maybe Integer
      -> Maybe Integer
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Integer
      -> Int
      -> Text
      -> DescribeStatementResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (NonEmpty SqlParameter))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"QueryParameters")
            Either
  String
  (Maybe Text
   -> Maybe Integer
   -> Maybe Integer
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Integer
   -> Int
   -> Text
   -> DescribeStatementResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Integer
      -> Maybe Integer
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Integer
      -> Int
      -> Text
      -> DescribeStatementResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Error")
            Either
  String
  (Maybe Integer
   -> Maybe Integer
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Integer
   -> Int
   -> Text
   -> DescribeStatementResponse)
-> Either String (Maybe Integer)
-> Either
     String
     (Maybe Integer
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Integer
      -> Int
      -> Text
      -> DescribeStatementResponse)
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
"ResultRows")
            Either
  String
  (Maybe Integer
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Integer
   -> Int
   -> Text
   -> DescribeStatementResponse)
-> Either String (Maybe Integer)
-> Either
     String
     (Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Integer
      -> Int
      -> Text
      -> DescribeStatementResponse)
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
"RedshiftPid")
            Either
  String
  (Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Integer
   -> Int
   -> Text
   -> DescribeStatementResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Bool
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Integer
      -> Int
      -> Text
      -> DescribeStatementResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ClusterIdentifier")
            Either
  String
  (Maybe Bool
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Integer
   -> Int
   -> Text
   -> DescribeStatementResponse)
-> Either String (Maybe Bool)
-> Either
     String
     (Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Integer
      -> Int
      -> Text
      -> DescribeStatementResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"HasResultSet")
            Either
  String
  (Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Integer
   -> Int
   -> Text
   -> DescribeStatementResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe POSIX
      -> Maybe Text
      -> Maybe Integer
      -> Int
      -> Text
      -> DescribeStatementResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"QueryString")
            Either
  String
  (Maybe POSIX
   -> Maybe Text
   -> Maybe Integer
   -> Int
   -> Text
   -> DescribeStatementResponse)
-> Either String (Maybe POSIX)
-> Either
     String
     (Maybe Text
      -> Maybe Integer -> Int -> Text -> DescribeStatementResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"UpdatedAt")
            Either
  String
  (Maybe Text
   -> Maybe Integer -> Int -> Text -> DescribeStatementResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe Integer -> Int -> Text -> DescribeStatementResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"SecretArn")
            Either
  String (Maybe Integer -> Int -> Text -> DescribeStatementResponse)
-> Either String (Maybe Integer)
-> Either String (Int -> Text -> DescribeStatementResponse)
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
"Duration")
            Either String (Int -> Text -> DescribeStatementResponse)
-> Either String Int
-> Either String (Text -> DescribeStatementResponse)
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))
            Either String (Text -> DescribeStatementResponse)
-> Either String Text -> Either String DescribeStatementResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"Id")
      )

instance Prelude.Hashable DescribeStatement

instance Prelude.NFData DescribeStatement

instance Core.ToHeaders DescribeStatement where
  toHeaders :: DescribeStatement -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeStatement -> 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
"RedshiftData.DescribeStatement" ::
                          Prelude.ByteString
                      ),
            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 DescribeStatement where
  toJSON :: DescribeStatement -> Value
toJSON DescribeStatement' {Text
id :: Text
$sel:id:DescribeStatement' :: DescribeStatement -> Text
..} =
    [Pair] -> Value
Core.object
      ([Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes [Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Id" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
id)])

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

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

-- | /See:/ 'newDescribeStatementResponse' smart constructor.
data DescribeStatementResponse = DescribeStatementResponse'
  { -- | The status of the SQL statement being described. Status values are
    -- defined as follows:
    --
    -- -   ABORTED - The query run was stopped by the user.
    --
    -- -   ALL - A status value that includes all query statuses. This value
    --     can be used to filter results.
    --
    -- -   FAILED - The query run failed.
    --
    -- -   FINISHED - The query has finished running.
    --
    -- -   PICKED - The query has been chosen to be run.
    --
    -- -   STARTED - The query run has started.
    --
    -- -   SUBMITTED - The query was submitted, but not yet processed.
    DescribeStatementResponse -> Maybe StatusString
status :: Prelude.Maybe StatusString,
    -- | The identifier of the query generated by Amazon Redshift. These
    -- identifiers are also available in the @query@ column of the @STL_QUERY@
    -- system view.
    DescribeStatementResponse -> Maybe Integer
redshiftQueryId :: Prelude.Maybe Prelude.Integer,
    -- | The size in bytes of the returned results. A @-1@ indicates the value is
    -- null.
    DescribeStatementResponse -> Maybe Integer
resultSize :: Prelude.Maybe Prelude.Integer,
    -- | The database user name.
    DescribeStatementResponse -> Maybe Text
dbUser :: Prelude.Maybe Prelude.Text,
    -- | The SQL statements from a multiple statement run.
    DescribeStatementResponse -> Maybe [SubStatementData]
subStatements :: Prelude.Maybe [SubStatementData],
    -- | The name of the database.
    DescribeStatementResponse -> Maybe Text
database :: Prelude.Maybe Prelude.Text,
    -- | The date and time (UTC) when the SQL statement was submitted to run.
    DescribeStatementResponse -> Maybe POSIX
createdAt :: Prelude.Maybe Core.POSIX,
    -- | The parameters for the SQL statement.
    DescribeStatementResponse -> Maybe (NonEmpty SqlParameter)
queryParameters :: Prelude.Maybe (Prelude.NonEmpty SqlParameter),
    -- | The error message from the cluster if the SQL statement encountered an
    -- error while running.
    DescribeStatementResponse -> Maybe Text
error :: Prelude.Maybe Prelude.Text,
    -- | Either the number of rows returned from the SQL statement or the number
    -- of rows affected. If result size is greater than zero, the result rows
    -- can be the number of rows affected by SQL statements such as INSERT,
    -- UPDATE, DELETE, COPY, and others. A @-1@ indicates the value is null.
    DescribeStatementResponse -> Maybe Integer
resultRows :: Prelude.Maybe Prelude.Integer,
    -- | The process identifier from Amazon Redshift.
    DescribeStatementResponse -> Maybe Integer
redshiftPid :: Prelude.Maybe Prelude.Integer,
    -- | The cluster identifier.
    DescribeStatementResponse -> Maybe Text
clusterIdentifier :: Prelude.Maybe Prelude.Text,
    -- | A value that indicates whether the statement has a result set. The
    -- result set can be empty.
    DescribeStatementResponse -> Maybe Bool
hasResultSet :: Prelude.Maybe Prelude.Bool,
    -- | The SQL statement text.
    DescribeStatementResponse -> Maybe Text
queryString :: Prelude.Maybe Prelude.Text,
    -- | The date and time (UTC) that the metadata for the SQL statement was last
    -- updated. An example is the time the status last changed.
    DescribeStatementResponse -> Maybe POSIX
updatedAt :: Prelude.Maybe Core.POSIX,
    -- | The name or Amazon Resource Name (ARN) of the secret that enables access
    -- to the database.
    DescribeStatementResponse -> Maybe Text
secretArn :: Prelude.Maybe Prelude.Text,
    -- | The amount of time in nanoseconds that the statement ran.
    DescribeStatementResponse -> Maybe Integer
duration :: Prelude.Maybe Prelude.Integer,
    -- | The response's http status code.
    DescribeStatementResponse -> Int
httpStatus :: Prelude.Int,
    -- | The identifier of the SQL statement described. This value is a
    -- universally unique identifier (UUID) generated by Amazon Redshift Data
    -- API.
    DescribeStatementResponse -> Text
id :: Prelude.Text
  }
  deriving (DescribeStatementResponse -> DescribeStatementResponse -> Bool
(DescribeStatementResponse -> DescribeStatementResponse -> Bool)
-> (DescribeStatementResponse -> DescribeStatementResponse -> Bool)
-> Eq DescribeStatementResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeStatementResponse -> DescribeStatementResponse -> Bool
$c/= :: DescribeStatementResponse -> DescribeStatementResponse -> Bool
== :: DescribeStatementResponse -> DescribeStatementResponse -> Bool
$c== :: DescribeStatementResponse -> DescribeStatementResponse -> Bool
Prelude.Eq, ReadPrec [DescribeStatementResponse]
ReadPrec DescribeStatementResponse
Int -> ReadS DescribeStatementResponse
ReadS [DescribeStatementResponse]
(Int -> ReadS DescribeStatementResponse)
-> ReadS [DescribeStatementResponse]
-> ReadPrec DescribeStatementResponse
-> ReadPrec [DescribeStatementResponse]
-> Read DescribeStatementResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeStatementResponse]
$creadListPrec :: ReadPrec [DescribeStatementResponse]
readPrec :: ReadPrec DescribeStatementResponse
$creadPrec :: ReadPrec DescribeStatementResponse
readList :: ReadS [DescribeStatementResponse]
$creadList :: ReadS [DescribeStatementResponse]
readsPrec :: Int -> ReadS DescribeStatementResponse
$creadsPrec :: Int -> ReadS DescribeStatementResponse
Prelude.Read, Int -> DescribeStatementResponse -> ShowS
[DescribeStatementResponse] -> ShowS
DescribeStatementResponse -> String
(Int -> DescribeStatementResponse -> ShowS)
-> (DescribeStatementResponse -> String)
-> ([DescribeStatementResponse] -> ShowS)
-> Show DescribeStatementResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeStatementResponse] -> ShowS
$cshowList :: [DescribeStatementResponse] -> ShowS
show :: DescribeStatementResponse -> String
$cshow :: DescribeStatementResponse -> String
showsPrec :: Int -> DescribeStatementResponse -> ShowS
$cshowsPrec :: Int -> DescribeStatementResponse -> ShowS
Prelude.Show, (forall x.
 DescribeStatementResponse -> Rep DescribeStatementResponse x)
-> (forall x.
    Rep DescribeStatementResponse x -> DescribeStatementResponse)
-> Generic DescribeStatementResponse
forall x.
Rep DescribeStatementResponse x -> DescribeStatementResponse
forall x.
DescribeStatementResponse -> Rep DescribeStatementResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeStatementResponse x -> DescribeStatementResponse
$cfrom :: forall x.
DescribeStatementResponse -> Rep DescribeStatementResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeStatementResponse' 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:
--
-- 'status', 'describeStatementResponse_status' - The status of the SQL statement being described. Status values are
-- defined as follows:
--
-- -   ABORTED - The query run was stopped by the user.
--
-- -   ALL - A status value that includes all query statuses. This value
--     can be used to filter results.
--
-- -   FAILED - The query run failed.
--
-- -   FINISHED - The query has finished running.
--
-- -   PICKED - The query has been chosen to be run.
--
-- -   STARTED - The query run has started.
--
-- -   SUBMITTED - The query was submitted, but not yet processed.
--
-- 'redshiftQueryId', 'describeStatementResponse_redshiftQueryId' - The identifier of the query generated by Amazon Redshift. These
-- identifiers are also available in the @query@ column of the @STL_QUERY@
-- system view.
--
-- 'resultSize', 'describeStatementResponse_resultSize' - The size in bytes of the returned results. A @-1@ indicates the value is
-- null.
--
-- 'dbUser', 'describeStatementResponse_dbUser' - The database user name.
--
-- 'subStatements', 'describeStatementResponse_subStatements' - The SQL statements from a multiple statement run.
--
-- 'database', 'describeStatementResponse_database' - The name of the database.
--
-- 'createdAt', 'describeStatementResponse_createdAt' - The date and time (UTC) when the SQL statement was submitted to run.
--
-- 'queryParameters', 'describeStatementResponse_queryParameters' - The parameters for the SQL statement.
--
-- 'error', 'describeStatementResponse_error' - The error message from the cluster if the SQL statement encountered an
-- error while running.
--
-- 'resultRows', 'describeStatementResponse_resultRows' - Either the number of rows returned from the SQL statement or the number
-- of rows affected. If result size is greater than zero, the result rows
-- can be the number of rows affected by SQL statements such as INSERT,
-- UPDATE, DELETE, COPY, and others. A @-1@ indicates the value is null.
--
-- 'redshiftPid', 'describeStatementResponse_redshiftPid' - The process identifier from Amazon Redshift.
--
-- 'clusterIdentifier', 'describeStatementResponse_clusterIdentifier' - The cluster identifier.
--
-- 'hasResultSet', 'describeStatementResponse_hasResultSet' - A value that indicates whether the statement has a result set. The
-- result set can be empty.
--
-- 'queryString', 'describeStatementResponse_queryString' - The SQL statement text.
--
-- 'updatedAt', 'describeStatementResponse_updatedAt' - The date and time (UTC) that the metadata for the SQL statement was last
-- updated. An example is the time the status last changed.
--
-- 'secretArn', 'describeStatementResponse_secretArn' - The name or Amazon Resource Name (ARN) of the secret that enables access
-- to the database.
--
-- 'duration', 'describeStatementResponse_duration' - The amount of time in nanoseconds that the statement ran.
--
-- 'httpStatus', 'describeStatementResponse_httpStatus' - The response's http status code.
--
-- 'id', 'describeStatementResponse_id' - The identifier of the SQL statement described. This value is a
-- universally unique identifier (UUID) generated by Amazon Redshift Data
-- API.
newDescribeStatementResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'id'
  Prelude.Text ->
  DescribeStatementResponse
newDescribeStatementResponse :: Int -> Text -> DescribeStatementResponse
newDescribeStatementResponse Int
pHttpStatus_ Text
pId_ =
  DescribeStatementResponse' :: Maybe StatusString
-> Maybe Integer
-> Maybe Integer
-> Maybe Text
-> Maybe [SubStatementData]
-> Maybe Text
-> Maybe POSIX
-> Maybe (NonEmpty SqlParameter)
-> Maybe Text
-> Maybe Integer
-> Maybe Integer
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Integer
-> Int
-> Text
-> DescribeStatementResponse
DescribeStatementResponse'
    { $sel:status:DescribeStatementResponse' :: Maybe StatusString
status =
        Maybe StatusString
forall a. Maybe a
Prelude.Nothing,
      $sel:redshiftQueryId:DescribeStatementResponse' :: Maybe Integer
redshiftQueryId = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:resultSize:DescribeStatementResponse' :: Maybe Integer
resultSize = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:dbUser:DescribeStatementResponse' :: Maybe Text
dbUser = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:subStatements:DescribeStatementResponse' :: Maybe [SubStatementData]
subStatements = Maybe [SubStatementData]
forall a. Maybe a
Prelude.Nothing,
      $sel:database:DescribeStatementResponse' :: Maybe Text
database = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:createdAt:DescribeStatementResponse' :: Maybe POSIX
createdAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:queryParameters:DescribeStatementResponse' :: Maybe (NonEmpty SqlParameter)
queryParameters = Maybe (NonEmpty SqlParameter)
forall a. Maybe a
Prelude.Nothing,
      $sel:error:DescribeStatementResponse' :: Maybe Text
error = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:resultRows:DescribeStatementResponse' :: Maybe Integer
resultRows = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:redshiftPid:DescribeStatementResponse' :: Maybe Integer
redshiftPid = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:clusterIdentifier:DescribeStatementResponse' :: Maybe Text
clusterIdentifier = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:hasResultSet:DescribeStatementResponse' :: Maybe Bool
hasResultSet = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:queryString:DescribeStatementResponse' :: Maybe Text
queryString = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:updatedAt:DescribeStatementResponse' :: Maybe POSIX
updatedAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:secretArn:DescribeStatementResponse' :: Maybe Text
secretArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:duration:DescribeStatementResponse' :: Maybe Integer
duration = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeStatementResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:id:DescribeStatementResponse' :: Text
id = Text
pId_
    }

-- | The status of the SQL statement being described. Status values are
-- defined as follows:
--
-- -   ABORTED - The query run was stopped by the user.
--
-- -   ALL - A status value that includes all query statuses. This value
--     can be used to filter results.
--
-- -   FAILED - The query run failed.
--
-- -   FINISHED - The query has finished running.
--
-- -   PICKED - The query has been chosen to be run.
--
-- -   STARTED - The query run has started.
--
-- -   SUBMITTED - The query was submitted, but not yet processed.
describeStatementResponse_status :: Lens.Lens' DescribeStatementResponse (Prelude.Maybe StatusString)
describeStatementResponse_status :: (Maybe StatusString -> f (Maybe StatusString))
-> DescribeStatementResponse -> f DescribeStatementResponse
describeStatementResponse_status = (DescribeStatementResponse -> Maybe StatusString)
-> (DescribeStatementResponse
    -> Maybe StatusString -> DescribeStatementResponse)
-> Lens
     DescribeStatementResponse
     DescribeStatementResponse
     (Maybe StatusString)
     (Maybe StatusString)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeStatementResponse' {Maybe StatusString
status :: Maybe StatusString
$sel:status:DescribeStatementResponse' :: DescribeStatementResponse -> Maybe StatusString
status} -> Maybe StatusString
status) (\s :: DescribeStatementResponse
s@DescribeStatementResponse' {} Maybe StatusString
a -> DescribeStatementResponse
s {$sel:status:DescribeStatementResponse' :: Maybe StatusString
status = Maybe StatusString
a} :: DescribeStatementResponse)

-- | The identifier of the query generated by Amazon Redshift. These
-- identifiers are also available in the @query@ column of the @STL_QUERY@
-- system view.
describeStatementResponse_redshiftQueryId :: Lens.Lens' DescribeStatementResponse (Prelude.Maybe Prelude.Integer)
describeStatementResponse_redshiftQueryId :: (Maybe Integer -> f (Maybe Integer))
-> DescribeStatementResponse -> f DescribeStatementResponse
describeStatementResponse_redshiftQueryId = (DescribeStatementResponse -> Maybe Integer)
-> (DescribeStatementResponse
    -> Maybe Integer -> DescribeStatementResponse)
-> Lens
     DescribeStatementResponse
     DescribeStatementResponse
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeStatementResponse' {Maybe Integer
redshiftQueryId :: Maybe Integer
$sel:redshiftQueryId:DescribeStatementResponse' :: DescribeStatementResponse -> Maybe Integer
redshiftQueryId} -> Maybe Integer
redshiftQueryId) (\s :: DescribeStatementResponse
s@DescribeStatementResponse' {} Maybe Integer
a -> DescribeStatementResponse
s {$sel:redshiftQueryId:DescribeStatementResponse' :: Maybe Integer
redshiftQueryId = Maybe Integer
a} :: DescribeStatementResponse)

-- | The size in bytes of the returned results. A @-1@ indicates the value is
-- null.
describeStatementResponse_resultSize :: Lens.Lens' DescribeStatementResponse (Prelude.Maybe Prelude.Integer)
describeStatementResponse_resultSize :: (Maybe Integer -> f (Maybe Integer))
-> DescribeStatementResponse -> f DescribeStatementResponse
describeStatementResponse_resultSize = (DescribeStatementResponse -> Maybe Integer)
-> (DescribeStatementResponse
    -> Maybe Integer -> DescribeStatementResponse)
-> Lens
     DescribeStatementResponse
     DescribeStatementResponse
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeStatementResponse' {Maybe Integer
resultSize :: Maybe Integer
$sel:resultSize:DescribeStatementResponse' :: DescribeStatementResponse -> Maybe Integer
resultSize} -> Maybe Integer
resultSize) (\s :: DescribeStatementResponse
s@DescribeStatementResponse' {} Maybe Integer
a -> DescribeStatementResponse
s {$sel:resultSize:DescribeStatementResponse' :: Maybe Integer
resultSize = Maybe Integer
a} :: DescribeStatementResponse)

-- | The database user name.
describeStatementResponse_dbUser :: Lens.Lens' DescribeStatementResponse (Prelude.Maybe Prelude.Text)
describeStatementResponse_dbUser :: (Maybe Text -> f (Maybe Text))
-> DescribeStatementResponse -> f DescribeStatementResponse
describeStatementResponse_dbUser = (DescribeStatementResponse -> Maybe Text)
-> (DescribeStatementResponse
    -> Maybe Text -> DescribeStatementResponse)
-> Lens
     DescribeStatementResponse
     DescribeStatementResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeStatementResponse' {Maybe Text
dbUser :: Maybe Text
$sel:dbUser:DescribeStatementResponse' :: DescribeStatementResponse -> Maybe Text
dbUser} -> Maybe Text
dbUser) (\s :: DescribeStatementResponse
s@DescribeStatementResponse' {} Maybe Text
a -> DescribeStatementResponse
s {$sel:dbUser:DescribeStatementResponse' :: Maybe Text
dbUser = Maybe Text
a} :: DescribeStatementResponse)

-- | The SQL statements from a multiple statement run.
describeStatementResponse_subStatements :: Lens.Lens' DescribeStatementResponse (Prelude.Maybe [SubStatementData])
describeStatementResponse_subStatements :: (Maybe [SubStatementData] -> f (Maybe [SubStatementData]))
-> DescribeStatementResponse -> f DescribeStatementResponse
describeStatementResponse_subStatements = (DescribeStatementResponse -> Maybe [SubStatementData])
-> (DescribeStatementResponse
    -> Maybe [SubStatementData] -> DescribeStatementResponse)
-> Lens
     DescribeStatementResponse
     DescribeStatementResponse
     (Maybe [SubStatementData])
     (Maybe [SubStatementData])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeStatementResponse' {Maybe [SubStatementData]
subStatements :: Maybe [SubStatementData]
$sel:subStatements:DescribeStatementResponse' :: DescribeStatementResponse -> Maybe [SubStatementData]
subStatements} -> Maybe [SubStatementData]
subStatements) (\s :: DescribeStatementResponse
s@DescribeStatementResponse' {} Maybe [SubStatementData]
a -> DescribeStatementResponse
s {$sel:subStatements:DescribeStatementResponse' :: Maybe [SubStatementData]
subStatements = Maybe [SubStatementData]
a} :: DescribeStatementResponse) ((Maybe [SubStatementData] -> f (Maybe [SubStatementData]))
 -> DescribeStatementResponse -> f DescribeStatementResponse)
-> ((Maybe [SubStatementData] -> f (Maybe [SubStatementData]))
    -> Maybe [SubStatementData] -> f (Maybe [SubStatementData]))
-> (Maybe [SubStatementData] -> f (Maybe [SubStatementData]))
-> DescribeStatementResponse
-> f DescribeStatementResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [SubStatementData]
  [SubStatementData]
  [SubStatementData]
  [SubStatementData]
-> Iso
     (Maybe [SubStatementData])
     (Maybe [SubStatementData])
     (Maybe [SubStatementData])
     (Maybe [SubStatementData])
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
  [SubStatementData]
  [SubStatementData]
  [SubStatementData]
  [SubStatementData]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

-- | The date and time (UTC) when the SQL statement was submitted to run.
describeStatementResponse_createdAt :: Lens.Lens' DescribeStatementResponse (Prelude.Maybe Prelude.UTCTime)
describeStatementResponse_createdAt :: (Maybe UTCTime -> f (Maybe UTCTime))
-> DescribeStatementResponse -> f DescribeStatementResponse
describeStatementResponse_createdAt = (DescribeStatementResponse -> Maybe POSIX)
-> (DescribeStatementResponse
    -> Maybe POSIX -> DescribeStatementResponse)
-> Lens
     DescribeStatementResponse
     DescribeStatementResponse
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeStatementResponse' {Maybe POSIX
createdAt :: Maybe POSIX
$sel:createdAt:DescribeStatementResponse' :: DescribeStatementResponse -> Maybe POSIX
createdAt} -> Maybe POSIX
createdAt) (\s :: DescribeStatementResponse
s@DescribeStatementResponse' {} Maybe POSIX
a -> DescribeStatementResponse
s {$sel:createdAt:DescribeStatementResponse' :: Maybe POSIX
createdAt = Maybe POSIX
a} :: DescribeStatementResponse) ((Maybe POSIX -> f (Maybe POSIX))
 -> DescribeStatementResponse -> f DescribeStatementResponse)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> DescribeStatementResponse
-> f DescribeStatementResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The parameters for the SQL statement.
describeStatementResponse_queryParameters :: Lens.Lens' DescribeStatementResponse (Prelude.Maybe (Prelude.NonEmpty SqlParameter))
describeStatementResponse_queryParameters :: (Maybe (NonEmpty SqlParameter)
 -> f (Maybe (NonEmpty SqlParameter)))
-> DescribeStatementResponse -> f DescribeStatementResponse
describeStatementResponse_queryParameters = (DescribeStatementResponse -> Maybe (NonEmpty SqlParameter))
-> (DescribeStatementResponse
    -> Maybe (NonEmpty SqlParameter) -> DescribeStatementResponse)
-> Lens
     DescribeStatementResponse
     DescribeStatementResponse
     (Maybe (NonEmpty SqlParameter))
     (Maybe (NonEmpty SqlParameter))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeStatementResponse' {Maybe (NonEmpty SqlParameter)
queryParameters :: Maybe (NonEmpty SqlParameter)
$sel:queryParameters:DescribeStatementResponse' :: DescribeStatementResponse -> Maybe (NonEmpty SqlParameter)
queryParameters} -> Maybe (NonEmpty SqlParameter)
queryParameters) (\s :: DescribeStatementResponse
s@DescribeStatementResponse' {} Maybe (NonEmpty SqlParameter)
a -> DescribeStatementResponse
s {$sel:queryParameters:DescribeStatementResponse' :: Maybe (NonEmpty SqlParameter)
queryParameters = Maybe (NonEmpty SqlParameter)
a} :: DescribeStatementResponse) ((Maybe (NonEmpty SqlParameter)
  -> f (Maybe (NonEmpty SqlParameter)))
 -> DescribeStatementResponse -> f DescribeStatementResponse)
-> ((Maybe (NonEmpty SqlParameter)
     -> f (Maybe (NonEmpty SqlParameter)))
    -> Maybe (NonEmpty SqlParameter)
    -> f (Maybe (NonEmpty SqlParameter)))
-> (Maybe (NonEmpty SqlParameter)
    -> f (Maybe (NonEmpty SqlParameter)))
-> DescribeStatementResponse
-> f DescribeStatementResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty SqlParameter)
  (NonEmpty SqlParameter)
  (NonEmpty SqlParameter)
  (NonEmpty SqlParameter)
-> Iso
     (Maybe (NonEmpty SqlParameter))
     (Maybe (NonEmpty SqlParameter))
     (Maybe (NonEmpty SqlParameter))
     (Maybe (NonEmpty 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
  (NonEmpty SqlParameter)
  (NonEmpty SqlParameter)
  (NonEmpty SqlParameter)
  (NonEmpty SqlParameter)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The error message from the cluster if the SQL statement encountered an
-- error while running.
describeStatementResponse_error :: Lens.Lens' DescribeStatementResponse (Prelude.Maybe Prelude.Text)
describeStatementResponse_error :: (Maybe Text -> f (Maybe Text))
-> DescribeStatementResponse -> f DescribeStatementResponse
describeStatementResponse_error = (DescribeStatementResponse -> Maybe Text)
-> (DescribeStatementResponse
    -> Maybe Text -> DescribeStatementResponse)
-> Lens
     DescribeStatementResponse
     DescribeStatementResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeStatementResponse' {Maybe Text
error :: Maybe Text
$sel:error:DescribeStatementResponse' :: DescribeStatementResponse -> Maybe Text
error} -> Maybe Text
error) (\s :: DescribeStatementResponse
s@DescribeStatementResponse' {} Maybe Text
a -> DescribeStatementResponse
s {$sel:error:DescribeStatementResponse' :: Maybe Text
error = Maybe Text
a} :: DescribeStatementResponse)

-- | Either the number of rows returned from the SQL statement or the number
-- of rows affected. If result size is greater than zero, the result rows
-- can be the number of rows affected by SQL statements such as INSERT,
-- UPDATE, DELETE, COPY, and others. A @-1@ indicates the value is null.
describeStatementResponse_resultRows :: Lens.Lens' DescribeStatementResponse (Prelude.Maybe Prelude.Integer)
describeStatementResponse_resultRows :: (Maybe Integer -> f (Maybe Integer))
-> DescribeStatementResponse -> f DescribeStatementResponse
describeStatementResponse_resultRows = (DescribeStatementResponse -> Maybe Integer)
-> (DescribeStatementResponse
    -> Maybe Integer -> DescribeStatementResponse)
-> Lens
     DescribeStatementResponse
     DescribeStatementResponse
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeStatementResponse' {Maybe Integer
resultRows :: Maybe Integer
$sel:resultRows:DescribeStatementResponse' :: DescribeStatementResponse -> Maybe Integer
resultRows} -> Maybe Integer
resultRows) (\s :: DescribeStatementResponse
s@DescribeStatementResponse' {} Maybe Integer
a -> DescribeStatementResponse
s {$sel:resultRows:DescribeStatementResponse' :: Maybe Integer
resultRows = Maybe Integer
a} :: DescribeStatementResponse)

-- | The process identifier from Amazon Redshift.
describeStatementResponse_redshiftPid :: Lens.Lens' DescribeStatementResponse (Prelude.Maybe Prelude.Integer)
describeStatementResponse_redshiftPid :: (Maybe Integer -> f (Maybe Integer))
-> DescribeStatementResponse -> f DescribeStatementResponse
describeStatementResponse_redshiftPid = (DescribeStatementResponse -> Maybe Integer)
-> (DescribeStatementResponse
    -> Maybe Integer -> DescribeStatementResponse)
-> Lens
     DescribeStatementResponse
     DescribeStatementResponse
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeStatementResponse' {Maybe Integer
redshiftPid :: Maybe Integer
$sel:redshiftPid:DescribeStatementResponse' :: DescribeStatementResponse -> Maybe Integer
redshiftPid} -> Maybe Integer
redshiftPid) (\s :: DescribeStatementResponse
s@DescribeStatementResponse' {} Maybe Integer
a -> DescribeStatementResponse
s {$sel:redshiftPid:DescribeStatementResponse' :: Maybe Integer
redshiftPid = Maybe Integer
a} :: DescribeStatementResponse)

-- | The cluster identifier.
describeStatementResponse_clusterIdentifier :: Lens.Lens' DescribeStatementResponse (Prelude.Maybe Prelude.Text)
describeStatementResponse_clusterIdentifier :: (Maybe Text -> f (Maybe Text))
-> DescribeStatementResponse -> f DescribeStatementResponse
describeStatementResponse_clusterIdentifier = (DescribeStatementResponse -> Maybe Text)
-> (DescribeStatementResponse
    -> Maybe Text -> DescribeStatementResponse)
-> Lens
     DescribeStatementResponse
     DescribeStatementResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeStatementResponse' {Maybe Text
clusterIdentifier :: Maybe Text
$sel:clusterIdentifier:DescribeStatementResponse' :: DescribeStatementResponse -> Maybe Text
clusterIdentifier} -> Maybe Text
clusterIdentifier) (\s :: DescribeStatementResponse
s@DescribeStatementResponse' {} Maybe Text
a -> DescribeStatementResponse
s {$sel:clusterIdentifier:DescribeStatementResponse' :: Maybe Text
clusterIdentifier = Maybe Text
a} :: DescribeStatementResponse)

-- | A value that indicates whether the statement has a result set. The
-- result set can be empty.
describeStatementResponse_hasResultSet :: Lens.Lens' DescribeStatementResponse (Prelude.Maybe Prelude.Bool)
describeStatementResponse_hasResultSet :: (Maybe Bool -> f (Maybe Bool))
-> DescribeStatementResponse -> f DescribeStatementResponse
describeStatementResponse_hasResultSet = (DescribeStatementResponse -> Maybe Bool)
-> (DescribeStatementResponse
    -> Maybe Bool -> DescribeStatementResponse)
-> Lens
     DescribeStatementResponse
     DescribeStatementResponse
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeStatementResponse' {Maybe Bool
hasResultSet :: Maybe Bool
$sel:hasResultSet:DescribeStatementResponse' :: DescribeStatementResponse -> Maybe Bool
hasResultSet} -> Maybe Bool
hasResultSet) (\s :: DescribeStatementResponse
s@DescribeStatementResponse' {} Maybe Bool
a -> DescribeStatementResponse
s {$sel:hasResultSet:DescribeStatementResponse' :: Maybe Bool
hasResultSet = Maybe Bool
a} :: DescribeStatementResponse)

-- | The SQL statement text.
describeStatementResponse_queryString :: Lens.Lens' DescribeStatementResponse (Prelude.Maybe Prelude.Text)
describeStatementResponse_queryString :: (Maybe Text -> f (Maybe Text))
-> DescribeStatementResponse -> f DescribeStatementResponse
describeStatementResponse_queryString = (DescribeStatementResponse -> Maybe Text)
-> (DescribeStatementResponse
    -> Maybe Text -> DescribeStatementResponse)
-> Lens
     DescribeStatementResponse
     DescribeStatementResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeStatementResponse' {Maybe Text
queryString :: Maybe Text
$sel:queryString:DescribeStatementResponse' :: DescribeStatementResponse -> Maybe Text
queryString} -> Maybe Text
queryString) (\s :: DescribeStatementResponse
s@DescribeStatementResponse' {} Maybe Text
a -> DescribeStatementResponse
s {$sel:queryString:DescribeStatementResponse' :: Maybe Text
queryString = Maybe Text
a} :: DescribeStatementResponse)

-- | The date and time (UTC) that the metadata for the SQL statement was last
-- updated. An example is the time the status last changed.
describeStatementResponse_updatedAt :: Lens.Lens' DescribeStatementResponse (Prelude.Maybe Prelude.UTCTime)
describeStatementResponse_updatedAt :: (Maybe UTCTime -> f (Maybe UTCTime))
-> DescribeStatementResponse -> f DescribeStatementResponse
describeStatementResponse_updatedAt = (DescribeStatementResponse -> Maybe POSIX)
-> (DescribeStatementResponse
    -> Maybe POSIX -> DescribeStatementResponse)
-> Lens
     DescribeStatementResponse
     DescribeStatementResponse
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeStatementResponse' {Maybe POSIX
updatedAt :: Maybe POSIX
$sel:updatedAt:DescribeStatementResponse' :: DescribeStatementResponse -> Maybe POSIX
updatedAt} -> Maybe POSIX
updatedAt) (\s :: DescribeStatementResponse
s@DescribeStatementResponse' {} Maybe POSIX
a -> DescribeStatementResponse
s {$sel:updatedAt:DescribeStatementResponse' :: Maybe POSIX
updatedAt = Maybe POSIX
a} :: DescribeStatementResponse) ((Maybe POSIX -> f (Maybe POSIX))
 -> DescribeStatementResponse -> f DescribeStatementResponse)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> DescribeStatementResponse
-> f DescribeStatementResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The name or Amazon Resource Name (ARN) of the secret that enables access
-- to the database.
describeStatementResponse_secretArn :: Lens.Lens' DescribeStatementResponse (Prelude.Maybe Prelude.Text)
describeStatementResponse_secretArn :: (Maybe Text -> f (Maybe Text))
-> DescribeStatementResponse -> f DescribeStatementResponse
describeStatementResponse_secretArn = (DescribeStatementResponse -> Maybe Text)
-> (DescribeStatementResponse
    -> Maybe Text -> DescribeStatementResponse)
-> Lens
     DescribeStatementResponse
     DescribeStatementResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeStatementResponse' {Maybe Text
secretArn :: Maybe Text
$sel:secretArn:DescribeStatementResponse' :: DescribeStatementResponse -> Maybe Text
secretArn} -> Maybe Text
secretArn) (\s :: DescribeStatementResponse
s@DescribeStatementResponse' {} Maybe Text
a -> DescribeStatementResponse
s {$sel:secretArn:DescribeStatementResponse' :: Maybe Text
secretArn = Maybe Text
a} :: DescribeStatementResponse)

-- | The amount of time in nanoseconds that the statement ran.
describeStatementResponse_duration :: Lens.Lens' DescribeStatementResponse (Prelude.Maybe Prelude.Integer)
describeStatementResponse_duration :: (Maybe Integer -> f (Maybe Integer))
-> DescribeStatementResponse -> f DescribeStatementResponse
describeStatementResponse_duration = (DescribeStatementResponse -> Maybe Integer)
-> (DescribeStatementResponse
    -> Maybe Integer -> DescribeStatementResponse)
-> Lens
     DescribeStatementResponse
     DescribeStatementResponse
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeStatementResponse' {Maybe Integer
duration :: Maybe Integer
$sel:duration:DescribeStatementResponse' :: DescribeStatementResponse -> Maybe Integer
duration} -> Maybe Integer
duration) (\s :: DescribeStatementResponse
s@DescribeStatementResponse' {} Maybe Integer
a -> DescribeStatementResponse
s {$sel:duration:DescribeStatementResponse' :: Maybe Integer
duration = Maybe Integer
a} :: DescribeStatementResponse)

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

-- | The identifier of the SQL statement described. This value is a
-- universally unique identifier (UUID) generated by Amazon Redshift Data
-- API.
describeStatementResponse_id :: Lens.Lens' DescribeStatementResponse Prelude.Text
describeStatementResponse_id :: (Text -> f Text)
-> DescribeStatementResponse -> f DescribeStatementResponse
describeStatementResponse_id = (DescribeStatementResponse -> Text)
-> (DescribeStatementResponse -> Text -> DescribeStatementResponse)
-> Lens
     DescribeStatementResponse DescribeStatementResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeStatementResponse' {Text
id :: Text
$sel:id:DescribeStatementResponse' :: DescribeStatementResponse -> Text
id} -> Text
id) (\s :: DescribeStatementResponse
s@DescribeStatementResponse' {} Text
a -> DescribeStatementResponse
s {$sel:id:DescribeStatementResponse' :: Text
id = Text
a} :: DescribeStatementResponse)

instance Prelude.NFData DescribeStatementResponse