{-# 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.GetStatementResult
-- 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)
--
-- Fetches the temporarily cached result of an SQL statement. A token is
-- returned to page through the statement results.
--
-- This operation returns paginated results.
module Amazonka.RedshiftData.GetStatementResult
  ( -- * Creating a Request
    GetStatementResult (..),
    newGetStatementResult,

    -- * Request Lenses
    getStatementResult_nextToken,
    getStatementResult_id,

    -- * Destructuring the Response
    GetStatementResultResponse (..),
    newGetStatementResultResponse,

    -- * Response Lenses
    getStatementResultResponse_totalNumRows,
    getStatementResultResponse_nextToken,
    getStatementResultResponse_columnMetadata,
    getStatementResultResponse_httpStatus,
    getStatementResultResponse_records,
  )
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:/ 'newGetStatementResult' smart constructor.
data GetStatementResult = GetStatementResult'
  { -- | A value that indicates the starting point for the next set of response
    -- records in a subsequent request. If a value is returned in a response,
    -- you can retrieve the next set of records by providing this returned
    -- NextToken value in the next NextToken parameter and retrying the
    -- command. If the NextToken field is empty, all response records have been
    -- retrieved for the request.
    GetStatementResult -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The identifier of the SQL statement whose results are to be fetched.
    -- This value is a universally unique identifier (UUID) generated by Amazon
    -- Redshift Data API. A suffix indicates then 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@, @ExecuteStatment@, and
    -- @ListStatements@.
    GetStatementResult -> Text
id :: Prelude.Text
  }
  deriving (GetStatementResult -> GetStatementResult -> Bool
(GetStatementResult -> GetStatementResult -> Bool)
-> (GetStatementResult -> GetStatementResult -> Bool)
-> Eq GetStatementResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetStatementResult -> GetStatementResult -> Bool
$c/= :: GetStatementResult -> GetStatementResult -> Bool
== :: GetStatementResult -> GetStatementResult -> Bool
$c== :: GetStatementResult -> GetStatementResult -> Bool
Prelude.Eq, ReadPrec [GetStatementResult]
ReadPrec GetStatementResult
Int -> ReadS GetStatementResult
ReadS [GetStatementResult]
(Int -> ReadS GetStatementResult)
-> ReadS [GetStatementResult]
-> ReadPrec GetStatementResult
-> ReadPrec [GetStatementResult]
-> Read GetStatementResult
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetStatementResult]
$creadListPrec :: ReadPrec [GetStatementResult]
readPrec :: ReadPrec GetStatementResult
$creadPrec :: ReadPrec GetStatementResult
readList :: ReadS [GetStatementResult]
$creadList :: ReadS [GetStatementResult]
readsPrec :: Int -> ReadS GetStatementResult
$creadsPrec :: Int -> ReadS GetStatementResult
Prelude.Read, Int -> GetStatementResult -> ShowS
[GetStatementResult] -> ShowS
GetStatementResult -> String
(Int -> GetStatementResult -> ShowS)
-> (GetStatementResult -> String)
-> ([GetStatementResult] -> ShowS)
-> Show GetStatementResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetStatementResult] -> ShowS
$cshowList :: [GetStatementResult] -> ShowS
show :: GetStatementResult -> String
$cshow :: GetStatementResult -> String
showsPrec :: Int -> GetStatementResult -> ShowS
$cshowsPrec :: Int -> GetStatementResult -> ShowS
Prelude.Show, (forall x. GetStatementResult -> Rep GetStatementResult x)
-> (forall x. Rep GetStatementResult x -> GetStatementResult)
-> Generic GetStatementResult
forall x. Rep GetStatementResult x -> GetStatementResult
forall x. GetStatementResult -> Rep GetStatementResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetStatementResult x -> GetStatementResult
$cfrom :: forall x. GetStatementResult -> Rep GetStatementResult x
Prelude.Generic)

