{-# 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.AccessAnalyzer.Types.FindingSummary
-- 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.AccessAnalyzer.Types.FindingSummary where

import Amazonka.AccessAnalyzer.Types.FindingSource
import Amazonka.AccessAnalyzer.Types.FindingStatus
import Amazonka.AccessAnalyzer.Types.ResourceType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains information about a finding.
--
-- /See:/ 'newFindingSummary' smart constructor.
data FindingSummary = FindingSummary'
  { -- | The error that resulted in an Error finding.
    FindingSummary -> Maybe Text
error :: Prelude.Maybe Prelude.Text,
    -- | Indicates whether the finding reports a resource that has a policy that
    -- allows public access.
    FindingSummary -> Maybe Bool
isPublic :: Prelude.Maybe Prelude.Bool,
    -- | The action in the analyzed policy statement that an external principal
    -- has permission to use.
    FindingSummary -> Maybe [Text]
action :: Prelude.Maybe [Prelude.Text],
    -- | The sources of the finding. This indicates how the access that generated
    -- the finding is granted. It is populated for Amazon S3 bucket findings.
    FindingSummary -> Maybe [FindingSource]
sources :: Prelude.Maybe [FindingSource],
    -- | The resource that the external principal has access to.
    FindingSummary -> Maybe Text
resource :: Prelude.Maybe Prelude.Text,
    -- | The external principal that has access to a resource within the zone of
    -- trust.
    FindingSummary -> Maybe (HashMap Text Text)
principal :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The time at which the resource-based policy that generated the finding
    -- was analyzed.
    FindingSummary -> POSIX
analyzedAt :: Core.POSIX,
    -- | The condition in the analyzed policy statement that resulted in a
    -- finding.
    FindingSummary -> HashMap Text Text
condition :: Prelude.HashMap Prelude.Text Prelude.Text,
    -- | The time at which the finding was created.
    FindingSummary -> POSIX
createdAt :: Core.POSIX,
    -- | The ID of the finding.
    FindingSummary -> Text
id :: Prelude.Text,
    -- | The Amazon Web Services account ID that owns the resource.
    FindingSummary -> Text
resourceOwnerAccount :: Prelude.Text,
    -- | The type of the resource that the external principal has access to.
    FindingSummary -> ResourceType
resourceType :: ResourceType,
    -- | The status of the finding.
    FindingSummary -> FindingStatus
status :: FindingStatus,
    -- | The time at which the finding was most recently updated.
    FindingSummary -> POSIX
updatedAt :: Core.POSIX
  }
  deriving (FindingSummary -> FindingSummary -> Bool
(FindingSummary -> FindingSummary -> Bool)
-> (FindingSummary -> FindingSummary -> Bool) -> Eq FindingSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FindingSummary -> FindingSummary -> Bool
$c/= :: FindingSummary -> FindingSummary -> Bool
== :: FindingSummary -> FindingSummary -> Bool
$c== :: FindingSummary -> FindingSummary -> Bool
Prelude.Eq, ReadPrec [FindingSummary]
ReadPrec FindingSummary
Int -> ReadS FindingSummary
ReadS [FindingSummary]
(Int -> ReadS FindingSummary)
-> ReadS [FindingSummary]
-> ReadPrec FindingSummary
-> ReadPrec [FindingSummary]
-> Read FindingSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FindingSummary]
$creadListPrec :: ReadPrec [FindingSummary]
readPrec :: ReadPrec FindingSummary
$creadPrec :: ReadPrec FindingSummary
readList :: ReadS [FindingSummary]
$creadList :: ReadS [FindingSummary]
readsPrec :: Int -> ReadS FindingSummary
$creadsPrec :: Int -> ReadS FindingSummary
Prelude.Read, Int -> FindingSummary -> ShowS
[FindingSummary] -> ShowS
FindingSummary -> String
(Int -> FindingSummary -> ShowS)
-> (FindingSummary -> String)
-> ([FindingSummary] -> ShowS)
-> Show FindingSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FindingSummary] -> ShowS
$cshowList :: [FindingSummary] -> ShowS
show :: FindingSummary -> String
$cshow :: FindingSummary -> String
showsPrec :: Int -> FindingSummary -> ShowS
$cshowsPrec :: Int -> FindingSummary -> ShowS
Prelude.Show, (forall x. FindingSummary -> Rep FindingSummary x)
-> (forall x. Rep FindingSummary x -> FindingSummary)
-> Generic FindingSummary
forall x. Rep FindingSummary x -> FindingSummary
forall x. FindingSummary -> Rep FindingSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FindingSummary x -> FindingSummary
$cfrom :: forall x. FindingSummary -> Rep FindingSummary x
Prelude.Generic)

