{-# 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.Athena.GetQueryResults
-- 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)
--
-- Streams the results of a single query execution specified by
-- @QueryExecutionId@ from the Athena query results location in Amazon S3.
-- For more information, see
-- <https://docs.aws.amazon.com/athena/latest/ug/querying.html Query Results>
-- in the /Amazon Athena User Guide/. This request does not execute the
-- query but returns results. Use StartQueryExecution to run a query.
--
-- To stream query results successfully, the IAM principal with permission
-- to call @GetQueryResults@ also must have permissions to the Amazon S3
-- @GetObject@ action for the Athena query results location.
--
-- IAM principals with permission to the Amazon S3 @GetObject@ action for
-- the query results location are able to retrieve query results from
-- Amazon S3 even if permission to the @GetQueryResults@ action is denied.
-- To restrict user or role access, ensure that Amazon S3 permissions to
-- the Athena query location are denied.
--
-- This operation returns paginated results.
module Amazonka.Athena.GetQueryResults
  ( -- * Creating a Request
    GetQueryResults (..),
    newGetQueryResults,

    -- * Request Lenses
    getQueryResults_nextToken,
    getQueryResults_maxResults,
    getQueryResults_queryExecutionId,

    -- * Destructuring the Response
    GetQueryResultsResponse (..),
    newGetQueryResultsResponse,

    -- * Response Lenses
    getQueryResultsResponse_updateCount,
    getQueryResultsResponse_nextToken,
    getQueryResultsResponse_resultSet,
    getQueryResultsResponse_httpStatus,
  )
where

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

-- | /See:/ 'newGetQueryResults' smart constructor.
data GetQueryResults = GetQueryResults'
  { -- | A token generated by the Athena service that specifies where to continue
    -- pagination if a previous request was truncated. To obtain the next set
    -- of pages, pass in the @NextToken@ from the response object of the
    -- previous page call.
    GetQueryResults -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results (rows) to return in this request.
    GetQueryResults -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The unique ID of the query execution.
    GetQueryResults -> Text
queryExecutionId :: Prelude.Text
  }
  deriving (GetQueryResults -> GetQueryResults -> Bool
(GetQueryResults -> GetQueryResults -> Bool)
-> (GetQueryResults -> GetQueryResults -> Bool)
-> Eq GetQueryResults
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetQueryResults -> GetQueryResults -> Bool
$c/= :: GetQueryResults -> GetQueryResults -> Bool
== :: GetQueryResults -> GetQueryResults -> Bool
$c== :: GetQueryResults -> GetQueryResults -> Bool
Prelude.Eq, ReadPrec [GetQueryResults]
ReadPrec GetQueryResults
Int -> ReadS GetQueryResults
ReadS [GetQueryResults]
(Int -> ReadS GetQueryResults)
-> ReadS [GetQueryResults]
-> ReadPrec GetQueryResults
-> ReadPrec [GetQueryResults]
-> Read GetQueryResults
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetQueryResults]
$creadListPrec :: ReadPrec [GetQueryResults]
readPrec :: ReadPrec GetQueryResults
$creadPrec :: ReadPrec GetQueryResults
readList :: ReadS [GetQueryResults]
$creadList :: ReadS [GetQueryResults]
readsPrec :: Int -> ReadS GetQueryResults
$creadsPrec :: Int -> ReadS GetQueryResults
Prelude.Read, Int -> GetQueryResults -> ShowS
[GetQueryResults] -> ShowS
GetQueryResults -> String
(Int -> GetQueryResults -> ShowS)
-> (GetQueryResults -> String)
-> ([GetQueryResults] -> ShowS)
-> Show GetQueryResults
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetQueryResults] -> ShowS
$cshowList :: [GetQueryResults] -> ShowS
show :: GetQueryResults -> String
$cshow :: GetQueryResults -> String
showsPrec :: Int -> GetQueryResults -> ShowS
$cshowsPrec :: Int -> GetQueryResults -> ShowS
Prelude.Show, (forall x. GetQueryResults -> Rep GetQueryResults x)
-> (forall x. Rep GetQueryResults x -> GetQueryResults)
-> Generic GetQueryResults
forall x. Rep GetQueryResults x -> GetQueryResults
forall x. GetQueryResults -> Rep GetQueryResults x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetQueryResults x -> GetQueryResults
$cfrom :: forall x. GetQueryResults -> Rep GetQueryResults x
Prelude.Generic)

