{-# 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.StartQueryExecution
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Runs the SQL query statements contained in the @Query@. Requires you to
-- have access to the workgroup in which the query ran. Running queries
-- against an external catalog requires GetDataCatalog permission to the
-- catalog. For code samples using the Amazon Web Services SDK for Java,
-- see
-- <http://docs.aws.amazon.com/athena/latest/ug/code-samples.html Examples and Code Samples>
-- in the /Amazon Athena User Guide/.
module Amazonka.Athena.StartQueryExecution
  ( -- * Creating a Request
    StartQueryExecution (..),
    newStartQueryExecution,

    -- * Request Lenses
    startQueryExecution_queryExecutionContext,
    startQueryExecution_resultConfiguration,
    startQueryExecution_clientRequestToken,
    startQueryExecution_workGroup,
    startQueryExecution_queryString,

    -- * Destructuring the Response
    StartQueryExecutionResponse (..),
    newStartQueryExecutionResponse,

    -- * Response Lenses
    startQueryExecutionResponse_queryExecutionId,
    startQueryExecutionResponse_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:/ 'newStartQueryExecution' smart constructor.
data StartQueryExecution = StartQueryExecution'
  { -- | The database within which the query executes.
    StartQueryExecution -> Maybe QueryExecutionContext
queryExecutionContext :: Prelude.Maybe QueryExecutionContext,
    -- | Specifies information about where and how to save the results of the
    -- query execution. If the query runs in a workgroup, then workgroup\'s
    -- settings may override query settings. This affects the query results
    -- location. The workgroup settings override is specified in
    -- EnforceWorkGroupConfiguration (true\/false) in the
    -- WorkGroupConfiguration. See
    -- WorkGroupConfiguration$EnforceWorkGroupConfiguration.
    StartQueryExecution -> Maybe ResultConfiguration
resultConfiguration :: Prelude.Maybe ResultConfiguration,
    -- | A unique case-sensitive string used to ensure the request to create the
    -- query is idempotent (executes only once). If another
    -- @StartQueryExecution@ request is received, the same response is returned
    -- and another query is not created. If a parameter has changed, for
    -- example, the @QueryString@, an error is returned.
    --
    -- This token is listed as not required because Amazon Web Services SDKs
    -- (for example the Amazon Web Services SDK for Java) auto-generate the
    -- token for users. If you are not using the Amazon Web Services SDK or the
    -- Amazon Web Services CLI, you must provide this token or the action will
    -- fail.
    StartQueryExecution -> Maybe Text
clientRequestToken :: Prelude.Maybe Prelude.Text,
    -- | The name of the workgroup in which the query is being started.
    StartQueryExecution -> Maybe Text
workGroup :: Prelude.Maybe Prelude.Text,
    -- | The SQL query statements to be executed.
    StartQueryExecution -> Text
queryString :: Prelude.Text
  }
  deriving (StartQueryExecution -> StartQueryExecution -> Bool
(StartQueryExecution -> StartQueryExecution -> Bool)
-> (StartQueryExecution -> StartQueryExecution -> Bool)
-> Eq StartQueryExecution
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartQueryExecution -> StartQueryExecution -> Bool
$c/= :: StartQueryExecution -> StartQueryExecution -> Bool
== :: StartQueryExecution -> StartQueryExecution -> Bool
$c== :: StartQueryExecution -> StartQueryExecution -> Bool
Prelude.Eq, ReadPrec [StartQueryExecution]
ReadPrec StartQueryExecution
Int -> ReadS StartQueryExecution
ReadS [StartQueryExecution]
(Int -> ReadS StartQueryExecution)
-> ReadS [StartQueryExecution]
-> ReadPrec StartQueryExecution
-> ReadPrec [StartQueryExecution]
-> Read StartQueryExecution
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartQueryExecution]
$creadListPrec :: ReadPrec [StartQueryExecution]
readPrec :: ReadPrec StartQueryExecution
$creadPrec :: ReadPrec StartQueryExecution
readList :: ReadS [StartQueryExecution]
$creadList :: ReadS [StartQueryExecution]
readsPrec :: Int -> ReadS StartQueryExecution
$creadsPrec :: Int -> ReadS StartQueryExecution
Prelude.Read, Int -> StartQueryExecution -> ShowS
[StartQueryExecution] -> ShowS
StartQueryExecution -> String
(Int -> StartQueryExecution -> ShowS)
-> (StartQueryExecution -> String)
-> ([StartQueryExecution] -> ShowS)
-> Show StartQueryExecution
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartQueryExecution] -> ShowS
$cshowList :: [StartQueryExecution] -> ShowS
show :: StartQueryExecution -> String
$cshow :: StartQueryExecution -> String
showsPrec :: Int -> StartQueryExecution -> ShowS
$cshowsPrec :: Int -> StartQueryExecution -> ShowS
Prelude.Show, (forall x. StartQueryExecution -> Rep StartQueryExecution x)
-> (forall x. Rep StartQueryExecution x -> StartQueryExecution)
-> Generic StartQueryExecution
forall x. Rep StartQueryExecution x -> StartQueryExecution
forall x. StartQueryExecution -> Rep StartQueryExecution x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartQueryExecution x -> StartQueryExecution
$cfrom :: forall x. StartQueryExecution -> Rep StartQueryExecution x
Prelude.Generic)