-- |
-- Create a value of 'FindingSummary' 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:
--
-- 'error', 'findingSummary_error' - The error that resulted in an Error finding.
--
-- 'isPublic', 'findingSummary_isPublic' - Indicates whether the finding reports a resource that has a policy that
-- allows public access.
--
-- 'action', 'findingSummary_action' - The action in the analyzed policy statement that an external principal
-- has permission to use.
--
-- 'sources', 'findingSummary_sources' - The sources of the finding. This indicates how the access that generated
-- the finding is granted. It is populated for Amazon S3 bucket findings.
--
-- 'resource', 'findingSummary_resource' - The resource that the external principal has access to.
--
-- 'principal', 'findingSummary_principal' - The external principal that has access to a resource within the zone of
-- trust.
--
-- 'analyzedAt', 'findingSummary_analyzedAt' - The time at which the resource-based policy that generated the finding
-- was analyzed.
--
-- 'condition', 'findingSummary_condition' - The condition in the analyzed policy statement that resulted in a
-- finding.
--
-- 'createdAt', 'findingSummary_createdAt' - The time at which the finding was created.
--
-- 'id', 'findingSummary_id' - The ID of the finding.
--
-- 'resourceOwnerAccount', 'findingSummary_resourceOwnerAccount' - The Amazon Web Services account ID that owns the resource.
--
-- 'resourceType', 'findingSummary_resourceType' - The type of the resource that the external principal has access to.
--
-- 'status', 'findingSummary_status' - The status of the finding.
--
-- 'updatedAt', 'findingSummary_updatedAt' - The time at which the finding was most recently updated.
newFindingSummary ::
  -- | 'analyzedAt'
  Prelude.UTCTime ->
  -- | 'createdAt'
  Prelude.UTCTime ->
  -- | 'id'
  Prelude.Text ->
  -- | 'resourceOwnerAccount'
  Prelude.Text ->
  -- | 'resourceType'
  ResourceType ->
  -- | 'status'
  FindingStatus ->
  -- | 'updatedAt'
  Prelude.UTCTime ->
  FindingSummary
newFindingSummary :: UTCTime
-> UTCTime
-> Text
-> Text
-> ResourceType
-> FindingStatus
-> UTCTime
-> FindingSummary
newFindingSummary
  UTCTime
pAnalyzedAt_
  UTCTime
pCreatedAt_
  Text
pId_
  Text
pResourceOwnerAccount_
  ResourceType
pResourceType_
  FindingStatus
pStatus_
  UTCTime
pUpdatedAt_ =
    FindingSummary' :: Maybe Text
