{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
{ $sel:ruleId:DeleteRateBasedRule' :: Text
ruleId = Text
pRuleId_,
$sel:changeToken:DeleteRateBasedRule' :: Text
changeToken = Text
pChangeToken_
}
deleteRateBasedRule_ruleId :: Lens.Lens' DeleteRateBasedRule Prelude.Text
deleteRateBasedRule_ruleId :: Lens' DeleteRateBasedRule Text
deleteRateBasedRule_ruleId = 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 :: Lens' DeleteRateBasedRule Text
deleteRateBasedRule_changeToken = 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 :: (Service -> Service)
-> DeleteRateBasedRule -> Request DeleteRateBasedRule
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteRateBasedRule
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DeleteRateBasedRule)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Text -> Int -> DeleteRateBasedRuleResponse
DeleteRateBasedRuleResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ChangeToken")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable DeleteRateBasedRule where
hashWithSalt :: Int -> DeleteRateBasedRule -> Int
hashWithSalt Int
_salt DeleteRateBasedRule' {Text
changeToken :: Text
ruleId :: Text
$sel:changeToken:DeleteRateBasedRule' :: DeleteRateBasedRule -> Text
$sel:ruleId:DeleteRateBasedRule' :: DeleteRateBasedRule -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
ruleId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
changeToken
instance Prelude.NFData DeleteRateBasedRule where
rnf :: DeleteRateBasedRule -> ()
rnf DeleteRateBasedRule' {Text
changeToken :: Text
ruleId :: Text
$sel:changeToken:DeleteRateBasedRule' :: DeleteRateBasedRule -> Text
$sel:ruleId:DeleteRateBasedRule' :: DeleteRateBasedRule -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
ruleId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
changeToken
instance Data.ToHeaders DeleteRateBasedRule where
toHeaders :: DeleteRateBasedRule -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AWSWAF_Regional_20161128.DeleteRateBasedRule" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"RuleId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
ruleId),
forall a. a -> Maybe a
Prelude.Just (Key
"ChangeToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
changeToken)
]
)
instance Data.ToPath DeleteRateBasedRule where
toPath :: DeleteRateBasedRule -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery DeleteRateBasedRule where
toQuery :: DeleteRateBasedRule -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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.
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'
{ $sel:changeToken:DeleteRateBasedRuleResponse' :: Maybe Text
changeToken =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DeleteRateBasedRuleResponse' :: Int
httpStatus = Int
pHttpStatus_
}
deleteRateBasedRuleResponse_changeToken :: Lens.Lens' DeleteRateBasedRuleResponse (Prelude.Maybe Prelude.Text)
deleteRateBasedRuleResponse_changeToken :: Lens' DeleteRateBasedRuleResponse (Maybe Text)
deleteRateBasedRuleResponse_changeToken = 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 :: Lens' DeleteRateBasedRuleResponse Int
deleteRateBasedRuleResponse_httpStatus = 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 where
rnf :: DeleteRateBasedRuleResponse -> ()
rnf DeleteRateBasedRuleResponse' {Int
Maybe Text
httpStatus :: Int
changeToken :: Maybe Text
$sel:httpStatus:DeleteRateBasedRuleResponse' :: DeleteRateBasedRuleResponse -> Int
$sel:changeToken:DeleteRateBasedRuleResponse' :: DeleteRateBasedRuleResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
changeToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus