{-# 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.DeleteQueryDefinition
(
DeleteQueryDefinition (..),
newDeleteQueryDefinition,
deleteQueryDefinition_queryDefinitionId,
DeleteQueryDefinitionResponse (..),
newDeleteQueryDefinitionResponse,
deleteQueryDefinitionResponse_success,
deleteQueryDefinitionResponse_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 DeleteQueryDefinition = DeleteQueryDefinition'
{
DeleteQueryDefinition -> Text
queryDefinitionId :: Prelude.Text
}
deriving (DeleteQueryDefinition -> DeleteQueryDefinition -> Bool
(DeleteQueryDefinition -> DeleteQueryDefinition -> Bool)
-> (DeleteQueryDefinition -> DeleteQueryDefinition -> Bool)
-> Eq DeleteQueryDefinition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteQueryDefinition -> DeleteQueryDefinition -> Bool
$c/= :: DeleteQueryDefinition -> DeleteQueryDefinition -> Bool
== :: DeleteQueryDefinition -> DeleteQueryDefinition -> Bool
$c== :: DeleteQueryDefinition -> DeleteQueryDefinition -> Bool
Prelude.Eq, ReadPrec [DeleteQueryDefinition]
ReadPrec DeleteQueryDefinition
Int -> ReadS DeleteQueryDefinition
ReadS [DeleteQueryDefinition]
(Int -> ReadS DeleteQueryDefinition)
-> ReadS [DeleteQueryDefinition]
-> ReadPrec DeleteQueryDefinition
-> ReadPrec [DeleteQueryDefinition]
-> Read DeleteQueryDefinition
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteQueryDefinition]
$creadListPrec :: ReadPrec [DeleteQueryDefinition]
readPrec :: ReadPrec DeleteQueryDefinition
$creadPrec :: ReadPrec DeleteQueryDefinition
readList :: ReadS [DeleteQueryDefinition]
$creadList :: ReadS [DeleteQueryDefinition]
readsPrec :: Int -> ReadS DeleteQueryDefinition
$creadsPrec :: Int -> ReadS DeleteQueryDefinition
Prelude.Read, Int -> DeleteQueryDefinition -> ShowS
[DeleteQueryDefinition] -> ShowS
DeleteQueryDefinition -> String
(Int -> DeleteQueryDefinition -> ShowS)
-> (DeleteQueryDefinition -> String)
-> ([DeleteQueryDefinition] -> ShowS)
-> Show DeleteQueryDefinition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteQueryDefinition] -> ShowS
$cshowList :: [DeleteQueryDefinition] -> ShowS
show :: DeleteQueryDefinition -> String
$cshow :: DeleteQueryDefinition -> String
showsPrec :: Int -> DeleteQueryDefinition -> ShowS
$cshowsPrec :: Int -> DeleteQueryDefinition -> ShowS
Prelude.Show, (forall x. DeleteQueryDefinition -> Rep DeleteQueryDefinition x)
-> (forall x. Rep DeleteQueryDefinition x -> DeleteQueryDefinition)
-> Generic DeleteQueryDefinition
forall x. Rep DeleteQueryDefinition x -> DeleteQueryDefinition
forall x. DeleteQueryDefinition -> Rep DeleteQueryDefinition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteQueryDefinition x -> DeleteQueryDefinition
$cfrom :: forall x. DeleteQueryDefinition -> Rep DeleteQueryDefinition x
Prelude.Generic)
newDeleteQueryDefinition ::
Prelude.Text ->
DeleteQueryDefinition
newDeleteQueryDefinition :: Text -> DeleteQueryDefinition
newDeleteQueryDefinition Text
pQueryDefinitionId_ =
DeleteQueryDefinition' :: Text -> DeleteQueryDefinition
DeleteQueryDefinition'
{ $sel:queryDefinitionId:DeleteQueryDefinition' :: Text
queryDefinitionId =
Text
pQueryDefinitionId_
}
deleteQueryDefinition_queryDefinitionId :: Lens.Lens' DeleteQueryDefinition Prelude.Text
deleteQueryDefinition_queryDefinitionId :: (Text -> f Text)
-> DeleteQueryDefinition -> f DeleteQueryDefinition
deleteQueryDefinition_queryDefinitionId = (DeleteQueryDefinition -> Text)
-> (DeleteQueryDefinition -> Text -> DeleteQueryDefinition)
-> Lens DeleteQueryDefinition DeleteQueryDefinition Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteQueryDefinition' {Text
queryDefinitionId :: Text
$sel:queryDefinitionId:DeleteQueryDefinition' :: DeleteQueryDefinition -> Text
queryDefinitionId} -> Text
queryDefinitionId) (\s :: DeleteQueryDefinition
s@DeleteQueryDefinition' {} Text
a -> DeleteQueryDefinition
s {$sel:queryDefinitionId:DeleteQueryDefinition' :: Text
queryDefinitionId = Text
a} :: DeleteQueryDefinition)
instance Core.AWSRequest DeleteQueryDefinition where
type
AWSResponse DeleteQueryDefinition =
DeleteQueryDefinitionResponse
request :: DeleteQueryDefinition -> Request DeleteQueryDefinition
request = Service -> DeleteQueryDefinition -> Request DeleteQueryDefinition
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DeleteQueryDefinition
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DeleteQueryDefinition)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DeleteQueryDefinition))
-> Logger
-> Service
-> Proxy DeleteQueryDefinition
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DeleteQueryDefinition)))
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 -> DeleteQueryDefinitionResponse
DeleteQueryDefinitionResponse'
(Maybe Bool -> Int -> DeleteQueryDefinitionResponse)
-> Either String (Maybe Bool)
-> Either String (Int -> DeleteQueryDefinitionResponse)
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 -> DeleteQueryDefinitionResponse)
-> Either String Int -> Either String DeleteQueryDefinitionResponse
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 DeleteQueryDefinition
instance Prelude.NFData DeleteQueryDefinition
instance Core.ToHeaders DeleteQueryDefinition where
toHeaders :: DeleteQueryDefinition -> ResponseHeaders
toHeaders =
ResponseHeaders -> DeleteQueryDefinition -> 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.DeleteQueryDefinition" ::
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 DeleteQueryDefinition where
toJSON :: DeleteQueryDefinition -> Value
toJSON DeleteQueryDefinition' {Text
queryDefinitionId :: Text
$sel:queryDefinitionId:DeleteQueryDefinition' :: DeleteQueryDefinition -> 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
"queryDefinitionId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
queryDefinitionId)
]
)
instance Core.ToPath DeleteQueryDefinition where
toPath :: DeleteQueryDefinition -> ByteString
toPath = ByteString -> DeleteQueryDefinition -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DeleteQueryDefinition where
toQuery :: DeleteQueryDefinition -> QueryString
toQuery = QueryString -> DeleteQueryDefinition -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DeleteQueryDefinitionResponse = DeleteQueryDefinitionResponse'
{
DeleteQueryDefinitionResponse -> Maybe Bool
success :: Prelude.Maybe Prelude.Bool,
DeleteQueryDefinitionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DeleteQueryDefinitionResponse
-> DeleteQueryDefinitionResponse -> Bool
(DeleteQueryDefinitionResponse
-> DeleteQueryDefinitionResponse -> Bool)
-> (DeleteQueryDefinitionResponse
-> DeleteQueryDefinitionResponse -> Bool)
-> Eq DeleteQueryDefinitionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteQueryDefinitionResponse
-> DeleteQueryDefinitionResponse -> Bool
$c/= :: DeleteQueryDefinitionResponse
-> DeleteQueryDefinitionResponse -> Bool
== :: DeleteQueryDefinitionResponse
-> DeleteQueryDefinitionResponse -> Bool
$c== :: DeleteQueryDefinitionResponse
-> DeleteQueryDefinitionResponse -> Bool
Prelude.Eq, ReadPrec [DeleteQueryDefinitionResponse]
ReadPrec DeleteQueryDefinitionResponse
Int -> ReadS DeleteQueryDefinitionResponse
ReadS [DeleteQueryDefinitionResponse]
(Int -> ReadS DeleteQueryDefinitionResponse)
-> ReadS [DeleteQueryDefinitionResponse]
-> ReadPrec DeleteQueryDefinitionResponse
-> ReadPrec [DeleteQueryDefinitionResponse]
-> Read DeleteQueryDefinitionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteQueryDefinitionResponse]
$creadListPrec :: ReadPrec [DeleteQueryDefinitionResponse]
readPrec :: ReadPrec DeleteQueryDefinitionResponse
$creadPrec :: ReadPrec DeleteQueryDefinitionResponse
readList :: ReadS [DeleteQueryDefinitionResponse]
$creadList :: ReadS [DeleteQueryDefinitionResponse]
readsPrec :: Int -> ReadS DeleteQueryDefinitionResponse
$creadsPrec :: Int -> ReadS DeleteQueryDefinitionResponse
Prelude.Read, Int -> DeleteQueryDefinitionResponse -> ShowS
[DeleteQueryDefinitionResponse] -> ShowS
DeleteQueryDefinitionResponse -> String
(Int -> DeleteQueryDefinitionResponse -> ShowS)
-> (DeleteQueryDefinitionResponse -> String)
-> ([DeleteQueryDefinitionResponse] -> ShowS)
-> Show DeleteQueryDefinitionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteQueryDefinitionResponse] -> ShowS
$cshowList :: [DeleteQueryDefinitionResponse] -> ShowS
show :: DeleteQueryDefinitionResponse -> String
$cshow :: DeleteQueryDefinitionResponse -> String
showsPrec :: Int -> DeleteQueryDefinitionResponse -> ShowS
$cshowsPrec :: Int -> DeleteQueryDefinitionResponse -> ShowS
Prelude.Show, (forall x.
DeleteQueryDefinitionResponse
-> Rep DeleteQueryDefinitionResponse x)
-> (forall x.
Rep DeleteQueryDefinitionResponse x
-> DeleteQueryDefinitionResponse)
-> Generic DeleteQueryDefinitionResponse
forall x.
Rep DeleteQueryDefinitionResponse x
-> DeleteQueryDefinitionResponse
forall x.
DeleteQueryDefinitionResponse
-> Rep DeleteQueryDefinitionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteQueryDefinitionResponse x
-> DeleteQueryDefinitionResponse
$cfrom :: forall x.
DeleteQueryDefinitionResponse
-> Rep DeleteQueryDefinitionResponse x
Prelude.Generic)
newDeleteQueryDefinitionResponse ::
Prelude.Int ->
DeleteQueryDefinitionResponse
newDeleteQueryDefinitionResponse :: Int -> DeleteQueryDefinitionResponse
newDeleteQueryDefinitionResponse Int
pHttpStatus_ =
DeleteQueryDefinitionResponse' :: Maybe Bool -> Int -> DeleteQueryDefinitionResponse
DeleteQueryDefinitionResponse'
{ $sel:success:DeleteQueryDefinitionResponse' :: Maybe Bool
success =
Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DeleteQueryDefinitionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
deleteQueryDefinitionResponse_success :: Lens.Lens' DeleteQueryDefinitionResponse (Prelude.Maybe Prelude.Bool)
deleteQueryDefinitionResponse_success :: (Maybe Bool -> f (Maybe Bool))
-> DeleteQueryDefinitionResponse -> f DeleteQueryDefinitionResponse
deleteQueryDefinitionResponse_success = (DeleteQueryDefinitionResponse -> Maybe Bool)
-> (DeleteQueryDefinitionResponse
-> Maybe Bool -> DeleteQueryDefinitionResponse)
-> Lens
DeleteQueryDefinitionResponse
DeleteQueryDefinitionResponse
(Maybe Bool)
(Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteQueryDefinitionResponse' {Maybe Bool
success :: Maybe Bool
$sel:success:DeleteQueryDefinitionResponse' :: DeleteQueryDefinitionResponse -> Maybe Bool
success} -> Maybe Bool
success) (\s :: DeleteQueryDefinitionResponse
s@DeleteQueryDefinitionResponse' {} Maybe Bool
a -> DeleteQueryDefinitionResponse
s {$sel:success:DeleteQueryDefinitionResponse' :: Maybe Bool
success = Maybe Bool
a} :: DeleteQueryDefinitionResponse)
deleteQueryDefinitionResponse_httpStatus :: Lens.Lens' DeleteQueryDefinitionResponse Prelude.Int
deleteQueryDefinitionResponse_httpStatus :: (Int -> f Int)
-> DeleteQueryDefinitionResponse -> f DeleteQueryDefinitionResponse
deleteQueryDefinitionResponse_httpStatus = (DeleteQueryDefinitionResponse -> Int)
-> (DeleteQueryDefinitionResponse
-> Int -> DeleteQueryDefinitionResponse)
-> Lens
DeleteQueryDefinitionResponse DeleteQueryDefinitionResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteQueryDefinitionResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteQueryDefinitionResponse' :: DeleteQueryDefinitionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteQueryDefinitionResponse
s@DeleteQueryDefinitionResponse' {} Int
a -> DeleteQueryDefinitionResponse
s {$sel:httpStatus:DeleteQueryDefinitionResponse' :: Int
httpStatus = Int
a} :: DeleteQueryDefinitionResponse)
instance Prelude.NFData DeleteQueryDefinitionResponse