{-# 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.CloudWatchEvents.DeleteRule
(
DeleteRule (..),
newDeleteRule,
deleteRule_force,
deleteRule_eventBusName,
deleteRule_name,
DeleteRuleResponse (..),
newDeleteRuleResponse,
)
where
import Amazonka.CloudWatchEvents.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 DeleteRule = DeleteRule'
{
DeleteRule -> Maybe Bool
force :: Prelude.Maybe Prelude.Bool,
DeleteRule -> Maybe Text
eventBusName :: Prelude.Maybe Prelude.Text,
DeleteRule -> Text
name :: Prelude.Text
}
deriving (DeleteRule -> DeleteRule -> Bool
(DeleteRule -> DeleteRule -> Bool)
-> (DeleteRule -> DeleteRule -> Bool) -> Eq DeleteRule
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteRule -> DeleteRule -> Bool
$c/= :: DeleteRule -> DeleteRule -> Bool
== :: DeleteRule -> DeleteRule -> Bool
$c== :: DeleteRule -> DeleteRule -> Bool
Prelude.Eq, ReadPrec [DeleteRule]
ReadPrec DeleteRule
Int -> ReadS DeleteRule
ReadS [DeleteRule]
(Int -> ReadS DeleteRule)
-> ReadS [DeleteRule]
-> ReadPrec DeleteRule
-> ReadPrec [DeleteRule]
-> Read DeleteRule
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteRule]
$creadListPrec :: ReadPrec [DeleteRule]
readPrec :: ReadPrec DeleteRule
$creadPrec :: ReadPrec DeleteRule
readList :: ReadS [DeleteRule]
$creadList :: ReadS [DeleteRule]
readsPrec :: Int -> ReadS DeleteRule
$creadsPrec :: Int -> ReadS DeleteRule
Prelude.Read, Int -> DeleteRule -> ShowS
[DeleteRule] -> ShowS
DeleteRule -> String
(Int -> DeleteRule -> ShowS)
-> (DeleteRule -> String)
-> ([DeleteRule] -> ShowS)
-> Show DeleteRule
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteRule] -> ShowS
$cshowList :: [DeleteRule] -> ShowS
show :: DeleteRule -> String
$cshow :: DeleteRule -> String
showsPrec :: Int -> DeleteRule -> ShowS
$cshowsPrec :: Int -> DeleteRule -> ShowS
Prelude.Show, (forall x. DeleteRule -> Rep DeleteRule x)
-> (forall x. Rep DeleteRule x -> DeleteRule) -> Generic DeleteRule
forall x. Rep DeleteRule x -> DeleteRule
forall x. DeleteRule -> Rep DeleteRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteRule x -> DeleteRule
$cfrom :: forall x. DeleteRule -> Rep DeleteRule x
Prelude.Generic)
newDeleteRule ::
Prelude.Text ->
DeleteRule
newDeleteRule :: Text -> DeleteRule
newDeleteRule Text
pName_ =
DeleteRule' :: Maybe Bool -> Maybe Text -> Text -> DeleteRule
DeleteRule'
{ $sel:force:DeleteRule' :: Maybe Bool
force = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:eventBusName:DeleteRule' :: Maybe Text
eventBusName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:name:DeleteRule' :: Text
name = Text
pName_
}
deleteRule_force :: Lens.Lens' DeleteRule (Prelude.Maybe Prelude.Bool)
deleteRule_force :: (Maybe Bool -> f (Maybe Bool)) -> DeleteRule -> f DeleteRule
deleteRule_force = (DeleteRule -> Maybe Bool)
-> (DeleteRule -> Maybe Bool -> DeleteRule)
-> Lens DeleteRule DeleteRule (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteRule' {Maybe Bool
force :: Maybe Bool
$sel:force:DeleteRule' :: DeleteRule -> Maybe Bool
force} -> Maybe Bool
force) (\s :: DeleteRule
s@DeleteRule' {} Maybe Bool
a -> DeleteRule
s {$sel:force:DeleteRule' :: Maybe Bool
force = Maybe Bool
a} :: DeleteRule)
deleteRule_eventBusName :: Lens.Lens' DeleteRule (Prelude.Maybe Prelude.Text)
deleteRule_eventBusName :: (Maybe Text -> f (Maybe Text)) -> DeleteRule -> f DeleteRule
deleteRule_eventBusName = (DeleteRule -> Maybe Text)
-> (DeleteRule -> Maybe Text -> DeleteRule)
-> Lens DeleteRule DeleteRule (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteRule' {Maybe Text
eventBusName :: Maybe Text
$sel:eventBusName:DeleteRule' :: DeleteRule -> Maybe Text
eventBusName} -> Maybe Text
eventBusName) (\s :: DeleteRule
s@DeleteRule' {} Maybe Text
a -> DeleteRule
s {$sel:eventBusName:DeleteRule' :: Maybe Text
eventBusName = Maybe Text
a} :: DeleteRule)
deleteRule_name :: Lens.Lens' DeleteRule Prelude.Text
deleteRule_name :: (Text -> f Text) -> DeleteRule -> f DeleteRule
deleteRule_name = (DeleteRule -> Text)
-> (DeleteRule -> Text -> DeleteRule)
-> Lens DeleteRule DeleteRule Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteRule' {Text
name :: Text
$sel:name:DeleteRule' :: DeleteRule -> Text
name} -> Text
name) (\s :: DeleteRule
s@DeleteRule' {} Text
a -> DeleteRule
s {$sel:name:DeleteRule' :: Text
name = Text
a} :: DeleteRule)
instance Core.AWSRequest DeleteRule where
type AWSResponse DeleteRule = DeleteRuleResponse
request :: DeleteRule -> Request DeleteRule
request = Service -> DeleteRule -> Request DeleteRule
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DeleteRule
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteRule)))
response = AWSResponse DeleteRule
-> Logger
-> Service
-> Proxy DeleteRule
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteRule)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse DeleteRule
DeleteRuleResponse
DeleteRuleResponse'
instance Prelude.Hashable DeleteRule
instance Prelude.NFData DeleteRule
instance Core.ToHeaders DeleteRule where
toHeaders :: DeleteRule -> [Header]
toHeaders =
[Header] -> DeleteRule -> [Header]
forall a b. a -> b -> a
Prelude.const
( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# (ByteString
"AWSEvents.DeleteRule" :: Prelude.ByteString),
HeaderName
"Content-Type"
HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON DeleteRule where
toJSON :: DeleteRule -> Value
toJSON DeleteRule' {Maybe Bool
Maybe Text
Text
name :: Text
eventBusName :: Maybe Text
force :: Maybe Bool
$sel:name:DeleteRule' :: DeleteRule -> Text
$sel:eventBusName:DeleteRule' :: DeleteRule -> Maybe Text
$sel:force:DeleteRule' :: DeleteRule -> Maybe Bool
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Force" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
force,
(Text
"EventBusName" 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
eventBusName,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)
]
)
instance Core.ToPath DeleteRule where
toPath :: DeleteRule -> ByteString
toPath = ByteString -> DeleteRule -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DeleteRule where
toQuery :: DeleteRule -> QueryString
toQuery = QueryString -> DeleteRule -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DeleteRuleResponse = DeleteRuleResponse'
{
}
deriving (DeleteRuleResponse -> DeleteRuleResponse -> Bool
(DeleteRuleResponse -> DeleteRuleResponse -> Bool)
-> (DeleteRuleResponse -> DeleteRuleResponse -> Bool)
-> Eq DeleteRuleResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteRuleResponse -> DeleteRuleResponse -> Bool
$c/= :: DeleteRuleResponse -> DeleteRuleResponse -> Bool
== :: DeleteRuleResponse -> DeleteRuleResponse -> Bool
$c== :: DeleteRuleResponse -> DeleteRuleResponse -> Bool
Prelude.Eq, ReadPrec [DeleteRuleResponse]
ReadPrec DeleteRuleResponse
Int -> ReadS DeleteRuleResponse
ReadS [DeleteRuleResponse]
(Int -> ReadS DeleteRuleResponse)
-> ReadS [DeleteRuleResponse]
-> ReadPrec DeleteRuleResponse
-> ReadPrec [DeleteRuleResponse]
-> Read DeleteRuleResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteRuleResponse]
$creadListPrec :: ReadPrec [DeleteRuleResponse]
readPrec :: ReadPrec DeleteRuleResponse
$creadPrec :: ReadPrec DeleteRuleResponse
readList :: ReadS [DeleteRuleResponse]
$creadList :: ReadS [DeleteRuleResponse]
readsPrec :: Int -> ReadS DeleteRuleResponse
$creadsPrec :: Int -> ReadS DeleteRuleResponse
Prelude.Read, Int -> DeleteRuleResponse -> ShowS
[DeleteRuleResponse] -> ShowS
DeleteRuleResponse -> String
(Int -> DeleteRuleResponse -> ShowS)
-> (DeleteRuleResponse -> String)
-> ([DeleteRuleResponse] -> ShowS)
-> Show DeleteRuleResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteRuleResponse] -> ShowS
$cshowList :: [DeleteRuleResponse] -> ShowS
show :: DeleteRuleResponse -> String
$cshow :: DeleteRuleResponse -> String
showsPrec :: Int -> DeleteRuleResponse -> ShowS
$cshowsPrec :: Int -> DeleteRuleResponse -> ShowS
Prelude.Show, (forall x. DeleteRuleResponse -> Rep DeleteRuleResponse x)
-> (forall x. Rep DeleteRuleResponse x -> DeleteRuleResponse)
-> Generic DeleteRuleResponse
forall x. Rep DeleteRuleResponse x -> DeleteRuleResponse
forall x. DeleteRuleResponse -> Rep DeleteRuleResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteRuleResponse x -> DeleteRuleResponse
$cfrom :: forall x. DeleteRuleResponse -> Rep DeleteRuleResponse x
Prelude.Generic)
newDeleteRuleResponse ::
DeleteRuleResponse
newDeleteRuleResponse :: DeleteRuleResponse
newDeleteRuleResponse = DeleteRuleResponse
DeleteRuleResponse'
instance Prelude.NFData DeleteRuleResponse