-> Maybe Bool
-> Maybe [Text]
-> Maybe [FindingSource]
-> Maybe Text
-> Maybe (HashMap Text Text)
-> POSIX
-> HashMap Text Text
-> POSIX
-> Text
-> Text
-> ResourceType
-> FindingStatus
-> POSIX
-> FindingSummary
FindingSummary'
      { $sel:error:FindingSummary' :: Maybe Text
error = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:isPublic:FindingSummary' :: Maybe Bool
isPublic = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:action:FindingSummary' :: Maybe [Text]
action = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
        $sel:sources:FindingSummary' :: Maybe [FindingSource]
sources = Maybe [FindingSource]
forall a. Maybe a
Prelude.Nothing,
        $sel:resource:FindingSummary' :: Maybe Text
resource = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:principal:FindingSummary' :: Maybe (HashMap Text Text)
principal = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:analyzedAt:FindingSummary' :: POSIX
analyzedAt = 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
pAnalyzedAt_,
        $sel:condition:FindingSummary' :: HashMap Text Text
condition = HashMap Text Text
forall a. Monoid a => a
Prelude.mempty,
        $sel:createdAt:FindingSummary' :: 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:id:FindingSummary' :: Text
id = Text
pId_,
        $sel:resourceOwnerAccount:FindingSummary' :: Text
resourceOwnerAccount = Text
pResourceOwnerAccount_,
        $sel:resourceType:FindingSummary' :: ResourceType
resourceType = ResourceType
pResourceType_,
        $sel:status:FindingSummary' :: FindingStatus
status = FindingStatus
pStatus_,
        $sel:updatedAt:FindingSummary' :: 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 error that resulted in an Error finding.
findingSummary_error :: Lens.Lens' FindingSummary (Prelude.Maybe Prelude.Text)
findingSummary_error :: (Maybe Text -> f (Maybe Text))
-> FindingSummary -> f FindingSummary
findingSummary_error = (FindingSummary -> Maybe Text)
-> (FindingSummary -> Maybe Text -> FindingSummary)
-> Lens FindingSummary FindingSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FindingSummary' {Maybe Text
error :: Maybe Text
$sel:error:FindingSummary' :: FindingSummary -> Maybe Text
error} -> Maybe Text
error) (\s :: FindingSummary
s@FindingSummary' {} Maybe Text
a -> FindingSummary
s {$sel:error:FindingSummary' :: Maybe Text
error = Maybe Text
a} :: FindingSummary)

-- | Indicates whether the finding reports a resource that has a policy that
-- allows public access.
findingSummary_isPublic :: Lens.Lens' FindingSummary (Prelude.Maybe Prelude.Bool)
findingSummary_isPublic :: (Maybe Bool -> f (Maybe Bool))
-> FindingSummary -> f FindingSummary
findingSummary_isPublic = (FindingSummary -> Maybe Bool)
-> (FindingSummary -> Maybe Bool -> FindingSummary)
-> Lens FindingSummary FindingSummary (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FindingSummary' {Maybe Bool
isPublic :: Maybe Bool
$sel:isPublic:FindingSummary' :: FindingSummary -> Maybe Bool
isPublic} -> Maybe Bool
isPublic) (\s :: FindingSummary
s@FindingSummary' {} Maybe Bool
a -> FindingSummary
s {$sel:isPublic:FindingSummary' :: Maybe Bool
isPublic = Maybe Bool
a} :: FindingSummary)

-- | The action in the analyzed policy statement that an external principal
-- has permission to use.
findingSummary_action :: Lens.Lens' FindingSummary (Prelude.Maybe [Prelude.Text])
findingSummary_action :: (Maybe [Text] -> f (Maybe [Text]))
-> FindingSummary -> f FindingSummary
findingSummary_action = (FindingSummary -> Maybe [Text])
-> (FindingSummary -> Maybe [Text] -> FindingSummary)
-> Lens FindingSummary FindingSummary (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FindingSummary' {Maybe [Text]
action :: Maybe [Text]
$sel:action:FindingSummary' :: FindingSummary -> Maybe [Text]
action} -> Maybe [Text]
action) (\s :: FindingSummary
s@FindingSummary' {} Maybe [Text]
a -> FindingSummary
s {$sel:action:FindingSummary' :: Maybe [Text]
action = Maybe [Text]
a} :: FindingSummary) ((Maybe [Text] -> f (Maybe [Text]))
 -> FindingSummary -> f FindingSummary)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> FindingSummary
-> f FindingSummary
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

-- | The sources of the finding. This indicates how the access that generated
-- the finding is granted. It is populated for Amazon S3 bucket findings.
findingSummary_sources :: Lens.Lens' FindingSummary (Prelude.Maybe [FindingSource])
findingSummary_sources :: (Maybe [FindingSource] -> f (Maybe [FindingSource]))
-> FindingSummary -> f FindingSummary
findingSummary_sources = (FindingSummary -> Maybe [FindingSource])
-> (FindingSummary -> Maybe [FindingSource] -> FindingSummary)
-> Lens
     FindingSummary
     FindingSummary
     (Maybe [FindingSource])
     (Maybe [FindingSource])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FindingSummary' {Maybe [FindingSource]
