{-# 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.CloudWatchLogs.StartQuery
-- 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)
--
-- Schedules a query of a log group using CloudWatch Logs Insights. You
-- specify the log group and time range to query and the query string to
-- use.
--
-- For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax.html CloudWatch Logs Insights Query Syntax>.
--
-- Queries time out after 15 minutes of execution. If your queries are
-- timing out, reduce the time range being searched or partition your query
-- into a number of queries.
module Amazonka.CloudWatchLogs.StartQuery
  ( -- * Creating a Request
    StartQuery (..),
    newStartQuery,

    -- * Request Lenses
    startQuery_logGroupNames,
    startQuery_logGroupName,
    startQuery_limit,
    startQuery_startTime,
    startQuery_endTime,
    startQuery_queryString,

    -- * Destructuring the Response
    StartQueryResponse (..),
    newStartQueryResponse,

    -- * Response Lenses
    startQueryResponse_queryId,
    startQueryResponse_httpStatus,
  )
where

import Amazonka.CloudWatchLogs.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:/ 'newStartQuery' smart constructor.
data StartQuery = StartQuery'
  { -- | The list of log groups to be queried. You can include up to 20 log
    -- groups.
    --
    -- A @StartQuery@ operation must include a @logGroupNames@ or a
    -- @logGroupName@ parameter, but not both.
    StartQuery -> Maybe [Text]
logGroupNames :: Prelude.Maybe [Prelude.Text],
    -- | The log group on which to perform the query.
    --
    -- A @StartQuery@ operation must include a @logGroupNames@ or a
    -- @logGroupName@ parameter, but not both.
    StartQuery -> Maybe Text
logGroupName :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of log events to return in the query. If the query
    -- string uses the @fields@ command, only the specified fields and their
    -- values are returned. The default is 1000.
    StartQuery -> Maybe Natural
limit :: Prelude.Maybe Prelude.Natural,
    -- | The beginning of the time range to query. The range is inclusive, so the
    -- specified start time is included in the query. Specified as epoch time,
    -- the number of seconds since January 1, 1970, 00:00:00 UTC.
    StartQuery -> Natural
startTime :: Prelude.Natural,
    -- | The end of the time range to query. The range is inclusive, so the
    -- specified end time is included in the query. Specified as epoch time,
    -- the number of seconds since January 1, 1970, 00:00:00 UTC.
    StartQuery -> Natural
endTime :: Prelude.Natural,
    -- | The query string to use. For more information, see
    -- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax.html CloudWatch Logs Insights Query Syntax>.
    StartQuery -> Text
queryString :: Prelude.Text
  }
  deriving (StartQuery -> StartQuery -> Bool
(StartQuery -> StartQuery -> Bool)
-> (StartQuery -> StartQuery -> Bool) -> Eq StartQuery
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartQuery -> StartQuery -> Bool
$c/= :: StartQuery -> StartQuery -> Bool
== :: StartQuery -> StartQuery -> Bool
$c== :: StartQuery -> StartQuery -> Bool
Prelude.Eq, ReadPrec [StartQuery]
ReadPrec StartQuery
Int -> ReadS StartQuery
ReadS [StartQuery]
(Int -> ReadS StartQuery)
-> ReadS [StartQuery]
-> ReadPrec StartQuery
-> ReadPrec [StartQuery]
-> Read StartQuery
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartQuery]
$creadListPrec :: ReadPrec [StartQuery]
readPrec :: ReadPrec StartQuery
$creadPrec :: ReadPrec StartQuery
readList :: ReadS [StartQuery]
$creadList :: ReadS [StartQuery]
readsPrec :: Int -> ReadS StartQuery
$creadsPrec :: Int -> ReadS StartQuery
Prelude.Read, Int -> StartQuery -> ShowS
[StartQuery] -> ShowS
StartQuery -> String
(Int -> StartQuery -> ShowS)
-> (StartQuery -> String)
-> ([StartQuery] -> ShowS)
-> Show StartQuery
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartQuery] -> ShowS
$cshowList :: [StartQuery] -> ShowS
show :: StartQuery -> String
$cshow :: StartQuery -> String
showsPrec :: Int -> StartQuery -> ShowS
$cshowsPrec :: Int -> StartQuery -> ShowS
Prelude.Show, (forall x. StartQuery -> Rep StartQuery x)
-> (forall x. Rep StartQuery x -> StartQuery) -> Generic StartQuery
forall x. Rep StartQuery x -> StartQuery
forall x. StartQuery -> Rep StartQuery x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartQuery x -> StartQuery
$cfrom :: forall x. StartQuery -> Rep StartQuery x
Prelude.Generic)

