{-# 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.CreateSizeConstraintSet
(
CreateSizeConstraintSet (..),
newCreateSizeConstraintSet,
createSizeConstraintSet_name,
createSizeConstraintSet_changeToken,
CreateSizeConstraintSetResponse (..),
newCreateSizeConstraintSetResponse,
createSizeConstraintSetResponse_sizeConstraintSet,
createSizeConstraintSetResponse_changeToken,
createSizeConstraintSetResponse_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 CreateSizeConstraintSet = CreateSizeConstraintSet'
{
CreateSizeConstraintSet -> Text
name :: Prelude.Text,
CreateSizeConstraintSet -> Text
changeToken :: Prelude.Text
}
deriving (CreateSizeConstraintSet -> CreateSizeConstraintSet -> Bool
(CreateSizeConstraintSet -> CreateSizeConstraintSet -> Bool)
-> (CreateSizeConstraintSet -> CreateSizeConstraintSet -> Bool)
-> Eq CreateSizeConstraintSet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateSizeConstraintSet -> CreateSizeConstraintSet -> Bool
$c/= :: CreateSizeConstraintSet -> CreateSizeConstraintSet -> Bool
== :: CreateSizeConstraintSet -> CreateSizeConstraintSet -> Bool
$c== :: CreateSizeConstraintSet -> CreateSizeConstraintSet -> Bool
Prelude.Eq, ReadPrec [CreateSizeConstraintSet]
ReadPrec CreateSizeConstraintSet
Int -> ReadS CreateSizeConstraintSet
ReadS [CreateSizeConstraintSet]
(Int -> ReadS CreateSizeConstraintSet)
-> ReadS [CreateSizeConstraintSet]
-> ReadPrec CreateSizeConstraintSet
-> ReadPrec [CreateSizeConstraintSet]
-> Read CreateSizeConstraintSet
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateSizeConstraintSet]
$creadListPrec :: ReadPrec [CreateSizeConstraintSet]
readPrec :: ReadPrec CreateSizeConstraintSet
$creadPrec :: ReadPrec CreateSizeConstraintSet
readList :: ReadS [CreateSizeConstraintSet]
$creadList :: ReadS [CreateSizeConstraintSet]
readsPrec :: Int -> ReadS CreateSizeConstraintSet
$creadsPrec :: Int -> ReadS CreateSizeConstraintSet
Prelude.Read, Int -> CreateSizeConstraintSet -> ShowS
[CreateSizeConstraintSet] -> ShowS
CreateSizeConstraintSet -> String
(Int -> CreateSizeConstraintSet -> ShowS)
-> (CreateSizeConstraintSet -> String)
-> ([CreateSizeConstraintSet] -> ShowS)
-> Show CreateSizeConstraintSet
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateSizeConstraintSet] -> ShowS
$cshowList :: [CreateSizeConstraintSet] -> ShowS
show :: CreateSizeConstraintSet -> String
$cshow :: CreateSizeConstraintSet -> String
showsPrec :: Int -> CreateSizeConstraintSet -> ShowS
$cshowsPrec :: Int -> CreateSizeConstraintSet -> ShowS
Prelude.Show, (forall x.
CreateSizeConstraintSet -> Rep CreateSizeConstraintSet x)
-> (forall x.
Rep CreateSizeConstraintSet x -> CreateSizeConstraintSet)
-> Generic CreateSizeConstraintSet
forall x. Rep CreateSizeConstraintSet x -> CreateSizeConstraintSet
forall x. CreateSizeConstraintSet -> Rep CreateSizeConstraintSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateSizeConstraintSet x -> CreateSizeConstraintSet
$cfrom :: forall x. CreateSizeConstraintSet -> Rep CreateSizeConstraintSet x
Prelude.Generic)
newCreateSizeConstraintSet ::
Prelude.Text ->
Prelude.Text ->
CreateSizeConstraintSet
newCreateSizeConstraintSet :: Text -> Text -> CreateSizeConstraintSet
newCreateSizeConstraintSet Text
pName_ Text
pChangeToken_ =
CreateSizeConstraintSet' :: Text -> Text -> CreateSizeConstraintSet
CreateSizeConstraintSet'
{ $sel:name:CreateSizeConstraintSet' :: Text
name = Text
pName_,
$sel:changeToken:CreateSizeConstraintSet' :: Text
changeToken = Text
pChangeToken_
}
createSizeConstraintSet_name :: Lens.Lens' CreateSizeConstraintSet Prelude.Text
createSizeConstraintSet_name :: (Text -> f Text)
-> CreateSizeConstraintSet -> f CreateSizeConstraintSet
createSizeConstraintSet_name = (CreateSizeConstraintSet -> Text)
-> (CreateSizeConstraintSet -> Text -> CreateSizeConstraintSet)
-> Lens CreateSizeConstraintSet CreateSizeConstraintSet Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSizeConstraintSet' {Text
name :: Text
$sel:name:CreateSizeConstraintSet' :: CreateSizeConstraintSet -> Text
name} -> Text
name) (\s :: CreateSizeConstraintSet
s@CreateSizeConstraintSet' {} Text
a -> CreateSizeConstraintSet
s {$sel:name:CreateSizeConstraintSet' :: Text
name = Text
a} :: CreateSizeConstraintSet)
createSizeConstraintSet_changeToken :: Lens.Lens' CreateSizeConstraintSet Prelude.Text
createSizeConstraintSet_changeToken :: (Text -> f Text)
-> CreateSizeConstraintSet -> f CreateSizeConstraintSet
createSizeConstraintSet_changeToken = (CreateSizeConstraintSet -> Text)
-> (CreateSizeConstraintSet -> Text -> CreateSizeConstraintSet)
-> Lens CreateSizeConstraintSet CreateSizeConstraintSet Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSizeConstraintSet' {Text
changeToken :: Text
$sel:changeToken:CreateSizeConstraintSet' :: CreateSizeConstraintSet -> Text
changeToken} -> Text
changeToken) (\s :: CreateSizeConstraintSet
s@CreateSizeConstraintSet' {} Text
a -> CreateSizeConstraintSet
s {$sel:changeToken:CreateSizeConstraintSet' :: Text
changeToken = Text
a} :: CreateSizeConstraintSet)
instance Core.AWSRequest CreateSizeConstraintSet where
type
AWSResponse CreateSizeConstraintSet =
CreateSizeConstraintSetResponse
request :: CreateSizeConstraintSet -> Request CreateSizeConstraintSet
request = Service
-> CreateSizeConstraintSet -> Request CreateSizeConstraintSet
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateSizeConstraintSet
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateSizeConstraintSet)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateSizeConstraintSet))
-> Logger
-> Service
-> Proxy CreateSizeConstraintSet
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateSizeConstraintSet)))
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 SizeConstraintSet
-> Maybe Text -> Int -> CreateSizeConstraintSetResponse
CreateSizeConstraintSetResponse'
(Maybe SizeConstraintSet
-> Maybe Text -> Int -> CreateSizeConstraintSetResponse)
-> Either String (Maybe SizeConstraintSet)
-> Either
String (Maybe Text -> Int -> CreateSizeConstraintSetResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe SizeConstraintSet)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"SizeConstraintSet")
Either
String (Maybe Text -> Int -> CreateSizeConstraintSetResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateSizeConstraintSetResponse)
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 -> CreateSizeConstraintSetResponse)
-> Either String Int
-> Either String CreateSizeConstraintSetResponse
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 CreateSizeConstraintSet
instance Prelude.NFData CreateSizeConstraintSet
instance Core.ToHeaders CreateSizeConstraintSet where
toHeaders :: CreateSizeConstraintSet -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateSizeConstraintSet -> 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.CreateSizeConstraintSet" ::
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 CreateSizeConstraintSet where
toJSON :: CreateSizeConstraintSet -> Value
toJSON CreateSizeConstraintSet' {Text
changeToken :: Text
name :: Text
$sel:changeToken:CreateSizeConstraintSet' :: CreateSizeConstraintSet -> Text
$sel:name:CreateSizeConstraintSet' :: CreateSizeConstraintSet -> 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 CreateSizeConstraintSet where
toPath :: CreateSizeConstraintSet -> ByteString
toPath = ByteString -> CreateSizeConstraintSet -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateSizeConstraintSet where
toQuery :: CreateSizeConstraintSet -> QueryString
toQuery = QueryString -> CreateSizeConstraintSet -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateSizeConstraintSetResponse = CreateSizeConstraintSetResponse'
{
CreateSizeConstraintSetResponse -> Maybe SizeConstraintSet
sizeConstraintSet :: Prelude.Maybe SizeConstraintSet,
CreateSizeConstraintSetResponse -> Maybe Text
changeToken :: Prelude.Maybe Prelude.Text,
CreateSizeConstraintSetResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateSizeConstraintSetResponse
-> CreateSizeConstraintSetResponse -> Bool
(CreateSizeConstraintSetResponse
-> CreateSizeConstraintSetResponse -> Bool)
-> (CreateSizeConstraintSetResponse
-> CreateSizeConstraintSetResponse -> Bool)
-> Eq CreateSizeConstraintSetResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateSizeConstraintSetResponse
-> CreateSizeConstraintSetResponse -> Bool
$c/= :: CreateSizeConstraintSetResponse
-> CreateSizeConstraintSetResponse -> Bool
== :: CreateSizeConstraintSetResponse
-> CreateSizeConstraintSetResponse -> Bool
$c== :: CreateSizeConstraintSetResponse
-> CreateSizeConstraintSetResponse -> Bool
Prelude.Eq, ReadPrec [CreateSizeConstraintSetResponse]
ReadPrec CreateSizeConstraintSetResponse
Int -> ReadS CreateSizeConstraintSetResponse
ReadS [CreateSizeConstraintSetResponse]
(Int -> ReadS CreateSizeConstraintSetResponse)
-> ReadS [CreateSizeConstraintSetResponse]
-> ReadPrec CreateSizeConstraintSetResponse
-> ReadPrec [CreateSizeConstraintSetResponse]
-> Read CreateSizeConstraintSetResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateSizeConstraintSetResponse]
$creadListPrec :: ReadPrec [CreateSizeConstraintSetResponse]
readPrec :: ReadPrec CreateSizeConstraintSetResponse
$creadPrec :: ReadPrec CreateSizeConstraintSetResponse
readList :: ReadS [CreateSizeConstraintSetResponse]
$creadList :: ReadS [CreateSizeConstraintSetResponse]
readsPrec :: Int -> ReadS CreateSizeConstraintSetResponse
$creadsPrec :: Int -> ReadS CreateSizeConstraintSetResponse
Prelude.Read, Int -> CreateSizeConstraintSetResponse -> ShowS
[CreateSizeConstraintSetResponse] -> ShowS
CreateSizeConstraintSetResponse -> String
(Int -> CreateSizeConstraintSetResponse -> ShowS)
-> (CreateSizeConstraintSetResponse -> String)
-> ([CreateSizeConstraintSetResponse] -> ShowS)
-> Show CreateSizeConstraintSetResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateSizeConstraintSetResponse] -> ShowS
$cshowList :: [CreateSizeConstraintSetResponse] -> ShowS
show :: CreateSizeConstraintSetResponse -> String
$cshow :: CreateSizeConstraintSetResponse -> String
showsPrec :: Int -> CreateSizeConstraintSetResponse -> ShowS
$cshowsPrec :: Int -> CreateSizeConstraintSetResponse -> ShowS
Prelude.Show, (forall x.
CreateSizeConstraintSetResponse
-> Rep CreateSizeConstraintSetResponse x)
-> (forall x.
Rep CreateSizeConstraintSetResponse x
-> CreateSizeConstraintSetResponse)
-> Generic CreateSizeConstraintSetResponse
forall x.
Rep CreateSizeConstraintSetResponse x
-> CreateSizeConstraintSetResponse
forall x.
CreateSizeConstraintSetResponse
-> Rep CreateSizeConstraintSetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateSizeConstraintSetResponse x
-> CreateSizeConstraintSetResponse
$cfrom :: forall x.
CreateSizeConstraintSetResponse
-> Rep CreateSizeConstraintSetResponse x
Prelude.Generic)
newCreateSizeConstraintSetResponse ::
Prelude.Int ->
CreateSizeConstraintSetResponse
newCreateSizeConstraintSetResponse :: Int -> CreateSizeConstraintSetResponse
newCreateSizeConstraintSetResponse Int
pHttpStatus_ =
CreateSizeConstraintSetResponse' :: Maybe SizeConstraintSet
-> Maybe Text -> Int -> CreateSizeConstraintSetResponse
CreateSizeConstraintSetResponse'
{ $sel:sizeConstraintSet:CreateSizeConstraintSetResponse' :: Maybe SizeConstraintSet
sizeConstraintSet =
Maybe SizeConstraintSet
forall a. Maybe a
Prelude.Nothing,
$sel:changeToken:CreateSizeConstraintSetResponse' :: Maybe Text
changeToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateSizeConstraintSetResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createSizeConstraintSetResponse_sizeConstraintSet :: Lens.Lens' CreateSizeConstraintSetResponse (Prelude.Maybe SizeConstraintSet)
createSizeConstraintSetResponse_sizeConstraintSet :: (Maybe SizeConstraintSet -> f (Maybe SizeConstraintSet))
-> CreateSizeConstraintSetResponse
-> f CreateSizeConstraintSetResponse
createSizeConstraintSetResponse_sizeConstraintSet = (CreateSizeConstraintSetResponse -> Maybe SizeConstraintSet)
-> (CreateSizeConstraintSetResponse
-> Maybe SizeConstraintSet -> CreateSizeConstraintSetResponse)
-> Lens
CreateSizeConstraintSetResponse
CreateSizeConstraintSetResponse
(Maybe SizeConstraintSet)
(Maybe SizeConstraintSet)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSizeConstraintSetResponse' {Maybe SizeConstraintSet
sizeConstraintSet :: Maybe SizeConstraintSet
$sel:sizeConstraintSet:CreateSizeConstraintSetResponse' :: CreateSizeConstraintSetResponse -> Maybe SizeConstraintSet
sizeConstraintSet} -> Maybe SizeConstraintSet
sizeConstraintSet) (\s :: CreateSizeConstraintSetResponse
s@CreateSizeConstraintSetResponse' {} Maybe SizeConstraintSet
a -> CreateSizeConstraintSetResponse
s {$sel:sizeConstraintSet:CreateSizeConstraintSetResponse' :: Maybe SizeConstraintSet
sizeConstraintSet = Maybe SizeConstraintSet
a} :: CreateSizeConstraintSetResponse)
createSizeConstraintSetResponse_changeToken :: Lens.Lens' CreateSizeConstraintSetResponse (Prelude.Maybe Prelude.Text)
createSizeConstraintSetResponse_changeToken :: (Maybe Text -> f (Maybe Text))
-> CreateSizeConstraintSetResponse
-> f CreateSizeConstraintSetResponse
createSizeConstraintSetResponse_changeToken = (CreateSizeConstraintSetResponse -> Maybe Text)
-> (CreateSizeConstraintSetResponse
-> Maybe Text -> CreateSizeConstraintSetResponse)
-> Lens
CreateSizeConstraintSetResponse
CreateSizeConstraintSetResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSizeConstraintSetResponse' {Maybe Text
changeToken :: Maybe Text
$sel:changeToken:CreateSizeConstraintSetResponse' :: CreateSizeConstraintSetResponse -> Maybe Text
changeToken} -> Maybe Text
changeToken) (\s :: CreateSizeConstraintSetResponse
s@CreateSizeConstraintSetResponse' {} Maybe Text
a -> CreateSizeConstraintSetResponse
s {$sel:changeToken:CreateSizeConstraintSetResponse' :: Maybe Text
changeToken = Maybe Text
a} :: CreateSizeConstraintSetResponse)
createSizeConstraintSetResponse_httpStatus :: Lens.Lens' CreateSizeConstraintSetResponse Prelude.Int
createSizeConstraintSetResponse_httpStatus :: (Int -> f Int)
-> CreateSizeConstraintSetResponse
-> f CreateSizeConstraintSetResponse
createSizeConstraintSetResponse_httpStatus = (CreateSizeConstraintSetResponse -> Int)
-> (CreateSizeConstraintSetResponse
-> Int -> CreateSizeConstraintSetResponse)
-> Lens
CreateSizeConstraintSetResponse
CreateSizeConstraintSetResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSizeConstraintSetResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateSizeConstraintSetResponse' :: CreateSizeConstraintSetResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateSizeConstraintSetResponse
s@CreateSizeConstraintSetResponse' {} Int
a -> CreateSizeConstraintSetResponse
s {$sel:httpStatus:CreateSizeConstraintSetResponse' :: Int
httpStatus = Int
a} :: CreateSizeConstraintSetResponse)
instance
Prelude.NFData
CreateSizeConstraintSetResponse