sources :: Maybe [FindingSource]
$sel:sources:FindingSummary' :: FindingSummary -> Maybe [FindingSource]
sources} -> Maybe [FindingSource]
sources) (\s :: FindingSummary
s@FindingSummary' {} Maybe [FindingSource]
a -> FindingSummary
s {$sel:sources:FindingSummary' :: Maybe [FindingSource]
sources = Maybe [FindingSource]
a} :: FindingSummary) ((Maybe [FindingSource] -> f (Maybe [FindingSource]))
 -> FindingSummary -> f FindingSummary)
-> ((Maybe [FindingSource] -> f (Maybe [FindingSource]))
    -> Maybe [FindingSource] -> f (Maybe [FindingSource]))
-> (Maybe [FindingSource] -> f (Maybe [FindingSource]))
-> FindingSummary
-> f FindingSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [FindingSource] [FindingSource] [FindingSource] [FindingSource]
-> Iso
     (Maybe [FindingSource])
     (Maybe [FindingSource])
     (Maybe [FindingSource])
     (Maybe [FindingSource])
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
  [FindingSource] [FindingSource] [FindingSource] [FindingSource]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The resource that the external principal has access to.
findingSummary_resource :: Lens.Lens' FindingSummary (Prelude.Maybe Prelude.Text)
findingSummary_resource :: (Maybe Text -> f (Maybe Text))
-> FindingSummary -> f FindingSummary
findingSummary_resource = (FindingSummary -> Maybe Text)
-> (FindingSummary -> Maybe Text -> FindingSummary)
-> Lens FindingSummary FindingSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FindingSummary' {Maybe Text
resource :: Maybe Text
$sel:resource:FindingSummary' :: FindingSummary -> Maybe Text
resource} -> Maybe Text
resource) (\s :: FindingSummary
s@FindingSummary' {} Maybe Text
a -> FindingSummary
s {$sel:resource:FindingSummary' :: Maybe Text
resource = Maybe Text
a} :: FindingSummary)

-- | The external principal that has access to a resource within the zone of
-- trust.
findingSummary_principal :: Lens.Lens' FindingSummary (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
findingSummary_principal :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> FindingSummary -> f FindingSummary
findingSummary_principal = (FindingSummary -> Maybe (HashMap Text Text))
-> (FindingSummary -> Maybe (HashMap Text Text) -> FindingSummary)
-> Lens
     FindingSummary
     FindingSummary
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FindingSummary' {Maybe (HashMap Text Text)
principal :: Maybe (HashMap Text Text)
$sel:principal:FindingSummary' :: FindingSummary -> Maybe (HashMap Text Text)
principal} -> Maybe (HashMap Text Text)
principal) (\s :: FindingSummary
s@FindingSummary' {} Maybe (HashMap Text Text)
a -> FindingSummary
s {$sel:principal:FindingSummary' :: Maybe (HashMap Text Text)
principal = Maybe (HashMap Text Text)
a} :: FindingSummary) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> FindingSummary -> f FindingSummary)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> FindingSummary
-> f FindingSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text 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
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The time at which the resource-based policy that generated the finding
-- was analyzed.
findingSummary_analyzedAt :: Lens.Lens' FindingSummary Prelude.UTCTime
findingSummary_analyzedAt :: (UTCTime -> f UTCTime) -> FindingSummary -> f FindingSummary
findingSummary_analyzedAt = (FindingSummary -> POSIX)
-> (FindingSummary -> POSIX -> FindingSummary)
-> Lens FindingSummary FindingSummary POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FindingSummary' {POSIX
analyzedAt :: POSIX
$sel:analyzedAt:FindingSummary' :: FindingSummary -> POSIX
analyzedAt} -> POSIX
analyzedAt) (\s :: FindingSummary
s@FindingSummary' {} POSIX
a -> FindingSummary
s {$sel:analyzedAt:FindingSummary' :: POSIX
analyzedAt = POSIX
a} :: FindingSummary) ((POSIX -> f POSIX) -> FindingSummary -> f FindingSummary)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> FindingSummary
-> f FindingSummary
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 condition in the analyzed policy statement that resulted in a
-- finding.
findingSummary_condition :: Lens.Lens' FindingSummary (Prelude.HashMap Prelude.Text Prelude.Text)
findingSummary_condition :: (HashMap Text Text -> f (HashMap Text Text))
-> FindingSummary -> f FindingSummary
findingSummary_condition = (FindingSummary -> HashMap Text Text)
-> (FindingSummary -> HashMap Text Text -> FindingSummary)
-> Lens
     FindingSummary
     FindingSummary
     (HashMap Text Text)
     (HashMap Text Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FindingSummary' {HashMap Text Text
condition :: HashMap Text Text
$sel:condition:FindingSummary' :: FindingSummary -> HashMap Text Text
condition} -> HashMap Text Text
condition) (\s :: FindingSummary
s@FindingSummary' {} HashMap Text Text
a -> FindingSummary
s {$sel:condition:FindingSummary' :: HashMap Text Text
condition = HashMap Text Text
a} :: FindingSummary) ((HashMap Text Text -> f (HashMap Text Text))
 -> FindingSummary -> f FindingSummary)
