{-# 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.NetworkFirewall.Types.IPSet where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data IPSet = IPSet'
{
IPSet -> [Text]
definition :: [Prelude.Text]
}
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 ::
IPSet
newIPSet :: IPSet
newIPSet = IPSet' :: [Text] -> IPSet
IPSet' {$sel:definition:IPSet' :: [Text]
definition = [Text]
forall a. Monoid a => a
Prelude.mempty}
iPSet_definition :: Lens.Lens' IPSet [Prelude.Text]
iPSet_definition :: ([Text] -> f [Text]) -> IPSet -> f IPSet
iPSet_definition = (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]
definition :: [Text]
$sel:definition:IPSet' :: IPSet -> [Text]
definition} -> [Text]
definition) (\s :: IPSet
s@IPSet' {} [Text]
a -> IPSet
s {$sel:definition:IPSet' :: [Text]
definition = [Text]
a} :: IPSet) (([Text] -> f [Text]) -> IPSet -> f IPSet)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> IPSet
-> f IPSet
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
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 ->
[Text] -> IPSet
IPSet'
([Text] -> IPSet) -> Parser [Text] -> Parser 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
"Definition" Parser (Maybe [Text]) -> [Text] -> Parser [Text]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [Text]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable IPSet
instance Prelude.NFData IPSet
instance Core.ToJSON IPSet where
toJSON :: IPSet -> Value
toJSON IPSet' {[Text]
definition :: [Text]
$sel:definition:IPSet' :: IPSet -> [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
"Definition" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
definition)]
)