-- |
-- Create a value of 'StartQueryExecution' 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:
--
-- 'queryExecutionContext', 'startQueryExecution_queryExecutionContext' - The database within which the query executes.
--
-- 'resultConfiguration', 'startQueryExecution_resultConfiguration' - Specifies information about where and how to save the results of the
-- query execution. If the query runs in a workgroup, then workgroup\'s
-- settings may override query settings. This affects the query results
-- location. The workgroup settings override is specified in
-- EnforceWorkGroupConfiguration (true\/false) in the
-- WorkGroupConfiguration. See
-- WorkGroupConfiguration$EnforceWorkGroupConfiguration.
--
-- 'clientRequestToken', 'startQueryExecution_clientRequestToken' - A unique case-sensitive string used to ensure the request to create the
-- query is idempotent (executes only once). If another
-- @StartQueryExecution@ request is received, the same response is returned
-- and another query is not created. If a parameter has changed, for
-- example, the @QueryString@, an error is returned.
--
-- This token is listed as not required because Amazon Web Services SDKs
-- (for example the Amazon Web Services SDK for Java) auto-generate the
-- token for users. If you are not using the Amazon Web Services SDK or the
-- Amazon Web Services CLI, you must provide this token or the action will
-- fail.
--
-- 'workGroup', 'startQueryExecution_workGroup' - The name of the workgroup in which the query is being started.
--
-- 'queryString', 'startQueryExecution_queryString' - The SQL query statements to be executed.
newStartQueryExecution ::
  -- | 'queryString'
  Prelude.Text ->
  StartQueryExecution
newStartQueryExecution :: Text -> StartQueryExecution
newStartQueryExecution Text
pQueryString_ =
  StartQueryExecution' :: Maybe QueryExecutionContext
-> Maybe ResultConfiguration
-> Maybe Text
-> Maybe Text
-> Text
-> StartQueryExecution
StartQueryExecution'
    { $sel:queryExecutionContext:StartQueryExecution' :: Maybe QueryExecutionContext
queryExecutionContext =
        Maybe QueryExecutionContext
forall a. Maybe a
Prelude.Nothing,
      $sel:resultConfiguration:StartQueryExecution' :: Maybe ResultConfiguration
resultConfiguration = Maybe ResultConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:clientRequestToken:StartQueryExecution' :: Maybe Text
clientRequestToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:workGroup:StartQueryExecution' :: Maybe Text
workGroup = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:queryString:StartQueryExecution' :: Text
queryString = Text
pQueryString_
    }

-- | The database within which the query executes.
startQueryExecution_queryExecutionContext :: Lens.Lens' StartQueryExecution (Prelude.Maybe QueryExecutionContext)
startQueryExecution_queryExecutionContext :: (Maybe QueryExecutionContext -> f (Maybe QueryExecutionContext))
-> StartQueryExecution -> f StartQueryExecution
startQueryExecution_queryExecutionContext = (StartQueryExecution -> Maybe QueryExecutionContext)
-> (StartQueryExecution
    -> Maybe QueryExecutionContext -> StartQueryExecution)
-> Lens
     StartQueryExecution
     StartQueryExecution
     (Maybe QueryExecutionContext)
     (Maybe QueryExecutionContext)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartQueryExecution' {Maybe QueryExecutionContext
queryExecutionContext :: Maybe QueryExecutionContext
$sel:queryExecutionContext:StartQueryExecution' :: StartQueryExecution -> Maybe QueryExecutionContext
queryExecutionContext} -> Maybe QueryExecutionContext
queryExecutionContext) (\s :: StartQueryExecution
s@StartQueryExecution' {} Maybe QueryExecutionContext
a -> StartQueryExecution
s {$sel:queryExecutionContext:StartQueryExecution' :: Maybe QueryExecutionContext
queryExecutionContext = Maybe QueryExecutionContext
a} :: StartQueryExecution)

