{-# 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.AssessmentRun
-- 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.AssessmentRun where

import qualified Amazonka.Core as Core
import Amazonka.Inspector.Types.AssessmentRunNotification
import Amazonka.Inspector.Types.AssessmentRunState
import Amazonka.Inspector.Types.AssessmentRunStateChange
import Amazonka.Inspector.Types.Attribute
import Amazonka.Inspector.Types.Severity
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A snapshot of an Amazon Inspector assessment run that contains the
-- findings of the assessment run .
--
-- Used as the response element in the DescribeAssessmentRuns action.
--
-- /See:/ 'newAssessmentRun' smart constructor.
data AssessmentRun = AssessmentRun'
  { -- | The time when StartAssessmentRun was called.
    AssessmentRun -> Maybe POSIX
startedAt :: Prelude.Maybe Core.POSIX,
    -- | The assessment run completion time that corresponds to the rules
    -- packages evaluation completion time or failure.
    AssessmentRun -> Maybe POSIX
completedAt :: Prelude.Maybe Core.POSIX,
    -- | The ARN of the assessment run.
    AssessmentRun -> Text
arn :: Prelude.Text,
    -- | The auto-generated name for the assessment run.
    AssessmentRun -> Text
name :: Prelude.Text,
    -- | The ARN of the assessment template that is associated with the
    -- assessment run.
    AssessmentRun -> Text
assessmentTemplateArn :: Prelude.Text,
    -- | The state of the assessment run.
    AssessmentRun -> AssessmentRunState
state :: AssessmentRunState,
    -- | The duration of the assessment run.
    AssessmentRun -> Natural
durationInSeconds :: Prelude.Natural,
    -- | The rules packages selected for the assessment run.
    AssessmentRun -> NonEmpty Text
rulesPackageArns :: Prelude.NonEmpty Prelude.Text,
    -- | The user-defined attributes that are assigned to every generated
    -- finding.
    AssessmentRun -> [Attribute]
userAttributesForFindings :: [Attribute],
    -- | The time when StartAssessmentRun was called.
    AssessmentRun -> POSIX
createdAt :: Core.POSIX,
    -- | The last time when the assessment run\'s state changed.
    AssessmentRun -> POSIX
stateChangedAt :: Core.POSIX,
    -- | A Boolean value (true or false) that specifies whether the process of
    -- collecting data from the agents is completed.
    AssessmentRun -> Bool
dataCollected :: Prelude.Bool,
    -- | A list of the assessment run state changes.
    AssessmentRun -> [AssessmentRunStateChange]
stateChanges :: [AssessmentRunStateChange],
    -- | A list of notifications for the event subscriptions. A notification
    -- about a particular generated finding is added to this list only once.
    AssessmentRun -> [AssessmentRunNotification]
notifications :: [AssessmentRunNotification],
    -- | Provides a total count of generated findings per severity.
    AssessmentRun -> HashMap Severity Int
findingCounts :: Prelude.HashMap Severity Prelude.Int
  }
  deriving (AssessmentRun -> AssessmentRun -> Bool
(AssessmentRun -> AssessmentRun -> Bool)
-> (AssessmentRun -> AssessmentRun -> Bool) -> Eq AssessmentRun
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssessmentRun -> AssessmentRun -> Bool
$c/= :: AssessmentRun -> AssessmentRun -> Bool
== :: AssessmentRun -> AssessmentRun -> Bool
$c== :: AssessmentRun -> AssessmentRun -> Bool
Prelude.Eq, ReadPrec [AssessmentRun]
ReadPrec AssessmentRun
Int -> ReadS AssessmentRun
ReadS [AssessmentRun]
(Int -> ReadS AssessmentRun)
-> ReadS [AssessmentRun]
-> ReadPrec AssessmentRun
-> ReadPrec [AssessmentRun]
-> Read AssessmentRun
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssessmentRun]
$creadListPrec :: ReadPrec [AssessmentRun]
readPrec :: ReadPrec AssessmentRun
$creadPrec :: ReadPrec AssessmentRun
readList :: ReadS [AssessmentRun]
$creadList :: ReadS [AssessmentRun]
readsPrec :: Int -> ReadS AssessmentRun
$creadsPrec :: Int -> ReadS AssessmentRun
Prelude.Read, Int -> AssessmentRun -> ShowS
[AssessmentRun] -> ShowS
AssessmentRun -> String
(Int -> AssessmentRun -> ShowS)
-> (AssessmentRun -> String)
-> ([AssessmentRun] -> ShowS)
-> Show AssessmentRun
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssessmentRun] -> ShowS
$cshowList :: [AssessmentRun] -> ShowS
show :: AssessmentRun -> String
$cshow :: AssessmentRun -> String
showsPrec :: Int -> AssessmentRun -> ShowS
$cshowsPrec :: Int -> AssessmentRun -> ShowS
Prelude.Show, (forall x. AssessmentRun -> Rep AssessmentRun x)
-> (forall x. Rep AssessmentRun x -> AssessmentRun)
-> Generic AssessmentRun
forall x. Rep AssessmentRun x -> AssessmentRun
forall x. AssessmentRun -> Rep AssessmentRun x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AssessmentRun x -> AssessmentRun
$cfrom :: forall x. AssessmentRun -> Rep AssessmentRun x
Prelude.Generic)

