{-# 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.WAF.Types.IPSet where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.WAF.Types.IPSetDescriptor
data IPSet = IPSet'
{
IPSet -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
IPSet -> Text
iPSetId :: Prelude.Text,
IPSet -> [IPSetDescriptor]
iPSetDescriptors :: [IPSetDescriptor]
}
deriving (IPSet -> IPSet -> Bool
(IPSet -> IPSet -> Bool) -> (IPSet -> IPSet -> Bool) -> Eq IPSet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IPSet -> IPSet -> Bool
$c/= :: IPSet -> IPSet -> Bool
== :: IPSet -> IPSet -> Bool
$c== :: IPSet -> IPSet -> Bool
Prelude.Eq, ReadPrec [IPSet]
ReadPrec IPSet
Int -> ReadS IPSet
ReadS [IPSet]
(Int -> ReadS IPSet)
-> ReadS [IPSet]
-> ReadPrec IPSet
-> ReadPrec [IPSet]
-> Read IPSet
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IPSet]
$creadListPrec :: ReadPrec [IPSet]
readPrec :: ReadPrec IPSet
$creadPrec :: ReadPrec IPSet
readList :: ReadS [IPSet]
$creadList :: ReadS [IPSet]
readsPrec :: Int -> ReadS IPSet
$creadsPrec :: Int -> ReadS IPSet
Prelude.Read, Int -> IPSet -> ShowS
[IPSet] -> ShowS
IPSet -> String
(Int -> IPSet -> ShowS)
-> (IPSet -> String) -> ([IPSet] -> ShowS) -> Show IPSet
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IPSet] -> ShowS
$cshowList :: [IPSet] -> ShowS
show :: IPSet -> String
$cshow :: IPSet -> String
showsPrec :: Int -> IPSet -> ShowS
$cshowsPrec :: Int -> IPSet -> ShowS
Prelude.Show, (forall x. IPSet -> Rep IPSet x)
-> (forall x. Rep IPSet x -> IPSet) -> Generic IPSet
forall x. Rep IPSet x -> IPSet
forall x. IPSet -> Rep IPSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IPSet x -> IPSet
$cfrom :: forall x. IPSet -> Rep IPSet x
Prelude.Generic)
newIPSet ::
Prelude.Text ->
IPSet
newIPSet :: Text -> IPSet
newIPSet Text
pIPSetId_ =
IPSet' :: Maybe Text -> Text -> [IPSetDescriptor] -> IPSet
IPSet'
{ $sel:name:IPSet' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:iPSetId:IPSet' :: Text
iPSetId = Text
pIPSetId_,
$sel:iPSetDescriptors:IPSet' :: [IPSetDescriptor]
iPSetDescriptors = [IPSetDescriptor]
forall a. Monoid a => a
Prelude.mempty
}
iPSet_name :: Lens.Lens' IPSet (Prelude.Maybe Prelude.Text)
iPSet_name :: (Maybe Text -> f (Maybe Text)) -> IPSet -> f IPSet
iPSet_name = (IPSet -> Maybe Text)
-> (IPSet -> Maybe Text -> IPSet)
-> Lens IPSet IPSet (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IPSet' {Maybe Text
name :: Maybe Text
$sel:name:IPSet' :: IPSet -> Maybe Text
name} -> Maybe Text
name) (\s :: IPSet
s@IPSet' {} Maybe Text
a -> IPSet
s {$sel:name:IPSet' :: Maybe Text
name = Maybe Text
a} :: IPSet)
iPSet_iPSetId :: Lens.Lens' IPSet Prelude.Text
iPSet_iPSetId :: (Text -> f Text) -> IPSet -> f IPSet
iPSet_iPSetId = (IPSet -> Text)
-> (IPSet -> Text -> IPSet) -> Lens IPSet IPSet Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IPSet' {Text
iPSetId :: Text
$sel:iPSetId:IPSet' :: IPSet -> Text
iPSetId} -> Text
iPSetId) (\s :: IPSet
s@IPSet' {} Text
a -> IPSet
s {$sel:iPSetId:IPSet' :: Text
iPSetId = Text
a} :: IPSet)
iPSet_iPSetDescriptors :: Lens.Lens' IPSet [IPSetDescriptor]
iPSet_iPSetDescriptors :: ([IPSetDescriptor] -> f [IPSetDescriptor]) -> IPSet -> f IPSet
iPSet_iPSetDescriptors = (IPSet -> [IPSetDescriptor])
-> (IPSet -> [IPSetDescriptor] -> IPSet)
-> Lens IPSet IPSet [IPSetDescriptor] [IPSetDescriptor]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IPSet' {[IPSetDescriptor]
iPSetDescriptors :: [IPSetDescriptor]
$sel:iPSetDescriptors:IPSet' :: IPSet -> [IPSetDescriptor]
iPSetDescriptors} -> [IPSetDescriptor]
iPSetDescriptors) (\s :: IPSet
s@IPSet' {} [IPSetDescriptor]
a -> IPSet
s {$sel:iPSetDescriptors:IPSet' :: [IPSetDescriptor]
iPSetDescriptors = [IPSetDescriptor]
a} :: IPSet) (([IPSetDescriptor] -> f [IPSetDescriptor]) -> IPSet -> f IPSet)
-> (([IPSetDescriptor] -> f [IPSetDescriptor])
-> [IPSetDescriptor] -> f [IPSetDescriptor])
-> ([IPSetDescriptor] -> f [IPSetDescriptor])
-> IPSet
-> f IPSet
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([IPSetDescriptor] -> f [IPSetDescriptor])
-> [IPSetDescriptor] -> f [IPSetDescriptor]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON IPSet where
parseJSON :: Value -> Parser IPSet
parseJSON =
String -> (Object -> Parser IPSet) -> Value -> Parser IPSet
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"IPSet"
( \Object
x ->
Maybe Text -> Text -> [IPSetDescriptor] -> IPSet
IPSet'
(Maybe Text -> Text -> [IPSetDescriptor] -> IPSet)
-> Parser (Maybe Text)
-> Parser (Text -> [IPSetDescriptor] -> IPSet)
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 -> [IPSetDescriptor] -> IPSet)
-> Parser Text -> Parser ([IPSetDescriptor] -> IPSet)
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
"IPSetId")
Parser ([IPSetDescriptor] -> IPSet)
-> Parser [IPSetDescriptor] -> Parser IPSet
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe [IPSetDescriptor])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"IPSetDescriptors"
Parser (Maybe [IPSetDescriptor])
-> [IPSetDescriptor] -> Parser [IPSetDescriptor]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [IPSetDescriptor]
forall a. Monoid a => a
Prelude.mempty
)
)
instance Prelude.Hashable IPSet
instance Prelude.NFData IPSet