{-# 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.SecurityHub.Types.RelatedFinding where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data RelatedFinding = RelatedFinding'
{
RelatedFinding -> Text
productArn :: Prelude.Text,
RelatedFinding -> Text
id :: Prelude.Text
}
deriving (RelatedFinding -> RelatedFinding -> Bool
(RelatedFinding -> RelatedFinding -> Bool)
-> (RelatedFinding -> RelatedFinding -> Bool) -> Eq RelatedFinding
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RelatedFinding -> RelatedFinding -> Bool
$c/= :: RelatedFinding -> RelatedFinding -> Bool
== :: RelatedFinding -> RelatedFinding -> Bool
$c== :: RelatedFinding -> RelatedFinding -> Bool
Prelude.Eq, ReadPrec [RelatedFinding]
ReadPrec RelatedFinding
Int -> ReadS RelatedFinding
ReadS [RelatedFinding]
(Int -> ReadS RelatedFinding)
-> ReadS [RelatedFinding]
-> ReadPrec RelatedFinding
-> ReadPrec [RelatedFinding]
-> Read RelatedFinding
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RelatedFinding]
$creadListPrec :: ReadPrec [RelatedFinding]
readPrec :: ReadPrec RelatedFinding
$creadPrec :: ReadPrec RelatedFinding
readList :: ReadS [RelatedFinding]
$creadList :: ReadS [RelatedFinding]
readsPrec :: Int -> ReadS RelatedFinding
$creadsPrec :: Int -> ReadS RelatedFinding
Prelude.Read, Int -> RelatedFinding -> ShowS
[RelatedFinding] -> ShowS
RelatedFinding -> String
(Int -> RelatedFinding -> ShowS)
-> (RelatedFinding -> String)
-> ([RelatedFinding] -> ShowS)
-> Show RelatedFinding
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RelatedFinding] -> ShowS
$cshowList :: [RelatedFinding] -> ShowS
show :: RelatedFinding -> String
$cshow :: RelatedFinding -> String
showsPrec :: Int -> RelatedFinding -> ShowS
$cshowsPrec :: Int -> RelatedFinding -> ShowS
Prelude.Show, (forall x. RelatedFinding -> Rep RelatedFinding x)
-> (forall x. Rep RelatedFinding x -> RelatedFinding)
-> Generic RelatedFinding
forall x. Rep RelatedFinding x -> RelatedFinding
forall x. RelatedFinding -> Rep RelatedFinding x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RelatedFinding x -> RelatedFinding
$cfrom :: forall x. RelatedFinding -> Rep RelatedFinding x
Prelude.Generic)
newRelatedFinding ::
Prelude.Text ->
Prelude.Text ->
RelatedFinding
newRelatedFinding :: Text -> Text -> RelatedFinding
newRelatedFinding Text
pProductArn_ Text
pId_ =
RelatedFinding' :: Text -> Text -> RelatedFinding
RelatedFinding'
{ $sel:productArn:RelatedFinding' :: Text
productArn = Text
pProductArn_,
$sel:id:RelatedFinding' :: Text
id = Text
pId_
}
relatedFinding_productArn :: Lens.Lens' RelatedFinding Prelude.Text
relatedFinding_productArn :: (Text -> f Text) -> RelatedFinding -> f RelatedFinding
relatedFinding_productArn = (RelatedFinding -> Text)
-> (RelatedFinding -> Text -> RelatedFinding)
-> Lens RelatedFinding RelatedFinding Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RelatedFinding' {Text
productArn :: Text
$sel:productArn:RelatedFinding' :: RelatedFinding -> Text
productArn} -> Text
productArn) (\s :: RelatedFinding
s@RelatedFinding' {} Text
a -> RelatedFinding
s {$sel:productArn:RelatedFinding' :: Text
productArn = Text
a} :: RelatedFinding)
relatedFinding_id :: Lens.Lens' RelatedFinding Prelude.Text
relatedFinding_id :: (Text -> f Text) -> RelatedFinding -> f RelatedFinding
relatedFinding_id = (RelatedFinding -> Text)
-> (RelatedFinding -> Text -> RelatedFinding)
-> Lens RelatedFinding RelatedFinding Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RelatedFinding' {Text
id :: Text
$sel:id:RelatedFinding' :: RelatedFinding -> Text
id} -> Text
id) (\s :: RelatedFinding
s@RelatedFinding' {} Text
a -> RelatedFinding
s {$sel:id:RelatedFinding' :: Text
id = Text
a} :: RelatedFinding)
instance Core.FromJSON RelatedFinding where
parseJSON :: Value -> Parser RelatedFinding
parseJSON =
String
-> (Object -> Parser RelatedFinding)
-> Value
-> Parser RelatedFinding
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"RelatedFinding"
( \Object
x ->
Text -> Text -> RelatedFinding
RelatedFinding'
(Text -> Text -> RelatedFinding)
-> Parser Text -> Parser (Text -> RelatedFinding)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ProductArn")
Parser (Text -> RelatedFinding)
-> Parser Text -> Parser RelatedFinding
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Id")
)
instance Prelude.Hashable RelatedFinding
instance Prelude.NFData RelatedFinding
instance Core.ToJSON RelatedFinding where
toJSON :: RelatedFinding -> Value
toJSON RelatedFinding' {Text
id :: Text
productArn :: Text
$sel:id:RelatedFinding' :: RelatedFinding -> Text
$sel:productArn:RelatedFinding' :: RelatedFinding -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ProductArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
productArn),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Id" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
id)
]
)