-- | Specifies information about where and how to save the results of the
-- query execution. If the query runs in a workgroup, then workgroup\'s
-- settings may override query settings. This affects the query results
-- location. The workgroup settings override is specified in
-- EnforceWorkGroupConfiguration (true\/false) in the
-- WorkGroupConfiguration. See
-- WorkGroupConfiguration$EnforceWorkGroupConfiguration.
startQueryExecution_resultConfiguration :: Lens.Lens' StartQueryExecution (Prelude.Maybe ResultConfiguration)
startQueryExecution_resultConfiguration :: (Maybe ResultConfiguration -> f (Maybe ResultConfiguration))
-> StartQueryExecution -> f StartQueryExecution
startQueryExecution_resultConfiguration = (StartQueryExecution -> Maybe ResultConfiguration)
-> (StartQueryExecution
    -> Maybe ResultConfiguration -> StartQueryExecution)
-> Lens
     StartQueryExecution
     StartQueryExecution
     (Maybe ResultConfiguration)
     (Maybe ResultConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartQueryExecution' {Maybe ResultConfiguration
resultConfiguration :: Maybe ResultConfiguration
$sel:resultConfiguration:StartQueryExecution' :: StartQueryExecution -> Maybe ResultConfiguration
resultConfiguration} -> Maybe ResultConfiguration
resultConfiguration) (\s :: StartQueryExecution
s@StartQueryExecution' {} Maybe ResultConfiguration
a -> StartQueryExecution
s {$sel:resultConfiguration:StartQueryExecution' :: Maybe ResultConfiguration
resultConfiguration = Maybe ResultConfiguration
a} :: StartQueryExecution)

-- | A unique case-sensitive string used to ensure the request to create the
-- query is idempotent (executes only once). If another
-- @StartQueryExecution@ request is received, the same response is returned
-- and another query is not created. If a parameter has changed, for
-- example, the @QueryString@, an error is returned.
--
-- This token is listed as not required because Amazon Web Services SDKs
-- (for example the Amazon Web Services SDK for Java) auto-generate the
-- token for users. If you are not using the Amazon Web Services SDK or the
-- Amazon Web Services CLI, you must provide this token or the action will
-- fail.
startQueryExecution_clientRequestToken :: Lens.Lens' StartQueryExecution (Prelude.Maybe Prelude.Text)
startQueryExecution_clientRequestToken :: (Maybe Text -> f (Maybe Text))
-> StartQueryExecution -> f StartQueryExecution
startQueryExecution_clientRequestToken = (StartQueryExecution -> Maybe Text)
-> (StartQueryExecution -> Maybe Text -> StartQueryExecution)
-> Lens
     StartQueryExecution StartQueryExecution (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartQueryExecution' {Maybe Text
clientRequestToken :: Maybe Text
$sel:clientRequestToken:StartQueryExecution' :: StartQueryExecution -> Maybe Text
clientRequestToken} -> Maybe Text
clientRequestToken) (\s :: StartQueryExecution
s@StartQueryExecution' {} Maybe Text
a -> StartQueryExecution
s {$sel:clientRequestToken:StartQueryExecution' :: Maybe Text
clientRequestToken = Maybe Text
a} :: StartQueryExecution)

-- | The name of the workgroup in which the query is being started.
startQueryExecution_workGroup :: Lens.Lens' StartQueryExecution (Prelude.Maybe Prelude.Text)
startQueryExecution_workGroup :: (Maybe Text -> f (Maybe Text))
-> StartQueryExecution -> f StartQueryExecution
startQueryExecution_workGroup = (StartQueryExecution -> Maybe Text)
-> (StartQueryExecution -> Maybe Text -> StartQueryExecution)
-> Lens
     StartQueryExecution StartQueryExecution (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartQueryExecution' {Maybe Text
workGroup :: Maybe Text
$sel:workGroup:StartQueryExecution' :: StartQueryExecution -> Maybe Text
workGroup} -> Maybe Text
workGroup) (\s :: StartQueryExecution
s@StartQueryExecution' {} Maybe Text
a -> StartQueryExecution
s {$sel:workGroup:StartQueryExecution' :: Maybe Text
workGroup = Maybe Text
a} :: StartQueryExecution)

