{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Inspector.Types.Finding
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Inspector.Types.Finding where

import qualified Amazonka.Core as Core
import Amazonka.Inspector.Types.AssetAttributes
import Amazonka.Inspector.Types.AssetType
import Amazonka.Inspector.Types.Attribute
import Amazonka.Inspector.Types.InspectorServiceAttributes
import Amazonka.Inspector.Types.Severity
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains information about an Amazon Inspector finding. This data type
-- is used as the response element in the DescribeFindings action.
--
-- /See:/ 'newFinding' smart constructor.
data Finding = Finding'
  { -- | The data element is set to \"Inspector\".
    Finding -> Maybe Text
service :: Prelude.Maybe Prelude.Text,
    -- | The finding severity. Values can be set to High, Medium, Low, and
    -- Informational.
    Finding -> Maybe Severity
severity :: Prelude.Maybe Severity,
    -- | The schema version of this data type.
    Finding -> Maybe Natural
schemaVersion :: Prelude.Maybe Prelude.Natural,
    -- | This data element is currently not used.
    Finding -> Maybe Natural
confidence :: Prelude.Maybe Prelude.Natural,
    -- | A collection of attributes of the host from which the finding is
    -- generated.
    Finding -> Maybe AssetAttributes
assetAttributes :: Prelude.Maybe AssetAttributes,
    -- | This data type is used in the Finding data type.
    Finding -> Maybe InspectorServiceAttributes
serviceAttributes :: Prelude.Maybe InspectorServiceAttributes,
    -- | The ID of the finding.
    Finding -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The numeric value of the finding severity.
    Finding -> Maybe Double
numericSeverity :: Prelude.Maybe Prelude.Double,
    -- | The type of the host from which the finding is generated.
    Finding -> Maybe AssetType
assetType :: Prelude.Maybe AssetType,
    -- | The name of the finding.
    Finding -> Maybe Text
title :: Prelude.Maybe Prelude.Text,
    -- | This data element is currently not used.
    Finding -> Maybe Bool
indicatorOfCompromise :: Prelude.Maybe Prelude.Bool,
    -- | The description of the finding.
    Finding -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The recommendation for the finding.
    Finding -> Maybe Text
recommendation :: Prelude.Maybe Prelude.Text,
    -- | The ARN that specifies the finding.
    Finding -> Text
arn :: Prelude.Text,
    -- | The system-defined attributes for the finding.
    Finding -> [Attribute]
attributes :: [Attribute],
    -- | The user-defined attributes that are assigned to the finding.
    Finding -> [Attribute]
userAttributes :: [Attribute],
    -- | The time when the finding was generated.
    Finding -> POSIX
createdAt :: Core.POSIX,
    -- | The time when AddAttributesToFindings is called.
    Finding -> POSIX
updatedAt :: Core.POSIX
  }
  deriving (Finding -> Finding -> Bool
(Finding -> Finding -> Bool)
-> (Finding -> Finding -> Bool) -> Eq Finding
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Finding -> Finding -> Bool
$c/= :: Finding -> Finding -> Bool
== :: Finding -> Finding -> Bool
$c== :: Finding -> Finding -> Bool
Prelude.Eq, ReadPrec [Finding]
ReadPrec Finding
Int -> ReadS Finding
ReadS [Finding]
(Int -> ReadS Finding)
-> ReadS [Finding]
-> ReadPrec Finding
-> ReadPrec [Finding]
-> Read Finding
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Finding]
$creadListPrec :: ReadPrec [Finding]
readPrec :: ReadPrec Finding
$creadPrec :: ReadPrec Finding
readList :: ReadS [Finding]
$creadList :: ReadS [Finding]
readsPrec :: Int -> ReadS Finding
$creadsPrec :: Int -> ReadS Finding
Prelude.Read, Int -> Finding -> ShowS
[Finding] -> ShowS
Finding -> String
(Int -> Finding -> ShowS)
-> (Finding -> String) -> ([Finding] -> ShowS) -> Show Finding
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Finding] -> ShowS
$cshowList :: [Finding] -> ShowS
show :: Finding -> String
$cshow :: Finding -> String
showsPrec :: Int -> Finding -> ShowS
$cshowsPrec :: Int -> Finding -> ShowS
Prelude.Show, (forall x. Finding -> Rep Finding x)
-> (forall x. Rep Finding x -> Finding) -> Generic Finding
forall x. Rep Finding x -> Finding
forall x. Finding -> Rep Finding x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Finding x -> Finding
$cfrom :: forall x. Finding -> Rep Finding x
Prelude.Generic)