-- |
-- Create a value of 'GetStatementResult' 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:
--
-- 'nextToken', 'getStatementResult_nextToken' - A value that indicates the starting point for the next set of response
-- records in a subsequent request. If a value is returned in a response,
-- you can retrieve the next set of records by providing this returned
-- NextToken value in the next NextToken parameter and retrying the
-- command. If the NextToken field is empty, all response records have been
-- retrieved for the request.
--
-- 'id', 'getStatementResult_id' - The identifier of the SQL statement whose results are to be fetched.
-- This value is a universally unique identifier (UUID) generated by Amazon
-- Redshift Data API. A suffix indicates then 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@, @ExecuteStatment@, and
-- @ListStatements@.
newGetStatementResult ::
  -- | 'id'
  Prelude.Text ->
  GetStatementResult
newGetStatementResult :: Text -> GetStatementResult
newGetStatementResult Text
pId_ =
  GetStatementResult' :: Maybe Text -> Text -> GetStatementResult
GetStatementResult'
    { $sel:nextToken:GetStatementResult' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:GetStatementResult' :: Text
id = Text
pId_
    }

-- | A value that indicates the starting point for the next set of response
-- records in a subsequent request. If a value is returned in a response,
-- you can retrieve the next set of records by providing this returned
-- NextToken value in the next NextToken parameter and retrying the
-- command. If the NextToken field is empty, all response records have been
-- retrieved for the request.
getStatementResult_nextToken :: Lens.Lens' GetStatementResult (Prelude.Maybe Prelude.Text)
getStatementResult_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetStatementResult -> f GetStatementResult
getStatementResult_nextToken = (GetStatementResult -> Maybe Text)
-> (GetStatementResult -> Maybe Text -> GetStatementResult)
-> Lens
     GetStatementResult GetStatementResult (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStatementResult' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetStatementResult' :: GetStatementResult -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetStatementResult
s@GetStatementResult' {} Maybe Text
a -> GetStatementResult
s {$sel:nextToken:GetStatementResult' :: Maybe Text
nextToken = Maybe Text
a} :: GetStatementResult)

-- | The identifier of the SQL statement whose results are to be fetched.
-- This value is a universally unique identifier (UUID) generated by Amazon
-- Redshift Data API. A suffix indicates then 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@, @ExecuteStatment@, and
-- @ListStatements@.
getStatementResult_id :: Lens.Lens' GetStatementResult Prelude.Text
getStatementResult_id :: (Text -> f Text) -> GetStatementResult -> f GetStatementResult
getStatementResult_id = (GetStatementResult -> Text)
-> (GetStatementResult -> Text -> GetStatementResult)
-> Lens GetStatementResult GetStatementResult Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStatementResult' {Text
id :: Text
$sel:id:GetStatementResult' :: GetStatementResult -> Text
id} -> Text
id) (\s :: GetStatementResult
s@GetStatementResult' {} Text
a -> GetStatementResult
s {$sel:id:GetStatementResult' :: Text
id = Text
a} :: GetStatementResult)

instance Core.AWSPager GetStatementResult where
  page :: GetStatementResult
-> AWSResponse GetStatementResult -> Maybe GetStatementResult
page GetStatementResult
rq AWSResponse GetStatementResult
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse GetStatementResult
GetStatementResultResponse
rs
            GetStatementResultResponse
-> Getting (First Text) GetStatementResultResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> GetStatementResultResponse
-> Const (First Text) GetStatementResultResponse
Lens' GetStatementResultResponse (Maybe Text)
getStatementResultResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> GetStatementResultResponse
 -> Const (First Text) GetStatementResultResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) GetStatementResultResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe GetStatementResult
forall a. Maybe a
Prelude.Nothing
    | [[Field]] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        (AWSResponse GetStatementResult
GetStatementResultResponse
rs GetStatementResultResponse
-> Getting [[Field]] GetStatementResultResponse [[Field]]
-> [[Field]]
forall s a. s -> Getting a s a -> a
Lens.^. Getting [[Field]] GetStatementResultResponse [[Field]]
Lens' GetStatementResultResponse [[Field]]
getStatementResultResponse_records) =
      Maybe GetStatementResult
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      GetStatementResult -> Maybe GetStatementResult
forall a. a -> Maybe a
Prelude.Just (GetStatementResult -> Maybe GetStatementResult)
-> GetStatementResult -> Maybe GetStatementResult
forall a b. (a -> b) -> a -> b
Prelude.$
        GetStatementResult
rq
          GetStatementResult
-> (GetStatementResult -> GetStatementResult) -> GetStatementResult
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> GetStatementResult -> Identity GetStatementResult
Lens
  GetStatementResult GetStatementResult (Maybe Text) (Maybe Text)