-- |
-- Create a value of 'AssessmentRun' 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:
--
-- 'startedAt', 'assessmentRun_startedAt' - The time when StartAssessmentRun was called.
--
-- 'completedAt', 'assessmentRun_completedAt' - The assessment run completion time that corresponds to the rules
-- packages evaluation completion time or failure.
--
-- 'arn', 'assessmentRun_arn' - The ARN of the assessment run.
--
-- 'name', 'assessmentRun_name' - The auto-generated name for the assessment run.
--
-- 'assessmentTemplateArn', 'assessmentRun_assessmentTemplateArn' - The ARN of the assessment template that is associated with the
-- assessment run.
--
-- 'state', 'assessmentRun_state' - The state of the assessment run.
--
-- 'durationInSeconds', 'assessmentRun_durationInSeconds' - The duration of the assessment run.
--
-- 'rulesPackageArns', 'assessmentRun_rulesPackageArns' - The rules packages selected for the assessment run.
--
-- 'userAttributesForFindings', 'assessmentRun_userAttributesForFindings' - The user-defined attributes that are assigned to every generated
-- finding.
--
-- 'createdAt', 'assessmentRun_createdAt' - The time when StartAssessmentRun was called.
--
-- 'stateChangedAt', 'assessmentRun_stateChangedAt' - The last time when the assessment run\'s state changed.
--
-- 'dataCollected', 'assessmentRun_dataCollected' - A Boolean value (true or false) that specifies whether the process of
-- collecting data from the agents is completed.
--
-- 'stateChanges', 'assessmentRun_stateChanges' - A list of the assessment run state changes.
--
-- 'notifications', 'assessmentRun_notifications' - A list of notifications for the event subscriptions. A notification
-- about a particular generated finding is added to this list only once.
--
-- 'findingCounts', 'assessmentRun_findingCounts' - Provides a total count of generated findings per severity.
newAssessmentRun ::
  -- | 'arn'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  -- | 'assessmentTemplateArn'
  Prelude.Text ->
  -- | 'state'
  AssessmentRunState ->
  -- | 'durationInSeconds'
  Prelude.Natural ->
  -- | 'rulesPackageArns'
  Prelude.NonEmpty Prelude.Text ->
  -- | 'createdAt'
  Prelude.UTCTime ->
  -- | 'stateChangedAt'
  Prelude.UTCTime ->
  -- | 'dataCollected'
  Prelude.Bool ->
  AssessmentRun
newAssessmentRun :: Text
-> Text
-> Text
-> AssessmentRunState
-> Natural
-> NonEmpty Text
-> UTCTime
-> UTCTime
-> Bool
-> AssessmentRun
newAssessmentRun
  Text
pArn_
  Text
pName_
  Text
pAssessmentTemplateArn_
  AssessmentRunState
pState_
  Natural
pDurationInSeconds_
  NonEmpty Text
pRulesPackageArns_
  UTCTime
pCreatedAt_
  UTCTime
pStateChangedAt_
  Bool
pDataCollected_ =
    AssessmentRun' :: Maybe POSIX
-> Maybe POSIX
-> Text
-> Text
-> Text
-> AssessmentRunState
-> Natural
-> NonEmpty Text
-> [Attribute]
-> POSIX
-> POSIX
-> Bool
-> [AssessmentRunStateChange]
-> [AssessmentRunNotification]
-> HashMap Severity Int
-> AssessmentRun
AssessmentRun'
      { $sel:startedAt:AssessmentRun' :: Maybe POSIX
startedAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
        $sel:completedAt:AssessmentRun' :: Maybe POSIX
completedAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
        $sel:arn:AssessmentRun' :: Text
arn = Text
pArn_,
        $sel:name:AssessmentRun' :: Text
name = Text
pName_,
        $sel:assessmentTemplateArn:AssessmentRun' :: Text
assessmentTemplateArn = Text
pAssessmentTemplateArn_,
        $sel:state:AssessmentRun' :: AssessmentRunState
state = AssessmentRunState
pState_,
        $sel:durationInSeconds:AssessmentRun' :: Natural
durationInSeconds = Natural
pDurationInSeconds_,
        $sel:rulesPackageArns:AssessmentRun' :: NonEmpty Text
rulesPackageArns =
          Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Text) (Identity (NonEmpty Text))
 -> Tagged (NonEmpty Text) (Identity (NonEmpty Text)))
