{-# 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.MacieV2.Types.SimpleScopeTerm where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MacieV2.Types.JobComparator
import Amazonka.MacieV2.Types.ScopeFilterKey
import qualified Amazonka.Prelude as Prelude
data SimpleScopeTerm = SimpleScopeTerm'
{
SimpleScopeTerm -> Maybe [Text]
values :: Prelude.Maybe [Prelude.Text],
SimpleScopeTerm -> Maybe ScopeFilterKey
key :: Prelude.Maybe ScopeFilterKey,
SimpleScopeTerm -> Maybe JobComparator
comparator :: Prelude.Maybe JobComparator
}
deriving (SimpleScopeTerm -> SimpleScopeTerm -> Bool
(SimpleScopeTerm -> SimpleScopeTerm -> Bool)
-> (SimpleScopeTerm -> SimpleScopeTerm -> Bool)
-> Eq SimpleScopeTerm
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SimpleScopeTerm -> SimpleScopeTerm -> Bool
$c/= :: SimpleScopeTerm -> SimpleScopeTerm -> Bool
== :: SimpleScopeTerm -> SimpleScopeTerm -> Bool
$c== :: SimpleScopeTerm -> SimpleScopeTerm -> Bool
Prelude.Eq, ReadPrec [SimpleScopeTerm]
ReadPrec SimpleScopeTerm
Int -> ReadS SimpleScopeTerm
ReadS [SimpleScopeTerm]
(Int -> ReadS SimpleScopeTerm)
-> ReadS [SimpleScopeTerm]
-> ReadPrec SimpleScopeTerm
-> ReadPrec [SimpleScopeTerm]
-> Read SimpleScopeTerm
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SimpleScopeTerm]
$creadListPrec :: ReadPrec [SimpleScopeTerm]
readPrec :: ReadPrec SimpleScopeTerm
$creadPrec :: ReadPrec SimpleScopeTerm
readList :: ReadS [SimpleScopeTerm]
$creadList :: ReadS [SimpleScopeTerm]
readsPrec :: Int -> ReadS SimpleScopeTerm
$creadsPrec :: Int -> ReadS SimpleScopeTerm
Prelude.Read, Int -> SimpleScopeTerm -> ShowS
[SimpleScopeTerm] -> ShowS
SimpleScopeTerm -> String
(Int -> SimpleScopeTerm -> ShowS)
-> (SimpleScopeTerm -> String)
-> ([SimpleScopeTerm] -> ShowS)
-> Show SimpleScopeTerm
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SimpleScopeTerm] -> ShowS
$cshowList :: [SimpleScopeTerm] -> ShowS
show :: SimpleScopeTerm -> String
$cshow :: SimpleScopeTerm -> String
showsPrec :: Int -> SimpleScopeTerm -> ShowS
$cshowsPrec :: Int -> SimpleScopeTerm -> ShowS
Prelude.Show, (forall x. SimpleScopeTerm -> Rep SimpleScopeTerm x)
-> (forall x. Rep SimpleScopeTerm x -> SimpleScopeTerm)
-> Generic SimpleScopeTerm
forall x. Rep SimpleScopeTerm x -> SimpleScopeTerm
forall x. SimpleScopeTerm -> Rep SimpleScopeTerm x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SimpleScopeTerm x -> SimpleScopeTerm
$cfrom :: forall x. SimpleScopeTerm -> Rep SimpleScopeTerm x
Prelude.Generic)
newSimpleScopeTerm ::
SimpleScopeTerm
newSimpleScopeTerm :: SimpleScopeTerm
newSimpleScopeTerm =
SimpleScopeTerm' :: Maybe [Text]
-> Maybe ScopeFilterKey -> Maybe JobComparator -> SimpleScopeTerm
SimpleScopeTerm'
{ $sel:values:SimpleScopeTerm' :: Maybe [Text]
values = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:key:SimpleScopeTerm' :: Maybe ScopeFilterKey
key = Maybe ScopeFilterKey
forall a. Maybe a
Prelude.Nothing,
$sel:comparator:SimpleScopeTerm' :: Maybe JobComparator
comparator = Maybe JobComparator
forall a. Maybe a
Prelude.Nothing
}
simpleScopeTerm_values :: Lens.Lens' SimpleScopeTerm (Prelude.Maybe [Prelude.Text])
simpleScopeTerm_values :: (Maybe [Text] -> f (Maybe [Text]))
-> SimpleScopeTerm -> f SimpleScopeTerm
simpleScopeTerm_values = (SimpleScopeTerm -> Maybe [Text])
-> (SimpleScopeTerm -> Maybe [Text] -> SimpleScopeTerm)
-> Lens
SimpleScopeTerm SimpleScopeTerm (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SimpleScopeTerm' {Maybe [Text]
values :: Maybe [Text]
$sel:values:SimpleScopeTerm' :: SimpleScopeTerm -> Maybe [Text]
values} -> Maybe [Text]
values) (\s :: SimpleScopeTerm
s@SimpleScopeTerm' {} Maybe [Text]
a -> SimpleScopeTerm
s {$sel:values:SimpleScopeTerm' :: Maybe [Text]
values = Maybe [Text]
a} :: SimpleScopeTerm) ((Maybe [Text] -> f (Maybe [Text]))
-> SimpleScopeTerm -> f SimpleScopeTerm)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> SimpleScopeTerm
-> f SimpleScopeTerm
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
simpleScopeTerm_key :: Lens.Lens' SimpleScopeTerm (Prelude.Maybe ScopeFilterKey)
simpleScopeTerm_key :: (Maybe ScopeFilterKey -> f (Maybe ScopeFilterKey))
-> SimpleScopeTerm -> f SimpleScopeTerm
simpleScopeTerm_key = (SimpleScopeTerm -> Maybe ScopeFilterKey)
-> (SimpleScopeTerm -> Maybe ScopeFilterKey -> SimpleScopeTerm)
-> Lens
SimpleScopeTerm
SimpleScopeTerm
(Maybe ScopeFilterKey)
(Maybe ScopeFilterKey)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SimpleScopeTerm' {Maybe ScopeFilterKey
key :: Maybe ScopeFilterKey
$sel:key:SimpleScopeTerm' :: SimpleScopeTerm -> Maybe ScopeFilterKey
key} -> Maybe ScopeFilterKey
key) (\s :: SimpleScopeTerm
s@SimpleScopeTerm' {} Maybe ScopeFilterKey
a -> SimpleScopeTerm
s {$sel:key:SimpleScopeTerm' :: Maybe ScopeFilterKey
key = Maybe ScopeFilterKey
a} :: SimpleScopeTerm)
simpleScopeTerm_comparator :: Lens.Lens' SimpleScopeTerm (Prelude.Maybe JobComparator)
simpleScopeTerm_comparator :: (Maybe JobComparator -> f (Maybe JobComparator))
-> SimpleScopeTerm -> f SimpleScopeTerm
simpleScopeTerm_comparator = (SimpleScopeTerm -> Maybe JobComparator)
-> (SimpleScopeTerm -> Maybe JobComparator -> SimpleScopeTerm)
-> Lens
SimpleScopeTerm
SimpleScopeTerm
(Maybe JobComparator)
(Maybe JobComparator)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SimpleScopeTerm' {Maybe JobComparator
comparator :: Maybe JobComparator
$sel:comparator:SimpleScopeTerm' :: SimpleScopeTerm -> Maybe JobComparator
comparator} -> Maybe JobComparator
comparator) (\s :: SimpleScopeTerm
s@SimpleScopeTerm' {} Maybe JobComparator
a -> SimpleScopeTerm
s {$sel:comparator:SimpleScopeTerm' :: Maybe JobComparator
comparator = Maybe JobComparator
a} :: SimpleScopeTerm)
instance Core.FromJSON SimpleScopeTerm where
parseJSON :: Value -> Parser SimpleScopeTerm
parseJSON =
String
-> (Object -> Parser SimpleScopeTerm)
-> Value
-> Parser SimpleScopeTerm
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"SimpleScopeTerm"
( \Object
x ->
Maybe [Text]
-> Maybe ScopeFilterKey -> Maybe JobComparator -> SimpleScopeTerm
SimpleScopeTerm'
(Maybe [Text]
-> Maybe ScopeFilterKey -> Maybe JobComparator -> SimpleScopeTerm)
-> Parser (Maybe [Text])
-> Parser
(Maybe ScopeFilterKey -> Maybe JobComparator -> SimpleScopeTerm)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"values" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
Parser
(Maybe ScopeFilterKey -> Maybe JobComparator -> SimpleScopeTerm)
-> Parser (Maybe ScopeFilterKey)
-> Parser (Maybe JobComparator -> SimpleScopeTerm)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ScopeFilterKey)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"key")
Parser (Maybe JobComparator -> SimpleScopeTerm)
-> Parser (Maybe JobComparator) -> Parser SimpleScopeTerm
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe JobComparator)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"comparator")
)
instance Prelude.Hashable SimpleScopeTerm
instance Prelude.NFData SimpleScopeTerm
instance Core.ToJSON SimpleScopeTerm where
toJSON :: SimpleScopeTerm -> Value
toJSON SimpleScopeTerm' {Maybe [Text]
Maybe JobComparator
Maybe ScopeFilterKey
comparator :: Maybe JobComparator
key :: Maybe ScopeFilterKey
values :: Maybe [Text]
$sel:comparator:SimpleScopeTerm' :: SimpleScopeTerm -> Maybe JobComparator
$sel:key:SimpleScopeTerm' :: SimpleScopeTerm -> Maybe ScopeFilterKey
$sel:values:SimpleScopeTerm' :: SimpleScopeTerm -> Maybe [Text]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"values" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
values,
(Text
"key" Text -> ScopeFilterKey -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ScopeFilterKey -> Pair) -> Maybe ScopeFilterKey -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ScopeFilterKey
key,
(Text
"comparator" Text -> JobComparator -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (JobComparator -> Pair) -> Maybe JobComparator -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe JobComparator
comparator
]
)