{-# 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.CloudTrail.Types.InsightSelector where
import Amazonka.CloudTrail.Types.InsightType
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data InsightSelector = InsightSelector'
{
InsightSelector -> Maybe InsightType
insightType :: Prelude.Maybe InsightType
}
deriving (InsightSelector -> InsightSelector -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InsightSelector -> InsightSelector -> Bool
$c/= :: InsightSelector -> InsightSelector -> Bool
== :: InsightSelector -> InsightSelector -> Bool
$c== :: InsightSelector -> InsightSelector -> Bool
Prelude.Eq, ReadPrec [InsightSelector]
ReadPrec InsightSelector
Int -> ReadS InsightSelector
ReadS [InsightSelector]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InsightSelector]
$creadListPrec :: ReadPrec [InsightSelector]
readPrec :: ReadPrec InsightSelector
$creadPrec :: ReadPrec InsightSelector
readList :: ReadS [InsightSelector]
$creadList :: ReadS [InsightSelector]
readsPrec :: Int -> ReadS InsightSelector
$creadsPrec :: Int -> ReadS InsightSelector
Prelude.Read, Int -> InsightSelector -> ShowS
[InsightSelector] -> ShowS
InsightSelector -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InsightSelector] -> ShowS
$cshowList :: [InsightSelector] -> ShowS
show :: InsightSelector -> String
$cshow :: InsightSelector -> String
showsPrec :: Int -> InsightSelector -> ShowS
$cshowsPrec :: Int -> InsightSelector -> ShowS
Prelude.Show, forall x. Rep InsightSelector x -> InsightSelector
forall x. InsightSelector -> Rep InsightSelector x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InsightSelector x -> InsightSelector
$cfrom :: forall x. InsightSelector -> Rep InsightSelector x
Prelude.Generic)
newInsightSelector ::
InsightSelector
newInsightSelector :: InsightSelector
newInsightSelector =
InsightSelector' {$sel:insightType:InsightSelector' :: Maybe InsightType
insightType = forall a. Maybe a
Prelude.Nothing}
insightSelector_insightType :: Lens.Lens' InsightSelector (Prelude.Maybe InsightType)
insightSelector_insightType :: Lens' InsightSelector (Maybe InsightType)
insightSelector_insightType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InsightSelector' {Maybe InsightType
insightType :: Maybe InsightType
$sel:insightType:InsightSelector' :: InsightSelector -> Maybe InsightType
insightType} -> Maybe InsightType
insightType) (\s :: InsightSelector
s@InsightSelector' {} Maybe InsightType
a -> InsightSelector
s {$sel:insightType:InsightSelector' :: Maybe InsightType
insightType = Maybe InsightType
a} :: InsightSelector)
instance Data.FromJSON InsightSelector where
parseJSON :: Value -> Parser InsightSelector
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"InsightSelector"
( \Object
x ->
Maybe InsightType -> InsightSelector
InsightSelector'
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
"InsightType")
)
instance Prelude.Hashable InsightSelector where
hashWithSalt :: Int -> InsightSelector -> Int
hashWithSalt Int
_salt InsightSelector' {Maybe InsightType
insightType :: Maybe InsightType
$sel:insightType:InsightSelector' :: InsightSelector -> Maybe InsightType
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InsightType
insightType
instance Prelude.NFData InsightSelector where
rnf :: InsightSelector -> ()
rnf InsightSelector' {Maybe InsightType
insightType :: Maybe InsightType
$sel:insightType:InsightSelector' :: InsightSelector -> Maybe InsightType
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe InsightType
insightType
instance Data.ToJSON InsightSelector where
toJSON :: InsightSelector -> Value
toJSON InsightSelector' {Maybe InsightType
insightType :: Maybe InsightType
$sel:insightType:InsightSelector' :: InsightSelector -> Maybe InsightType
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[(Key
"InsightType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe InsightType
insightType]
)