-- |
-- Create a value of 'Finding' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'service', 'finding_service' - The data element is set to \"Inspector\".
--
-- 'severity', 'finding_severity' - The finding severity. Values can be set to High, Medium, Low, and
-- Informational.
--
-- 'schemaVersion', 'finding_schemaVersion' - The schema version of this data type.
--
-- 'confidence', 'finding_confidence' - This data element is currently not used.
--
-- 'assetAttributes', 'finding_assetAttributes' - A collection of attributes of the host from which the finding is
-- generated.
--
-- 'serviceAttributes', 'finding_serviceAttributes' - This data type is used in the Finding data type.
--
-- 'id', 'finding_id' - The ID of the finding.
--
-- 'numericSeverity', 'finding_numericSeverity' - The numeric value of the finding severity.
--
-- 'assetType', 'finding_assetType' - The type of the host from which the finding is generated.
--
-- 'title', 'finding_title' - The name of the finding.
--
-- 'indicatorOfCompromise', 'finding_indicatorOfCompromise' - This data element is currently not used.
--
-- 'description', 'finding_description' - The description of the finding.
--
-- 'recommendation', 'finding_recommendation' - The recommendation for the finding.
--
-- 'arn', 'finding_arn' - The ARN that specifies the finding.
--
-- 'attributes', 'finding_attributes' - The system-defined attributes for the finding.
--
-- 'userAttributes', 'finding_userAttributes' - The user-defined attributes that are assigned to the finding.
--
-- 'createdAt', 'finding_createdAt' - The time when the finding was generated.
--
-- 'updatedAt', 'finding_updatedAt' - The time when AddAttributesToFindings is called.
newFinding ::
  -- | 'arn'
  Prelude.Text ->
  -- | 'createdAt'
  Prelude.UTCTime ->
  -- | 'updatedAt'
  Prelude.UTCTime ->
  Finding
newFinding :: Text -> UTCTime -> UTCTime -> Finding
newFinding Text
pArn_ UTCTime
pCreatedAt_ UTCTime
pUpdatedAt_ =
  Finding' :: Maybe Text
-> Maybe Severity
-> Maybe Natural
-> Maybe Natural
-> Maybe AssetAttributes
-> Maybe InspectorServiceAttributes
-> Maybe Text
-> Maybe Double
-> Maybe AssetType
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Text
-> [Attribute]
-> [Attribute]
-> POSIX
-> POSIX
-> Finding
Finding'
    { $sel:service:Finding' :: Maybe Text
service = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:severity:Finding' :: Maybe Severity
severity = Maybe Severity
forall a. Maybe a
Prelude.Nothing,
      $sel:schemaVersion:Finding' :: Maybe Natural
schemaVersion = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:confidence:Finding' :: Maybe Natural
confidence = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:assetAttributes:Finding' :: Maybe AssetAttributes
assetAttributes = Maybe AssetAttributes
forall a. Maybe a
Prelude.Nothing,
      $sel:serviceAttributes:Finding' :: Maybe InspectorServiceAttributes
serviceAttributes = Maybe InspectorServiceAttributes
forall a. Maybe a
Prelude.Nothing,
      $sel:id:Finding' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:numericSeverity:Finding' :: Maybe Double
numericSeverity = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:assetType:Finding' :: Maybe AssetType
assetType = Maybe AssetType
forall a. Maybe a
Prelude.Nothing,
      $sel:title:Finding' :: Maybe Text
title = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:indicatorOfCompromise:Finding' :: Maybe Bool
indicatorOfCompromise = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:description:Finding' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:recommendation:Finding' :: Maybe Text
recommendation = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:Finding' :: Text
arn = Text
pArn_,
      $sel:attributes:Finding' :: [Attribute]
attributes = [Attribute]
forall a. Monoid a => a
Prelude.mempty,
      $sel:userAttributes:Finding' :: [Attribute]
userAttributes = [Attribute]
forall a. Monoid a => a
Prelude.mempty,
      $sel:createdAt:Finding' :: POSIX
createdAt = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreatedAt_,
      $sel:updatedAt:Finding' :: POSIX
updatedAt = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pUpdatedAt_
    }