-- | The SQL query statements to be executed.
startQueryExecution_queryString :: Lens.Lens' StartQueryExecution Prelude.Text
startQueryExecution_queryString :: (Text -> f Text) -> StartQueryExecution -> f StartQueryExecution
startQueryExecution_queryString = (StartQueryExecution -> Text)
-> (StartQueryExecution -> Text -> StartQueryExecution)
-> Lens StartQueryExecution StartQueryExecution Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartQueryExecution' {Text
queryString :: Text
$sel:queryString:StartQueryExecution' :: StartQueryExecution -> Text
queryString} -> Text
queryString) (\s :: StartQueryExecution
s@StartQueryExecution' {} Text
a -> StartQueryExecution
s {$sel:queryString:StartQueryExecution' :: Text
queryString = Text
a} :: StartQueryExecution)

instance Core.AWSRequest StartQueryExecution where
  type
    AWSResponse StartQueryExecution =
      StartQueryExecutionResponse
  request :: StartQueryExecution -> Request StartQueryExecution
request = Service -> StartQueryExecution -> Request StartQueryExecution
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy StartQueryExecution
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StartQueryExecution)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse StartQueryExecution))
-> Logger
-> Service
-> Proxy StartQueryExecution
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StartQueryExecution)))
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 Text -> Int -> StartQueryExecutionResponse
StartQueryExecutionResponse'
            (Maybe Text -> Int -> StartQueryExecutionResponse)
-> Either String (Maybe Text)
-> Either String (Int -> StartQueryExecutionResponse)
forall (f :: * -> *) a b. Functor 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
"QueryExecutionId")
            Either String (Int -> StartQueryExecutionResponse)
-> Either String Int -> Either String StartQueryExecutionResponse
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 StartQueryExecution

instance Prelude.NFData StartQueryExecution

instance Core.ToHeaders StartQueryExecution where
  toHeaders :: StartQueryExecution -> ResponseHeaders
toHeaders =
    ResponseHeaders -> StartQueryExecution -> 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.StartQueryExecution" ::
                          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 StartQueryExecution where
  toJSON :: StartQueryExecution -> Value
toJSON StartQueryExecution' {Maybe Text
Maybe QueryExecutionContext
Maybe ResultConfiguration
Text
queryString :: Text
workGroup :: Maybe Text
clientRequestToken :: Maybe Text
resultConfiguration :: Maybe ResultConfiguration
queryExecutionContext :: Maybe QueryExecutionContext
$sel:queryString:StartQueryExecution' :: StartQueryExecution -> Text
$sel:workGroup:StartQueryExecution' :: StartQueryExecution -> Maybe Text
$sel:clientRequestToken:StartQueryExecution' :: StartQueryExecution -> Maybe Text
$sel:resultConfiguration:StartQueryExecution' :: StartQueryExecution -> Maybe ResultConfiguration
$sel:queryExecutionContext:StartQueryExecution' :: StartQueryExecution -> Maybe QueryExecutionContext
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"QueryExecutionContext" Text -> QueryExecutionContext -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (QueryExecutionContext -> Pair)
-> Maybe QueryExecutionContext -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe QueryExecutionContext
queryExecutionContext,
            (Text
"ResultConfiguration" Text -> ResultConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ResultConfiguration -> Pair)
-> Maybe ResultConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ResultConfiguration
resultConfiguration,
            (Text
"ClientRequestToken" 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
clientRequestToken,
            (Text
"WorkGroup" 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
workGroup,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"QueryString" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
queryString)
          ]
      )

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

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