-> NonEmpty Text -> NonEmpty Text
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pRulesPackageArns_,
        $sel:userAttributesForFindings:AssessmentRun' :: [Attribute]
userAttributesForFindings = [Attribute]
forall a. Monoid a => a
Prelude.mempty,
        $sel:createdAt:AssessmentRun' :: 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:stateChangedAt:AssessmentRun' :: POSIX
stateChangedAt = 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
pStateChangedAt_,
        $sel:dataCollected:AssessmentRun' :: Bool
dataCollected = Bool
pDataCollected_,
        $sel:stateChanges:AssessmentRun' :: [AssessmentRunStateChange]
stateChanges = [AssessmentRunStateChange]
forall a. Monoid a => a
Prelude.mempty,
        $sel:notifications:AssessmentRun' :: [AssessmentRunNotification]
notifications = [AssessmentRunNotification]
forall a. Monoid a => a
Prelude.mempty,
        $sel:findingCounts:AssessmentRun' :: HashMap Severity Int
findingCounts = HashMap Severity Int
forall a. Monoid a => a
Prelude.mempty
      }

-- | The time when StartAssessmentRun was called.
assessmentRun_startedAt :: Lens.Lens' AssessmentRun (Prelude.Maybe Prelude.UTCTime)
assessmentRun_startedAt :: (Maybe UTCTime -> f (Maybe UTCTime))
-> AssessmentRun -> f AssessmentRun
assessmentRun_startedAt = (AssessmentRun -> Maybe POSIX)
-> (AssessmentRun -> Maybe POSIX -> AssessmentRun)
-> Lens AssessmentRun AssessmentRun (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssessmentRun' {Maybe POSIX
startedAt :: Maybe POSIX
$sel:startedAt:AssessmentRun' :: AssessmentRun -> Maybe POSIX
startedAt} -> Maybe POSIX
startedAt) (\s :: AssessmentRun
s@AssessmentRun' {} Maybe POSIX
a -> AssessmentRun
s {$sel:startedAt:AssessmentRun' :: Maybe POSIX
startedAt = Maybe POSIX
a} :: AssessmentRun) ((Maybe POSIX -> f (Maybe POSIX))
 -> AssessmentRun -> f AssessmentRun)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> AssessmentRun
-> f AssessmentRun
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The assessment run completion time that corresponds to the rules
-- packages evaluation completion time or failure.
assessmentRun_completedAt :: Lens.Lens' AssessmentRun (Prelude.Maybe Prelude.UTCTime)
assessmentRun_completedAt :: (Maybe UTCTime -> f (Maybe UTCTime))
-> AssessmentRun -> f AssessmentRun
assessmentRun_completedAt = (AssessmentRun -> Maybe POSIX)
-> (AssessmentRun -> Maybe POSIX -> AssessmentRun)
-> Lens AssessmentRun AssessmentRun (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssessmentRun' {Maybe POSIX
completedAt :: Maybe POSIX
$sel:completedAt:AssessmentRun' :: AssessmentRun -> Maybe POSIX
completedAt} -> Maybe POSIX
completedAt) (\s :: AssessmentRun
s@AssessmentRun' {} Maybe POSIX
a -> AssessmentRun
s {$sel:completedAt:AssessmentRun' :: Maybe POSIX
completedAt = Maybe POSIX
a} :: AssessmentRun) ((Maybe POSIX -> f (Maybe POSIX))
 -> AssessmentRun -> f AssessmentRun)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> AssessmentRun
-> f AssessmentRun
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The ARN of the assessment run.
assessmentRun_arn :: Lens.Lens' AssessmentRun Prelude.Text
assessmentRun_arn :: (Text -> f Text) -> AssessmentRun -> f AssessmentRun
assessmentRun_arn = (AssessmentRun -> Text)
-> (AssessmentRun -> Text -> AssessmentRun)
-> Lens AssessmentRun AssessmentRun Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssessmentRun' {Text
arn :: Text
$sel:arn:AssessmentRun' :: AssessmentRun -> Text
arn} -> Text
arn) (\s :: AssessmentRun
s@AssessmentRun' {} Text
a -> AssessmentRun
s {$sel:arn:AssessmentRun' :: Text
arn = Text
a} :: AssessmentRun)

