{-# 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.WAFRegional.DeleteRateBasedRule
(
DeleteRateBasedRule (..),
newDeleteRateBasedRule,
deleteRateBasedRule_ruleId,
deleteRateBasedRule_changeToken,
DeleteRateBasedRuleResponse (..),
newDeleteRateBasedRuleResponse,
deleteRateBasedRuleResponse_changeToken,
deleteRateBasedRuleResponse_httpStatus,
)
where
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
import Amazonka.WAFRegional.Types
data DeleteRateBasedRule = DeleteRateBasedRule'
{
DeleteRateBasedRule -> Text
ruleId :: Prelude.Text,
DeleteRateBasedRule -> Text
changeToken :: Prelude.Text
}
deriving (DeleteRateBasedRule -> DeleteRateBasedRule -> Bool
(DeleteRateBasedRule -> DeleteRateBasedRule -> Bool)
-> (DeleteRateBasedRule -> DeleteRateBasedRule -> Bool)
-> Eq DeleteRateBasedRule
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteRateBasedRule -> DeleteRateBasedRule -> Bool
$c/= :: DeleteRateBasedRule -> DeleteRateBasedRule -> Bool
== :: DeleteRateBasedRule -> DeleteRateBasedRule -> Bool
$c== :: DeleteRateBasedRule -> DeleteRateBasedRule -> Bool
Prelude.Eq, ReadPrec [DeleteRateBasedRule]
ReadPrec DeleteRateBasedRule
Int -> ReadS DeleteRateBasedRule
ReadS [DeleteRateBasedRule]
(Int -> ReadS DeleteRateBasedRule)
-> ReadS [DeleteRateBasedRule]
-> ReadPrec DeleteRateBasedRule
-> ReadPrec [DeleteRateBasedRule]
-> Read DeleteRateBasedRule
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteRateBasedRule]
$creadListPrec :: ReadPrec [DeleteRateBasedRule]
readPrec :: ReadPrec DeleteRateBasedRule
$creadPrec :: ReadPrec DeleteRateBasedRule
readList :: ReadS [DeleteRateBasedRule]
$creadList :: ReadS [DeleteRateBasedRule]
readsPrec :: Int -> ReadS DeleteRateBasedRule
$creadsPrec :: Int -> ReadS DeleteRateBasedRule
Prelude.Read, Int -> DeleteRateBasedRule -> ShowS
[DeleteRateBasedRule] -> ShowS
DeleteRateBasedRule -> String
(Int -> DeleteRateBasedRule -> ShowS)
-> (DeleteRateBasedRule -> String)
-> ([DeleteRateBasedRule] -> ShowS)
-> Show DeleteRateBasedRule
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteRateBasedRule] -> ShowS
$cshowList :: [DeleteRateBasedRule] -> ShowS
show :: DeleteRateBasedRule -> String
$cshow :: DeleteRateBasedRule -> String
showsPrec :: Int -> DeleteRateBasedRule -> ShowS
$cshowsPrec :: Int -> DeleteRateBasedRule -> ShowS
Prelude.Show, (forall x. DeleteRateBasedRule -> Rep DeleteRateBasedRule x)
-> (forall x. Rep DeleteRateBasedRule x -> DeleteRateBasedRule)
-> Generic DeleteRateBasedRule
forall x. Rep DeleteRateBasedRule x -> DeleteRateBasedRule
forall x. DeleteRateBasedRule -> Rep DeleteRateBasedRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteRateBasedRule x -> DeleteRateBasedRule
$cfrom :: forall x. DeleteRateBasedRule -> Rep DeleteRateBasedRule x
Prelude.Generic)
newDeleteRateBasedRule ::
Prelude.Text ->
Prelude.Text ->
DeleteRateBasedRule
newDeleteRateBasedRule :: Text -> Text -> DeleteRateBasedRule
newDeleteRateBasedRule Text
pRuleId_ Text
pChangeToken_ =
DeleteRateBasedRule' :: Text -> Text -> DeleteRateBasedRule
DeleteRateBasedRule'
{ $sel:ruleId:DeleteRateBasedRule' :: Text
ruleId = Text
pRuleId_,
$sel:changeToken:DeleteRateBasedRule' :: Text
changeToken = Text
pChangeToken_
}
deleteRateBasedRule_ruleId :: Lens.Lens' DeleteRateBasedRule Prelude.Text
deleteRateBasedRule_ruleId :: (Text -> f Text) -> DeleteRateBasedRule -> f DeleteRateBasedRule
deleteRateBasedRule_ruleId = (DeleteRateBasedRule -> Text)
-> (DeleteRateBasedRule -> Text -> DeleteRateBasedRule)
-> Lens DeleteRateBasedRule DeleteRateBasedRule Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteRateBasedRule' {Text
ruleId :: Text
$sel:ruleId:DeleteRateBasedRule' :: DeleteRateBasedRule -> Text
ruleId} -> Text
ruleId) (\s :: DeleteRateBasedRule
s@DeleteRateBasedRule' {} Text
a -> DeleteRateBasedRule
s {$sel:ruleId:DeleteRateBasedRule' :: Text
ruleId = Text
a} :: DeleteRateBasedRule)
deleteRateBasedRule_changeToken :: Lens.Lens' DeleteRateBasedRule Prelude.Text
deleteRateBasedRule_changeToken :: (Text -> f Text) -> DeleteRateBasedRule -> f DeleteRateBasedRule
deleteRateBasedRule_changeToken = (DeleteRateBasedRule -> Text)
-> (DeleteRateBasedRule -> Text -> DeleteRateBasedRule)
-> Lens DeleteRateBasedRule DeleteRateBasedRule Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteRateBasedRule' {Text
changeToken :: Text
$sel:changeToken:DeleteRateBasedRule' :: DeleteRateBasedRule -> Text
changeToken} -> Text
changeToken) (\s :: DeleteRateBasedRule
s@DeleteRateBasedRule' {} Text
a -> DeleteRateBasedRule
s {$sel:changeToken:DeleteRateBasedRule' :: Text
changeToken = Text
a} :: DeleteRateBasedRule)
instance Core.AWSRequest DeleteRateBasedRule where
type
AWSResponse DeleteRateBasedRule =
DeleteRateBasedRuleResponse
request :: DeleteRateBasedRule -> Request DeleteRateBasedRule
request = Service -> DeleteRateBasedRule -> Request DeleteRateBasedRule
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DeleteRateBasedRule
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DeleteRateBasedRule)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DeleteRateBasedRule))
-> Logger
-> Service
-> Proxy DeleteRateBasedRule
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DeleteRateBasedRule)))
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 -> DeleteRateBasedRuleResponse
DeleteRateBasedRuleResponse'
(Maybe Text -> Int -> DeleteRateBasedRuleResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DeleteRateBasedRuleResponse)
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
"ChangeToken")
Either String (Int -> DeleteRateBasedRuleResponse)
-> Either String Int -> Either String DeleteRateBasedRuleResponse
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 DeleteRateBasedRule
instance Prelude.NFData DeleteRateBasedRule
instance Core.ToHeaders DeleteRateBasedRule where
toHeaders :: DeleteRateBasedRule -> ResponseHeaders
toHeaders =
ResponseHeaders -> DeleteRateBasedRule -> 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
"AWSWAF_Regional_20161128.DeleteRateBasedRule" ::
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 DeleteRateBasedRule where
toJSON :: DeleteRateBasedRule -> Value
toJSON DeleteRateBasedRule' {Text
changeToken :: Text
ruleId :: Text
$sel:changeToken:DeleteRateBasedRule' :: DeleteRateBasedRule -> Text
$sel:ruleId:DeleteRateBasedRule' :: DeleteRateBasedRule -> 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
"RuleId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
ruleId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ChangeToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
changeToken)
]
)
instance Core.ToPath DeleteRateBasedRule where
toPath :: DeleteRateBasedRule -> ByteString
toPath = ByteString -> DeleteRateBasedRule -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DeleteRateBasedRule where
toQuery :: DeleteRateBasedRule -> QueryString
toQuery = QueryString -> DeleteRateBasedRule -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DeleteRateBasedRuleResponse = DeleteRateBasedRuleResponse'
{
DeleteRateBasedRuleResponse -> Maybe Text
changeToken :: Prelude.Maybe Prelude.Text,
DeleteRateBasedRuleResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DeleteRateBasedRuleResponse -> DeleteRateBasedRuleResponse -> Bool
(DeleteRateBasedRuleResponse
-> DeleteRateBasedRuleResponse -> Bool)
-> (DeleteRateBasedRuleResponse
-> DeleteRateBasedRuleResponse -> Bool)
-> Eq DeleteRateBasedRuleResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteRateBasedRuleResponse -> DeleteRateBasedRuleResponse -> Bool
$c/= :: DeleteRateBasedRuleResponse -> DeleteRateBasedRuleResponse -> Bool
== :: DeleteRateBasedRuleResponse -> DeleteRateBasedRuleResponse -> Bool
$c== :: DeleteRateBasedRuleResponse -> DeleteRateBasedRuleResponse -> Bool
Prelude.Eq, ReadPrec [DeleteRateBasedRuleResponse]
ReadPrec DeleteRateBasedRuleResponse
Int -> ReadS DeleteRateBasedRuleResponse
ReadS [DeleteRateBasedRuleResponse]
(Int -> ReadS DeleteRateBasedRuleResponse)
-> ReadS [DeleteRateBasedRuleResponse]
-> ReadPrec DeleteRateBasedRuleResponse
-> ReadPrec [DeleteRateBasedRuleResponse]
-> Read DeleteRateBasedRuleResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteRateBasedRuleResponse]
$creadListPrec :: ReadPrec [DeleteRateBasedRuleResponse]
readPrec :: ReadPrec DeleteRateBasedRuleResponse
$creadPrec :: ReadPrec DeleteRateBasedRuleResponse
readList :: ReadS [DeleteRateBasedRuleResponse]
$creadList :: ReadS [DeleteRateBasedRuleResponse]
readsPrec :: Int -> ReadS DeleteRateBasedRuleResponse
$creadsPrec :: Int -> ReadS DeleteRateBasedRuleResponse
Prelude.Read, Int -> DeleteRateBasedRuleResponse -> ShowS
[DeleteRateBasedRuleResponse] -> ShowS
DeleteRateBasedRuleResponse -> String
(Int -> DeleteRateBasedRuleResponse -> ShowS)
-> (DeleteRateBasedRuleResponse -> String)
-> ([DeleteRateBasedRuleResponse] -> ShowS)
-> Show DeleteRateBasedRuleResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteRateBasedRuleResponse] -> ShowS
$cshowList :: [DeleteRateBasedRuleResponse] -> ShowS
show :: DeleteRateBasedRuleResponse -> String
$cshow :: DeleteRateBasedRuleResponse -> String
showsPrec :: Int -> DeleteRateBasedRuleResponse -> ShowS
$cshowsPrec :: Int -> DeleteRateBasedRuleResponse -> ShowS
Prelude.Show, (forall x.
DeleteRateBasedRuleResponse -> Rep DeleteRateBasedRuleResponse x)
-> (forall x.
Rep DeleteRateBasedRuleResponse x -> DeleteRateBasedRuleResponse)
-> Generic DeleteRateBasedRuleResponse
forall x.
Rep DeleteRateBasedRuleResponse x -> DeleteRateBasedRuleResponse
forall x.
DeleteRateBasedRuleResponse -> Rep DeleteRateBasedRuleResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteRateBasedRuleResponse x -> DeleteRateBasedRuleResponse
$cfrom :: forall x.
DeleteRateBasedRuleResponse -> Rep DeleteRateBasedRuleResponse x
Prelude.Generic)
newDeleteRateBasedRuleResponse ::
Prelude.Int ->
DeleteRateBasedRuleResponse
newDeleteRateBasedRuleResponse :: Int -> DeleteRateBasedRuleResponse
newDeleteRateBasedRuleResponse Int
pHttpStatus_ =
DeleteRateBasedRuleResponse' :: Maybe Text -> Int -> DeleteRateBasedRuleResponse
DeleteRateBasedRuleResponse'
{ $sel:changeToken:DeleteRateBasedRuleResponse' :: Maybe Text
changeToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DeleteRateBasedRuleResponse' :: Int
httpStatus = Int
pHttpStatus_
}
deleteRateBasedRuleResponse_changeToken :: Lens.Lens' DeleteRateBasedRuleResponse (Prelude.Maybe Prelude.Text)
deleteRateBasedRuleResponse_changeToken :: (Maybe Text -> f (Maybe Text))
-> DeleteRateBasedRuleResponse -> f DeleteRateBasedRuleResponse
deleteRateBasedRuleResponse_changeToken = (DeleteRateBasedRuleResponse -> Maybe Text)
-> (DeleteRateBasedRuleResponse
-> Maybe Text -> DeleteRateBasedRuleResponse)
-> Lens
DeleteRateBasedRuleResponse
DeleteRateBasedRuleResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteRateBasedRuleResponse' {Maybe Text
changeToken :: Maybe Text
$sel:changeToken:DeleteRateBasedRuleResponse' :: DeleteRateBasedRuleResponse -> Maybe Text
changeToken} -> Maybe Text
changeToken) (\s :: DeleteRateBasedRuleResponse
s@DeleteRateBasedRuleResponse' {} Maybe Text
a -> DeleteRateBasedRuleResponse
s {$sel:changeToken:DeleteRateBasedRuleResponse' :: Maybe Text
changeToken = Maybe Text
a} :: DeleteRateBasedRuleResponse)
deleteRateBasedRuleResponse_httpStatus :: Lens.Lens' DeleteRateBasedRuleResponse Prelude.Int
deleteRateBasedRuleResponse_httpStatus :: (Int -> f Int)
-> DeleteRateBasedRuleResponse -> f DeleteRateBasedRuleResponse
deleteRateBasedRuleResponse_httpStatus = (DeleteRateBasedRuleResponse -> Int)
-> (DeleteRateBasedRuleResponse
-> Int -> DeleteRateBasedRuleResponse)
-> Lens
DeleteRateBasedRuleResponse DeleteRateBasedRuleResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteRateBasedRuleResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteRateBasedRuleResponse' :: DeleteRateBasedRuleResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteRateBasedRuleResponse
s@DeleteRateBasedRuleResponse' {} Int
a -> DeleteRateBasedRuleResponse
s {$sel:httpStatus:DeleteRateBasedRuleResponse' :: Int
httpStatus = Int
a} :: DeleteRateBasedRuleResponse)
instance Prelude.NFData DeleteRateBasedRuleResponse