-- |
-- Create a value of 'GetQueryResults' 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', 'getQueryResults_nextToken' - A token generated by the Athena service that specifies where to continue
-- pagination if a previous request was truncated. To obtain the next set
-- of pages, pass in the @NextToken@ from the response object of the
-- previous page call.
--
-- 'maxResults', 'getQueryResults_maxResults' - The maximum number of results (rows) to return in this request.
--
-- 'queryExecutionId', 'getQueryResults_queryExecutionId' - The unique ID of the query execution.
newGetQueryResults ::
  -- | 'queryExecutionId'
  Prelude.Text ->
  GetQueryResults
newGetQueryResults :: Text -> GetQueryResults
newGetQueryResults Text
pQueryExecutionId_ =
  GetQueryResults' :: Maybe Text -> Maybe Natural -> Text -> GetQueryResults
GetQueryResults'
    { $sel:nextToken:GetQueryResults' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:GetQueryResults' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:queryExecutionId:GetQueryResults' :: Text
queryExecutionId = Text
pQueryExecutionId_
    }

-- | A token generated by the Athena service that specifies where to continue
-- pagination if a previous request was truncated. To obtain the next set
-- of pages, pass in the @NextToken@ from the response object of the
-- previous page call.
getQueryResults_nextToken :: Lens.Lens' GetQueryResults (Prelude.Maybe Prelude.Text)
getQueryResults_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetQueryResults -> f GetQueryResults
getQueryResults_nextToken = (GetQueryResults -> Maybe Text)
-> (GetQueryResults -> Maybe Text -> GetQueryResults)
-> Lens GetQueryResults GetQueryResults (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetQueryResults' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetQueryResults' :: GetQueryResults -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetQueryResults
s@GetQueryResults' {} Maybe Text
a -> GetQueryResults
s {$sel:nextToken:GetQueryResults' :: Maybe Text
nextToken = Maybe Text
a} :: GetQueryResults)

-- | The maximum number of results (rows) to return in this request.
getQueryResults_maxResults :: Lens.Lens' GetQueryResults (Prelude.Maybe Prelude.Natural)
getQueryResults_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> GetQueryResults -> f GetQueryResults
getQueryResults_maxResults = (GetQueryResults -> Maybe Natural)
-> (GetQueryResults -> Maybe Natural -> GetQueryResults)
-> Lens
     GetQueryResults GetQueryResults (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetQueryResults' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:GetQueryResults' :: GetQueryResults -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: GetQueryResults
s@GetQueryResults' {} Maybe Natural
a -> GetQueryResults
s {$sel:maxResults:GetQueryResults' :: Maybe Natural
maxResults = Maybe Natural
a} :: GetQueryResults)

-- | The unique ID of the query execution.
getQueryResults_queryExecutionId :: Lens.Lens' GetQueryResults Prelude.Text
getQueryResults_queryExecutionId :: (Text -> f Text) -> GetQueryResults -> f GetQueryResults
getQueryResults_queryExecutionId = (GetQueryResults -> Text)
-> (GetQueryResults -> Text -> GetQueryResults)
-> Lens GetQueryResults GetQueryResults Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetQueryResults' {Text
queryExecutionId :: Text
$sel:queryExecutionId:GetQueryResults' :: GetQueryResults -> Text
queryExecutionId} -> Text
queryExecutionId) (\s :: GetQueryResults
s@GetQueryResults' {} Text
a -> GetQueryResults
s {$sel:queryExecutionId:GetQueryResults' :: Text
queryExecutionId = Text
a} :: GetQueryResults)

instance Core.AWSPager GetQueryResults where
  page :: GetQueryResults
-> AWSResponse GetQueryResults -> Maybe GetQueryResults
page GetQueryResults
rq AWSResponse GetQueryResults
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse GetQueryResults
GetQueryResultsResponse
rs
            GetQueryResultsResponse
-> Getting (First Text) GetQueryResultsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> GetQueryResultsResponse
-> Const (First Text) GetQueryResultsResponse
Lens' GetQueryResultsResponse (Maybe Text)
getQueryResultsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> GetQueryResultsResponse
 -> Const (First Text) GetQueryResultsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) GetQueryResultsResponse 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 GetQueryResults
forall a. Maybe a
Prelude.Nothing
    | Maybe [Row] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse GetQueryResults
GetQueryResultsResponse
rs
            GetQueryResultsResponse