-- | The auto-generated name for the assessment run.
assessmentRun_name :: Lens.Lens' AssessmentRun Prelude.Text
assessmentRun_name :: (Text -> f Text) -> AssessmentRun -> f AssessmentRun
assessmentRun_name = (AssessmentRun -> Text)
-> (AssessmentRun -> Text -> AssessmentRun)
-> Lens AssessmentRun AssessmentRun Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssessmentRun' {Text
name :: Text
$sel:name:AssessmentRun' :: AssessmentRun -> Text
name} -> Text
name) (\s :: AssessmentRun
s@AssessmentRun' {} Text
a -> AssessmentRun
s {$sel:name:AssessmentRun' :: Text
name = Text
a} :: AssessmentRun)

-- | The ARN of the assessment template that is associated with the
-- assessment run.
assessmentRun_assessmentTemplateArn :: Lens.Lens' AssessmentRun Prelude.Text
assessmentRun_assessmentTemplateArn :: (Text -> f Text) -> AssessmentRun -> f AssessmentRun
assessmentRun_assessmentTemplateArn = (AssessmentRun -> Text)
-> (AssessmentRun -> Text -> AssessmentRun)
-> Lens AssessmentRun AssessmentRun Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssessmentRun' {Text
assessmentTemplateArn :: Text
$sel:assessmentTemplateArn:AssessmentRun' :: AssessmentRun -> Text
assessmentTemplateArn} -> Text
assessmentTemplateArn) (\s :: AssessmentRun
s@AssessmentRun' {} Text
a -> AssessmentRun
s {$sel:assessmentTemplateArn:AssessmentRun' :: Text
assessmentTemplateArn = Text
a} :: AssessmentRun)

-- | The state of the assessment run.
assessmentRun_state :: Lens.Lens' AssessmentRun AssessmentRunState
assessmentRun_state :: (AssessmentRunState -> f AssessmentRunState)
-> AssessmentRun -> f AssessmentRun
assessmentRun_state = (AssessmentRun -> AssessmentRunState)
-> (AssessmentRun -> AssessmentRunState -> AssessmentRun)
-> Lens
     AssessmentRun AssessmentRun AssessmentRunState AssessmentRunState
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssessmentRun' {AssessmentRunState
state :: AssessmentRunState
$sel:state:AssessmentRun' :: AssessmentRun -> AssessmentRunState
state} -> AssessmentRunState
state) (\s :: AssessmentRun
s@AssessmentRun' {} AssessmentRunState
a -> AssessmentRun
s {$sel:state:AssessmentRun' :: AssessmentRunState
state = AssessmentRunState
a} :: AssessmentRun)

-- | The duration of the assessment run.
assessmentRun_durationInSeconds :: Lens.Lens' AssessmentRun Prelude.Natural
assessmentRun_durationInSeconds :: (Natural -> f Natural) -> AssessmentRun -> f AssessmentRun
assessmentRun_durationInSeconds = (AssessmentRun -> Natural)
-> (AssessmentRun -> Natural -> AssessmentRun)
-> Lens AssessmentRun AssessmentRun Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssessmentRun' {Natural
durationInSeconds :: Natural
$sel:durationInSeconds:AssessmentRun' :: AssessmentRun -> Natural
durationInSeconds} -> Natural
durationInSeconds) (\s :: AssessmentRun
s@AssessmentRun' {} Natural
a -> AssessmentRun
s {$sel:durationInSeconds:AssessmentRun' :: Natural
durationInSeconds = Natural
a} :: AssessmentRun)

-- | The rules packages selected for the assessment run.
assessmentRun_rulesPackageArns :: Lens.Lens' AssessmentRun (Prelude.NonEmpty Prelude.Text)
assessmentRun_rulesPackageArns :: (NonEmpty Text -> f (NonEmpty Text))
-> AssessmentRun -> f AssessmentRun
assessmentRun_rulesPackageArns = (AssessmentRun -> NonEmpty Text)
-> (AssessmentRun -> NonEmpty Text -> AssessmentRun)
-> Lens AssessmentRun AssessmentRun (NonEmpty Text) (NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssessmentRun' {NonEmpty Text
rulesPackageArns :: NonEmpty Text
$sel:rulesPackageArns:AssessmentRun' :: AssessmentRun -> NonEmpty Text
rulesPackageArns} -> NonEmpty Text
rulesPackageArns) (\s :: AssessmentRun
s@AssessmentRun' {} NonEmpty Text
a -> AssessmentRun
s {$sel:rulesPackageArns:AssessmentRun' :: NonEmpty Text
rulesPackageArns = NonEmpty Text
a} :: AssessmentRun) ((NonEmpty Text -> f (NonEmpty Text))
 -> AssessmentRun -> f AssessmentRun)
