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