{-# 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.Severity where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SecurityHub.Types.SeverityLabel
data Severity = Severity'
{
Severity -> Maybe Double
product :: Prelude.Maybe Prelude.Double,
Severity -> Maybe SeverityLabel
label :: Prelude.Maybe SeverityLabel,
Severity -> Maybe Text
original :: Prelude.Maybe Prelude.Text,
Severity -> Maybe Int
normalized :: Prelude.Maybe Prelude.Int
}
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 Double
-> Maybe SeverityLabel -> Maybe Text -> Maybe Int -> Severity
Severity'
{ $sel:product:Severity' :: Maybe Double
product = Maybe Double
forall a. Maybe a
Prelude.Nothing,
$sel:label:Severity' :: Maybe SeverityLabel
label = Maybe SeverityLabel
forall a. Maybe a
Prelude.Nothing,
$sel:original:Severity' :: Maybe Text
original = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:normalized:Severity' :: Maybe Int
normalized = Maybe Int
forall a. Maybe a
Prelude.Nothing
}
severity_product :: Lens.Lens' Severity (Prelude.Maybe Prelude.Double)
severity_product :: (Maybe Double -> f (Maybe Double)) -> Severity -> f Severity
severity_product = (Severity -> Maybe Double)
-> (Severity -> Maybe Double -> Severity)
-> Lens Severity Severity (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Severity' {Maybe Double
product :: Maybe Double
$sel:product:Severity' :: Severity -> Maybe Double
product} -> Maybe Double
product) (\s :: Severity
s@Severity' {} Maybe Double
a -> Severity
s {$sel:product:Severity' :: Maybe Double
product = Maybe Double
a} :: Severity)
severity_label :: Lens.Lens' Severity (Prelude.Maybe SeverityLabel)
severity_label :: (Maybe SeverityLabel -> f (Maybe SeverityLabel))
-> Severity -> f Severity
severity_label = (Severity -> Maybe SeverityLabel)
-> (Severity -> Maybe SeverityLabel -> Severity)
-> Lens
Severity Severity (Maybe SeverityLabel) (Maybe SeverityLabel)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Severity' {Maybe SeverityLabel
label :: Maybe SeverityLabel
$sel:label:Severity' :: Severity -> Maybe SeverityLabel
label} -> Maybe SeverityLabel
label) (\s :: Severity
s@Severity' {} Maybe SeverityLabel
a -> Severity
s {$sel:label:Severity' :: Maybe SeverityLabel
label = Maybe SeverityLabel
a} :: Severity)
severity_original :: Lens.Lens' Severity (Prelude.Maybe Prelude.Text)
severity_original :: (Maybe Text -> f (Maybe Text)) -> Severity -> f Severity
severity_original = (Severity -> Maybe Text)
-> (Severity -> Maybe Text -> Severity)
-> Lens Severity Severity (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Severity' {Maybe Text
original :: Maybe Text
$sel:original:Severity' :: Severity -> Maybe Text
original} -> Maybe Text
original) (\s :: Severity
s@Severity' {} Maybe Text
a -> Severity
s {$sel:original:Severity' :: Maybe Text
original = Maybe Text
a} :: Severity)
severity_normalized :: Lens.Lens' Severity (Prelude.Maybe Prelude.Int)
severity_normalized :: (Maybe Int -> f (Maybe Int)) -> Severity -> f Severity
severity_normalized = (Severity -> Maybe Int)
-> (Severity -> Maybe Int -> Severity)
-> Lens Severity Severity (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Severity' {Maybe Int
normalized :: Maybe Int
$sel:normalized:Severity' :: Severity -> Maybe Int
normalized} -> Maybe Int
normalized) (\s :: Severity
s@Severity' {} Maybe Int
a -> Severity
s {$sel:normalized:Severity' :: Maybe Int
normalized = Maybe Int
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 Double
-> Maybe SeverityLabel -> Maybe Text -> Maybe Int -> Severity
Severity'
(Maybe Double
-> Maybe SeverityLabel -> Maybe Text -> Maybe Int -> Severity)
-> Parser (Maybe Double)
-> Parser
(Maybe SeverityLabel -> Maybe Text -> Maybe Int -> Severity)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Product")
Parser (Maybe SeverityLabel -> Maybe Text -> Maybe Int -> Severity)
-> Parser (Maybe SeverityLabel)
-> Parser (Maybe Text -> Maybe Int -> Severity)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SeverityLabel)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Label")
Parser (Maybe Text -> Maybe Int -> Severity)
-> Parser (Maybe Text) -> Parser (Maybe Int -> Severity)
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
"Original")
Parser (Maybe Int -> Severity)
-> Parser (Maybe Int) -> Parser Severity
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Normalized")
)
instance Prelude.Hashable Severity
instance Prelude.NFData Severity
instance Core.ToJSON Severity where
toJSON :: Severity -> Value
toJSON Severity' {Maybe Double
Maybe Int
Maybe Text
Maybe SeverityLabel
normalized :: Maybe Int
original :: Maybe Text
label :: Maybe SeverityLabel
product :: Maybe Double
$sel:normalized:Severity' :: Severity -> Maybe Int
$sel:original:Severity' :: Severity -> Maybe Text
$sel:label:Severity' :: Severity -> Maybe SeverityLabel
$sel:product:Severity' :: Severity -> Maybe Double
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Product" Text -> Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Double -> Pair) -> Maybe Double -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Double
product,
(Text
"Label" Text -> SeverityLabel -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SeverityLabel -> Pair) -> Maybe SeverityLabel -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SeverityLabel
label,
(Text
"Original" 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
original,
(Text
"Normalized" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
normalized
]
)