-- | /See:/ 'newStartQueryExecutionResponse' smart constructor.
data StartQueryExecutionResponse = StartQueryExecutionResponse'
  { -- | The unique ID of the query that ran as a result of this request.
    StartQueryExecutionResponse -> Maybe Text
queryExecutionId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    StartQueryExecutionResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (StartQueryExecutionResponse -> StartQueryExecutionResponse -> Bool
(StartQueryExecutionResponse
 -> StartQueryExecutionResponse -> Bool)
-> (StartQueryExecutionResponse
    -> StartQueryExecutionResponse -> Bool)
-> Eq StartQueryExecutionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartQueryExecutionResponse -> StartQueryExecutionResponse -> Bool
$c/= :: StartQueryExecutionResponse -> StartQueryExecutionResponse -> Bool
== :: StartQueryExecutionResponse -> StartQueryExecutionResponse -> Bool
$c== :: StartQueryExecutionResponse -> StartQueryExecutionResponse -> Bool
Prelude.Eq, ReadPrec [StartQueryExecutionResponse]
ReadPrec StartQueryExecutionResponse
Int -> ReadS StartQueryExecutionResponse
ReadS [StartQueryExecutionResponse]
(Int -> ReadS StartQueryExecutionResponse)
-> ReadS [StartQueryExecutionResponse]
-> ReadPrec StartQueryExecutionResponse
-> ReadPrec [StartQueryExecutionResponse]
-> Read StartQueryExecutionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartQueryExecutionResponse]
$creadListPrec :: ReadPrec [StartQueryExecutionResponse]
readPrec :: ReadPrec StartQueryExecutionResponse
$creadPrec :: ReadPrec StartQueryExecutionResponse
readList :: ReadS [StartQueryExecutionResponse]
$creadList :: ReadS [StartQueryExecutionResponse]
readsPrec :: Int -> ReadS StartQueryExecutionResponse
$creadsPrec :: Int -> ReadS StartQueryExecutionResponse
Prelude.Read, Int -> StartQueryExecutionResponse -> ShowS
[StartQueryExecutionResponse] -> ShowS
StartQueryExecutionResponse -> String
(Int -> StartQueryExecutionResponse -> ShowS)
-> (StartQueryExecutionResponse -> String)
-> ([StartQueryExecutionResponse] -> ShowS)
-> Show StartQueryExecutionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartQueryExecutionResponse] -> ShowS
$cshowList :: [StartQueryExecutionResponse] -> ShowS
show :: StartQueryExecutionResponse -> String
$cshow :: StartQueryExecutionResponse -> String
showsPrec :: Int -> StartQueryExecutionResponse -> ShowS
$cshowsPrec :: Int -> StartQueryExecutionResponse -> ShowS
Prelude.Show, (forall x.
 StartQueryExecutionResponse -> Rep StartQueryExecutionResponse x)
-> (forall x.
    Rep StartQueryExecutionResponse x -> StartQueryExecutionResponse)
-> Generic StartQueryExecutionResponse
forall x.
Rep StartQueryExecutionResponse x -> StartQueryExecutionResponse
forall x.
StartQueryExecutionResponse -> Rep StartQueryExecutionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartQueryExecutionResponse x -> StartQueryExecutionResponse
$cfrom :: forall x.
StartQueryExecutionResponse -> Rep StartQueryExecutionResponse x
Prelude.Generic)

-- |
-- Create a value of 'StartQueryExecutionResponse' 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:
--
-- 'queryExecutionId', 'startQueryExecutionResponse_queryExecutionId' - The unique ID of the query that ran as a result of this request.
--
-- 'httpStatus', 'startQueryExecutionResponse_httpStatus' - The response's http status code.
newStartQueryExecutionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  StartQueryExecutionResponse
newStartQueryExecutionResponse :: Int -> StartQueryExecutionResponse
newStartQueryExecutionResponse Int
pHttpStatus_ =
  StartQueryExecutionResponse' :: Maybe Text -> Int -> StartQueryExecutionResponse
StartQueryExecutionResponse'
    { $sel:queryExecutionId:StartQueryExecutionResponse' :: Maybe Text
queryExecutionId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:StartQueryExecutionResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The unique ID of the query that ran as a result of this request.
startQueryExecutionResponse_queryExecutionId :: Lens.Lens' StartQueryExecutionResponse (Prelude.Maybe Prelude.Text)
startQueryExecutionResponse_queryExecutionId :: (Maybe Text -> f (Maybe Text))
-> StartQueryExecutionResponse -> f StartQueryExecutionResponse
startQueryExecutionResponse_queryExecutionId = (StartQueryExecutionResponse -> Maybe Text)
-> (StartQueryExecutionResponse
    -> Maybe Text -> StartQueryExecutionResponse)
-> Lens
     StartQueryExecutionResponse
     StartQueryExecutionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartQueryExecutionResponse' {Maybe Text
queryExecutionId :: Maybe Text
$sel:queryExecutionId:StartQueryExecutionResponse' :: StartQueryExecutionResponse -> Maybe Text
queryExecutionId} -> Maybe Text
queryExecutionId) (\s :: StartQueryExecutionResponse
s@StartQueryExecutionResponse' {} Maybe Text
a -> StartQueryExecutionResponse
s {$sel:queryExecutionId:StartQueryExecutionResponse' :: Maybe Text
queryExecutionId = Maybe Text
a} :: StartQueryExecutionResponse)

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

instance Prelude.NFData StartQueryExecutionResponse