-> ((NonEmpty Text -> f (NonEmpty Text))
    -> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> AssessmentRun
-> f AssessmentRun
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text)
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 every generated
-- finding.
assessmentRun_userAttributesForFindings :: Lens.Lens' AssessmentRun [Attribute]
assessmentRun_userAttributesForFindings :: ([Attribute] -> f [Attribute]) -> AssessmentRun -> f AssessmentRun
assessmentRun_userAttributesForFindings = (AssessmentRun -> [Attribute])
-> (AssessmentRun -> [Attribute] -> AssessmentRun)
-> Lens AssessmentRun AssessmentRun [Attribute] [Attribute]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssessmentRun' {[Attribute]
userAttributesForFindings :: [Attribute]
$sel:userAttributesForFindings:AssessmentRun' :: AssessmentRun -> [Attribute]
userAttributesForFindings} -> [Attribute]
userAttributesForFindings) (\s :: AssessmentRun
s@AssessmentRun' {} [Attribute]
a -> AssessmentRun
s {$sel:userAttributesForFindings:AssessmentRun' :: [Attribute]
userAttributesForFindings = [Attribute]
a} :: AssessmentRun) (([Attribute] -> f [Attribute])
 -> AssessmentRun -> f AssessmentRun)
-> (([Attribute] -> f [Attribute]) -> [Attribute] -> f [Attribute])
-> ([Attribute] -> f [Attribute])
-> AssessmentRun
-> f AssessmentRun
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 StartAssessmentRun was called.
assessmentRun_createdAt :: Lens.Lens' AssessmentRun Prelude.UTCTime
assessmentRun_createdAt :: (UTCTime -> f UTCTime) -> AssessmentRun -> f AssessmentRun
assessmentRun_createdAt = (AssessmentRun -> POSIX)
-> (AssessmentRun -> POSIX -> AssessmentRun)
-> Lens AssessmentRun AssessmentRun POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssessmentRun' {POSIX
createdAt :: POSIX
$sel:createdAt:AssessmentRun' :: AssessmentRun -> POSIX
createdAt} -> POSIX
createdAt) (\s :: AssessmentRun
s@AssessmentRun' {} POSIX
a -> AssessmentRun
s {$sel:createdAt:AssessmentRun' :: POSIX
createdAt = POSIX
a} :: AssessmentRun) ((POSIX -> f POSIX) -> AssessmentRun -> f AssessmentRun)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> AssessmentRun
-> f AssessmentRun
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 last time when the assessment run\'s state changed.
assessmentRun_stateChangedAt :: Lens.Lens' AssessmentRun Prelude.UTCTime
assessmentRun_stateChangedAt :: (UTCTime -> f UTCTime) -> AssessmentRun -> f AssessmentRun
assessmentRun_stateChangedAt = (AssessmentRun -> POSIX)
-> (AssessmentRun -> POSIX -> AssessmentRun)
-> Lens AssessmentRun AssessmentRun POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssessmentRun' {POSIX
stateChangedAt :: POSIX
$sel:stateChangedAt:AssessmentRun' :: AssessmentRun -> POSIX
stateChangedAt} -> POSIX
stateChangedAt) (\s :: AssessmentRun
s@AssessmentRun' {} POSIX
a -> AssessmentRun
s {$sel:stateChangedAt:AssessmentRun' :: POSIX
stateChangedAt = POSIX
a} :: AssessmentRun) ((POSIX -> f POSIX) -> AssessmentRun -> f AssessmentRun)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> AssessmentRun
-> f AssessmentRun
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

-- | A Boolean value (true or false) that specifies whether the process of
-- collecting data from the agents is completed.
assessmentRun_dataCollected :: Lens.Lens' AssessmentRun Prelude.Bool
assessmentRun_dataCollected :: (Bool -> f Bool) -> AssessmentRun -> f AssessmentRun
assessmentRun_dataCollected = (AssessmentRun -> Bool)
-> (AssessmentRun -> Bool -> AssessmentRun)
-> Lens AssessmentRun AssessmentRun Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssessmentRun' {Bool
dataCollected :: Bool
$sel:dataCollected:AssessmentRun' :: AssessmentRun -> Bool
dataCollected} -> Bool
dataCollected) (\s :: AssessmentRun
s@AssessmentRun' {} Bool
a -> AssessmentRun
s {$sel:dataCollected:AssessmentRun' :: Bool
dataCollected = Bool
a} :: AssessmentRun)

-- | A list of the assessment run state changes.
assessmentRun_stateChanges :: Lens.Lens' AssessmentRun [AssessmentRunStateChange]
assessmentRun_stateChanges :: ([AssessmentRunStateChange] -> f [AssessmentRunStateChange])
-> AssessmentRun -> f AssessmentRun
assessmentRun_stateChanges = (AssessmentRun -> [AssessmentRunStateChange])
-> (AssessmentRun -> [AssessmentRunStateChange] -> AssessmentRun)
-> Lens
     AssessmentRun
     AssessmentRun
     [AssessmentRunStateChange]
     [AssessmentRunStateChange]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssessmentRun' {[AssessmentRunStateChange]