-- |
-- Create a value of 'StartQuery' 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:
--
-- 'logGroupNames', 'startQuery_logGroupNames' - The list of log groups to be queried. You can include up to 20 log
-- groups.
--
-- A @StartQuery@ operation must include a @logGroupNames@ or a
-- @logGroupName@ parameter, but not both.
--
-- 'logGroupName', 'startQuery_logGroupName' - The log group on which to perform the query.
--
-- A @StartQuery@ operation must include a @logGroupNames@ or a
-- @logGroupName@ parameter, but not both.
--
-- 'limit', 'startQuery_limit' - The maximum number of log events to return in the query. If the query
-- string uses the @fields@ command, only the specified fields and their
-- values are returned. The default is 1000.
--
-- 'startTime', 'startQuery_startTime' - The beginning of the time range to query. The range is inclusive, so the
-- specified start time is included in the query. Specified as epoch time,
-- the number of seconds since January 1, 1970, 00:00:00 UTC.
--
-- 'endTime', 'startQuery_endTime' - The end of the time range to query. The range is inclusive, so the
-- specified end time is included in the query. Specified as epoch time,
-- the number of seconds since January 1, 1970, 00:00:00 UTC.
--
-- 'queryString', 'startQuery_queryString' - The query string to use. For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax.html CloudWatch Logs Insights Query Syntax>.
newStartQuery ::
  -- | 'startTime'
  Prelude.Natural ->
  -- | 'endTime'
  Prelude.Natural ->
  -- | 'queryString'
  Prelude.Text ->
  StartQuery
newStartQuery :: Natural -> Natural -> Text -> StartQuery
newStartQuery Natural
pStartTime_ Natural
pEndTime_ Text
pQueryString_ =
  StartQuery' :: Maybe [Text]
-> Maybe Text
-> Maybe Natural
-> Natural
-> Natural
-> Text
-> StartQuery
StartQuery'
    { $sel:logGroupNames:StartQuery' :: Maybe [Text]
logGroupNames = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:logGroupName:StartQuery' :: Maybe Text
logGroupName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:limit:StartQuery' :: Maybe Natural
limit = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:startTime:StartQuery' :: Natural
startTime = Natural
pStartTime_,
      $sel:endTime:StartQuery' :: Natural
endTime = Natural
pEndTime_,
      $sel:queryString:StartQuery' :: Text
queryString = Text
pQueryString_
    }

