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