-> Getting (First [Row]) GetQueryResultsResponse [Row]
-> Maybe [Row]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe ResultSet -> Const (First [Row]) (Maybe ResultSet))
-> GetQueryResultsResponse
-> Const (First [Row]) GetQueryResultsResponse
Lens' GetQueryResultsResponse (Maybe ResultSet)
getQueryResultsResponse_resultSet
              ((Maybe ResultSet -> Const (First [Row]) (Maybe ResultSet))
 -> GetQueryResultsResponse
 -> Const (First [Row]) GetQueryResultsResponse)
-> (([Row] -> Const (First [Row]) [Row])
    -> Maybe ResultSet -> Const (First [Row]) (Maybe ResultSet))
-> Getting (First [Row]) GetQueryResultsResponse [Row]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (ResultSet -> Const (First [Row]) ResultSet)
-> Maybe ResultSet -> Const (First [Row]) (Maybe ResultSet)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
              ((ResultSet -> Const (First [Row]) ResultSet)
 -> Maybe ResultSet -> Const (First [Row]) (Maybe ResultSet))
-> (([Row] -> Const (First [Row]) [Row])
    -> ResultSet -> Const (First [Row]) ResultSet)
-> ([Row] -> Const (First [Row]) [Row])
-> Maybe ResultSet
-> Const (First [Row]) (Maybe ResultSet)
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Maybe [Row] -> Const (First [Row]) (Maybe [Row]))
-> ResultSet -> Const (First [Row]) ResultSet
Lens' ResultSet (Maybe [Row])
resultSet_rows
              ((Maybe [Row] -> Const (First [Row]) (Maybe [Row]))
 -> ResultSet -> Const (First [Row]) ResultSet)
-> (([Row] -> Const (First [Row]) [Row])
    -> Maybe [Row] -> Const (First [Row]) (Maybe [Row]))
-> ([Row] -> Const (First [Row]) [Row])
-> ResultSet
-> Const (First [Row]) ResultSet
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Row] -> Const (First [Row]) [Row])
-> Maybe [Row] -> Const (First [Row]) (Maybe [Row])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe GetQueryResults
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      GetQueryResults -> Maybe GetQueryResults
forall a. a -> Maybe a
Prelude.Just (GetQueryResults -> Maybe GetQueryResults)
-> GetQueryResults -> Maybe GetQueryResults
forall a b. (a -> b) -> a -> b
Prelude.$
        GetQueryResults
rq
          GetQueryResults
-> (GetQueryResults -> GetQueryResults) -> GetQueryResults
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> GetQueryResults -> Identity GetQueryResults
Lens GetQueryResults GetQueryResults (Maybe Text) (Maybe Text)
getQueryResults_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> GetQueryResults -> Identity GetQueryResults)
-> Maybe Text -> GetQueryResults -> GetQueryResults
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse GetQueryResults
GetQueryResultsResponse
rs
          GetQueryResultsResponse
-> Getting (First Text) GetQueryResultsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> GetQueryResultsResponse
-> Const (First Text) GetQueryResultsResponse
Lens' GetQueryResultsResponse (Maybe Text)
getQueryResultsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> GetQueryResultsResponse
 -> Const (First Text) GetQueryResultsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) GetQueryResultsResponse 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 GetQueryResults where
  type
    AWSResponse GetQueryResults =
      GetQueryResultsResponse
  request :: GetQueryResults -> Request GetQueryResults
request = Service -> GetQueryResults -> Request GetQueryResults
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetQueryResults
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetQueryResults)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetQueryResults))
-> Logger
-> Service
-> Proxy GetQueryResults
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetQueryResults)))
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 ResultSet -> Int -> GetQueryResultsResponse
GetQueryResultsResponse'
            (Maybe Integer
 -> Maybe Text -> Maybe ResultSet -> Int -> GetQueryResultsResponse)
-> Either String (Maybe Integer)
-> Either
     String
     (Maybe Text -> Maybe ResultSet -> Int -> GetQueryResultsResponse)
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
"UpdateCount")
            Either
  String
  (Maybe Text -> Maybe ResultSet -> Int -> GetQueryResultsResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe ResultSet -> Int -> GetQueryResultsResponse)
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 ResultSet -> Int -> GetQueryResultsResponse)
-> Either String (Maybe ResultSet)
-> Either String (Int -> GetQueryResultsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe ResultSet)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ResultSet")
            Either String (Int -> GetQueryResultsResponse)
-> Either String Int -> Either String GetQueryResultsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable GetQueryResults

instance Prelude.NFData GetQueryResults