-- | The data element is set to \"Inspector\".
finding_service :: Lens.Lens' Finding (Prelude.Maybe Prelude.Text)
finding_service :: (Maybe Text -> f (Maybe Text)) -> Finding -> f Finding
finding_service = (Finding -> Maybe Text)
-> (Finding -> Maybe Text -> Finding)
-> Lens Finding Finding (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Finding' {Maybe Text
service :: Maybe Text
$sel:service:Finding' :: Finding -> Maybe Text
service} -> Maybe Text
service) (\s :: Finding
s@Finding' {} Maybe Text
a -> Finding
s {$sel:service:Finding' :: Maybe Text
service = Maybe Text
a} :: Finding)

-- | The finding severity. Values can be set to High, Medium, Low, and
-- Informational.
finding_severity :: Lens.Lens' Finding (Prelude.Maybe Severity)
finding_severity :: (Maybe Severity -> f (Maybe Severity)) -> Finding -> f Finding
finding_severity = (Finding -> Maybe Severity)
-> (Finding -> Maybe Severity -> Finding)
-> Lens Finding Finding (Maybe Severity) (Maybe Severity)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Finding' {Maybe Severity
severity :: Maybe Severity
$sel:severity:Finding' :: Finding -> Maybe Severity
severity} -> Maybe Severity
severity) (\s :: Finding
s@Finding' {} Maybe Severity
a -> Finding
s {$sel:severity:Finding' :: Maybe Severity
severity = Maybe Severity
a} :: Finding)

-- | The schema version of this data type.
finding_schemaVersion :: Lens.Lens' Finding (Prelude.Maybe Prelude.Natural)
finding_schemaVersion :: (Maybe Natural -> f (Maybe Natural)) -> Finding -> f Finding
finding_schemaVersion = (Finding -> Maybe Natural)
-> (Finding -> Maybe Natural -> Finding)
-> Lens Finding Finding (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Finding' {Maybe Natural
schemaVersion :: Maybe Natural
$sel:schemaVersion:Finding' :: Finding -> Maybe Natural
schemaVersion} -> Maybe Natural
schemaVersion) (\s :: Finding
s@Finding' {} Maybe Natural
a -> Finding
s {$sel:schemaVersion:Finding' :: Maybe Natural
schemaVersion = Maybe Natural
a} :: Finding)

-- | This data element is currently not used.
finding_confidence :: Lens.Lens' Finding (Prelude.Maybe Prelude.Natural)
finding_confidence :: (Maybe Natural -> f (Maybe Natural)) -> Finding -> f Finding
finding_confidence = (Finding -> Maybe Natural)
-> (Finding -> Maybe Natural -> Finding)
-> Lens Finding Finding (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Finding' {Maybe Natural
confidence :: Maybe Natural
$sel:confidence:Finding' :: Finding -> Maybe Natural
confidence} -> Maybe Natural
confidence) (\s :: Finding
s@Finding' {} Maybe Natural
a -> Finding
s {$sel:confidence:Finding' :: Maybe Natural
confidence = Maybe Natural
a} :: Finding)

-- | A collection of attributes of the host from which the finding is
-- generated.
finding_assetAttributes :: Lens.Lens' Finding (Prelude.Maybe AssetAttributes)
finding_assetAttributes :: (Maybe AssetAttributes -> f (Maybe AssetAttributes))
-> Finding -> f Finding
finding_assetAttributes = (Finding -> Maybe AssetAttributes)
-> (Finding -> Maybe AssetAttributes -> Finding)
-> Lens
     Finding Finding (Maybe AssetAttributes) (Maybe AssetAttributes)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Finding' {Maybe AssetAttributes
