{-# 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 #-}
module Amazonka.CloudWatchLogs.GetQueryResults
(
GetQueryResults (..),
newGetQueryResults,
getQueryResults_queryId,
GetQueryResultsResponse (..),
newGetQueryResultsResponse,
getQueryResultsResponse_status,
getQueryResultsResponse_results,
getQueryResultsResponse_statistics,
getQueryResultsResponse_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
data GetQueryResults = GetQueryResults'
{
GetQueryResults -> Text
queryId :: 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)
newGetQueryResults ::
Prelude.Text ->
GetQueryResults
newGetQueryResults :: Text -> GetQueryResults
newGetQueryResults Text
pQueryId_ =
GetQueryResults' :: Text -> GetQueryResults
GetQueryResults' {$sel:queryId:GetQueryResults' :: Text
queryId = Text
pQueryId_}
getQueryResults_queryId :: Lens.Lens' GetQueryResults Prelude.Text
getQueryResults_queryId :: (Text -> f Text) -> GetQueryResults -> f GetQueryResults
getQueryResults_queryId = (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
queryId :: Text
$sel:queryId:GetQueryResults' :: GetQueryResults -> Text
queryId} -> Text
queryId) (\s :: GetQueryResults
s@GetQueryResults' {} Text
a -> GetQueryResults
s {$sel:queryId:GetQueryResults' :: Text
queryId = Text
a} :: GetQueryResults)
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 QueryStatus
-> Maybe [[ResultField]]
-> Maybe QueryStatistics
-> Int
-> GetQueryResultsResponse
GetQueryResultsResponse'
(Maybe QueryStatus
-> Maybe [[ResultField]]
-> Maybe QueryStatistics
-> Int
-> GetQueryResultsResponse)
-> Either String (Maybe QueryStatus)
-> Either
String
(Maybe [[ResultField]]
-> Maybe QueryStatistics -> Int -> GetQueryResultsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe QueryStatus)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"status")
Either
String
(Maybe [[ResultField]]
-> Maybe QueryStatistics -> Int -> GetQueryResultsResponse)
-> Either String (Maybe [[ResultField]])
-> Either
String (Maybe QueryStatistics -> Int -> GetQueryResultsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [[ResultField]]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"results" Either String (Maybe (Maybe [[ResultField]]))
-> Maybe [[ResultField]] -> Either String (Maybe [[ResultField]])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [[ResultField]]
forall a. Monoid a => a
Prelude.mempty)
Either
String (Maybe QueryStatistics -> Int -> GetQueryResultsResponse)
-> Either String (Maybe QueryStatistics)
-> 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 QueryStatistics)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"statistics")
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
"Logs_20140328.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' {Text
queryId :: Text
$sel:queryId:GetQueryResults' :: GetQueryResults -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"queryId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
queryId)]
)
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
data GetQueryResultsResponse = GetQueryResultsResponse'
{
GetQueryResultsResponse -> Maybe QueryStatus
status :: Prelude.Maybe QueryStatus,
GetQueryResultsResponse -> Maybe [[ResultField]]
results :: Prelude.Maybe [[ResultField]],
GetQueryResultsResponse -> Maybe QueryStatistics
statistics :: Prelude.Maybe QueryStatistics,
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)
newGetQueryResultsResponse ::
Prelude.Int ->
GetQueryResultsResponse
newGetQueryResultsResponse :: Int -> GetQueryResultsResponse
newGetQueryResultsResponse Int
pHttpStatus_ =
GetQueryResultsResponse' :: Maybe QueryStatus
-> Maybe [[ResultField]]
-> Maybe QueryStatistics
-> Int
-> GetQueryResultsResponse
GetQueryResultsResponse'
{ $sel:status:GetQueryResultsResponse' :: Maybe QueryStatus
status = Maybe QueryStatus
forall a. Maybe a
Prelude.Nothing,
$sel:results:GetQueryResultsResponse' :: Maybe [[ResultField]]
results = Maybe [[ResultField]]
forall a. Maybe a
Prelude.Nothing,
$sel:statistics:GetQueryResultsResponse' :: Maybe QueryStatistics
statistics = Maybe QueryStatistics
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetQueryResultsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getQueryResultsResponse_status :: Lens.Lens' GetQueryResultsResponse (Prelude.Maybe QueryStatus)
getQueryResultsResponse_status :: (Maybe QueryStatus -> f (Maybe QueryStatus))
-> GetQueryResultsResponse -> f GetQueryResultsResponse
getQueryResultsResponse_status = (GetQueryResultsResponse -> Maybe QueryStatus)
-> (GetQueryResultsResponse
-> Maybe QueryStatus -> GetQueryResultsResponse)
-> Lens
GetQueryResultsResponse
GetQueryResultsResponse
(Maybe QueryStatus)
(Maybe QueryStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetQueryResultsResponse' {Maybe QueryStatus
status :: Maybe QueryStatus
$sel:status:GetQueryResultsResponse' :: GetQueryResultsResponse -> Maybe QueryStatus
status} -> Maybe QueryStatus
status) (\s :: GetQueryResultsResponse
s@GetQueryResultsResponse' {} Maybe QueryStatus
a -> GetQueryResultsResponse
s {$sel:status:GetQueryResultsResponse' :: Maybe QueryStatus
status = Maybe QueryStatus
a} :: GetQueryResultsResponse)
getQueryResultsResponse_results :: Lens.Lens' GetQueryResultsResponse (Prelude.Maybe [[ResultField]])
getQueryResultsResponse_results :: (Maybe [[ResultField]] -> f (Maybe [[ResultField]]))
-> GetQueryResultsResponse -> f GetQueryResultsResponse
getQueryResultsResponse_results = (GetQueryResultsResponse -> Maybe [[ResultField]])
-> (GetQueryResultsResponse
-> Maybe [[ResultField]] -> GetQueryResultsResponse)
-> Lens
GetQueryResultsResponse
GetQueryResultsResponse
(Maybe [[ResultField]])
(Maybe [[ResultField]])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetQueryResultsResponse' {Maybe [[ResultField]]
results :: Maybe [[ResultField]]
$sel:results:GetQueryResultsResponse' :: GetQueryResultsResponse -> Maybe [[ResultField]]
results} -> Maybe [[ResultField]]
results) (\s :: GetQueryResultsResponse
s@GetQueryResultsResponse' {} Maybe [[ResultField]]
a -> GetQueryResultsResponse
s {$sel:results:GetQueryResultsResponse' :: Maybe [[ResultField]]
results = Maybe [[ResultField]]
a} :: GetQueryResultsResponse) ((Maybe [[ResultField]] -> f (Maybe [[ResultField]]))
-> GetQueryResultsResponse -> f GetQueryResultsResponse)
-> ((Maybe [[ResultField]] -> f (Maybe [[ResultField]]))
-> Maybe [[ResultField]] -> f (Maybe [[ResultField]]))
-> (Maybe [[ResultField]] -> f (Maybe [[ResultField]]))
-> GetQueryResultsResponse
-> f GetQueryResultsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[[ResultField]] [[ResultField]] [[ResultField]] [[ResultField]]
-> Iso
(Maybe [[ResultField]])
(Maybe [[ResultField]])
(Maybe [[ResultField]])
(Maybe [[ResultField]])
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
[[ResultField]] [[ResultField]] [[ResultField]] [[ResultField]]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getQueryResultsResponse_statistics :: Lens.Lens' GetQueryResultsResponse (Prelude.Maybe QueryStatistics)
getQueryResultsResponse_statistics :: (Maybe QueryStatistics -> f (Maybe QueryStatistics))
-> GetQueryResultsResponse -> f GetQueryResultsResponse
getQueryResultsResponse_statistics = (GetQueryResultsResponse -> Maybe QueryStatistics)
-> (GetQueryResultsResponse
-> Maybe QueryStatistics -> GetQueryResultsResponse)
-> Lens
GetQueryResultsResponse
GetQueryResultsResponse
(Maybe QueryStatistics)
(Maybe QueryStatistics)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetQueryResultsResponse' {Maybe QueryStatistics
statistics :: Maybe QueryStatistics
$sel:statistics:GetQueryResultsResponse' :: GetQueryResultsResponse -> Maybe QueryStatistics
statistics} -> Maybe QueryStatistics
statistics) (\s :: GetQueryResultsResponse
s@GetQueryResultsResponse' {} Maybe QueryStatistics
a -> GetQueryResultsResponse
s {$sel:statistics:GetQueryResultsResponse' :: Maybe QueryStatistics
statistics = Maybe QueryStatistics
a} :: GetQueryResultsResponse)
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