instance Core.ToHeaders GetQueryResults where
  toHeaders :: GetQueryResults -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetQueryResults -> 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
"AmazonAthena.GetQueryResults" ::
                          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 GetQueryResults where
  toJSON :: GetQueryResults -> Value
toJSON GetQueryResults' {Maybe Natural
Maybe Text
Text
queryExecutionId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:queryExecutionId:GetQueryResults' :: GetQueryResults -> Text
$sel:maxResults:GetQueryResults' :: GetQueryResults -> Maybe Natural
$sel:nextToken:GetQueryResults' :: GetQueryResults -> 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,
            (Text
"MaxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"QueryExecutionId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
queryExecutionId)
          ]
      )

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

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

-- | /See:/ 'newGetQueryResultsResponse' smart constructor.
data GetQueryResultsResponse = GetQueryResultsResponse'
  { -- | The number of rows inserted with a @CREATE TABLE AS SELECT@ statement.
    GetQueryResultsResponse -> Maybe Integer
updateCount :: Prelude.Maybe Prelude.Integer,
    -- | A token generated by the Athena service that specifies where to continue
    -- pagination if a previous request was truncated. To obtain the next set
    -- of pages, pass in the @NextToken@ from the response object of the
    -- previous page call.
    GetQueryResultsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The results of the query execution.
    GetQueryResultsResponse -> Maybe ResultSet
resultSet :: Prelude.Maybe ResultSet,
    -- | The response's http status code.
    GetQueryResultsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetQueryResultsResponse -> GetQueryResultsResponse -> Bool
(GetQueryResultsResponse -> GetQueryResultsResponse -> Bool)
-> (GetQueryResultsResponse -> GetQueryResultsResponse -> Bool)
-> Eq GetQueryResultsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetQueryResultsResponse -> GetQueryResultsResponse -> Bool
$c/= :: GetQueryResultsResponse -> GetQueryResultsResponse -> Bool
== :: GetQueryResultsResponse -> GetQueryResultsResponse -> Bool
$c== :: GetQueryResultsResponse -> GetQueryResultsResponse -> Bool
Prelude.Eq, ReadPrec [GetQueryResultsResponse]
ReadPrec GetQueryResultsResponse
Int -> ReadS GetQueryResultsResponse
ReadS [GetQueryResultsResponse]
(Int -> ReadS GetQueryResultsResponse)
-> ReadS [GetQueryResultsResponse]
-> ReadPrec GetQueryResultsResponse
-> ReadPrec [GetQueryResultsResponse]
-> Read GetQueryResultsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetQueryResultsResponse]
$creadListPrec :: ReadPrec [GetQueryResultsResponse]
readPrec :: ReadPrec GetQueryResultsResponse
$creadPrec :: ReadPrec GetQueryResultsResponse
readList :: ReadS [GetQueryResultsResponse]
$creadList :: ReadS [GetQueryResultsResponse]
readsPrec :: Int -> ReadS GetQueryResultsResponse
$creadsPrec :: Int -> ReadS GetQueryResultsResponse
Prelude.Read, Int -> GetQueryResultsResponse -> ShowS
[GetQueryResultsResponse] -> ShowS
GetQueryResultsResponse -> String
(Int -> GetQueryResultsResponse -> ShowS)
-> (GetQueryResultsResponse -> String)
-> ([GetQueryResultsResponse] -> ShowS)
-> Show GetQueryResultsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetQueryResultsResponse] -> ShowS
$cshowList :: [GetQueryResultsResponse] -> ShowS
show :: GetQueryResultsResponse -> String
$cshow :: GetQueryResultsResponse -> String
showsPrec :: Int -> GetQueryResultsResponse -> ShowS
$cshowsPrec :: Int -> GetQueryResultsResponse -> ShowS
Prelude.Show, (forall x.
 GetQueryResultsResponse -> Rep GetQueryResultsResponse x)
-> (forall x.
    Rep GetQueryResultsResponse x -> GetQueryResultsResponse)
