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