-> ((HashMap Text Text -> f (HashMap Text Text))
    -> HashMap Text Text -> f (HashMap Text Text))
-> (HashMap Text Text -> f (HashMap Text Text))
-> FindingSummary
-> f FindingSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (HashMap Text Text -> f (HashMap Text Text))
-> HashMap Text Text -> f (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The time at which the finding was created.
findingSummary_createdAt :: Lens.Lens' FindingSummary Prelude.UTCTime
findingSummary_createdAt :: (UTCTime -> f UTCTime) -> FindingSummary -> f FindingSummary
findingSummary_createdAt = (FindingSummary -> POSIX)
-> (FindingSummary -> POSIX -> FindingSummary)
-> Lens FindingSummary FindingSummary POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FindingSummary' {POSIX
createdAt :: POSIX
$sel:createdAt:FindingSummary' :: FindingSummary -> POSIX
createdAt} -> POSIX
createdAt) (\s :: FindingSummary
s@FindingSummary' {} POSIX
a -> FindingSummary
s {$sel:createdAt:FindingSummary' :: POSIX
createdAt = POSIX
a} :: FindingSummary) ((POSIX -> f POSIX) -> FindingSummary -> f FindingSummary)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> FindingSummary
-> f FindingSummary
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 ID of the finding.
findingSummary_id :: Lens.Lens' FindingSummary Prelude.Text
findingSummary_id :: (Text -> f Text) -> FindingSummary -> f FindingSummary
findingSummary_id = (FindingSummary -> Text)
-> (FindingSummary -> Text -> FindingSummary)
-> Lens FindingSummary FindingSummary Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FindingSummary' {Text
id :: Text
$sel:id:FindingSummary' :: FindingSummary -> Text
id} -> Text
id) (\s :: FindingSummary
s@FindingSummary' {} Text
a -> FindingSummary
s {$sel:id:FindingSummary' :: Text
id = Text
a} :: FindingSummary)

-- | The Amazon Web Services account ID that owns the resource.
findingSummary_resourceOwnerAccount :: Lens.Lens' FindingSummary Prelude.Text
findingSummary_resourceOwnerAccount :: (Text -> f Text) -> FindingSummary -> f FindingSummary
findingSummary_resourceOwnerAccount = (FindingSummary -> Text)
-> (FindingSummary -> Text -> FindingSummary)
-> Lens FindingSummary FindingSummary Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FindingSummary' {Text
resourceOwnerAccount :: Text
$sel:resourceOwnerAccount:FindingSummary' :: FindingSummary -> Text
resourceOwnerAccount} -> Text
resourceOwnerAccount) (\s :: FindingSummary
s@FindingSummary' {} Text
a -> FindingSummary
s {$sel:resourceOwnerAccount:FindingSummary' :: Text
resourceOwnerAccount = Text
a} :: FindingSummary)

-- | The type of the resource that the external principal has access to.
findingSummary_resourceType :: Lens.Lens' FindingSummary ResourceType
findingSummary_resourceType :: (ResourceType -> f ResourceType)
-> FindingSummary -> f FindingSummary
findingSummary_resourceType = (FindingSummary -> ResourceType)
-> (FindingSummary -> ResourceType -> FindingSummary)
-> Lens FindingSummary FindingSummary ResourceType ResourceType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FindingSummary' {ResourceType
resourceType :: ResourceType
$sel:resourceType:FindingSummary' :: FindingSummary -> ResourceType
resourceType} -> ResourceType
resourceType) (\s :: FindingSummary
s@FindingSummary' {} ResourceType
a -> FindingSummary
s {$sel:resourceType:FindingSummary' :: ResourceType
resourceType = ResourceType
a} :: FindingSummary)