getStatementResult_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> GetStatementResult -> Identity GetStatementResult)
-> Maybe Text -> GetStatementResult -> GetStatementResult
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse GetStatementResult
GetStatementResultResponse
rs
          GetStatementResultResponse
-> Getting (First Text) GetStatementResultResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> GetStatementResultResponse
-> Const (First Text) GetStatementResultResponse
Lens' GetStatementResultResponse (Maybe Text)
getStatementResultResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> GetStatementResultResponse
 -> Const (First Text) GetStatementResultResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) GetStatementResultResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

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

instance Prelude.Hashable GetStatementResult

instance Prelude.NFData GetStatementResult

instance Core.ToHeaders GetStatementResult where
  toHeaders :: GetStatementResult -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetStatementResult -> 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.GetStatementResult" ::
                          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 GetStatementResult where
  toJSON :: GetStatementResult -> Value
toJSON GetStatementResult' {Maybe Text
Text
id :: Text
nextToken :: Maybe Text
$sel:id:GetStatementResult' :: GetStatementResult -> Text
$sel:nextToken:GetStatementResult' :: GetStatementResult -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"NextToken" 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
nextToken,
            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 GetStatementResult where
  toPath :: GetStatementResult -> ByteString
toPath = ByteString -> GetStatementResult -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | /See:/ 'newGetStatementResultResponse' smart constructor.
data GetStatementResultResponse = GetStatementResultResponse'
  { -- | The total number of rows in the result set returned from a query. You
    -- can use this number to estimate the number of calls to the
    -- @GetStatementResult@ operation needed to page through the results.
    GetStatementResultResponse -> Maybe Integer
totalNumRows :: Prelude.Maybe Prelude.Integer,
    -- | A value that indicates the starting point for the next set of response
    -- records in a subsequent request. If a value is returned in a response,
    -- you can retrieve the next set of records by providing this returned
    -- NextToken value in the next NextToken parameter and retrying the
    -- command. If the NextToken field is empty, all response records have been
    -- retrieved for the request.
    GetStatementResultResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The properties (metadata) of a column.
    GetStatementResultResponse -> Maybe [ColumnMetadata]
columnMetadata :: Prelude.Maybe [ColumnMetadata],
    -- | The response's http status code.
    GetStatementResultResponse -> Int
httpStatus :: Prelude.Int,
    -- | The results of the SQL statement.
    GetStatementResultResponse -> [[Field]]
records :: [[Field]]
  }
  deriving (GetStatementResultResponse -> GetStatementResultResponse -> Bool
(GetStatementResultResponse -> GetStatementResultResponse -> Bool)
-> (GetStatementResultResponse
    -> GetStatementResultResponse -> Bool)
-> Eq GetStatementResultResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetStatementResultResponse -> GetStatementResultResponse -> Bool
$c/= :: GetStatementResultResponse -> GetStatementResultResponse -> Bool
== :: GetStatementResultResponse -> GetStatementResultResponse -> Bool
$c== :: GetStatementResultResponse -> GetStatementResultResponse -> Bool
Prelude.Eq, ReadPrec [GetStatementResultResponse]
ReadPrec GetStatementResultResponse
Int -> ReadS GetStatementResultResponse
ReadS [GetStatementResultResponse]
(Int -> ReadS GetStatementResultResponse)
-> ReadS [GetStatementResultResponse]
-> ReadPrec GetStatementResultResponse
-> ReadPrec [GetStatementResultResponse]
-> Read GetStatementResultResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetStatementResultResponse]
$creadListPrec :: ReadPrec [GetStatementResultResponse]
readPrec :: ReadPrec GetStatementResultResponse
$creadPrec :: ReadPrec GetStatementResultResponse
readList :: ReadS [GetStatementResultResponse]
$creadList :: ReadS [GetStatementResultResponse]
readsPrec :: Int -> ReadS GetStatementResultResponse
$creadsPrec :: Int -> ReadS GetStatementResultResponse
Prelude.Read, Int -> GetStatementResultResponse -> ShowS
[GetStatementResultResponse] -> ShowS
GetStatementResultResponse -> String
(Int -> GetStatementResultResponse -> ShowS)
-> (GetStatementResultResponse -> String)
-> ([GetStatementResultResponse] -> ShowS)
-> Show GetStatementResultResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetStatementResultResponse] -> ShowS
$cshowList :: [GetStatementResultResponse] -> ShowS
show :: GetStatementResultResponse -> String
$cshow :: GetStatementResultResponse -> String
showsPrec :: Int -> GetStatementResultResponse -> ShowS
$cshowsPrec :: Int -> GetStatementResultResponse -> ShowS
Prelude.Show, (forall x.
 GetStatementResultResponse -> Rep GetStatementResultResponse x)
