{-# 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.AccessAnalyzer.Types.FindingSource where
import Amazonka.AccessAnalyzer.Types.FindingSourceDetail
import Amazonka.AccessAnalyzer.Types.FindingSourceType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data FindingSource = FindingSource'
{
FindingSource -> Maybe FindingSourceDetail
detail :: Prelude.Maybe FindingSourceDetail,
FindingSource -> FindingSourceType
type' :: FindingSourceType
}
deriving (FindingSource -> FindingSource -> Bool
(FindingSource -> FindingSource -> Bool)
-> (FindingSource -> FindingSource -> Bool) -> Eq FindingSource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FindingSource -> FindingSource -> Bool
$c/= :: FindingSource -> FindingSource -> Bool
== :: FindingSource -> FindingSource -> Bool
$c== :: FindingSource -> FindingSource -> Bool
Prelude.Eq, ReadPrec [FindingSource]
ReadPrec FindingSource
Int -> ReadS FindingSource
ReadS [FindingSource]
(Int -> ReadS FindingSource)
-> ReadS [FindingSource]
-> ReadPrec FindingSource
-> ReadPrec [FindingSource]
-> Read FindingSource
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FindingSource]
$creadListPrec :: ReadPrec [FindingSource]
readPrec :: ReadPrec FindingSource
$creadPrec :: ReadPrec FindingSource
readList :: ReadS [FindingSource]
$creadList :: ReadS [FindingSource]
readsPrec :: Int -> ReadS FindingSource
$creadsPrec :: Int -> ReadS FindingSource
Prelude.Read, Int -> FindingSource -> ShowS
[FindingSource] -> ShowS
FindingSource -> String
(Int -> FindingSource -> ShowS)
-> (FindingSource -> String)
-> ([FindingSource] -> ShowS)
-> Show FindingSource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FindingSource] -> ShowS
$cshowList :: [FindingSource] -> ShowS
show :: FindingSource -> String
$cshow :: FindingSource -> String
showsPrec :: Int -> FindingSource -> ShowS
$cshowsPrec :: Int -> FindingSource -> ShowS
Prelude.Show, (forall x. FindingSource -> Rep FindingSource x)
-> (forall x. Rep FindingSource x -> FindingSource)
-> Generic FindingSource
forall x. Rep FindingSource x -> FindingSource
forall x. FindingSource -> Rep FindingSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FindingSource x -> FindingSource
$cfrom :: forall x. FindingSource -> Rep FindingSource x
Prelude.Generic)
newFindingSource ::
FindingSourceType ->
FindingSource
newFindingSource :: FindingSourceType -> FindingSource
newFindingSource FindingSourceType
pType_ =
FindingSource' :: Maybe FindingSourceDetail -> FindingSourceType -> FindingSource
FindingSource'
{ $sel:detail:FindingSource' :: Maybe FindingSourceDetail
detail = Maybe FindingSourceDetail
forall a. Maybe a
Prelude.Nothing,
$sel:type':FindingSource' :: FindingSourceType
type' = FindingSourceType
pType_
}
findingSource_detail :: Lens.Lens' FindingSource (Prelude.Maybe FindingSourceDetail)
findingSource_detail :: (Maybe FindingSourceDetail -> f (Maybe FindingSourceDetail))
-> FindingSource -> f FindingSource
findingSource_detail = (FindingSource -> Maybe FindingSourceDetail)
-> (FindingSource -> Maybe FindingSourceDetail -> FindingSource)
-> Lens
FindingSource
FindingSource
(Maybe FindingSourceDetail)
(Maybe FindingSourceDetail)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FindingSource' {Maybe FindingSourceDetail
detail :: Maybe FindingSourceDetail
$sel:detail:FindingSource' :: FindingSource -> Maybe FindingSourceDetail
detail} -> Maybe FindingSourceDetail
detail) (\s :: FindingSource
s@FindingSource' {} Maybe FindingSourceDetail
a -> FindingSource
s {$sel:detail:FindingSource' :: Maybe FindingSourceDetail
detail = Maybe FindingSourceDetail
a} :: FindingSource)
findingSource_type :: Lens.Lens' FindingSource FindingSourceType
findingSource_type :: (FindingSourceType -> f FindingSourceType)
-> FindingSource -> f FindingSource
findingSource_type = (FindingSource -> FindingSourceType)
-> (FindingSource -> FindingSourceType -> FindingSource)
-> Lens
FindingSource FindingSource FindingSourceType FindingSourceType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FindingSource' {FindingSourceType
type' :: FindingSourceType
$sel:type':FindingSource' :: FindingSource -> FindingSourceType
type'} -> FindingSourceType
type') (\s :: FindingSource
s@FindingSource' {} FindingSourceType
a -> FindingSource
s {$sel:type':FindingSource' :: FindingSourceType
type' = FindingSourceType
a} :: FindingSource)
instance Core.FromJSON FindingSource where
parseJSON :: Value -> Parser FindingSource
parseJSON =
String
-> (Object -> Parser FindingSource)
-> Value
-> Parser FindingSource
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"FindingSource"
( \Object
x ->
Maybe FindingSourceDetail -> FindingSourceType -> FindingSource
FindingSource'
(Maybe FindingSourceDetail -> FindingSourceType -> FindingSource)
-> Parser (Maybe FindingSourceDetail)
-> Parser (FindingSourceType -> FindingSource)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe FindingSourceDetail)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"detail") Parser (FindingSourceType -> FindingSource)
-> Parser FindingSourceType -> Parser FindingSource
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser FindingSourceType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"type")
)
instance Prelude.Hashable FindingSource
instance Prelude.NFData FindingSource