assetAttributes :: Maybe AssetAttributes
$sel:assetAttributes:Finding' :: Finding -> Maybe AssetAttributes
assetAttributes} -> Maybe AssetAttributes
assetAttributes) (\s :: Finding
s@Finding' {} Maybe AssetAttributes
a -> Finding
s {$sel:assetAttributes:Finding' :: Maybe AssetAttributes
assetAttributes = Maybe AssetAttributes
a} :: Finding)

-- | This data type is used in the Finding data type.
finding_serviceAttributes :: Lens.Lens' Finding (Prelude.Maybe InspectorServiceAttributes)
finding_serviceAttributes :: (Maybe InspectorServiceAttributes
 -> f (Maybe InspectorServiceAttributes))
-> Finding -> f Finding
finding_serviceAttributes = (Finding -> Maybe InspectorServiceAttributes)
-> (Finding -> Maybe InspectorServiceAttributes -> Finding)
-> Lens
     Finding
     Finding
     (Maybe InspectorServiceAttributes)
     (Maybe InspectorServiceAttributes)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Finding' {Maybe InspectorServiceAttributes
serviceAttributes :: Maybe InspectorServiceAttributes
$sel:serviceAttributes:Finding' :: Finding -> Maybe InspectorServiceAttributes
serviceAttributes} -> Maybe InspectorServiceAttributes
serviceAttributes) (\s :: Finding
s@Finding' {} Maybe InspectorServiceAttributes
a -> Finding
s {$sel:serviceAttributes:Finding' :: Maybe InspectorServiceAttributes
serviceAttributes = Maybe InspectorServiceAttributes
a} :: Finding)

-- | The ID of the finding.
finding_id :: Lens.Lens' Finding (Prelude.Maybe Prelude.Text)
finding_id :: (Maybe Text -> f (Maybe Text)) -> Finding -> f Finding
finding_id = (Finding -> Maybe Text)
-> (Finding -> Maybe Text -> Finding)
-> Lens Finding Finding (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Finding' {Maybe Text
id :: Maybe Text
$sel:id:Finding' :: Finding -> Maybe Text
id} -> Maybe Text
id) (\s :: Finding
s@Finding' {} Maybe Text
a -> Finding
s {$sel:id:Finding' :: Maybe Text
id = Maybe Text
a} :: Finding)

-- | The numeric value of the finding severity.
finding_numericSeverity :: Lens.Lens' Finding (Prelude.Maybe Prelude.Double)
finding_numericSeverity :: (Maybe Double -> f (Maybe Double)) -> Finding -> f Finding
finding_numericSeverity = (Finding -> Maybe Double)
-> (Finding -> Maybe Double -> Finding)
-> Lens Finding Finding (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Finding' {Maybe Double
numericSeverity :: Maybe Double
$sel:numericSeverity:Finding' :: Finding -> Maybe Double
numericSeverity} -> Maybe Double
numericSeverity) (\s :: Finding
s@Finding' {} Maybe Double
a -> Finding
s {$sel:numericSeverity:Finding' :: Maybe Double
numericSeverity = Maybe Double
a} :: Finding)

-- | The type of the host from which the finding is generated.
finding_assetType :: Lens.Lens' Finding (Prelude.Maybe AssetType)
finding_assetType :: (Maybe AssetType -> f (Maybe AssetType)) -> Finding -> f Finding
finding_assetType = (Finding -> Maybe AssetType)
-> (Finding -> Maybe AssetType -> Finding)
-> Lens Finding Finding (Maybe AssetType) (Maybe AssetType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Finding' {Maybe AssetType
assetType :: Maybe AssetType
$sel:assetType:Finding' :: Finding -> Maybe AssetType
assetType} -> Maybe AssetType
assetType) (\s :: Finding
s@Finding' {} Maybe AssetType
a -> Finding
s {$sel:assetType:Finding' :: Maybe AssetType
assetType = Maybe AssetType
a} :: Finding)