-- | The list of log groups to be queried. You can include up to 20 log
-- groups.
--
-- A @StartQuery@ operation must include a @logGroupNames@ or a
-- @logGroupName@ parameter, but not both.
startQuery_logGroupNames :: Lens.Lens' StartQuery (Prelude.Maybe [Prelude.Text])
startQuery_logGroupNames :: (Maybe [Text] -> f (Maybe [Text])) -> StartQuery -> f StartQuery
startQuery_logGroupNames = (StartQuery -> Maybe [Text])
-> (StartQuery -> Maybe [Text] -> StartQuery)
-> Lens StartQuery StartQuery (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartQuery' {Maybe [Text]
logGroupNames :: Maybe [Text]
$sel:logGroupNames:StartQuery' :: StartQuery -> Maybe [Text]
logGroupNames} -> Maybe [Text]
logGroupNames) (\s :: StartQuery
s@StartQuery' {} Maybe [Text]
a -> StartQuery
s {$sel:logGroupNames:StartQuery' :: Maybe [Text]
logGroupNames = Maybe [Text]
a} :: StartQuery) ((Maybe [Text] -> f (Maybe [Text])) -> StartQuery -> f StartQuery)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> StartQuery
-> f StartQuery
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The log group on which to perform the query.
--
-- A @StartQuery@ operation must include a @logGroupNames@ or a
-- @logGroupName@ parameter, but not both.
startQuery_logGroupName :: Lens.Lens' StartQuery (Prelude.Maybe Prelude.Text)
startQuery_logGroupName :: (Maybe Text -> f (Maybe Text)) -> StartQuery -> f StartQuery
startQuery_logGroupName = (StartQuery -> Maybe Text)
-> (StartQuery -> Maybe Text -> StartQuery)
-> Lens StartQuery StartQuery (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartQuery' {Maybe Text
logGroupName :: Maybe Text
$sel:logGroupName:StartQuery' :: StartQuery -> Maybe Text
logGroupName} -> Maybe Text
logGroupName) (\s :: StartQuery
s@StartQuery' {} Maybe Text
a -> StartQuery
s {$sel:logGroupName:StartQuery' :: Maybe Text
logGroupName = Maybe Text
a} :: StartQuery)

-- | The maximum number of log events to return in the query. If the query
-- string uses the @fields@ command, only the specified fields and their
-- values are returned. The default is 1000.
startQuery_limit :: Lens.Lens' StartQuery (Prelude.Maybe Prelude.Natural)
startQuery_limit :: (Maybe Natural -> f (Maybe Natural)) -> StartQuery -> f StartQuery
startQuery_limit = (StartQuery -> Maybe Natural)
-> (StartQuery -> Maybe Natural -> StartQuery)
-> Lens StartQuery StartQuery (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartQuery' {Maybe Natural
limit :: Maybe Natural
$sel:limit:StartQuery' :: StartQuery -> Maybe Natural
limit} -> Maybe Natural
limit) (\s :: StartQuery
s@StartQuery' {} Maybe Natural
a -> StartQuery
s {$sel:limit:StartQuery' :: Maybe Natural
limit = Maybe Natural
a} :: StartQuery)

-- | The beginning of the time range to query. The range is inclusive, so the
-- specified start time is included in the query. Specified as epoch time,
-- the number of seconds since January 1, 1970, 00:00:00 UTC.
startQuery_startTime :: Lens.Lens' StartQuery Prelude.Natural
startQuery_startTime :: (Natural -> f Natural) -> StartQuery -> f StartQuery
startQuery_startTime = (StartQuery -> Natural)
-> (StartQuery -> Natural -> StartQuery)
-> Lens StartQuery StartQuery Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartQuery' {Natural
startTime :: Natural
$sel:startTime:StartQuery' :: StartQuery -> Natural
startTime} -> Natural
startTime) (\s :: StartQuery
s@StartQuery' {} Natural
a -> StartQuery
s {$sel:startTime:StartQuery' :: Natural
startTime = Natural
a} :: StartQuery)

-- | The end of the time range to query. The range is inclusive, so the
-- specified end time is included in the query. Specified as epoch time,
-- the number of seconds since January 1, 1970, 00:00:00 UTC.
startQuery_endTime :: Lens.Lens' StartQuery Prelude.Natural
startQuery_endTime :: (Natural -> f Natural) -> StartQuery -> f StartQuery
startQuery_endTime = (StartQuery -> Natural)
-> (StartQuery -> Natural -> StartQuery)
-> Lens StartQuery StartQuery Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartQuery' {Natural
endTime :: Natural
$sel:endTime:StartQuery' :: StartQuery -> Natural
endTime} -> Natural
endTime) (\s :: StartQuery
s@StartQuery' {} Natural
a -> StartQuery
s {$sel:endTime:StartQuery' :: Natural
endTime = Natural
a} :: StartQuery)