stateChanges :: [AssessmentRunStateChange]
$sel:stateChanges:AssessmentRun' :: AssessmentRun -> [AssessmentRunStateChange]
stateChanges} -> [AssessmentRunStateChange]
stateChanges) (\s :: AssessmentRun
s@AssessmentRun' {} [AssessmentRunStateChange]
a -> AssessmentRun
s {$sel:stateChanges:AssessmentRun' :: [AssessmentRunStateChange]
stateChanges = [AssessmentRunStateChange]
a} :: AssessmentRun) (([AssessmentRunStateChange] -> f [AssessmentRunStateChange])
 -> AssessmentRun -> f AssessmentRun)
-> (([AssessmentRunStateChange] -> f [AssessmentRunStateChange])
    -> [AssessmentRunStateChange] -> f [AssessmentRunStateChange])
-> ([AssessmentRunStateChange] -> f [AssessmentRunStateChange])
-> AssessmentRun
-> f AssessmentRun
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([AssessmentRunStateChange] -> f [AssessmentRunStateChange])
-> [AssessmentRunStateChange] -> f [AssessmentRunStateChange]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A list of notifications for the event subscriptions. A notification
-- about a particular generated finding is added to this list only once.
assessmentRun_notifications :: Lens.Lens' AssessmentRun [AssessmentRunNotification]
assessmentRun_notifications :: ([AssessmentRunNotification] -> f [AssessmentRunNotification])
-> AssessmentRun -> f AssessmentRun
assessmentRun_notifications = (AssessmentRun -> [AssessmentRunNotification])
-> (AssessmentRun -> [AssessmentRunNotification] -> AssessmentRun)
-> Lens
     AssessmentRun
     AssessmentRun
     [AssessmentRunNotification]
     [AssessmentRunNotification]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssessmentRun' {[AssessmentRunNotification]
notifications :: [AssessmentRunNotification]
$sel:notifications:AssessmentRun' :: AssessmentRun -> [AssessmentRunNotification]
notifications} -> [AssessmentRunNotification]
notifications) (\s :: AssessmentRun
s@AssessmentRun' {} [AssessmentRunNotification]
a -> AssessmentRun
s {$sel:notifications:AssessmentRun' :: [AssessmentRunNotification]
notifications = [AssessmentRunNotification]
a} :: AssessmentRun) (([AssessmentRunNotification] -> f [AssessmentRunNotification])
 -> AssessmentRun -> f AssessmentRun)
-> (([AssessmentRunNotification] -> f [AssessmentRunNotification])
    -> [AssessmentRunNotification] -> f [AssessmentRunNotification])
-> ([AssessmentRunNotification] -> f [AssessmentRunNotification])
-> AssessmentRun
-> f AssessmentRun
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([AssessmentRunNotification] -> f [AssessmentRunNotification])
-> [AssessmentRunNotification] -> f [AssessmentRunNotification]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Provides a total count of generated findings per severity.
assessmentRun_findingCounts :: Lens.Lens' AssessmentRun (Prelude.HashMap Severity Prelude.Int)
assessmentRun_findingCounts :: (HashMap Severity Int -> f (HashMap Severity Int))
-> AssessmentRun -> f AssessmentRun
assessmentRun_findingCounts = (AssessmentRun -> HashMap Severity Int)
-> (AssessmentRun -> HashMap Severity Int -> AssessmentRun)
-> Lens
     AssessmentRun
     AssessmentRun
     (HashMap Severity Int)
     (HashMap Severity Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssessmentRun' {HashMap Severity Int
findingCounts :: HashMap Severity Int
$sel:findingCounts:AssessmentRun' :: AssessmentRun -> HashMap Severity Int
findingCounts} -> HashMap Severity Int
findingCounts) (\s :: AssessmentRun
s@AssessmentRun' {} HashMap Severity Int
a -> AssessmentRun
s {$sel:findingCounts:AssessmentRun' :: HashMap Severity Int
findingCounts = HashMap Severity Int
a} :: AssessmentRun) ((HashMap Severity Int -> f (HashMap Severity Int))
 -> AssessmentRun -> f AssessmentRun)
-> ((HashMap Severity Int -> f (HashMap Severity Int))
    -> HashMap Severity Int -> f (HashMap Severity Int))
-> (HashMap Severity Int -> f (HashMap Severity Int))
-> AssessmentRun
-> f AssessmentRun
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (HashMap Severity Int -> f (HashMap Severity Int))
-> HashMap Severity Int -> f (HashMap Severity Int)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON AssessmentRun where
  parseJSON :: Value -> Parser AssessmentRun