-- | The name of the finding.
finding_title :: Lens.Lens' Finding (Prelude.Maybe Prelude.Text)
finding_title :: (Maybe Text -> f (Maybe Text)) -> Finding -> f Finding
finding_title = (Finding -> Maybe Text)
-> (Finding -> Maybe Text -> Finding)
-> Lens Finding Finding (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Finding' {Maybe Text
title :: Maybe Text
$sel:title:Finding' :: Finding -> Maybe Text
title} -> Maybe Text
title) (\s :: Finding
s@Finding' {} Maybe Text
a -> Finding
s {$sel:title:Finding' :: Maybe Text
title = Maybe Text
a} :: Finding)

-- | This data element is currently not used.
finding_indicatorOfCompromise :: Lens.Lens' Finding (Prelude.Maybe Prelude.Bool)
finding_indicatorOfCompromise :: (Maybe Bool -> f (Maybe Bool)) -> Finding -> f Finding
finding_indicatorOfCompromise = (Finding -> Maybe Bool)
-> (Finding -> Maybe Bool -> Finding)
-> Lens Finding Finding (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Finding' {Maybe Bool
indicatorOfCompromise :: Maybe Bool
$sel:indicatorOfCompromise:Finding' :: Finding -> Maybe Bool
indicatorOfCompromise} -> Maybe Bool
indicatorOfCompromise) (\s :: Finding
s@Finding' {} Maybe Bool
a -> Finding
s {$sel:indicatorOfCompromise:Finding' :: Maybe Bool
indicatorOfCompromise = Maybe Bool
a} :: Finding)

-- | The description of the finding.
finding_description :: Lens.Lens' Finding (Prelude.Maybe Prelude.Text)
finding_description :: (Maybe Text -> f (Maybe Text)) -> Finding -> f Finding
finding_description = (Finding -> Maybe Text)
-> (Finding -> Maybe Text -> Finding)
-> Lens Finding Finding (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Finding' {Maybe Text
description :: Maybe Text
$sel:description:Finding' :: Finding -> Maybe Text
description} -> Maybe Text
description) (\s :: Finding
s@Finding' {} Maybe Text
a -> Finding
s {$sel:description:Finding' :: Maybe Text
description = Maybe Text
a} :: Finding)

-- | The recommendation for the finding.
finding_recommendation :: Lens.Lens' Finding (Prelude.Maybe Prelude.Text)
finding_recommendation :: (Maybe Text -> f (Maybe Text)) -> Finding -> f Finding
finding_recommendation = (Finding -> Maybe Text)
-> (Finding -> Maybe Text -> Finding)
-> Lens Finding Finding (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Finding' {Maybe Text
recommendation :: Maybe Text
$sel:recommendation:Finding' :: Finding -> Maybe Text
recommendation} -> Maybe Text
recommendation) (\s :: Finding
s@Finding' {} Maybe Text
a -> Finding
s {$sel:recommendation:Finding' :: Maybe Text
recommendation = Maybe Text
a} :: Finding)

-- | The ARN that specifies the finding.
finding_arn :: Lens.Lens' Finding Prelude.Text
finding_arn :: (Text -> f Text) -> Finding -> f Finding
finding_arn = (Finding -> Text)
-> (Finding -> Text -> Finding) -> Lens Finding Finding Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Finding' {Text
arn :: Text
$sel:arn:Finding' :: Finding -> Text
arn} -> Text
arn) (\s :: Finding
s@Finding' {} Text
a -> Finding
s {$sel:arn:Finding' :: Text
arn = Text
a} :: Finding)

