{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
{ $sel:name:IPSet' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
$sel:iPSetId:IPSet' :: Text
iPSetId = Text
pIPSetId_,
$sel:iPSetDescriptors:IPSet' :: [IPSetDescriptor]
iPSetDescriptors = forall a. Monoid a => a
Prelude.mempty
}
iPSet_name :: Lens.Lens' IPSet (Prelude.Maybe Prelude.Text)
iPSet_name :: Lens' IPSet (Maybe Text)
iPSet_name = 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 :: Lens' IPSet Text
iPSet_iPSetId = 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 :: Lens' IPSet [IPSetDescriptor]
iPSet_iPSetDescriptors = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Data.FromJSON IPSet where
parseJSON :: Value -> Parser IPSet
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"IPSet"
( \Object
x ->
Maybe Text -> Text -> [IPSetDescriptor] -> IPSet
IPSet'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Name")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"IPSetId")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"IPSetDescriptors"
forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
)
)
instance Prelude.Hashable IPSet where
hashWithSalt :: Int -> IPSet -> Int
hashWithSalt Int
_salt IPSet' {[IPSetDescriptor]
Maybe Text
Text
iPSetDescriptors :: [IPSetDescriptor]
iPSetId :: Text
name :: Maybe Text
$sel:iPSetDescriptors:IPSet' :: IPSet -> [IPSetDescriptor]
$sel:iPSetId:IPSet' :: IPSet -> Text
$sel:name:IPSet' :: IPSet -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
iPSetId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [IPSetDescriptor]
iPSetDescriptors
instance Prelude.NFData IPSet where
rnf :: IPSet -> ()
rnf IPSet' {[IPSetDescriptor]
Maybe Text
Text
iPSetDescriptors :: [IPSetDescriptor]
iPSetId :: Text
name :: Maybe Text
$sel:iPSetDescriptors:IPSet' :: IPSet -> [IPSetDescriptor]
$sel:iPSetId:IPSet' :: IPSet -> Text
$sel:name:IPSet' :: IPSet -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
iPSetId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [IPSetDescriptor]
iPSetDescriptors