parseJSON =
    String
-> (Object -> Parser AssessmentRun)
-> Value
-> Parser AssessmentRun
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AssessmentRun"
      ( \Object
x ->
          Maybe POSIX
-> Maybe POSIX
-> Text
-> Text
-> Text
-> AssessmentRunState
-> Natural
-> NonEmpty Text
-> [Attribute]
-> POSIX
-> POSIX
-> Bool
-> [AssessmentRunStateChange]
-> [AssessmentRunNotification]
-> HashMap Severity Int
-> AssessmentRun
AssessmentRun'
            (Maybe POSIX
 -> Maybe POSIX
 -> Text
 -> Text
 -> Text
 -> AssessmentRunState
 -> Natural
 -> NonEmpty Text
 -> [Attribute]
 -> POSIX
 -> POSIX
 -> Bool
 -> [AssessmentRunStateChange]
 -> [AssessmentRunNotification]
 -> HashMap Severity Int
 -> AssessmentRun)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe POSIX
      -> Text
      -> Text
      -> Text
      -> AssessmentRunState
      -> Natural
      -> NonEmpty Text
      -> [Attribute]
      -> POSIX
      -> POSIX
      -> Bool
      -> [AssessmentRunStateChange]
      -> [AssessmentRunNotification]
      -> HashMap Severity Int
      -> AssessmentRun)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"startedAt")
            Parser
  (Maybe POSIX
   -> Text
   -> Text
   -> Text
   -> AssessmentRunState
   -> Natural
   -> NonEmpty Text
   -> [Attribute]
   -> POSIX
   -> POSIX
   -> Bool
   -> [AssessmentRunStateChange]
   -> [AssessmentRunNotification]
   -> HashMap Severity Int
   -> AssessmentRun)
-> Parser (Maybe POSIX)
-> Parser
     (Text
      -> Text
      -> Text
      -> AssessmentRunState
      -> Natural
      -> NonEmpty Text
      -> [Attribute]
      -> POSIX
      -> POSIX
      -> Bool
      -> [AssessmentRunStateChange]
      -> [AssessmentRunNotification]
      -> HashMap Severity Int
      -> AssessmentRun)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"completedAt")
            Parser
  (Text
   -> Text
   -> Text
   -> AssessmentRunState
   -> Natural
   -> NonEmpty Text
   -> [Attribute]
   -> POSIX
   -> POSIX
   -> Bool
   -> [AssessmentRunStateChange]
   -> [AssessmentRunNotification]
   -> HashMap Severity Int
   -> AssessmentRun)
-> Parser Text
-> Parser
     (Text
      -> Text
      -> AssessmentRunState
      -> Natural
      -> NonEmpty Text
      -> [Attribute]
      -> POSIX
      -> POSIX
      -> Bool
      -> [AssessmentRunStateChange]
      -> [AssessmentRunNotification]
      -> HashMap Severity Int
      -> AssessmentRun)
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
  (Text
   -> Text
   -> AssessmentRunState
   -> Natural
   -> NonEmpty Text
   -> [Attribute]
   -> POSIX
   -> POSIX
   -> Bool
   -> [AssessmentRunStateChange]
   -> [AssessmentRunNotification]
   -> HashMap Severity Int
   -> AssessmentRun)
-> Parser Text
-> Parser
     (Text
      -> AssessmentRunState
      -> Natural
      -> NonEmpty Text
      -> [Attribute]
      -> POSIX
      -> POSIX
      -> Bool
      -> [AssessmentRunStateChange]
      -> [AssessmentRunNotification]
      -> HashMap Severity Int
      -> AssessmentRun)
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
"name")
            Parser
  (Text
   -> AssessmentRunState
   -> Natural
   -> NonEmpty Text
   -> [Attribute]
   -> POSIX
   -> POSIX
   -> Bool
   -> [AssessmentRunStateChange]
   -> [AssessmentRunNotification]
   -> HashMap Severity Int
   -> AssessmentRun)
-> Parser Text
-> Parser
     (AssessmentRunState
      -> Natural
      -> NonEmpty Text
      -> [Attribute]
      -> POSIX
      -> POSIX
      -> Bool
      -> [AssessmentRunStateChange]
      -> [AssessmentRunNotification]
      -> HashMap Severity Int
      -> AssessmentRun)
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
"assessmentTemplateArn")
            Parser
  (AssessmentRunState
   -> Natural
   -> NonEmpty Text
   -> [Attribute]
   -> POSIX
   -> POSIX
   -> Bool
   -> [AssessmentRunStateChange]
   -> [AssessmentRunNotification]
   -> HashMap Severity Int
   -> AssessmentRun)