-- | The system-defined attributes for the finding.
finding_attributes :: Lens.Lens' Finding [Attribute]
finding_attributes :: ([Attribute] -> f [Attribute]) -> Finding -> f Finding
finding_attributes = (Finding -> [Attribute])
-> (Finding -> [Attribute] -> Finding)
-> Lens Finding Finding [Attribute] [Attribute]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Finding' {[Attribute]
attributes :: [Attribute]
$sel:attributes:Finding' :: Finding -> [Attribute]
attributes} -> [Attribute]
attributes) (\s :: Finding
s@Finding' {} [Attribute]
a -> Finding
s {$sel:attributes:Finding' :: [Attribute]
attributes = [Attribute]
a} :: Finding) (([Attribute] -> f [Attribute]) -> Finding -> f Finding)
-> (([Attribute] -> f [Attribute]) -> [Attribute] -> f [Attribute])
-> ([Attribute] -> f [Attribute])
-> Finding
-> f Finding
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Attribute] -> f [Attribute]) -> [Attribute] -> f [Attribute]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The user-defined attributes that are assigned to the finding.
finding_userAttributes :: Lens.Lens' Finding [Attribute]
finding_userAttributes :: ([Attribute] -> f [Attribute]) -> Finding -> f Finding
finding_userAttributes = (Finding -> [Attribute])
-> (Finding -> [Attribute] -> Finding)
-> Lens Finding Finding [Attribute] [Attribute]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Finding' {[Attribute]
userAttributes :: [Attribute]
$sel:userAttributes:Finding' :: Finding -> [Attribute]
userAttributes} -> [Attribute]
userAttributes) (\s :: Finding
s@Finding' {} [Attribute]
a -> Finding
s {$sel:userAttributes:Finding' :: [Attribute]
userAttributes = [Attribute]
a} :: Finding) (([Attribute] -> f [Attribute]) -> Finding -> f Finding)
-> (([Attribute] -> f [Attribute]) -> [Attribute] -> f [Attribute])
-> ([Attribute] -> f [Attribute])
-> Finding
-> f Finding
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Attribute] -> f [Attribute]) -> [Attribute] -> f [Attribute]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The time when the finding was generated.
finding_createdAt :: Lens.Lens' Finding Prelude.UTCTime
finding_createdAt :: (UTCTime -> f UTCTime) -> Finding -> f Finding
finding_createdAt = (Finding -> POSIX)
-> (Finding -> POSIX -> Finding)
-> Lens Finding Finding POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Finding' {POSIX
createdAt :: POSIX
$sel:createdAt:Finding' :: Finding -> POSIX
createdAt} -> POSIX
createdAt) (\s :: Finding
s@Finding' {} POSIX
a -> Finding
s {$sel:createdAt:Finding' :: POSIX
createdAt = POSIX
a} :: Finding) ((POSIX -> f POSIX) -> Finding -> f Finding)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> Finding
-> f Finding
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The time when AddAttributesToFindings is called.
finding_updatedAt :: Lens.Lens' Finding Prelude.UTCTime
finding_updatedAt :: (UTCTime -> f UTCTime) -> Finding -> f Finding
finding_updatedAt = (Finding -> POSIX)
-> (Finding -> POSIX -> Finding)
-> Lens Finding Finding POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Finding' {POSIX
updatedAt :: POSIX
$sel:updatedAt:Finding' :: Finding -> POSIX
updatedAt} -> POSIX
updatedAt) (\s :: Finding
s@Finding' {} POSIX
a -> Finding
s {$sel:updatedAt:Finding' :: POSIX
updatedAt = POSIX
a} :: Finding) ((POSIX -> f POSIX) -> Finding -> f Finding)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> Finding
-> f Finding
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

instance Core.FromJSON Finding where
  parseJSON :: Value -> Parser Finding
