{-# 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.RulesSourceList where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.NetworkFirewall.Types.GeneratedRulesType
import Amazonka.NetworkFirewall.Types.TargetType
import qualified Amazonka.Prelude as Prelude
data RulesSourceList = RulesSourceList'
{
RulesSourceList -> [Text]
targets :: [Prelude.Text],
RulesSourceList -> [TargetType]
targetTypes :: [TargetType],
RulesSourceList -> GeneratedRulesType
generatedRulesType :: GeneratedRulesType
}
deriving (RulesSourceList -> RulesSourceList -> Bool
(RulesSourceList -> RulesSourceList -> Bool)
-> (RulesSourceList -> RulesSourceList -> Bool)
-> Eq RulesSourceList
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RulesSourceList -> RulesSourceList -> Bool
$c/= :: RulesSourceList -> RulesSourceList -> Bool
== :: RulesSourceList -> RulesSourceList -> Bool
$c== :: RulesSourceList -> RulesSourceList -> Bool
Prelude.Eq, ReadPrec [RulesSourceList]
ReadPrec RulesSourceList
Int -> ReadS RulesSourceList
ReadS [RulesSourceList]
(Int -> ReadS RulesSourceList)
-> ReadS [RulesSourceList]
-> ReadPrec RulesSourceList
-> ReadPrec [RulesSourceList]
-> Read RulesSourceList
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RulesSourceList]
$creadListPrec :: ReadPrec [RulesSourceList]
readPrec :: ReadPrec RulesSourceList
$creadPrec :: ReadPrec RulesSourceList
readList :: ReadS [RulesSourceList]
$creadList :: ReadS [RulesSourceList]
readsPrec :: Int -> ReadS RulesSourceList
$creadsPrec :: Int -> ReadS RulesSourceList
Prelude.Read, Int -> RulesSourceList -> ShowS
[RulesSourceList] -> ShowS
RulesSourceList -> String
(Int -> RulesSourceList -> ShowS)
-> (RulesSourceList -> String)
-> ([RulesSourceList] -> ShowS)
-> Show RulesSourceList
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RulesSourceList] -> ShowS
$cshowList :: [RulesSourceList] -> ShowS
show :: RulesSourceList -> String
$cshow :: RulesSourceList -> String
showsPrec :: Int -> RulesSourceList -> ShowS
$cshowsPrec :: Int -> RulesSourceList -> ShowS
Prelude.Show, (forall x. RulesSourceList -> Rep RulesSourceList x)
-> (forall x. Rep RulesSourceList x -> RulesSourceList)
-> Generic RulesSourceList
forall x. Rep RulesSourceList x -> RulesSourceList
forall x. RulesSourceList -> Rep RulesSourceList x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RulesSourceList x -> RulesSourceList
$cfrom :: forall x. RulesSourceList -> Rep RulesSourceList x
Prelude.Generic)
newRulesSourceList ::
GeneratedRulesType ->
RulesSourceList
newRulesSourceList :: GeneratedRulesType -> RulesSourceList
newRulesSourceList GeneratedRulesType
pGeneratedRulesType_ =
RulesSourceList' :: [Text] -> [TargetType] -> GeneratedRulesType -> RulesSourceList
RulesSourceList'
{ $sel:targets:RulesSourceList' :: [Text]
targets = [Text]
forall a. Monoid a => a
Prelude.mempty,
$sel:targetTypes:RulesSourceList' :: [TargetType]
targetTypes = [TargetType]
forall a. Monoid a => a
Prelude.mempty,
$sel:generatedRulesType:RulesSourceList' :: GeneratedRulesType
generatedRulesType = GeneratedRulesType
pGeneratedRulesType_
}
rulesSourceList_targets :: Lens.Lens' RulesSourceList [Prelude.Text]
rulesSourceList_targets :: ([Text] -> f [Text]) -> RulesSourceList -> f RulesSourceList
rulesSourceList_targets = (RulesSourceList -> [Text])
-> (RulesSourceList -> [Text] -> RulesSourceList)
-> Lens RulesSourceList RulesSourceList [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RulesSourceList' {[Text]
targets :: [Text]
$sel:targets:RulesSourceList' :: RulesSourceList -> [Text]
targets} -> [Text]
targets) (\s :: RulesSourceList
s@RulesSourceList' {} [Text]
a -> RulesSourceList
s {$sel:targets:RulesSourceList' :: [Text]
targets = [Text]
a} :: RulesSourceList) (([Text] -> f [Text]) -> RulesSourceList -> f RulesSourceList)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> RulesSourceList
-> f RulesSourceList
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
rulesSourceList_targetTypes :: Lens.Lens' RulesSourceList [TargetType]
rulesSourceList_targetTypes :: ([TargetType] -> f [TargetType])
-> RulesSourceList -> f RulesSourceList
rulesSourceList_targetTypes = (RulesSourceList -> [TargetType])
-> (RulesSourceList -> [TargetType] -> RulesSourceList)
-> Lens RulesSourceList RulesSourceList [TargetType] [TargetType]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RulesSourceList' {[TargetType]
targetTypes :: [TargetType]
$sel:targetTypes:RulesSourceList' :: RulesSourceList -> [TargetType]
targetTypes} -> [TargetType]
targetTypes) (\s :: RulesSourceList
s@RulesSourceList' {} [TargetType]
a -> RulesSourceList
s {$sel:targetTypes:RulesSourceList' :: [TargetType]
targetTypes = [TargetType]
a} :: RulesSourceList) (([TargetType] -> f [TargetType])
-> RulesSourceList -> f RulesSourceList)
-> (([TargetType] -> f [TargetType])
-> [TargetType] -> f [TargetType])
-> ([TargetType] -> f [TargetType])
-> RulesSourceList
-> f RulesSourceList
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([TargetType] -> f [TargetType]) -> [TargetType] -> f [TargetType]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
rulesSourceList_generatedRulesType :: Lens.Lens' RulesSourceList GeneratedRulesType
rulesSourceList_generatedRulesType :: (GeneratedRulesType -> f GeneratedRulesType)
-> RulesSourceList -> f RulesSourceList
rulesSourceList_generatedRulesType = (RulesSourceList -> GeneratedRulesType)
-> (RulesSourceList -> GeneratedRulesType -> RulesSourceList)
-> Lens
RulesSourceList
RulesSourceList
GeneratedRulesType
GeneratedRulesType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RulesSourceList' {GeneratedRulesType
generatedRulesType :: GeneratedRulesType
$sel:generatedRulesType:RulesSourceList' :: RulesSourceList -> GeneratedRulesType
generatedRulesType} -> GeneratedRulesType
generatedRulesType) (\s :: RulesSourceList
s@RulesSourceList' {} GeneratedRulesType
a -> RulesSourceList
s {$sel:generatedRulesType:RulesSourceList' :: GeneratedRulesType
generatedRulesType = GeneratedRulesType
a} :: RulesSourceList)
instance Core.FromJSON RulesSourceList where
parseJSON :: Value -> Parser RulesSourceList
parseJSON =
String
-> (Object -> Parser RulesSourceList)
-> Value
-> Parser RulesSourceList
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"RulesSourceList"
( \Object
x ->
[Text] -> [TargetType] -> GeneratedRulesType -> RulesSourceList
RulesSourceList'
([Text] -> [TargetType] -> GeneratedRulesType -> RulesSourceList)
-> Parser [Text]
-> Parser ([TargetType] -> GeneratedRulesType -> RulesSourceList)
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
"Targets" Parser (Maybe [Text]) -> [Text] -> Parser [Text]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [Text]
forall a. Monoid a => a
Prelude.mempty)
Parser ([TargetType] -> GeneratedRulesType -> RulesSourceList)
-> Parser [TargetType]
-> Parser (GeneratedRulesType -> RulesSourceList)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe [TargetType])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TargetTypes" Parser (Maybe [TargetType]) -> [TargetType] -> Parser [TargetType]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [TargetType]
forall a. Monoid a => a
Prelude.mempty)
Parser (GeneratedRulesType -> RulesSourceList)
-> Parser GeneratedRulesType -> Parser RulesSourceList
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser GeneratedRulesType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"GeneratedRulesType")
)
instance Prelude.Hashable RulesSourceList
instance Prelude.NFData RulesSourceList
instance Core.ToJSON RulesSourceList where
toJSON :: RulesSourceList -> Value
toJSON RulesSourceList' {[Text]
[TargetType]
GeneratedRulesType
generatedRulesType :: GeneratedRulesType
targetTypes :: [TargetType]
targets :: [Text]
$sel:generatedRulesType:RulesSourceList' :: RulesSourceList -> GeneratedRulesType
$sel:targetTypes:RulesSourceList' :: RulesSourceList -> [TargetType]
$sel:targets:RulesSourceList' :: RulesSourceList -> [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
"Targets" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
targets),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TargetTypes" Text -> [TargetType] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [TargetType]
targetTypes),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"GeneratedRulesType" Text -> GeneratedRulesType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= GeneratedRulesType
generatedRulesType)
]
)