{-# 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.StopQuery
(
StopQuery (..),
newStopQuery,
stopQuery_queryId,
StopQueryResponse (..),
newStopQueryResponse,
stopQueryResponse_success,
stopQueryResponse_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 StopQuery = StopQuery'
{
StopQuery -> Text
queryId :: Prelude.Text
}
deriving (StopQuery -> StopQuery -> Bool
(StopQuery -> StopQuery -> Bool)
-> (StopQuery -> StopQuery -> Bool) -> Eq StopQuery
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopQuery -> StopQuery -> Bool
$c/= :: StopQuery -> StopQuery -> Bool
== :: StopQuery -> StopQuery -> Bool
$c== :: StopQuery -> StopQuery -> Bool
Prelude.Eq, ReadPrec [StopQuery]
ReadPrec StopQuery
Int -> ReadS StopQuery
ReadS [StopQuery]
(Int -> ReadS StopQuery)
-> ReadS [StopQuery]
-> ReadPrec StopQuery
-> ReadPrec [StopQuery]
-> Read StopQuery
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopQuery]
$creadListPrec :: ReadPrec [StopQuery]
readPrec :: ReadPrec StopQuery
$creadPrec :: ReadPrec StopQuery
readList :: ReadS [StopQuery]
$creadList :: ReadS [StopQuery]
readsPrec :: Int -> ReadS StopQuery
$creadsPrec :: Int -> ReadS StopQuery
Prelude.Read, Int -> StopQuery -> ShowS
[StopQuery] -> ShowS
StopQuery -> String
(Int -> StopQuery -> ShowS)
-> (StopQuery -> String)
-> ([StopQuery] -> ShowS)
-> Show StopQuery
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopQuery] -> ShowS
$cshowList :: [StopQuery] -> ShowS
show :: StopQuery -> String
$cshow :: StopQuery -> String
showsPrec :: Int -> StopQuery -> ShowS
$cshowsPrec :: Int -> StopQuery -> ShowS
Prelude.Show, (forall x. StopQuery -> Rep StopQuery x)
-> (forall x. Rep StopQuery x -> StopQuery) -> Generic StopQuery
forall x. Rep StopQuery x -> StopQuery
forall x. StopQuery -> Rep StopQuery x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StopQuery x -> StopQuery
$cfrom :: forall x. StopQuery -> Rep StopQuery x
Prelude.Generic)
newStopQuery ::
Prelude.Text ->
StopQuery
newStopQuery :: Text -> StopQuery
newStopQuery Text
pQueryId_ =
StopQuery' :: Text -> StopQuery
StopQuery' {$sel:queryId:StopQuery' :: Text
queryId = Text
pQueryId_}
stopQuery_queryId :: Lens.Lens' StopQuery Prelude.Text
stopQuery_queryId :: (Text -> f Text) -> StopQuery -> f StopQuery
stopQuery_queryId = (StopQuery -> Text)
-> (StopQuery -> Text -> StopQuery)
-> Lens StopQuery StopQuery Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopQuery' {Text
queryId :: Text
$sel:queryId:StopQuery' :: StopQuery -> Text
queryId} -> Text
queryId) (\s :: StopQuery
s@StopQuery' {} Text
a -> StopQuery
s {$sel:queryId:StopQuery' :: Text
queryId = Text
a} :: StopQuery)
instance Core.AWSRequest StopQuery where
type AWSResponse StopQuery = StopQueryResponse
request :: StopQuery -> Request StopQuery
request = Service -> StopQuery -> Request StopQuery
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy StopQuery
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StopQuery)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse StopQuery))
-> Logger
-> Service
-> Proxy StopQuery
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StopQuery)))
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 Bool -> Int -> StopQueryResponse
StopQueryResponse'
(Maybe Bool -> Int -> StopQueryResponse)
-> Either String (Maybe Bool)
-> Either String (Int -> StopQueryResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"success")
Either String (Int -> StopQueryResponse)
-> Either String Int -> Either String StopQueryResponse
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 StopQuery
instance Prelude.NFData StopQuery
instance Core.ToHeaders StopQuery where
toHeaders :: StopQuery -> ResponseHeaders
toHeaders =
ResponseHeaders -> StopQuery -> 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.StopQuery" :: 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 StopQuery where
toJSON :: StopQuery -> Value
toJSON StopQuery' {Text
queryId :: Text
$sel:queryId:StopQuery' :: StopQuery -> 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 StopQuery where
toPath :: StopQuery -> ByteString
toPath = ByteString -> StopQuery -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery StopQuery where
toQuery :: StopQuery -> QueryString
toQuery = QueryString -> StopQuery -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data StopQueryResponse = StopQueryResponse'
{
StopQueryResponse -> Maybe Bool
success :: Prelude.Maybe Prelude.Bool,
StopQueryResponse -> Int
httpStatus :: Prelude.Int
}
deriving (StopQueryResponse -> StopQueryResponse -> Bool
(StopQueryResponse -> StopQueryResponse -> Bool)
-> (StopQueryResponse -> StopQueryResponse -> Bool)
-> Eq StopQueryResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopQueryResponse -> StopQueryResponse -> Bool
$c/= :: StopQueryResponse -> StopQueryResponse -> Bool
== :: StopQueryResponse -> StopQueryResponse -> Bool
$c== :: StopQueryResponse -> StopQueryResponse -> Bool
Prelude.Eq, ReadPrec [StopQueryResponse]
ReadPrec StopQueryResponse
Int -> ReadS StopQueryResponse
ReadS [StopQueryResponse]
(Int -> ReadS StopQueryResponse)
-> ReadS [StopQueryResponse]
-> ReadPrec StopQueryResponse
-> ReadPrec [StopQueryResponse]
-> Read StopQueryResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopQueryResponse]
$creadListPrec :: ReadPrec [StopQueryResponse]
readPrec :: ReadPrec StopQueryResponse
$creadPrec :: ReadPrec StopQueryResponse
readList :: ReadS [StopQueryResponse]
$creadList :: ReadS [StopQueryResponse]
readsPrec :: Int -> ReadS StopQueryResponse
$creadsPrec :: Int -> ReadS StopQueryResponse
Prelude.Read, Int -> StopQueryResponse -> ShowS
[StopQueryResponse] -> ShowS
StopQueryResponse -> String
(Int -> StopQueryResponse -> ShowS)
-> (StopQueryResponse -> String)
-> ([StopQueryResponse] -> ShowS)
-> Show StopQueryResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopQueryResponse] -> ShowS
$cshowList :: [StopQueryResponse] -> ShowS
show :: StopQueryResponse -> String
$cshow :: StopQueryResponse -> String
showsPrec :: Int -> StopQueryResponse -> ShowS
$cshowsPrec :: Int -> StopQueryResponse -> ShowS
Prelude.Show, (forall x. StopQueryResponse -> Rep StopQueryResponse x)
-> (forall x. Rep StopQueryResponse x -> StopQueryResponse)
-> Generic StopQueryResponse
forall x. Rep StopQueryResponse x -> StopQueryResponse
forall x. StopQueryResponse -> Rep StopQueryResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StopQueryResponse x -> StopQueryResponse
$cfrom :: forall x. StopQueryResponse -> Rep StopQueryResponse x
Prelude.Generic)
newStopQueryResponse ::
Prelude.Int ->
StopQueryResponse
newStopQueryResponse :: Int -> StopQueryResponse
newStopQueryResponse Int
pHttpStatus_ =
StopQueryResponse' :: Maybe Bool -> Int -> StopQueryResponse
StopQueryResponse'
{ $sel:success:StopQueryResponse' :: Maybe Bool
success = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:StopQueryResponse' :: Int
httpStatus = Int
pHttpStatus_
}
stopQueryResponse_success :: Lens.Lens' StopQueryResponse (Prelude.Maybe Prelude.Bool)
stopQueryResponse_success :: (Maybe Bool -> f (Maybe Bool))
-> StopQueryResponse -> f StopQueryResponse
stopQueryResponse_success = (StopQueryResponse -> Maybe Bool)
-> (StopQueryResponse -> Maybe Bool -> StopQueryResponse)
-> Lens
StopQueryResponse StopQueryResponse (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopQueryResponse' {Maybe Bool
success :: Maybe Bool
$sel:success:StopQueryResponse' :: StopQueryResponse -> Maybe Bool
success} -> Maybe Bool
success) (\s :: StopQueryResponse
s@StopQueryResponse' {} Maybe Bool
a -> StopQueryResponse
s {$sel:success:StopQueryResponse' :: Maybe Bool
success = Maybe Bool
a} :: StopQueryResponse)
stopQueryResponse_httpStatus :: Lens.Lens' StopQueryResponse Prelude.Int
stopQueryResponse_httpStatus :: (Int -> f Int) -> StopQueryResponse -> f StopQueryResponse
stopQueryResponse_httpStatus = (StopQueryResponse -> Int)
-> (StopQueryResponse -> Int -> StopQueryResponse)
-> Lens StopQueryResponse StopQueryResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopQueryResponse' {Int
httpStatus :: Int
$sel:httpStatus:StopQueryResponse' :: StopQueryResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StopQueryResponse
s@StopQueryResponse' {} Int
a -> StopQueryResponse
s {$sel:httpStatus:StopQueryResponse' :: Int
httpStatus = Int
a} :: StopQueryResponse)
instance Prelude.NFData StopQueryResponse