-> Parser AssessmentRunState
-> Parser
     (Natural
      -> NonEmpty Text
      -> [Attribute]
      -> POSIX
      -> POSIX
      -> Bool
      -> [AssessmentRunStateChange]
      -> [AssessmentRunNotification]
      -> HashMap Severity Int
      -> AssessmentRun)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser AssessmentRunState
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"state")
            Parser
  (Natural
   -> NonEmpty Text
   -> [Attribute]
   -> POSIX
   -> POSIX
   -> Bool
   -> [AssessmentRunStateChange]
   -> [AssessmentRunNotification]
   -> HashMap Severity Int
   -> AssessmentRun)
-> Parser Natural
-> Parser
     (NonEmpty Text
      -> [Attribute]
      -> POSIX
      -> POSIX
      -> Bool
      -> [AssessmentRunStateChange]
      -> [AssessmentRunNotification]
      -> HashMap Severity Int
      -> AssessmentRun)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"durationInSeconds")
            Parser
  (NonEmpty Text
   -> [Attribute]
   -> POSIX
   -> POSIX
   -> Bool
   -> [AssessmentRunStateChange]
   -> [AssessmentRunNotification]
   -> HashMap Severity Int
   -> AssessmentRun)
-> Parser (NonEmpty Text)
-> Parser
     ([Attribute]
      -> POSIX
      -> POSIX
      -> Bool
      -> [AssessmentRunStateChange]
      -> [AssessmentRunNotification]
      -> HashMap Severity Int
      -> AssessmentRun)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (NonEmpty Text)
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"rulesPackageArns")
            Parser
  ([Attribute]
   -> POSIX
   -> POSIX
   -> Bool
   -> [AssessmentRunStateChange]
   -> [AssessmentRunNotification]
   -> HashMap Severity Int
   -> AssessmentRun)
-> Parser [Attribute]
-> Parser
     (POSIX
      -> POSIX
      -> Bool
      -> [AssessmentRunStateChange]
      -> [AssessmentRunNotification]
      -> HashMap Severity Int
      -> AssessmentRun)
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
"userAttributesForFindings"
                            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
   -> Bool
   -> [AssessmentRunStateChange]
   -> [AssessmentRunNotification]
   -> HashMap Severity Int
   -> AssessmentRun)
-> Parser POSIX
-> Parser
     (POSIX
      -> Bool
      -> [AssessmentRunStateChange]
      -> [AssessmentRunNotification]
      -> HashMap Severity Int
      -> AssessmentRun)
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
   -> Bool
   -> [AssessmentRunStateChange]
   -> [AssessmentRunNotification]
   -> HashMap Severity Int
   -> AssessmentRun)
-> Parser POSIX
-> Parser
     (Bool
      -> [AssessmentRunStateChange]
      -> [AssessmentRunNotification]
      -> HashMap Severity Int
      -> AssessmentRun)
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
"stateChangedAt")
            Parser
  (Bool
   -> [AssessmentRunStateChange]
   -> [AssessmentRunNotification]
   -> HashMap Severity Int
   -> AssessmentRun)
-> Parser Bool
-> Parser
     ([AssessmentRunStateChange]
      -> [AssessmentRunNotification]
      -> HashMap Severity Int
      -> AssessmentRun)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Bool
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"dataCollected")
            Parser
  ([AssessmentRunStateChange]
   -> [AssessmentRunNotification]
   -> HashMap Severity Int
   -> AssessmentRun)
-> Parser [AssessmentRunStateChange]
-> Parser
     ([AssessmentRunNotification]
      -> HashMap Severity Int -> AssessmentRun)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe [AssessmentRunStateChange])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"stateChanges" Parser (Maybe [AssessmentRunStateChange])
-> [AssessmentRunStateChange] -> Parser [AssessmentRunStateChange]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [AssessmentRunStateChange]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  ([AssessmentRunNotification]
   -> HashMap Severity Int -> AssessmentRun)
-> Parser [AssessmentRunNotification]
-> Parser (HashMap Severity Int -> AssessmentRun)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe [AssessmentRunNotification])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"notifications" Parser (Maybe [AssessmentRunNotification])
-> [AssessmentRunNotification]
-> Parser [AssessmentRunNotification]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [AssessmentRunNotification]
forall a. Monoid a => a
Prelude.mempty)
            Parser (HashMap Severity Int -> AssessmentRun)
-> Parser (HashMap Severity Int) -> Parser AssessmentRun
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (HashMap Severity Int))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"findingCounts" Parser (Maybe (HashMap Severity Int))
-> HashMap Severity Int -> Parser (HashMap Severity Int)
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= HashMap Severity Int
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable AssessmentRun

instance Prelude.NFData AssessmentRun