-- | The status of the finding.
findingSummary_status :: Lens.Lens' FindingSummary FindingStatus
findingSummary_status :: (FindingStatus -> f FindingStatus)
-> FindingSummary -> f FindingSummary
findingSummary_status = (FindingSummary -> FindingStatus)
-> (FindingSummary -> FindingStatus -> FindingSummary)
-> Lens FindingSummary FindingSummary FindingStatus FindingStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FindingSummary' {FindingStatus
status :: FindingStatus
$sel:status:FindingSummary' :: FindingSummary -> FindingStatus
status} -> FindingStatus
status) (\s :: FindingSummary
s@FindingSummary' {} FindingStatus
a -> FindingSummary
s {$sel:status:FindingSummary' :: FindingStatus
status = FindingStatus
a} :: FindingSummary)

-- | The time at which the finding was most recently updated.
findingSummary_updatedAt :: Lens.Lens' FindingSummary Prelude.UTCTime
findingSummary_updatedAt :: (UTCTime -> f UTCTime) -> FindingSummary -> f FindingSummary
findingSummary_updatedAt = (FindingSummary -> POSIX)
-> (FindingSummary -> POSIX -> FindingSummary)
-> Lens FindingSummary FindingSummary POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FindingSummary' {POSIX
updatedAt :: POSIX
$sel:updatedAt:FindingSummary' :: FindingSummary -> POSIX
updatedAt} -> POSIX
updatedAt) (\s :: FindingSummary
s@FindingSummary' {} POSIX
a -> FindingSummary
s {$sel:updatedAt:FindingSummary' :: POSIX
updatedAt = POSIX
a} :: FindingSummary) ((POSIX -> f POSIX) -> FindingSummary -> f FindingSummary)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> FindingSummary
-> f FindingSummary
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 FindingSummary where
  parseJSON :: Value -> Parser FindingSummary
parseJSON =
    String
-> (Object -> Parser FindingSummary)
-> Value
-> Parser FindingSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"FindingSummary"
      ( \Object
x ->
          Maybe Text
-> Maybe Bool
-> Maybe [Text]
-> Maybe [FindingSource]
-> Maybe Text
-> Maybe (HashMap Text Text)
-> POSIX
-> HashMap Text Text
-> POSIX
-> Text
-> Text
-> ResourceType
-> FindingStatus
-> POSIX
-> FindingSummary
FindingSummary'
            (Maybe Text
 -> Maybe Bool
 -> Maybe [Text]
 -> Maybe [FindingSource]
 -> Maybe Text
 -> Maybe (HashMap Text Text)
 -> POSIX
 -> HashMap Text Text
 -> POSIX
 -> Text
 -> Text
 -> ResourceType
 -> FindingStatus
 -> POSIX
 -> FindingSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Bool
      -> Maybe [Text]
      -> Maybe [FindingSource]
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> POSIX
      -> HashMap Text Text
      -> POSIX
      -> Text
      -> Text
      -> ResourceType
      -> FindingStatus
      -> POSIX
      -> FindingSummary)
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
"error")
            Parser
  (Maybe Bool
   -> Maybe [Text]
   -> Maybe [FindingSource]
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> POSIX
   -> HashMap Text Text
   -> POSIX
   -> Text
   -> Text
   -> ResourceType
   -> FindingStatus
   -> POSIX
   -> FindingSummary)
-> Parser (Maybe Bool)
-> Parser
     (Maybe [Text]
      -> Maybe [FindingSource]
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> POSIX
      -> HashMap Text Text
      -> POSIX
      -> Text
      -> Text
      -> ResourceType
      -> FindingStatus
      -> POSIX
      -> FindingSummary)
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
"isPublic")
            Parser
  (Maybe [Text]
   -> Maybe [FindingSource]
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> POSIX
   -> HashMap Text Text
   -> POSIX
   -> Text
   -> Text
   -> ResourceType
   -> FindingStatus
   -> POSIX
   -> FindingSummary)
