{-# 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.WAF.GetSizeConstraintSet
(
GetSizeConstraintSet (..),
newGetSizeConstraintSet,
getSizeConstraintSet_sizeConstraintSetId,
GetSizeConstraintSetResponse (..),
newGetSizeConstraintSetResponse,
getSizeConstraintSetResponse_sizeConstraintSet,
getSizeConstraintSetResponse_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.WAF.Types
data GetSizeConstraintSet = GetSizeConstraintSet'
{
GetSizeConstraintSet -> Text
sizeConstraintSetId :: Prelude.Text
}
deriving (GetSizeConstraintSet -> GetSizeConstraintSet -> Bool
(GetSizeConstraintSet -> GetSizeConstraintSet -> Bool)
-> (GetSizeConstraintSet -> GetSizeConstraintSet -> Bool)
-> Eq GetSizeConstraintSet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSizeConstraintSet -> GetSizeConstraintSet -> Bool
$c/= :: GetSizeConstraintSet -> GetSizeConstraintSet -> Bool
== :: GetSizeConstraintSet -> GetSizeConstraintSet -> Bool
$c== :: GetSizeConstraintSet -> GetSizeConstraintSet -> Bool
Prelude.Eq, ReadPrec [GetSizeConstraintSet]
ReadPrec GetSizeConstraintSet
Int -> ReadS GetSizeConstraintSet
ReadS [GetSizeConstraintSet]
(Int -> ReadS GetSizeConstraintSet)
-> ReadS [GetSizeConstraintSet]
-> ReadPrec GetSizeConstraintSet
-> ReadPrec [GetSizeConstraintSet]
-> Read GetSizeConstraintSet
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSizeConstraintSet]
$creadListPrec :: ReadPrec [GetSizeConstraintSet]
readPrec :: ReadPrec GetSizeConstraintSet
$creadPrec :: ReadPrec GetSizeConstraintSet
readList :: ReadS [GetSizeConstraintSet]
$creadList :: ReadS [GetSizeConstraintSet]
readsPrec :: Int -> ReadS GetSizeConstraintSet
$creadsPrec :: Int -> ReadS GetSizeConstraintSet
Prelude.Read, Int -> GetSizeConstraintSet -> ShowS
[GetSizeConstraintSet] -> ShowS
GetSizeConstraintSet -> String
(Int -> GetSizeConstraintSet -> ShowS)
-> (GetSizeConstraintSet -> String)
-> ([GetSizeConstraintSet] -> ShowS)
-> Show GetSizeConstraintSet
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSizeConstraintSet] -> ShowS
$cshowList :: [GetSizeConstraintSet] -> ShowS
show :: GetSizeConstraintSet -> String
$cshow :: GetSizeConstraintSet -> String
showsPrec :: Int -> GetSizeConstraintSet -> ShowS
$cshowsPrec :: Int -> GetSizeConstraintSet -> ShowS
Prelude.Show, (forall x. GetSizeConstraintSet -> Rep GetSizeConstraintSet x)
-> (forall x. Rep GetSizeConstraintSet x -> GetSizeConstraintSet)
-> Generic GetSizeConstraintSet
forall x. Rep GetSizeConstraintSet x -> GetSizeConstraintSet
forall x. GetSizeConstraintSet -> Rep GetSizeConstraintSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetSizeConstraintSet x -> GetSizeConstraintSet
$cfrom :: forall x. GetSizeConstraintSet -> Rep GetSizeConstraintSet x
Prelude.Generic)
newGetSizeConstraintSet ::
Prelude.Text ->
GetSizeConstraintSet
newGetSizeConstraintSet :: Text -> GetSizeConstraintSet
newGetSizeConstraintSet Text
pSizeConstraintSetId_ =
GetSizeConstraintSet' :: Text -> GetSizeConstraintSet
GetSizeConstraintSet'
{ $sel:sizeConstraintSetId:GetSizeConstraintSet' :: Text
sizeConstraintSetId =
Text
pSizeConstraintSetId_
}
getSizeConstraintSet_sizeConstraintSetId :: Lens.Lens' GetSizeConstraintSet Prelude.Text
getSizeConstraintSet_sizeConstraintSetId :: (Text -> f Text) -> GetSizeConstraintSet -> f GetSizeConstraintSet
getSizeConstraintSet_sizeConstraintSetId = (GetSizeConstraintSet -> Text)
-> (GetSizeConstraintSet -> Text -> GetSizeConstraintSet)
-> Lens GetSizeConstraintSet GetSizeConstraintSet Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSizeConstraintSet' {Text
sizeConstraintSetId :: Text
$sel:sizeConstraintSetId:GetSizeConstraintSet' :: GetSizeConstraintSet -> Text
sizeConstraintSetId} -> Text
sizeConstraintSetId) (\s :: GetSizeConstraintSet
s@GetSizeConstraintSet' {} Text
a -> GetSizeConstraintSet
s {$sel:sizeConstraintSetId:GetSizeConstraintSet' :: Text
sizeConstraintSetId = Text
a} :: GetSizeConstraintSet)
instance Core.AWSRequest GetSizeConstraintSet where
type
AWSResponse GetSizeConstraintSet =
GetSizeConstraintSetResponse
request :: GetSizeConstraintSet -> Request GetSizeConstraintSet
request = Service -> GetSizeConstraintSet -> Request GetSizeConstraintSet
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetSizeConstraintSet
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetSizeConstraintSet)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetSizeConstraintSet))
-> Logger
-> Service
-> Proxy GetSizeConstraintSet
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetSizeConstraintSet)))
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 -> Int -> GetSizeConstraintSetResponse
GetSizeConstraintSetResponse'
(Maybe SizeConstraintSet -> Int -> GetSizeConstraintSetResponse)
-> Either String (Maybe SizeConstraintSet)
-> Either String (Int -> GetSizeConstraintSetResponse)
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 (Int -> GetSizeConstraintSetResponse)
-> Either String Int -> Either String GetSizeConstraintSetResponse
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 GetSizeConstraintSet
instance Prelude.NFData GetSizeConstraintSet
instance Core.ToHeaders GetSizeConstraintSet where
toHeaders :: GetSizeConstraintSet -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetSizeConstraintSet -> 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_20150824.GetSizeConstraintSet" ::
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 GetSizeConstraintSet where
toJSON :: GetSizeConstraintSet -> Value
toJSON GetSizeConstraintSet' {Text
sizeConstraintSetId :: Text
$sel:sizeConstraintSetId:GetSizeConstraintSet' :: GetSizeConstraintSet -> 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
"SizeConstraintSetId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
sizeConstraintSetId)
]
)
instance Core.ToPath GetSizeConstraintSet where
toPath :: GetSizeConstraintSet -> ByteString
toPath = ByteString -> GetSizeConstraintSet -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetSizeConstraintSet where
toQuery :: GetSizeConstraintSet -> QueryString
toQuery = QueryString -> GetSizeConstraintSet -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetSizeConstraintSetResponse = GetSizeConstraintSetResponse'
{
GetSizeConstraintSetResponse -> Maybe SizeConstraintSet
sizeConstraintSet :: Prelude.Maybe SizeConstraintSet,
GetSizeConstraintSetResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetSizeConstraintSetResponse
-> GetSizeConstraintSetResponse -> Bool
(GetSizeConstraintSetResponse
-> GetSizeConstraintSetResponse -> Bool)
-> (GetSizeConstraintSetResponse
-> GetSizeConstraintSetResponse -> Bool)
-> Eq GetSizeConstraintSetResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSizeConstraintSetResponse
-> GetSizeConstraintSetResponse -> Bool
$c/= :: GetSizeConstraintSetResponse
-> GetSizeConstraintSetResponse -> Bool
== :: GetSizeConstraintSetResponse
-> GetSizeConstraintSetResponse -> Bool
$c== :: GetSizeConstraintSetResponse
-> GetSizeConstraintSetResponse -> Bool
Prelude.Eq, ReadPrec [GetSizeConstraintSetResponse]
ReadPrec GetSizeConstraintSetResponse
Int -> ReadS GetSizeConstraintSetResponse
ReadS [GetSizeConstraintSetResponse]
(Int -> ReadS GetSizeConstraintSetResponse)
-> ReadS [GetSizeConstraintSetResponse]
-> ReadPrec GetSizeConstraintSetResponse
-> ReadPrec [GetSizeConstraintSetResponse]
-> Read GetSizeConstraintSetResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSizeConstraintSetResponse]
$creadListPrec :: ReadPrec [GetSizeConstraintSetResponse]
readPrec :: ReadPrec GetSizeConstraintSetResponse
$creadPrec :: ReadPrec GetSizeConstraintSetResponse
readList :: ReadS [GetSizeConstraintSetResponse]
$creadList :: ReadS [GetSizeConstraintSetResponse]
readsPrec :: Int -> ReadS GetSizeConstraintSetResponse
$creadsPrec :: Int -> ReadS GetSizeConstraintSetResponse
Prelude.Read, Int -> GetSizeConstraintSetResponse -> ShowS
[GetSizeConstraintSetResponse] -> ShowS
GetSizeConstraintSetResponse -> String
(Int -> GetSizeConstraintSetResponse -> ShowS)
-> (GetSizeConstraintSetResponse -> String)
-> ([GetSizeConstraintSetResponse] -> ShowS)
-> Show GetSizeConstraintSetResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSizeConstraintSetResponse] -> ShowS
$cshowList :: [GetSizeConstraintSetResponse] -> ShowS
show :: GetSizeConstraintSetResponse -> String
$cshow :: GetSizeConstraintSetResponse -> String
showsPrec :: Int -> GetSizeConstraintSetResponse -> ShowS
$cshowsPrec :: Int -> GetSizeConstraintSetResponse -> ShowS
Prelude.Show, (forall x.
GetSizeConstraintSetResponse -> Rep GetSizeConstraintSetResponse x)
-> (forall x.
Rep GetSizeConstraintSetResponse x -> GetSizeConstraintSetResponse)
-> Generic GetSizeConstraintSetResponse
forall x.
Rep GetSizeConstraintSetResponse x -> GetSizeConstraintSetResponse
forall x.
GetSizeConstraintSetResponse -> Rep GetSizeConstraintSetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetSizeConstraintSetResponse x -> GetSizeConstraintSetResponse
$cfrom :: forall x.
GetSizeConstraintSetResponse -> Rep GetSizeConstraintSetResponse x
Prelude.Generic)
newGetSizeConstraintSetResponse ::
Prelude.Int ->
GetSizeConstraintSetResponse
newGetSizeConstraintSetResponse :: Int -> GetSizeConstraintSetResponse
newGetSizeConstraintSetResponse Int
pHttpStatus_ =
GetSizeConstraintSetResponse' :: Maybe SizeConstraintSet -> Int -> GetSizeConstraintSetResponse
GetSizeConstraintSetResponse'
{ $sel:sizeConstraintSet:GetSizeConstraintSetResponse' :: Maybe SizeConstraintSet
sizeConstraintSet =
Maybe SizeConstraintSet
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetSizeConstraintSetResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getSizeConstraintSetResponse_sizeConstraintSet :: Lens.Lens' GetSizeConstraintSetResponse (Prelude.Maybe SizeConstraintSet)
getSizeConstraintSetResponse_sizeConstraintSet :: (Maybe SizeConstraintSet -> f (Maybe SizeConstraintSet))
-> GetSizeConstraintSetResponse -> f GetSizeConstraintSetResponse
getSizeConstraintSetResponse_sizeConstraintSet = (GetSizeConstraintSetResponse -> Maybe SizeConstraintSet)
-> (GetSizeConstraintSetResponse
-> Maybe SizeConstraintSet -> GetSizeConstraintSetResponse)
-> Lens
GetSizeConstraintSetResponse
GetSizeConstraintSetResponse
(Maybe SizeConstraintSet)
(Maybe SizeConstraintSet)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSizeConstraintSetResponse' {Maybe SizeConstraintSet
sizeConstraintSet :: Maybe SizeConstraintSet
$sel:sizeConstraintSet:GetSizeConstraintSetResponse' :: GetSizeConstraintSetResponse -> Maybe SizeConstraintSet
sizeConstraintSet} -> Maybe SizeConstraintSet
sizeConstraintSet) (\s :: GetSizeConstraintSetResponse
s@GetSizeConstraintSetResponse' {} Maybe SizeConstraintSet
a -> GetSizeConstraintSetResponse
s {$sel:sizeConstraintSet:GetSizeConstraintSetResponse' :: Maybe SizeConstraintSet
sizeConstraintSet = Maybe SizeConstraintSet
a} :: GetSizeConstraintSetResponse)
getSizeConstraintSetResponse_httpStatus :: Lens.Lens' GetSizeConstraintSetResponse Prelude.Int
getSizeConstraintSetResponse_httpStatus :: (Int -> f Int)
-> GetSizeConstraintSetResponse -> f GetSizeConstraintSetResponse
getSizeConstraintSetResponse_httpStatus = (GetSizeConstraintSetResponse -> Int)
-> (GetSizeConstraintSetResponse
-> Int -> GetSizeConstraintSetResponse)
-> Lens
GetSizeConstraintSetResponse GetSizeConstraintSetResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSizeConstraintSetResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetSizeConstraintSetResponse' :: GetSizeConstraintSetResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetSizeConstraintSetResponse
s@GetSizeConstraintSetResponse' {} Int
a -> GetSizeConstraintSetResponse
s {$sel:httpStatus:GetSizeConstraintSetResponse' :: Int
httpStatus = Int
a} :: GetSizeConstraintSetResponse)
instance Prelude.NFData GetSizeConstraintSetResponse