-> (forall x.
    Rep GetStatementResultResponse x -> GetStatementResultResponse)
-> Generic GetStatementResultResponse
forall x.
Rep GetStatementResultResponse x -> GetStatementResultResponse
forall x.
GetStatementResultResponse -> Rep GetStatementResultResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetStatementResultResponse x -> GetStatementResultResponse
$cfrom :: forall x.
GetStatementResultResponse -> Rep GetStatementResultResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetStatementResultResponse' 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:
--
-- 'totalNumRows', 'getStatementResultResponse_totalNumRows' - The total number of rows in the result set returned from a query. You
-- can use this number to estimate the number of calls to the
-- @GetStatementResult@ operation needed to page through the results.
--
-- 'nextToken', 'getStatementResultResponse_nextToken' - A value that indicates the starting point for the next set of response
-- records in a subsequent request. If a value is returned in a response,
-- you can retrieve the next set of records by providing this returned
-- NextToken value in the next NextToken parameter and retrying the
-- command. If the NextToken field is empty, all response records have been
-- retrieved for the request.
--
-- 'columnMetadata', 'getStatementResultResponse_columnMetadata' - The properties (metadata) of a column.
--
-- 'httpStatus', 'getStatementResultResponse_httpStatus' - The response's http status code.
--
-- 'records', 'getStatementResultResponse_records' - The results of the SQL statement.
newGetStatementResultResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetStatementResultResponse
newGetStatementResultResponse :: Int -> GetStatementResultResponse
newGetStatementResultResponse Int
pHttpStatus_ =
  GetStatementResultResponse' :: Maybe Integer
-> Maybe Text
-> Maybe [ColumnMetadata]
-> Int
-> [[Field]]
-> GetStatementResultResponse
GetStatementResultResponse'
    { $sel:totalNumRows:GetStatementResultResponse' :: Maybe Integer
totalNumRows =
        Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:GetStatementResultResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:columnMetadata:GetStatementResultResponse' :: Maybe [ColumnMetadata]
columnMetadata = Maybe [ColumnMetadata]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetStatementResultResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:records:GetStatementResultResponse' :: [[Field]]
records = [[Field]]
forall a. Monoid a => a
Prelude.mempty
    }

-- | The total number of rows in the result set returned from a query. You
-- can use this number to estimate the number of calls to the
-- @GetStatementResult@ operation needed to page through the results.
getStatementResultResponse_totalNumRows :: Lens.Lens' GetStatementResultResponse (Prelude.Maybe Prelude.Integer)
getStatementResultResponse_totalNumRows :: (Maybe Integer -> f (Maybe Integer))
-> GetStatementResultResponse -> f GetStatementResultResponse
getStatementResultResponse_totalNumRows = (GetStatementResultResponse -> Maybe Integer)
-> (GetStatementResultResponse
    -> Maybe Integer -> GetStatementResultResponse)
-> Lens
     GetStatementResultResponse
     GetStatementResultResponse
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStatementResultResponse' {Maybe Integer
totalNumRows :: Maybe Integer
$sel:totalNumRows:GetStatementResultResponse' :: GetStatementResultResponse -> Maybe Integer
totalNumRows} -> Maybe Integer
totalNumRows) (\s :: GetStatementResultResponse
s@GetStatementResultResponse' {} Maybe Integer
a -> GetStatementResultResponse
s {$sel:totalNumRows:GetStatementResultResponse' :: Maybe Integer
totalNumRows = Maybe Integer
a} :: GetStatementResultResponse)