-> Parser (Maybe [Text])
-> Parser
     (Maybe [FindingSource]
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> POSIX
      -> HashMap Text Text
      -> POSIX
      -> Text
      -> Text
      -> ResourceType
      -> FindingStatus
      -> POSIX
      -> FindingSummary)
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
"action" 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 [FindingSource]
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> POSIX
   -> HashMap Text Text
   -> POSIX
   -> Text
   -> Text
   -> ResourceType
   -> FindingStatus
   -> POSIX
   -> FindingSummary)
-> Parser (Maybe [FindingSource])
-> Parser
     (Maybe Text
      -> Maybe (HashMap Text Text)
      -> POSIX
      -> HashMap Text Text
      -> POSIX
      -> Text
      -> Text
      -> ResourceType
      -> FindingStatus
      -> POSIX
      -> FindingSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [FindingSource]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"sources" Parser (Maybe (Maybe [FindingSource]))
-> Maybe [FindingSource] -> Parser (Maybe [FindingSource])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [FindingSource]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe Text
   -> Maybe (HashMap Text Text)
   -> POSIX
   -> HashMap Text Text
   -> POSIX
   -> Text
   -> Text
   -> ResourceType
   -> FindingStatus
   -> POSIX
   -> FindingSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe (HashMap Text Text)
      -> POSIX
      -> HashMap Text Text
      -> POSIX
      -> Text
      -> Text
      -> ResourceType
      -> FindingStatus
      -> POSIX
      -> FindingSummary)
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
"resource")
            Parser
  (Maybe (HashMap Text Text)
   -> POSIX
   -> HashMap Text Text
   -> POSIX
   -> Text
   -> Text
   -> ResourceType
   -> FindingStatus
   -> POSIX
   -> FindingSummary)
-> Parser (Maybe (HashMap Text Text))
-> Parser
     (POSIX
      -> HashMap Text Text
      -> POSIX
      -> Text
      -> Text
      -> ResourceType
      -> FindingStatus
      -> POSIX
      -> FindingSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"principal" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (POSIX
   -> HashMap Text Text
   -> POSIX
   -> Text
   -> Text
   -> ResourceType
   -> FindingStatus
   -> POSIX
   -> FindingSummary)
-> Parser POSIX
-> Parser
     (HashMap Text Text
      -> POSIX
      -> Text
      -> Text
      -> ResourceType
      -> FindingStatus
      -> POSIX
      -> FindingSummary)
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
"analyzedAt")
            Parser
  (HashMap Text Text
   -> POSIX
   -> Text
   -> Text
   -> ResourceType
   -> FindingStatus
   -> POSIX
   -> FindingSummary)
-> Parser (HashMap Text Text)
-> Parser
     (POSIX
      -> Text
      -> Text
      -> ResourceType
      -> FindingStatus
      -> POSIX
      -> FindingSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (HashMap Text Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"condition" Parser (Maybe (HashMap Text Text))
-> HashMap Text Text -> Parser (HashMap Text Text)
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= HashMap Text Text
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (POSIX
   -> Text
   -> Text
   -> ResourceType
   -> FindingStatus
   -> POSIX
   -> FindingSummary)
-> Parser POSIX
-> Parser
     (Text
      -> Text
      -> ResourceType
      -> FindingStatus
      -> POSIX
      -> FindingSummary)
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
  (Text
   -> Text
   -> ResourceType
   -> FindingStatus
   -> POSIX
   -> FindingSummary)
-> Parser Text
-> Parser
     (Text -> ResourceType -> FindingStatus -> POSIX -> FindingSummary)
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
"id")
            Parser
  (Text -> ResourceType -> FindingStatus -> POSIX -> FindingSummary)
-> Parser Text
-> Parser
     (ResourceType -> FindingStatus -> POSIX -> FindingSummary)
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
"resourceOwnerAccount")
            Parser (ResourceType -> FindingStatus -> POSIX -> FindingSummary)
-> Parser ResourceType
-> Parser (FindingStatus -> POSIX -> FindingSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ResourceType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"resourceType")
            Parser (FindingStatus -> POSIX -> FindingSummary)
-> Parser FindingStatus -> Parser (POSIX -> FindingSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser FindingStatus
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"status")
            Parser (POSIX -> FindingSummary)
-> Parser POSIX -> Parser FindingSummary
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 FindingSummary

instance Prelude.NFData FindingSummary