{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.WAFRegional.Types.SizeConstraintSet where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.WAFRegional.Types.SizeConstraint
data SizeConstraintSet = SizeConstraintSet'
{
SizeConstraintSet -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
SizeConstraintSet -> Text
sizeConstraintSetId :: Prelude.Text,
SizeConstraintSet -> [SizeConstraint]
sizeConstraints :: [SizeConstraint]
}
deriving (SizeConstraintSet -> SizeConstraintSet -> Bool
(SizeConstraintSet -> SizeConstraintSet -> Bool)
-> (SizeConstraintSet -> SizeConstraintSet -> Bool)
-> Eq SizeConstraintSet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SizeConstraintSet -> SizeConstraintSet -> Bool
$c/= :: SizeConstraintSet -> SizeConstraintSet -> Bool
== :: SizeConstraintSet -> SizeConstraintSet -> Bool
$c== :: SizeConstraintSet -> SizeConstraintSet -> Bool
Prelude.Eq, ReadPrec [SizeConstraintSet]
ReadPrec SizeConstraintSet
Int -> ReadS SizeConstraintSet
ReadS [SizeConstraintSet]
(Int -> ReadS SizeConstraintSet)
-> ReadS [SizeConstraintSet]
-> ReadPrec SizeConstraintSet
-> ReadPrec [SizeConstraintSet]
-> Read SizeConstraintSet
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SizeConstraintSet]
$creadListPrec :: ReadPrec [SizeConstraintSet]
readPrec :: ReadPrec SizeConstraintSet
$creadPrec :: ReadPrec SizeConstraintSet
readList :: ReadS [SizeConstraintSet]
$creadList :: ReadS [SizeConstraintSet]
readsPrec :: Int -> ReadS SizeConstraintSet
$creadsPrec :: Int -> ReadS SizeConstraintSet
Prelude.Read, Int -> SizeConstraintSet -> ShowS
[SizeConstraintSet] -> ShowS
SizeConstraintSet -> String
(Int -> SizeConstraintSet -> ShowS)
-> (SizeConstraintSet -> String)
-> ([SizeConstraintSet] -> ShowS)
-> Show SizeConstraintSet
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SizeConstraintSet] -> ShowS
$cshowList :: [SizeConstraintSet] -> ShowS
show :: SizeConstraintSet -> String
$cshow :: SizeConstraintSet -> String
showsPrec :: Int -> SizeConstraintSet -> ShowS
$cshowsPrec :: Int -> SizeConstraintSet -> ShowS
Prelude.Show, (forall x. SizeConstraintSet -> Rep SizeConstraintSet x)
-> (forall x. Rep SizeConstraintSet x -> SizeConstraintSet)
-> Generic SizeConstraintSet
forall x. Rep SizeConstraintSet x -> SizeConstraintSet
forall x. SizeConstraintSet -> Rep SizeConstraintSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SizeConstraintSet x -> SizeConstraintSet
$cfrom :: forall x. SizeConstraintSet -> Rep SizeConstraintSet x
Prelude.Generic)
newSizeConstraintSet ::
Prelude.Text ->
SizeConstraintSet
newSizeConstraintSet :: Text -> SizeConstraintSet
newSizeConstraintSet Text
pSizeConstraintSetId_ =
SizeConstraintSet' :: Maybe Text -> Text -> [SizeConstraint] -> SizeConstraintSet
SizeConstraintSet'
{ $sel:name:SizeConstraintSet' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:sizeConstraintSetId:SizeConstraintSet' :: Text
sizeConstraintSetId = Text
pSizeConstraintSetId_,
$sel:sizeConstraints:SizeConstraintSet' :: [SizeConstraint]
sizeConstraints = [SizeConstraint]
forall a. Monoid a => a
Prelude.mempty
}
sizeConstraintSet_name :: Lens.Lens' SizeConstraintSet (Prelude.Maybe Prelude.Text)
sizeConstraintSet_name :: (Maybe Text -> f (Maybe Text))
-> SizeConstraintSet -> f SizeConstraintSet
sizeConstraintSet_name = (SizeConstraintSet -> Maybe Text)
-> (SizeConstraintSet -> Maybe Text -> SizeConstraintSet)
-> Lens
SizeConstraintSet SizeConstraintSet (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SizeConstraintSet' {Maybe Text
name :: Maybe Text
$sel:name:SizeConstraintSet' :: SizeConstraintSet -> Maybe Text
name} -> Maybe Text
name) (\s :: SizeConstraintSet
s@SizeConstraintSet' {} Maybe Text
a -> SizeConstraintSet
s {$sel:name:SizeConstraintSet' :: Maybe Text
name = Maybe Text
a} :: SizeConstraintSet)
sizeConstraintSet_sizeConstraintSetId :: Lens.Lens' SizeConstraintSet Prelude.Text
sizeConstraintSet_sizeConstraintSetId :: (Text -> f Text) -> SizeConstraintSet -> f SizeConstraintSet
sizeConstraintSet_sizeConstraintSetId = (SizeConstraintSet -> Text)
-> (SizeConstraintSet -> Text -> SizeConstraintSet)
-> Lens SizeConstraintSet SizeConstraintSet Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SizeConstraintSet' {Text
sizeConstraintSetId :: Text
$sel:sizeConstraintSetId:SizeConstraintSet' :: SizeConstraintSet -> Text
sizeConstraintSetId} -> Text
sizeConstraintSetId) (\s :: SizeConstraintSet
s@SizeConstraintSet' {} Text
a -> SizeConstraintSet
s {$sel:sizeConstraintSetId:SizeConstraintSet' :: Text
sizeConstraintSetId = Text
a} :: SizeConstraintSet)
sizeConstraintSet_sizeConstraints :: Lens.Lens' SizeConstraintSet [SizeConstraint]
sizeConstraintSet_sizeConstraints :: ([SizeConstraint] -> f [SizeConstraint])
-> SizeConstraintSet -> f SizeConstraintSet
sizeConstraintSet_sizeConstraints = (SizeConstraintSet -> [SizeConstraint])
-> (SizeConstraintSet -> [SizeConstraint] -> SizeConstraintSet)
-> Lens
SizeConstraintSet
SizeConstraintSet
[SizeConstraint]
[SizeConstraint]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SizeConstraintSet' {[SizeConstraint]
sizeConstraints :: [SizeConstraint]
$sel:sizeConstraints:SizeConstraintSet' :: SizeConstraintSet -> [SizeConstraint]
sizeConstraints} -> [SizeConstraint]
sizeConstraints) (\s :: SizeConstraintSet
s@SizeConstraintSet' {} [SizeConstraint]
a -> SizeConstraintSet
s {$sel:sizeConstraints:SizeConstraintSet' :: [SizeConstraint]
sizeConstraints = [SizeConstraint]
a} :: SizeConstraintSet) (([SizeConstraint] -> f [SizeConstraint])
-> SizeConstraintSet -> f SizeConstraintSet)
-> (([SizeConstraint] -> f [SizeConstraint])
-> [SizeConstraint] -> f [SizeConstraint])
-> ([SizeConstraint] -> f [SizeConstraint])
-> SizeConstraintSet
-> f SizeConstraintSet
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([SizeConstraint] -> f [SizeConstraint])
-> [SizeConstraint] -> f [SizeConstraint]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON SizeConstraintSet where
parseJSON :: Value -> Parser SizeConstraintSet
parseJSON =
String
-> (Object -> Parser SizeConstraintSet)
-> Value
-> Parser SizeConstraintSet
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"SizeConstraintSet"
( \Object
x ->
Maybe Text -> Text -> [SizeConstraint] -> SizeConstraintSet
SizeConstraintSet'
(Maybe Text -> Text -> [SizeConstraint] -> SizeConstraintSet)
-> Parser (Maybe Text)
-> Parser (Text -> [SizeConstraint] -> SizeConstraintSet)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Name")
Parser (Text -> [SizeConstraint] -> SizeConstraintSet)
-> Parser Text -> Parser ([SizeConstraint] -> SizeConstraintSet)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"SizeConstraintSetId")
Parser ([SizeConstraint] -> SizeConstraintSet)
-> Parser [SizeConstraint] -> Parser SizeConstraintSet
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe [SizeConstraint])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SizeConstraints"
Parser (Maybe [SizeConstraint])
-> [SizeConstraint] -> Parser [SizeConstraint]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [SizeConstraint]
forall a. Monoid a => a
Prelude.mempty
)
)
instance Prelude.Hashable SizeConstraintSet
instance Prelude.NFData SizeConstraintSet