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