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