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