{-# 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.FindingProviderFields where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SecurityHub.Types.FindingProviderSeverity
import Amazonka.SecurityHub.Types.RelatedFinding
data FindingProviderFields = FindingProviderFields'
{
FindingProviderFields -> Maybe Natural
criticality :: Prelude.Maybe Prelude.Natural,
FindingProviderFields -> Maybe FindingProviderSeverity
severity :: Prelude.Maybe FindingProviderSeverity,
FindingProviderFields -> Maybe [Text]
types :: Prelude.Maybe [Prelude.Text],
FindingProviderFields -> Maybe [RelatedFinding]
relatedFindings :: Prelude.Maybe [RelatedFinding],
FindingProviderFields -> Maybe Natural
confidence :: Prelude.Maybe Prelude.Natural
}
deriving (FindingProviderFields -> FindingProviderFields -> Bool
(FindingProviderFields -> FindingProviderFields -> Bool)
-> (FindingProviderFields -> FindingProviderFields -> Bool)
-> Eq FindingProviderFields
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FindingProviderFields -> FindingProviderFields -> Bool
$c/= :: FindingProviderFields -> FindingProviderFields -> Bool
== :: FindingProviderFields -> FindingProviderFields -> Bool
$c== :: FindingProviderFields -> FindingProviderFields -> Bool
Prelude.Eq, ReadPrec [FindingProviderFields]
ReadPrec FindingProviderFields
Int -> ReadS FindingProviderFields
ReadS [FindingProviderFields]
(Int -> ReadS FindingProviderFields)
-> ReadS [FindingProviderFields]
-> ReadPrec FindingProviderFields
-> ReadPrec [FindingProviderFields]
-> Read FindingProviderFields
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FindingProviderFields]
$creadListPrec :: ReadPrec [FindingProviderFields]
readPrec :: ReadPrec FindingProviderFields
$creadPrec :: ReadPrec FindingProviderFields
readList :: ReadS [FindingProviderFields]
$creadList :: ReadS [FindingProviderFields]
readsPrec :: Int -> ReadS FindingProviderFields
$creadsPrec :: Int -> ReadS FindingProviderFields
Prelude.Read, Int -> FindingProviderFields -> ShowS
[FindingProviderFields] -> ShowS
FindingProviderFields -> String
(Int -> FindingProviderFields -> ShowS)
-> (FindingProviderFields -> String)
-> ([FindingProviderFields] -> ShowS)
-> Show FindingProviderFields
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FindingProviderFields] -> ShowS
$cshowList :: [FindingProviderFields] -> ShowS
show :: FindingProviderFields -> String
$cshow :: FindingProviderFields -> String
showsPrec :: Int -> FindingProviderFields -> ShowS
$cshowsPrec :: Int -> FindingProviderFields -> ShowS
Prelude.Show, (forall x. FindingProviderFields -> Rep FindingProviderFields x)
-> (forall x. Rep FindingProviderFields x -> FindingProviderFields)
-> Generic FindingProviderFields
forall x. Rep FindingProviderFields x -> FindingProviderFields
forall x. FindingProviderFields -> Rep FindingProviderFields x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FindingProviderFields x -> FindingProviderFields
$cfrom :: forall x. FindingProviderFields -> Rep FindingProviderFields x
Prelude.Generic)
newFindingProviderFields ::
FindingProviderFields
newFindingProviderFields :: FindingProviderFields
newFindingProviderFields =
FindingProviderFields' :: Maybe Natural
-> Maybe FindingProviderSeverity
-> Maybe [Text]
-> Maybe [RelatedFinding]
-> Maybe Natural
-> FindingProviderFields
FindingProviderFields'
{ $sel:criticality:FindingProviderFields' :: Maybe Natural
criticality =
Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:severity:FindingProviderFields' :: Maybe FindingProviderSeverity
severity = Maybe FindingProviderSeverity
forall a. Maybe a
Prelude.Nothing,
$sel:types:FindingProviderFields' :: Maybe [Text]
types = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:relatedFindings:FindingProviderFields' :: Maybe [RelatedFinding]
relatedFindings = Maybe [RelatedFinding]
forall a. Maybe a
Prelude.Nothing,
$sel:confidence:FindingProviderFields' :: Maybe Natural
confidence = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
findingProviderFields_criticality :: Lens.Lens' FindingProviderFields (Prelude.Maybe Prelude.Natural)
findingProviderFields_criticality :: (Maybe Natural -> f (Maybe Natural))
-> FindingProviderFields -> f FindingProviderFields
findingProviderFields_criticality = (FindingProviderFields -> Maybe Natural)
-> (FindingProviderFields
-> Maybe Natural -> FindingProviderFields)
-> Lens
FindingProviderFields
FindingProviderFields
(Maybe Natural)
(Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FindingProviderFields' {Maybe Natural
criticality :: Maybe Natural
$sel:criticality:FindingProviderFields' :: FindingProviderFields -> Maybe Natural
criticality} -> Maybe Natural
criticality) (\s :: FindingProviderFields
s@FindingProviderFields' {} Maybe Natural
a -> FindingProviderFields
s {$sel:criticality:FindingProviderFields' :: Maybe Natural
criticality = Maybe Natural
a} :: FindingProviderFields)
findingProviderFields_severity :: Lens.Lens' FindingProviderFields (Prelude.Maybe FindingProviderSeverity)
findingProviderFields_severity :: (Maybe FindingProviderSeverity
-> f (Maybe FindingProviderSeverity))
-> FindingProviderFields -> f FindingProviderFields
findingProviderFields_severity = (FindingProviderFields -> Maybe FindingProviderSeverity)
-> (FindingProviderFields
-> Maybe FindingProviderSeverity -> FindingProviderFields)
-> Lens
FindingProviderFields
FindingProviderFields
(Maybe FindingProviderSeverity)
(Maybe FindingProviderSeverity)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FindingProviderFields' {Maybe FindingProviderSeverity
severity :: Maybe FindingProviderSeverity
$sel:severity:FindingProviderFields' :: FindingProviderFields -> Maybe FindingProviderSeverity
severity} -> Maybe FindingProviderSeverity
severity) (\s :: FindingProviderFields
s@FindingProviderFields' {} Maybe FindingProviderSeverity
a -> FindingProviderFields
s {$sel:severity:FindingProviderFields' :: Maybe FindingProviderSeverity
severity = Maybe FindingProviderSeverity
a} :: FindingProviderFields)
findingProviderFields_types :: Lens.Lens' FindingProviderFields (Prelude.Maybe [Prelude.Text])
findingProviderFields_types :: (Maybe [Text] -> f (Maybe [Text]))
-> FindingProviderFields -> f FindingProviderFields
findingProviderFields_types = (FindingProviderFields -> Maybe [Text])
-> (FindingProviderFields -> Maybe [Text] -> FindingProviderFields)
-> Lens
FindingProviderFields
FindingProviderFields
(Maybe [Text])
(Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FindingProviderFields' {Maybe [Text]
types :: Maybe [Text]
$sel:types:FindingProviderFields' :: FindingProviderFields -> Maybe [Text]
types} -> Maybe [Text]
types) (\s :: FindingProviderFields
s@FindingProviderFields' {} Maybe [Text]
a -> FindingProviderFields
s {$sel:types:FindingProviderFields' :: Maybe [Text]
types = Maybe [Text]
a} :: FindingProviderFields) ((Maybe [Text] -> f (Maybe [Text]))
-> FindingProviderFields -> f FindingProviderFields)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> FindingProviderFields
-> f FindingProviderFields
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
findingProviderFields_relatedFindings :: Lens.Lens' FindingProviderFields (Prelude.Maybe [RelatedFinding])
findingProviderFields_relatedFindings :: (Maybe [RelatedFinding] -> f (Maybe [RelatedFinding]))
-> FindingProviderFields -> f FindingProviderFields
findingProviderFields_relatedFindings = (FindingProviderFields -> Maybe [RelatedFinding])
-> (FindingProviderFields
-> Maybe [RelatedFinding] -> FindingProviderFields)
-> Lens
FindingProviderFields
FindingProviderFields
(Maybe [RelatedFinding])
(Maybe [RelatedFinding])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FindingProviderFields' {Maybe [RelatedFinding]
relatedFindings :: Maybe [RelatedFinding]
$sel:relatedFindings:FindingProviderFields' :: FindingProviderFields -> Maybe [RelatedFinding]
relatedFindings} -> Maybe [RelatedFinding]
relatedFindings) (\s :: FindingProviderFields
s@FindingProviderFields' {} Maybe [RelatedFinding]
a -> FindingProviderFields
s {$sel:relatedFindings:FindingProviderFields' :: Maybe [RelatedFinding]
relatedFindings = Maybe [RelatedFinding]
a} :: FindingProviderFields) ((Maybe [RelatedFinding] -> f (Maybe [RelatedFinding]))
-> FindingProviderFields -> f FindingProviderFields)
-> ((Maybe [RelatedFinding] -> f (Maybe [RelatedFinding]))
-> Maybe [RelatedFinding] -> f (Maybe [RelatedFinding]))
-> (Maybe [RelatedFinding] -> f (Maybe [RelatedFinding]))
-> FindingProviderFields
-> f FindingProviderFields
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[RelatedFinding] [RelatedFinding] [RelatedFinding] [RelatedFinding]
-> Iso
(Maybe [RelatedFinding])
(Maybe [RelatedFinding])
(Maybe [RelatedFinding])
(Maybe [RelatedFinding])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
[RelatedFinding] [RelatedFinding] [RelatedFinding] [RelatedFinding]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
findingProviderFields_confidence :: Lens.Lens' FindingProviderFields (Prelude.Maybe Prelude.Natural)
findingProviderFields_confidence :: (Maybe Natural -> f (Maybe Natural))
-> FindingProviderFields -> f FindingProviderFields
findingProviderFields_confidence = (FindingProviderFields -> Maybe Natural)
-> (FindingProviderFields
-> Maybe Natural -> FindingProviderFields)
-> Lens
FindingProviderFields
FindingProviderFields
(Maybe Natural)
(Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FindingProviderFields' {Maybe Natural
confidence :: Maybe Natural
$sel:confidence:FindingProviderFields' :: FindingProviderFields -> Maybe Natural
confidence} -> Maybe Natural
confidence) (\s :: FindingProviderFields
s@FindingProviderFields' {} Maybe Natural
a -> FindingProviderFields
s {$sel:confidence:FindingProviderFields' :: Maybe Natural
confidence = Maybe Natural
a} :: FindingProviderFields)
instance Core.FromJSON FindingProviderFields where
parseJSON :: Value -> Parser FindingProviderFields
parseJSON =
String
-> (Object -> Parser FindingProviderFields)
-> Value
-> Parser FindingProviderFields
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"FindingProviderFields"
( \Object
x ->
Maybe Natural
-> Maybe FindingProviderSeverity
-> Maybe [Text]
-> Maybe [RelatedFinding]
-> Maybe Natural
-> FindingProviderFields
FindingProviderFields'
(Maybe Natural
-> Maybe FindingProviderSeverity
-> Maybe [Text]
-> Maybe [RelatedFinding]
-> Maybe Natural
-> FindingProviderFields)
-> Parser (Maybe Natural)
-> Parser
(Maybe FindingProviderSeverity
-> Maybe [Text]
-> Maybe [RelatedFinding]
-> Maybe Natural
-> FindingProviderFields)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Criticality")
Parser
(Maybe FindingProviderSeverity
-> Maybe [Text]
-> Maybe [RelatedFinding]
-> Maybe Natural
-> FindingProviderFields)
-> Parser (Maybe FindingProviderSeverity)
-> Parser
(Maybe [Text]
-> Maybe [RelatedFinding]
-> Maybe Natural
-> FindingProviderFields)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe FindingProviderSeverity)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Severity")
Parser
(Maybe [Text]
-> Maybe [RelatedFinding]
-> Maybe Natural
-> FindingProviderFields)
-> Parser (Maybe [Text])
-> Parser
(Maybe [RelatedFinding] -> Maybe Natural -> FindingProviderFields)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Types" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
Parser
(Maybe [RelatedFinding] -> Maybe Natural -> FindingProviderFields)
-> Parser (Maybe [RelatedFinding])
-> Parser (Maybe Natural -> FindingProviderFields)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [RelatedFinding]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RelatedFindings"
Parser (Maybe (Maybe [RelatedFinding]))
-> Maybe [RelatedFinding] -> Parser (Maybe [RelatedFinding])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [RelatedFinding]
forall a. Monoid a => a
Prelude.mempty
)
Parser (Maybe Natural -> FindingProviderFields)
-> Parser (Maybe Natural) -> Parser FindingProviderFields
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Confidence")
)
instance Prelude.Hashable FindingProviderFields
instance Prelude.NFData FindingProviderFields
instance Core.ToJSON FindingProviderFields where
toJSON :: FindingProviderFields -> Value
toJSON FindingProviderFields' {Maybe Natural
Maybe [Text]
Maybe [RelatedFinding]
Maybe FindingProviderSeverity
confidence :: Maybe Natural
relatedFindings :: Maybe [RelatedFinding]
types :: Maybe [Text]
severity :: Maybe FindingProviderSeverity
criticality :: Maybe Natural
$sel:confidence:FindingProviderFields' :: FindingProviderFields -> Maybe Natural
$sel:relatedFindings:FindingProviderFields' :: FindingProviderFields -> Maybe [RelatedFinding]
$sel:types:FindingProviderFields' :: FindingProviderFields -> Maybe [Text]
$sel:severity:FindingProviderFields' :: FindingProviderFields -> Maybe FindingProviderSeverity
$sel:criticality:FindingProviderFields' :: FindingProviderFields -> Maybe Natural
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Criticality" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
criticality,
(Text
"Severity" Text -> FindingProviderSeverity -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (FindingProviderSeverity -> Pair)
-> Maybe FindingProviderSeverity -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe FindingProviderSeverity
severity,
(Text
"Types" 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]
types,
(Text
"RelatedFindings" Text -> [RelatedFinding] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([RelatedFinding] -> Pair) -> Maybe [RelatedFinding] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [RelatedFinding]
relatedFindings,
(Text
"Confidence" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
confidence
]
)