{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
{ $sel:targets:RulesSourceList' :: [Text]
targets = forall a. Monoid a => a
Prelude.mempty,
$sel:targetTypes:RulesSourceList' :: [TargetType]
targetTypes = forall a. Monoid a => a
Prelude.mempty,
$sel:generatedRulesType:RulesSourceList' :: GeneratedRulesType
generatedRulesType = GeneratedRulesType
pGeneratedRulesType_
}
rulesSourceList_targets :: Lens.Lens' RulesSourceList [Prelude.Text]
rulesSourceList_targets :: Lens' RulesSourceList [Text]
rulesSourceList_targets = 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) 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
rulesSourceList_targetTypes :: Lens.Lens' RulesSourceList [TargetType]
rulesSourceList_targetTypes :: Lens' RulesSourceList [TargetType]
rulesSourceList_targetTypes = 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) 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
rulesSourceList_generatedRulesType :: Lens.Lens' RulesSourceList GeneratedRulesType
rulesSourceList_generatedRulesType :: Lens' RulesSourceList GeneratedRulesType
rulesSourceList_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 Data.FromJSON RulesSourceList where
parseJSON :: Value -> Parser RulesSourceList
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"RulesSourceList"
( \Object
x ->
[Text] -> [TargetType] -> GeneratedRulesType -> RulesSourceList
RulesSourceList'
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
"Targets" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
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
"TargetTypes" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
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
"GeneratedRulesType")
)
instance Prelude.Hashable RulesSourceList where
hashWithSalt :: Int -> RulesSourceList -> Int
hashWithSalt Int
_salt 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]
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Text]
targets
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [TargetType]
targetTypes
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` GeneratedRulesType
generatedRulesType
instance Prelude.NFData RulesSourceList where
rnf :: RulesSourceList -> ()
rnf 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]
..} =
forall a. NFData a => a -> ()
Prelude.rnf [Text]
targets
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [TargetType]
targetTypes
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf GeneratedRulesType
generatedRulesType
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"Targets" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [Text]
targets),
forall a. a -> Maybe a
Prelude.Just (Key
"TargetTypes" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [TargetType]
targetTypes),
forall a. a -> Maybe a
Prelude.Just
(Key
"GeneratedRulesType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= GeneratedRulesType
generatedRulesType)
]
)