{-# 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.CreateByteMatchSet
(
CreateByteMatchSet (..),
newCreateByteMatchSet,
createByteMatchSet_name,
createByteMatchSet_changeToken,
CreateByteMatchSetResponse (..),
newCreateByteMatchSetResponse,
createByteMatchSetResponse_byteMatchSet,
createByteMatchSetResponse_changeToken,
createByteMatchSetResponse_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 CreateByteMatchSet = CreateByteMatchSet'
{
CreateByteMatchSet -> Text
name :: Prelude.Text,
CreateByteMatchSet -> Text
changeToken :: Prelude.Text
}
deriving (CreateByteMatchSet -> CreateByteMatchSet -> Bool
(CreateByteMatchSet -> CreateByteMatchSet -> Bool)
-> (CreateByteMatchSet -> CreateByteMatchSet -> Bool)
-> Eq CreateByteMatchSet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateByteMatchSet -> CreateByteMatchSet -> Bool
$c/= :: CreateByteMatchSet -> CreateByteMatchSet -> Bool
== :: CreateByteMatchSet -> CreateByteMatchSet -> Bool
$c== :: CreateByteMatchSet -> CreateByteMatchSet -> Bool
Prelude.Eq, ReadPrec [CreateByteMatchSet]
ReadPrec CreateByteMatchSet
Int -> ReadS CreateByteMatchSet
ReadS [CreateByteMatchSet]
(Int -> ReadS CreateByteMatchSet)
-> ReadS [CreateByteMatchSet]
-> ReadPrec CreateByteMatchSet
-> ReadPrec [CreateByteMatchSet]
-> Read CreateByteMatchSet
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateByteMatchSet]
$creadListPrec :: ReadPrec [CreateByteMatchSet]
readPrec :: ReadPrec CreateByteMatchSet
$creadPrec :: ReadPrec CreateByteMatchSet
readList :: ReadS [CreateByteMatchSet]
$creadList :: ReadS [CreateByteMatchSet]
readsPrec :: Int -> ReadS CreateByteMatchSet
$creadsPrec :: Int -> ReadS CreateByteMatchSet
Prelude.Read, Int -> CreateByteMatchSet -> ShowS
[CreateByteMatchSet] -> ShowS
CreateByteMatchSet -> String
(Int -> CreateByteMatchSet -> ShowS)
-> (CreateByteMatchSet -> String)
-> ([CreateByteMatchSet] -> ShowS)
-> Show CreateByteMatchSet
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateByteMatchSet] -> ShowS
$cshowList :: [CreateByteMatchSet] -> ShowS
show :: CreateByteMatchSet -> String
$cshow :: CreateByteMatchSet -> String
showsPrec :: Int -> CreateByteMatchSet -> ShowS
$cshowsPrec :: Int -> CreateByteMatchSet -> ShowS
Prelude.Show, (forall x. CreateByteMatchSet -> Rep CreateByteMatchSet x)
-> (forall x. Rep CreateByteMatchSet x -> CreateByteMatchSet)
-> Generic CreateByteMatchSet
forall x. Rep CreateByteMatchSet x -> CreateByteMatchSet
forall x. CreateByteMatchSet -> Rep CreateByteMatchSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateByteMatchSet x -> CreateByteMatchSet
$cfrom :: forall x. CreateByteMatchSet -> Rep CreateByteMatchSet x
Prelude.Generic)
newCreateByteMatchSet ::
Prelude.Text ->
Prelude.Text ->
CreateByteMatchSet
newCreateByteMatchSet :: Text -> Text -> CreateByteMatchSet
newCreateByteMatchSet Text
pName_ Text
pChangeToken_ =
CreateByteMatchSet' :: Text -> Text -> CreateByteMatchSet
CreateByteMatchSet'
{ $sel:name:CreateByteMatchSet' :: Text
name = Text
pName_,
$sel:changeToken:CreateByteMatchSet' :: Text
changeToken = Text
pChangeToken_
}
createByteMatchSet_name :: Lens.Lens' CreateByteMatchSet Prelude.Text
createByteMatchSet_name :: (Text -> f Text) -> CreateByteMatchSet -> f CreateByteMatchSet
createByteMatchSet_name = (CreateByteMatchSet -> Text)
-> (CreateByteMatchSet -> Text -> CreateByteMatchSet)
-> Lens CreateByteMatchSet CreateByteMatchSet Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateByteMatchSet' {Text
name :: Text
$sel:name:CreateByteMatchSet' :: CreateByteMatchSet -> Text
name} -> Text
name) (\s :: CreateByteMatchSet
s@CreateByteMatchSet' {} Text
a -> CreateByteMatchSet
s {$sel:name:CreateByteMatchSet' :: Text
name = Text
a} :: CreateByteMatchSet)
createByteMatchSet_changeToken :: Lens.Lens' CreateByteMatchSet Prelude.Text
createByteMatchSet_changeToken :: (Text -> f Text) -> CreateByteMatchSet -> f CreateByteMatchSet
createByteMatchSet_changeToken = (CreateByteMatchSet -> Text)
-> (CreateByteMatchSet -> Text -> CreateByteMatchSet)
-> Lens CreateByteMatchSet CreateByteMatchSet Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateByteMatchSet' {Text
changeToken :: Text
$sel:changeToken:CreateByteMatchSet' :: CreateByteMatchSet -> Text
changeToken} -> Text
changeToken) (\s :: CreateByteMatchSet
s@CreateByteMatchSet' {} Text
a -> CreateByteMatchSet
s {$sel:changeToken:CreateByteMatchSet' :: Text
changeToken = Text
a} :: CreateByteMatchSet)
instance Core.AWSRequest CreateByteMatchSet where
type
AWSResponse CreateByteMatchSet =
CreateByteMatchSetResponse
request :: CreateByteMatchSet -> Request CreateByteMatchSet
request = Service -> CreateByteMatchSet -> Request CreateByteMatchSet
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateByteMatchSet
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateByteMatchSet)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateByteMatchSet))
-> Logger
-> Service
-> Proxy CreateByteMatchSet
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateByteMatchSet)))
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 ByteMatchSet
-> Maybe Text -> Int -> CreateByteMatchSetResponse
CreateByteMatchSetResponse'
(Maybe ByteMatchSet
-> Maybe Text -> Int -> CreateByteMatchSetResponse)
-> Either String (Maybe ByteMatchSet)
-> Either String (Maybe Text -> Int -> CreateByteMatchSetResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ByteMatchSet)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ByteMatchSet")
Either String (Maybe Text -> Int -> CreateByteMatchSetResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateByteMatchSetResponse)
forall (f :: * -> *) a b. Applicative f => 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 -> CreateByteMatchSetResponse)
-> Either String Int -> Either String CreateByteMatchSetResponse
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 CreateByteMatchSet
instance Prelude.NFData CreateByteMatchSet
instance Core.ToHeaders CreateByteMatchSet where
toHeaders :: CreateByteMatchSet -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateByteMatchSet -> 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.CreateByteMatchSet" ::
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 CreateByteMatchSet where
toJSON :: CreateByteMatchSet -> Value
toJSON CreateByteMatchSet' {Text
changeToken :: Text
name :: Text
$sel:changeToken:CreateByteMatchSet' :: CreateByteMatchSet -> Text
$sel:name:CreateByteMatchSet' :: CreateByteMatchSet -> 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
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
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 CreateByteMatchSet where
toPath :: CreateByteMatchSet -> ByteString
toPath = ByteString -> CreateByteMatchSet -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateByteMatchSet where
toQuery :: CreateByteMatchSet -> QueryString
toQuery = QueryString -> CreateByteMatchSet -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateByteMatchSetResponse = CreateByteMatchSetResponse'
{
CreateByteMatchSetResponse -> Maybe ByteMatchSet
byteMatchSet :: Prelude.Maybe ByteMatchSet,
CreateByteMatchSetResponse -> Maybe Text
changeToken :: Prelude.Maybe Prelude.Text,
CreateByteMatchSetResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateByteMatchSetResponse -> CreateByteMatchSetResponse -> Bool
(CreateByteMatchSetResponse -> CreateByteMatchSetResponse -> Bool)
-> (CreateByteMatchSetResponse
-> CreateByteMatchSetResponse -> Bool)
-> Eq CreateByteMatchSetResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateByteMatchSetResponse -> CreateByteMatchSetResponse -> Bool
$c/= :: CreateByteMatchSetResponse -> CreateByteMatchSetResponse -> Bool
== :: CreateByteMatchSetResponse -> CreateByteMatchSetResponse -> Bool
$c== :: CreateByteMatchSetResponse -> CreateByteMatchSetResponse -> Bool
Prelude.Eq, ReadPrec [CreateByteMatchSetResponse]
ReadPrec CreateByteMatchSetResponse
Int -> ReadS CreateByteMatchSetResponse
ReadS [CreateByteMatchSetResponse]
(Int -> ReadS CreateByteMatchSetResponse)
-> ReadS [CreateByteMatchSetResponse]
-> ReadPrec CreateByteMatchSetResponse
-> ReadPrec [CreateByteMatchSetResponse]
-> Read CreateByteMatchSetResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateByteMatchSetResponse]
$creadListPrec :: ReadPrec [CreateByteMatchSetResponse]
readPrec :: ReadPrec CreateByteMatchSetResponse
$creadPrec :: ReadPrec CreateByteMatchSetResponse
readList :: ReadS [CreateByteMatchSetResponse]
$creadList :: ReadS [CreateByteMatchSetResponse]
readsPrec :: Int -> ReadS CreateByteMatchSetResponse
$creadsPrec :: Int -> ReadS CreateByteMatchSetResponse
Prelude.Read, Int -> CreateByteMatchSetResponse -> ShowS
[CreateByteMatchSetResponse] -> ShowS
CreateByteMatchSetResponse -> String
(Int -> CreateByteMatchSetResponse -> ShowS)
-> (CreateByteMatchSetResponse -> String)
-> ([CreateByteMatchSetResponse] -> ShowS)
-> Show CreateByteMatchSetResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateByteMatchSetResponse] -> ShowS
$cshowList :: [CreateByteMatchSetResponse] -> ShowS
show :: CreateByteMatchSetResponse -> String
$cshow :: CreateByteMatchSetResponse -> String
showsPrec :: Int -> CreateByteMatchSetResponse -> ShowS
$cshowsPrec :: Int -> CreateByteMatchSetResponse -> ShowS
Prelude.Show, (forall x.
CreateByteMatchSetResponse -> Rep CreateByteMatchSetResponse x)
-> (forall x.
Rep CreateByteMatchSetResponse x -> CreateByteMatchSetResponse)
-> Generic CreateByteMatchSetResponse
forall x.
Rep CreateByteMatchSetResponse x -> CreateByteMatchSetResponse
forall x.
CreateByteMatchSetResponse -> Rep CreateByteMatchSetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateByteMatchSetResponse x -> CreateByteMatchSetResponse
$cfrom :: forall x.
CreateByteMatchSetResponse -> Rep CreateByteMatchSetResponse x
Prelude.Generic)
newCreateByteMatchSetResponse ::
Prelude.Int ->
CreateByteMatchSetResponse
newCreateByteMatchSetResponse :: Int -> CreateByteMatchSetResponse
newCreateByteMatchSetResponse Int
pHttpStatus_ =
CreateByteMatchSetResponse' :: Maybe ByteMatchSet
-> Maybe Text -> Int -> CreateByteMatchSetResponse
CreateByteMatchSetResponse'
{ $sel:byteMatchSet:CreateByteMatchSetResponse' :: Maybe ByteMatchSet
byteMatchSet =
Maybe ByteMatchSet
forall a. Maybe a
Prelude.Nothing,
$sel:changeToken:CreateByteMatchSetResponse' :: Maybe Text
changeToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateByteMatchSetResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createByteMatchSetResponse_byteMatchSet :: Lens.Lens' CreateByteMatchSetResponse (Prelude.Maybe ByteMatchSet)
createByteMatchSetResponse_byteMatchSet :: (Maybe ByteMatchSet -> f (Maybe ByteMatchSet))
-> CreateByteMatchSetResponse -> f CreateByteMatchSetResponse
createByteMatchSetResponse_byteMatchSet = (CreateByteMatchSetResponse -> Maybe ByteMatchSet)
-> (CreateByteMatchSetResponse
-> Maybe ByteMatchSet -> CreateByteMatchSetResponse)
-> Lens
CreateByteMatchSetResponse
CreateByteMatchSetResponse
(Maybe ByteMatchSet)
(Maybe ByteMatchSet)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateByteMatchSetResponse' {Maybe ByteMatchSet
byteMatchSet :: Maybe ByteMatchSet
$sel:byteMatchSet:CreateByteMatchSetResponse' :: CreateByteMatchSetResponse -> Maybe ByteMatchSet
byteMatchSet} -> Maybe ByteMatchSet
byteMatchSet) (\s :: CreateByteMatchSetResponse
s@CreateByteMatchSetResponse' {} Maybe ByteMatchSet
a -> CreateByteMatchSetResponse
s {$sel:byteMatchSet:CreateByteMatchSetResponse' :: Maybe ByteMatchSet
byteMatchSet = Maybe ByteMatchSet
a} :: CreateByteMatchSetResponse)
createByteMatchSetResponse_changeToken :: Lens.Lens' CreateByteMatchSetResponse (Prelude.Maybe Prelude.Text)
createByteMatchSetResponse_changeToken :: (Maybe Text -> f (Maybe Text))
-> CreateByteMatchSetResponse -> f CreateByteMatchSetResponse
createByteMatchSetResponse_changeToken = (CreateByteMatchSetResponse -> Maybe Text)
-> (CreateByteMatchSetResponse
-> Maybe Text -> CreateByteMatchSetResponse)
-> Lens
CreateByteMatchSetResponse
CreateByteMatchSetResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateByteMatchSetResponse' {Maybe Text
changeToken :: Maybe Text
$sel:changeToken:CreateByteMatchSetResponse' :: CreateByteMatchSetResponse -> Maybe Text
changeToken} -> Maybe Text
changeToken) (\s :: CreateByteMatchSetResponse
s@CreateByteMatchSetResponse' {} Maybe Text
a -> CreateByteMatchSetResponse
s {$sel:changeToken:CreateByteMatchSetResponse' :: Maybe Text
changeToken = Maybe Text
a} :: CreateByteMatchSetResponse)
createByteMatchSetResponse_httpStatus :: Lens.Lens' CreateByteMatchSetResponse Prelude.Int
createByteMatchSetResponse_httpStatus :: (Int -> f Int)
-> CreateByteMatchSetResponse -> f CreateByteMatchSetResponse
createByteMatchSetResponse_httpStatus = (CreateByteMatchSetResponse -> Int)
-> (CreateByteMatchSetResponse
-> Int -> CreateByteMatchSetResponse)
-> Lens
CreateByteMatchSetResponse CreateByteMatchSetResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateByteMatchSetResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateByteMatchSetResponse' :: CreateByteMatchSetResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateByteMatchSetResponse
s@CreateByteMatchSetResponse' {} Int
a -> CreateByteMatchSetResponse
s {$sel:httpStatus:CreateByteMatchSetResponse' :: Int
httpStatus = Int
a} :: CreateByteMatchSetResponse)
instance Prelude.NFData CreateByteMatchSetResponse