parseJSON =
    String -> (Object -> Parser Finding) -> Value -> Parser Finding
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Finding"
      ( \Object
x ->
          Maybe Text
-> Maybe Severity
-> Maybe Natural
-> Maybe Natural
-> Maybe AssetAttributes
-> Maybe InspectorServiceAttributes
-> Maybe Text
-> Maybe Double
-> Maybe AssetType
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Text
-> [Attribute]
-> [Attribute]
-> POSIX
-> POSIX
-> Finding
Finding'
            (Maybe Text
 -> Maybe Severity
 -> Maybe Natural
 -> Maybe Natural
 -> Maybe AssetAttributes
 -> Maybe InspectorServiceAttributes
 -> Maybe Text
 -> Maybe Double
 -> Maybe AssetType
 -> Maybe Text
 -> Maybe Bool
 -> Maybe Text
 -> Maybe Text
 -> Text
 -> [Attribute]
 -> [Attribute]
 -> POSIX
 -> POSIX
 -> Finding)
-> Parser (Maybe Text)
-> Parser
     (Maybe Severity
      -> Maybe Natural
      -> Maybe Natural
      -> Maybe AssetAttributes
      -> Maybe InspectorServiceAttributes
      -> Maybe Text
      -> Maybe Double
      -> Maybe AssetType
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Text
      -> [Attribute]
      -> [Attribute]
      -> POSIX
      -> POSIX
      -> Finding)
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
"service")
            Parser
  (Maybe Severity
   -> Maybe Natural
   -> Maybe Natural
   -> Maybe AssetAttributes
   -> Maybe InspectorServiceAttributes
   -> Maybe Text
   -> Maybe Double
   -> Maybe AssetType
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Text
   -> [Attribute]
   -> [Attribute]
   -> POSIX
   -> POSIX
   -> Finding)
-> Parser (Maybe Severity)
-> Parser
     (Maybe Natural
      -> Maybe Natural
      -> Maybe AssetAttributes
      -> Maybe InspectorServiceAttributes
      -> Maybe Text
      -> Maybe Double
      -> Maybe AssetType
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Text
      -> [Attribute]
      -> [Attribute]
      -> POSIX
      -> POSIX
      -> Finding)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Severity)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"severity")
            Parser
  (Maybe Natural
   -> Maybe Natural
   -> Maybe AssetAttributes
   -> Maybe InspectorServiceAttributes
   -> Maybe Text
   -> Maybe Double
   -> Maybe AssetType
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Text
   -> [Attribute]
   -> [Attribute]
   -> POSIX
   -> POSIX
   -> Finding)
-> Parser (Maybe Natural)
-> Parser
     (Maybe Natural
      -> Maybe AssetAttributes
      -> Maybe InspectorServiceAttributes
      -> Maybe Text
      -> Maybe Double
      -> Maybe AssetType
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Text
      -> [Attribute]
      -> [Attribute]
      -> POSIX
      -> POSIX
      -> Finding)
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
"schemaVersion")
            Parser
  (Maybe Natural
   -> Maybe AssetAttributes
   -> Maybe InspectorServiceAttributes
   -> Maybe Text
   -> Maybe Double
   -> Maybe AssetType
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Text
   -> [Attribute]
   -> [Attribute]
   -> POSIX
   -> POSIX
   -> Finding)
-> Parser (Maybe Natural)
-> Parser
     (Maybe AssetAttributes
      -> Maybe InspectorServiceAttributes
      -> Maybe Text
      -> Maybe Double
      -> Maybe AssetType
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Text
      -> [Attribute]
      -> [Attribute]
      -> POSIX
      -> POSIX
      -> Finding)
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")
            Parser
  (Maybe AssetAttributes
   -> Maybe InspectorServiceAttributes
   -> Maybe Text
   -> Maybe Double
   -> Maybe AssetType
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Text
   -> [Attribute]
   -> [Attribute]
   -> POSIX
   -> POSIX
   -> Finding)
-> Parser (Maybe AssetAttributes)
-> Parser
     (Maybe InspectorServiceAttributes
      -> Maybe Text
      -> Maybe Double
      -> Maybe AssetType
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Text
      -> [Attribute]
      -> [Attribute]
      -> POSIX
      -> POSIX
      -> Finding)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe AssetAttributes)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"assetAttributes")
            Parser
  (Maybe InspectorServiceAttributes
   -> Maybe Text
   -> Maybe Double
   -> Maybe AssetType
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Text
   -> [Attribute]
   -> [Attribute]
   -> POSIX
   -> POSIX
   -> Finding)