-- | The query string to use. For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax.html CloudWatch Logs Insights Query Syntax>.
startQuery_queryString :: Lens.Lens' StartQuery Prelude.Text
startQuery_queryString :: (Text -> f Text) -> StartQuery -> f StartQuery
startQuery_queryString = (StartQuery -> Text)
-> (StartQuery -> Text -> StartQuery)
-> Lens StartQuery StartQuery Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartQuery' {Text
queryString :: Text
$sel:queryString:StartQuery' :: StartQuery -> Text
queryString} -> Text
queryString) (\s :: StartQuery
s@StartQuery' {} Text
a -> StartQuery
s {$sel:queryString:StartQuery' :: Text
queryString = Text
a} :: StartQuery)

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

instance Prelude.NFData StartQuery

instance Core.ToHeaders StartQuery where
  toHeaders :: StartQuery -> ResponseHeaders
toHeaders =
    ResponseHeaders -> StartQuery -> 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
"Logs_20140328.StartQuery" :: 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 StartQuery where
  toJSON :: StartQuery -> Value
toJSON StartQuery' {Natural
Maybe Natural
Maybe [Text]
Maybe Text
Text
queryString :: Text
endTime :: Natural
startTime :: Natural
limit :: Maybe Natural
logGroupName :: Maybe Text
logGroupNames :: Maybe [Text]
$sel:queryString:StartQuery' :: StartQuery -> Text
$sel:endTime:StartQuery' :: StartQuery -> Natural
$sel:startTime:StartQuery' :: StartQuery -> Natural
$sel:limit:StartQuery' :: StartQuery -> Maybe Natural
$sel:logGroupName:StartQuery' :: StartQuery -> Maybe Text
$sel:logGroupNames:StartQuery' :: StartQuery -> Maybe [Text]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"logGroupNames" 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]
logGroupNames,
            (Text
"logGroupName" 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
logGroupName,
            (Text
"limit" 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
limit,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"startTime" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
startTime),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"endTime" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
endTime),
            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 StartQuery where
  toPath :: StartQuery -> ByteString
toPath = ByteString -> StartQuery -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

-- |
-- Create a value of 'StartQueryResponse' 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:
--
-- 'queryId', 'startQueryResponse_queryId' - The unique ID of the query.
--
-- 'httpStatus', 'startQueryResponse_httpStatus' - The response's http status code.
newStartQueryResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  StartQueryResponse
newStartQueryResponse :: Int -> StartQueryResponse
newStartQueryResponse Int
pHttpStatus_ =
  StartQueryResponse' :: Maybe Text -> Int -> StartQueryResponse
StartQueryResponse'
    { $sel:queryId:StartQueryResponse' :: Maybe Text
queryId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:StartQueryResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The unique ID of the query.
startQueryResponse_queryId :: Lens.Lens' StartQueryResponse (Prelude.Maybe Prelude.Text)
startQueryResponse_queryId :: (Maybe Text -> f (Maybe Text))
-> StartQueryResponse -> f StartQueryResponse
startQueryResponse_queryId = (StartQueryResponse -> Maybe Text)
-> (StartQueryResponse -> Maybe Text -> StartQueryResponse)
-> Lens
     StartQueryResponse StartQueryResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartQueryResponse' {Maybe Text
queryId :: Maybe Text
$sel:queryId:StartQueryResponse' :: StartQueryResponse -> Maybe Text
queryId} -> Maybe Text
queryId) (\s :: StartQueryResponse
s@StartQueryResponse' {} Maybe Text
a -> StartQueryResponse
s {$sel:queryId:StartQueryResponse' :: Maybe Text
queryId = Maybe Text
a} :: StartQueryResponse)

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

instance Prelude.NFData StartQueryResponse