-> Generic GetQueryResultsResponse
forall x. Rep GetQueryResultsResponse x -> GetQueryResultsResponse
forall x. GetQueryResultsResponse -> Rep GetQueryResultsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetQueryResultsResponse x -> GetQueryResultsResponse
$cfrom :: forall x. GetQueryResultsResponse -> Rep GetQueryResultsResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetQueryResultsResponse' 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:
--
-- 'updateCount', 'getQueryResultsResponse_updateCount' - The number of rows inserted with a @CREATE TABLE AS SELECT@ statement.
--
-- 'nextToken', 'getQueryResultsResponse_nextToken' - A token generated by the Athena service that specifies where to continue
-- pagination if a previous request was truncated. To obtain the next set
-- of pages, pass in the @NextToken@ from the response object of the
-- previous page call.
--
-- 'resultSet', 'getQueryResultsResponse_resultSet' - The results of the query execution.
--
-- 'httpStatus', 'getQueryResultsResponse_httpStatus' - The response's http status code.
newGetQueryResultsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetQueryResultsResponse
newGetQueryResultsResponse :: Int -> GetQueryResultsResponse
newGetQueryResultsResponse Int
pHttpStatus_ =
  GetQueryResultsResponse' :: Maybe Integer
-> Maybe Text -> Maybe ResultSet -> Int -> GetQueryResultsResponse
GetQueryResultsResponse'
    { $sel:updateCount:GetQueryResultsResponse' :: Maybe Integer
updateCount =
        Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:GetQueryResultsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:resultSet:GetQueryResultsResponse' :: Maybe ResultSet
resultSet = Maybe ResultSet
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetQueryResultsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The number of rows inserted with a @CREATE TABLE AS SELECT@ statement.
getQueryResultsResponse_updateCount :: Lens.Lens' GetQueryResultsResponse (Prelude.Maybe Prelude.Integer)
getQueryResultsResponse_updateCount :: (Maybe Integer -> f (Maybe Integer))
-> GetQueryResultsResponse -> f GetQueryResultsResponse
getQueryResultsResponse_updateCount = (GetQueryResultsResponse -> Maybe Integer)
-> (GetQueryResultsResponse
    -> Maybe Integer -> GetQueryResultsResponse)
-> Lens
     GetQueryResultsResponse
     GetQueryResultsResponse
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetQueryResultsResponse' {Maybe Integer
updateCount :: Maybe Integer
$sel:updateCount:GetQueryResultsResponse' :: GetQueryResultsResponse -> Maybe Integer
updateCount} -> Maybe Integer
updateCount) (\s :: GetQueryResultsResponse
s@GetQueryResultsResponse' {} Maybe Integer
a -> GetQueryResultsResponse
s {$sel:updateCount:GetQueryResultsResponse' :: Maybe Integer
updateCount = Maybe Integer
a} :: GetQueryResultsResponse)

-- | A token generated by the Athena service that specifies where to continue
-- pagination if a previous request was truncated. To obtain the next set
-- of pages, pass in the @NextToken@ from the response object of the
-- previous page call.
getQueryResultsResponse_nextToken :: Lens.Lens' GetQueryResultsResponse (Prelude.Maybe Prelude.Text)
getQueryResultsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetQueryResultsResponse -> f GetQueryResultsResponse
getQueryResultsResponse_nextToken = (GetQueryResultsResponse -> Maybe Text)
-> (GetQueryResultsResponse
    -> Maybe Text -> GetQueryResultsResponse)
-> Lens' GetQueryResultsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetQueryResultsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetQueryResultsResponse' :: GetQueryResultsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetQueryResultsResponse
s@GetQueryResultsResponse' {} Maybe Text
a -> GetQueryResultsResponse
s {$sel:nextToken:GetQueryResultsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetQueryResultsResponse)

-- | The results of the query execution.
getQueryResultsResponse_resultSet :: Lens.Lens' GetQueryResultsResponse (Prelude.Maybe ResultSet)
getQueryResultsResponse_resultSet :: (Maybe ResultSet -> f (Maybe ResultSet))
-> GetQueryResultsResponse -> f GetQueryResultsResponse
getQueryResultsResponse_resultSet = (GetQueryResultsResponse -> Maybe ResultSet)
-> (GetQueryResultsResponse
    -> Maybe ResultSet -> GetQueryResultsResponse)
-> Lens' GetQueryResultsResponse (Maybe ResultSet)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetQueryResultsResponse' {Maybe ResultSet
resultSet :: Maybe ResultSet
$sel:resultSet:GetQueryResultsResponse' :: GetQueryResultsResponse -> Maybe ResultSet
resultSet} -> Maybe ResultSet
resultSet) (\s :: GetQueryResultsResponse
s@GetQueryResultsResponse' {} Maybe ResultSet
a -> GetQueryResultsResponse
s {$sel:resultSet:GetQueryResultsResponse' :: Maybe ResultSet
resultSet = Maybe ResultSet
a} :: GetQueryResultsResponse)

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

instance Prelude.NFData GetQueryResultsResponse