-> Parser (Maybe InspectorServiceAttributes)
-> Parser
     (Maybe Text
      -> Maybe Double
      -> Maybe AssetType
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Text
      -> [Attribute]
      -> [Attribute]
      -> POSIX
      -> POSIX
      -> Finding)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe InspectorServiceAttributes)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"serviceAttributes")
            Parser
  (Maybe Text
   -> Maybe Double
   -> Maybe AssetType
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Text
   -> [Attribute]
   -> [Attribute]
   -> POSIX
   -> POSIX
   -> Finding)
-> Parser (Maybe Text)
-> Parser
     (Maybe Double
      -> Maybe AssetType
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Text
      -> [Attribute]
      -> [Attribute]
      -> POSIX
      -> POSIX
      -> Finding)
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
"id")
            Parser
  (Maybe Double
   -> Maybe AssetType
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Text
   -> [Attribute]
   -> [Attribute]
   -> POSIX
   -> POSIX
   -> Finding)
-> Parser (Maybe Double)
-> Parser
     (Maybe AssetType
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Text
      -> [Attribute]
      -> [Attribute]
      -> POSIX
      -> POSIX
      -> Finding)
forall (f :: * -> *) a b. Applicative f => 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
"numericSeverity")
            Parser
  (Maybe AssetType
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Text
   -> [Attribute]
   -> [Attribute]
   -> POSIX
   -> POSIX
   -> Finding)
-> Parser (Maybe AssetType)
-> Parser
     (Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Text
      -> [Attribute]
      -> [Attribute]
      -> POSIX
      -> POSIX
      -> Finding)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe AssetType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"assetType")
            Parser
  (Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Text
   -> [Attribute]
   -> [Attribute]
   -> POSIX
   -> POSIX
   -> Finding)
-> Parser (Maybe Text)
-> Parser
     (Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Text
      -> [Attribute]
      -> [Attribute]
      -> POSIX
      -> POSIX
      -> Finding)
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
"title")
            Parser
  (Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Text
   -> [Attribute]
   -> [Attribute]
   -> POSIX
   -> POSIX
   -> Finding)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Text
      -> [Attribute]
      -> [Attribute]
      -> POSIX
      -> POSIX
      -> Finding)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"indicatorOfCompromise")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Text
   -> [Attribute]
   -> [Attribute]
   -> POSIX
   -> POSIX
   -> Finding)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Text -> [Attribute] -> [Attribute] -> POSIX -> POSIX -> Finding)
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
"description")
            Parser
  (Maybe Text
   -> Text -> [Attribute] -> [Attribute] -> POSIX -> POSIX -> Finding)
-> Parser (Maybe Text)
-> Parser
     (Text -> [Attribute] -> [Attribute] -> POSIX -> POSIX -> Finding)
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
"recommendation")
            Parser
  (Text -> [Attribute] -> [Attribute] -> POSIX -> POSIX -> Finding)
-> Parser Text
-> Parser ([Attribute] -> [Attribute] -> POSIX -> POSIX -> Finding)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"arn")
            Parser ([Attribute] -> [Attribute] -> POSIX -> POSIX -> Finding)
-> Parser [Attribute]
-> Parser ([Attribute] -> POSIX -> POSIX -> Finding)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe [Attribute])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"attributes" Parser (Maybe [Attribute]) -> [Attribute] -> Parser [Attribute]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [Attribute]
forall a. Monoid a => a
Prelude.mempty)
            Parser ([Attribute] -> POSIX -> POSIX -> Finding)
-> Parser [Attribute] -> Parser (POSIX -> POSIX -> Finding)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe [Attribute])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"userAttributes" Parser (Maybe [Attribute]) -> [Attribute] -> Parser [Attribute]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [Attribute]
forall a. Monoid a => a
Prelude.mempty)
            Parser (POSIX -> POSIX -> Finding)
-> Parser POSIX -> Parser (POSIX -> Finding)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser POSIX
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"createdAt")
            Parser (POSIX -> Finding) -> Parser POSIX -> Parser Finding
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser POSIX
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"updatedAt")
      )

instance Prelude.Hashable Finding

instance Prelude.NFData Finding