-- | A value that indicates the starting point for the next set of response
-- records in a subsequent request. If a value is returned in a response,
-- you can retrieve the next set of records by providing this returned
-- NextToken value in the next NextToken parameter and retrying the
-- command. If the NextToken field is empty, all response records have been
-- retrieved for the request.
getStatementResultResponse_nextToken :: Lens.Lens' GetStatementResultResponse (Prelude.Maybe Prelude.Text)
getStatementResultResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetStatementResultResponse -> f GetStatementResultResponse
getStatementResultResponse_nextToken = (GetStatementResultResponse -> Maybe Text)
-> (GetStatementResultResponse
    -> Maybe Text -> GetStatementResultResponse)
-> Lens' GetStatementResultResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStatementResultResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetStatementResultResponse' :: GetStatementResultResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetStatementResultResponse
s@GetStatementResultResponse' {} Maybe Text
a -> GetStatementResultResponse
s {$sel:nextToken:GetStatementResultResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetStatementResultResponse)

-- | The properties (metadata) of a column.
getStatementResultResponse_columnMetadata :: Lens.Lens' GetStatementResultResponse (Prelude.Maybe [ColumnMetadata])
getStatementResultResponse_columnMetadata :: (Maybe [ColumnMetadata] -> f (Maybe [ColumnMetadata]))
-> GetStatementResultResponse -> f GetStatementResultResponse
getStatementResultResponse_columnMetadata = (GetStatementResultResponse -> Maybe [ColumnMetadata])
-> (GetStatementResultResponse
    -> Maybe [ColumnMetadata] -> GetStatementResultResponse)
-> Lens
     GetStatementResultResponse
     GetStatementResultResponse
     (Maybe [ColumnMetadata])
     (Maybe [ColumnMetadata])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStatementResultResponse' {Maybe [ColumnMetadata]
columnMetadata :: Maybe [ColumnMetadata]
$sel:columnMetadata:GetStatementResultResponse' :: GetStatementResultResponse -> Maybe [ColumnMetadata]
columnMetadata} -> Maybe [ColumnMetadata]
columnMetadata) (\s :: GetStatementResultResponse
s@GetStatementResultResponse' {} Maybe [ColumnMetadata]
a -> GetStatementResultResponse
s {$sel:columnMetadata:GetStatementResultResponse' :: Maybe [ColumnMetadata]
columnMetadata = Maybe [ColumnMetadata]
a} :: GetStatementResultResponse) ((Maybe [ColumnMetadata] -> f (Maybe [ColumnMetadata]))
 -> GetStatementResultResponse -> f GetStatementResultResponse)
-> ((Maybe [ColumnMetadata] -> f (Maybe [ColumnMetadata]))
    -> Maybe [ColumnMetadata] -> f (Maybe [ColumnMetadata]))
-> (Maybe [ColumnMetadata] -> f (Maybe [ColumnMetadata]))
-> GetStatementResultResponse
-> f GetStatementResultResponse
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

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

-- | The results of the SQL statement.
getStatementResultResponse_records :: Lens.Lens' GetStatementResultResponse [[Field]]
getStatementResultResponse_records :: ([[Field]] -> f [[Field]])
-> GetStatementResultResponse -> f GetStatementResultResponse
getStatementResultResponse_records = (GetStatementResultResponse -> [[Field]])
-> (GetStatementResultResponse
    -> [[Field]] -> GetStatementResultResponse)
-> Lens' GetStatementResultResponse [[Field]]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStatementResultResponse' {[[Field]]
records :: [[Field]]
$sel:records:GetStatementResultResponse' :: GetStatementResultResponse -> [[Field]]
records} -> [[Field]]
records) (\s :: GetStatementResultResponse
s@GetStatementResultResponse' {} [[Field]]
a -> GetStatementResultResponse
s {$sel:records:GetStatementResultResponse' :: [[Field]]
records = [[Field]]
a} :: GetStatementResultResponse) (([[Field]] -> f [[Field]])
 -> GetStatementResultResponse -> f GetStatementResultResponse)
-> (([[Field]] -> f [[Field]]) -> [[Field]] -> f [[Field]])
-> ([[Field]] -> f [[Field]])
-> GetStatementResultResponse
-> f GetStatementResultResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([[Field]] -> f [[Field]]) -> [[Field]] -> f [[Field]]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.NFData GetStatementResultResponse