{-# 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.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.AccessAnalyzer.Types.Finding 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:/ 'newFinding' smart constructor.
data Finding = Finding'
  { -- | An error.
    Finding -> Maybe Text
error :: Prelude.Maybe Prelude.Text,
    -- | Indicates whether the policy that generated the finding allows public
    -- access to the resource.
    Finding -> Maybe Bool
isPublic :: Prelude.Maybe Prelude.Bool,
    -- | The action in the analyzed policy statement that an external principal
    -- has permission to use.
    Finding -> 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.
    Finding -> Maybe [FindingSource]
sources :: Prelude.Maybe [FindingSource],
    -- | The resource that an external principal has access to.
    Finding -> Maybe Text
resource :: Prelude.Maybe Prelude.Text,
    -- | The external principal that access to a resource within the zone of
    -- trust.
    Finding -> Maybe (HashMap Text Text)
principal :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The time at which the resource was analyzed.
    Finding -> POSIX
analyzedAt :: Core.POSIX,
    -- | The condition in the analyzed policy statement that resulted in a
    -- finding.
    Finding -> HashMap Text Text
condition :: Prelude.HashMap Prelude.Text Prelude.Text,
    -- | The time at which the finding was generated.
    Finding -> POSIX
createdAt :: Core.POSIX,
    -- | The ID of the finding.
    Finding -> Text
id :: Prelude.Text,
    -- | The Amazon Web Services account ID that owns the resource.
    Finding -> Text
resourceOwnerAccount :: Prelude.Text,
    -- | The type of the resource identified in the finding.
    Finding -> ResourceType
resourceType :: ResourceType,
    -- | The current status of the finding.
    Finding -> FindingStatus
status :: FindingStatus,
    -- | The time at which the finding was updated.
    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:
--
-- 'error', 'finding_error' - An error.
--
-- 'isPublic', 'finding_isPublic' - Indicates whether the policy that generated the finding allows public
-- access to the resource.
--
-- 'action', 'finding_action' - The action in the analyzed policy statement that an external principal
-- has permission to use.
--
-- 'sources', 'finding_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', 'finding_resource' - The resource that an external principal has access to.
--
-- 'principal', 'finding_principal' - The external principal that access to a resource within the zone of
-- trust.
--
-- 'analyzedAt', 'finding_analyzedAt' - The time at which the resource was analyzed.
--
-- 'condition', 'finding_condition' - The condition in the analyzed policy statement that resulted in a
-- finding.
--
-- 'createdAt', 'finding_createdAt' - The time at which the finding was generated.
--
-- 'id', 'finding_id' - The ID of the finding.
--
-- 'resourceOwnerAccount', 'finding_resourceOwnerAccount' - The Amazon Web Services account ID that owns the resource.
--
-- 'resourceType', 'finding_resourceType' - The type of the resource identified in the finding.
--
-- 'status', 'finding_status' - The current status of the finding.
--
-- 'updatedAt', 'finding_updatedAt' - The time at which the finding was updated.
newFinding ::
  -- | 'analyzedAt'
  Prelude.UTCTime ->
  -- | 'createdAt'
  Prelude.UTCTime ->
  -- | 'id'
  Prelude.Text ->
  -- | 'resourceOwnerAccount'
  Prelude.Text ->
  -- | 'resourceType'
  ResourceType ->
  -- | 'status'
  FindingStatus ->
  -- | 'updatedAt'
  Prelude.UTCTime ->
  Finding
newFinding :: UTCTime
-> UTCTime
-> Text
-> Text
-> ResourceType
-> FindingStatus
-> UTCTime
-> Finding
newFinding
  UTCTime
pAnalyzedAt_
  UTCTime
pCreatedAt_
  Text
pId_
  Text
pResourceOwnerAccount_
  ResourceType
pResourceType_
  FindingStatus
pStatus_
  UTCTime
pUpdatedAt_ =
    Finding' :: Maybe Text
-> Maybe Bool
-> Maybe [Text]
-> Maybe [FindingSource]
-> Maybe Text
-> Maybe (HashMap Text Text)
-> POSIX
-> HashMap Text Text
-> POSIX
-> Text
-> Text
-> ResourceType
-> FindingStatus
-> POSIX
-> Finding
Finding'
      { $sel:error:Finding' :: Maybe Text
error = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:isPublic:Finding' :: Maybe Bool
isPublic = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:action:Finding' :: Maybe [Text]
action = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
        $sel:sources:Finding' :: Maybe [FindingSource]
sources = Maybe [FindingSource]
forall a. Maybe a
Prelude.Nothing,
        $sel:resource:Finding' :: Maybe Text
resource = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:principal:Finding' :: Maybe (HashMap Text Text)
principal = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:analyzedAt:Finding' :: 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:Finding' :: HashMap Text Text
condition = HashMap Text Text
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:id:Finding' :: Text
id = Text
pId_,
        $sel:resourceOwnerAccount:Finding' :: Text
resourceOwnerAccount = Text
pResourceOwnerAccount_,
        $sel:resourceType:Finding' :: ResourceType
resourceType = ResourceType
pResourceType_,
        $sel:status:Finding' :: FindingStatus
status = FindingStatus
pStatus_,
        $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_
      }

-- | An error.
finding_error :: Lens.Lens' Finding (Prelude.Maybe Prelude.Text)
finding_error :: (Maybe Text -> f (Maybe Text)) -> Finding -> f Finding
finding_error = (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
error :: Maybe Text
$sel:error:Finding' :: Finding -> Maybe Text
error} -> Maybe Text
error) (\s :: Finding
s@Finding' {} Maybe Text
a -> Finding
s {$sel:error:Finding' :: Maybe Text
error = Maybe Text
a} :: Finding)

-- | Indicates whether the policy that generated the finding allows public
-- access to the resource.
finding_isPublic :: Lens.Lens' Finding (Prelude.Maybe Prelude.Bool)
finding_isPublic :: (Maybe Bool -> f (Maybe Bool)) -> Finding -> f Finding
finding_isPublic = (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
isPublic :: Maybe Bool
$sel:isPublic:Finding' :: Finding -> Maybe Bool
isPublic} -> Maybe Bool
isPublic) (\s :: Finding
s@Finding' {} Maybe Bool
a -> Finding
s {$sel:isPublic:Finding' :: Maybe Bool
isPublic = Maybe Bool
a} :: Finding)

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

-- | The external principal that access to a resource within the zone of
-- trust.
finding_principal :: Lens.Lens' Finding (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
finding_principal :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Finding -> f Finding
finding_principal = (Finding -> Maybe (HashMap Text Text))
-> (Finding -> Maybe (HashMap Text Text) -> Finding)
-> Lens
     Finding
     Finding
     (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 (\Finding' {Maybe (HashMap Text Text)
principal :: Maybe (HashMap Text Text)
$sel:principal:Finding' :: Finding -> Maybe (HashMap Text Text)
principal} -> Maybe (HashMap Text Text)
principal) (\s :: Finding
s@Finding' {} Maybe (HashMap Text Text)
a -> Finding
s {$sel:principal:Finding' :: Maybe (HashMap Text Text)
principal = Maybe (HashMap Text Text)
a} :: Finding) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> Finding -> f Finding)
-> ((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)))
-> Finding
-> f Finding
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 was analyzed.
finding_analyzedAt :: Lens.Lens' Finding Prelude.UTCTime
finding_analyzedAt :: (UTCTime -> f UTCTime) -> Finding -> f Finding
finding_analyzedAt = (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
analyzedAt :: POSIX
$sel:analyzedAt:Finding' :: Finding -> POSIX
analyzedAt} -> POSIX
analyzedAt) (\s :: Finding
s@Finding' {} POSIX
a -> Finding
s {$sel:analyzedAt:Finding' :: POSIX
analyzedAt = 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 condition in the analyzed policy statement that resulted in a
-- finding.
finding_condition :: Lens.Lens' Finding (Prelude.HashMap Prelude.Text Prelude.Text)
finding_condition :: (HashMap Text Text -> f (HashMap Text Text))
-> Finding -> f Finding
finding_condition = (Finding -> HashMap Text Text)
-> (Finding -> HashMap Text Text -> Finding)
-> Lens Finding Finding (HashMap Text Text) (HashMap Text Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Finding' {HashMap Text Text
condition :: HashMap Text Text
$sel:condition:Finding' :: Finding -> HashMap Text Text
condition} -> HashMap Text Text
condition) (\s :: Finding
s@Finding' {} HashMap Text Text
a -> Finding
s {$sel:condition:Finding' :: HashMap Text Text
condition = HashMap Text Text
a} :: Finding) ((HashMap Text Text -> f (HashMap Text Text))
 -> Finding -> f Finding)
-> ((HashMap Text Text -> f (HashMap Text Text))
    -> HashMap Text Text -> f (HashMap Text Text))
-> (HashMap Text Text -> f (HashMap Text Text))
-> Finding
-> f Finding
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 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 ID of the finding.
finding_id :: Lens.Lens' Finding Prelude.Text
finding_id :: (Text -> f Text) -> Finding -> f Finding
finding_id = (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
id :: Text
$sel:id:Finding' :: Finding -> Text
id} -> Text
id) (\s :: Finding
s@Finding' {} Text
a -> Finding
s {$sel:id:Finding' :: Text
id = Text
a} :: Finding)

-- | The Amazon Web Services account ID that owns the resource.
finding_resourceOwnerAccount :: Lens.Lens' Finding Prelude.Text
finding_resourceOwnerAccount :: (Text -> f Text) -> Finding -> f Finding
finding_resourceOwnerAccount = (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
resourceOwnerAccount :: Text
$sel:resourceOwnerAccount:Finding' :: Finding -> Text
resourceOwnerAccount} -> Text
resourceOwnerAccount) (\s :: Finding
s@Finding' {} Text
a -> Finding
s {$sel:resourceOwnerAccount:Finding' :: Text
resourceOwnerAccount = Text
a} :: Finding)

-- | The type of the resource identified in the finding.
finding_resourceType :: Lens.Lens' Finding ResourceType
finding_resourceType :: (ResourceType -> f ResourceType) -> Finding -> f Finding
finding_resourceType = (Finding -> ResourceType)
-> (Finding -> ResourceType -> Finding)
-> Lens Finding Finding ResourceType ResourceType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Finding' {ResourceType
resourceType :: ResourceType
$sel:resourceType:Finding' :: Finding -> ResourceType
resourceType} -> ResourceType
resourceType) (\s :: Finding
s@Finding' {} ResourceType
a -> Finding
s {$sel:resourceType:Finding' :: ResourceType
resourceType = ResourceType
a} :: Finding)

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

-- | The time at which the finding was updated.
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 Bool
-> Maybe [Text]
-> Maybe [FindingSource]
-> Maybe Text
-> Maybe (HashMap Text Text)
-> POSIX
-> HashMap Text Text
-> POSIX
-> Text
-> Text
-> ResourceType
-> FindingStatus
-> POSIX
-> Finding
Finding'
            (Maybe Text
 -> Maybe Bool
 -> Maybe [Text]
 -> Maybe [FindingSource]
 -> Maybe Text
 -> Maybe (HashMap Text Text)
 -> POSIX
 -> HashMap Text Text
 -> POSIX
 -> Text
 -> Text
 -> ResourceType
 -> FindingStatus
 -> POSIX
 -> Finding)
-> 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
      -> 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
"error")
            Parser
  (Maybe Bool
   -> Maybe [Text]
   -> Maybe [FindingSource]
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> POSIX
   -> HashMap Text Text
   -> POSIX
   -> Text
   -> Text
   -> ResourceType
   -> FindingStatus
   -> POSIX
   -> Finding)
-> Parser (Maybe Bool)
-> Parser
     (Maybe [Text]
      -> Maybe [FindingSource]
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> POSIX
      -> HashMap Text Text
      -> POSIX
      -> Text
      -> Text
      -> ResourceType
      -> FindingStatus
      -> 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
"isPublic")
            Parser
  (Maybe [Text]
   -> Maybe [FindingSource]
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> POSIX
   -> HashMap Text Text
   -> POSIX
   -> Text
   -> Text
   -> ResourceType
   -> FindingStatus
   -> POSIX
   -> Finding)
-> Parser (Maybe [Text])
-> Parser
     (Maybe [FindingSource]
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> POSIX
      -> HashMap Text Text
      -> POSIX
      -> Text
      -> Text
      -> ResourceType
      -> FindingStatus
      -> POSIX
      -> Finding)
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
   -> Finding)
-> Parser (Maybe [FindingSource])
-> Parser
     (Maybe Text
      -> Maybe (HashMap Text Text)
      -> POSIX
      -> HashMap Text Text
      -> POSIX
      -> Text
      -> Text
      -> ResourceType
      -> FindingStatus
      -> POSIX
      -> Finding)
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
   -> Finding)
-> Parser (Maybe Text)
-> Parser
     (Maybe (HashMap Text Text)
      -> POSIX
      -> HashMap Text Text
      -> POSIX
      -> Text
      -> Text
      -> ResourceType
      -> FindingStatus
      -> 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
"resource")
            Parser
  (Maybe (HashMap Text Text)
   -> POSIX
   -> HashMap Text Text
   -> POSIX
   -> Text
   -> Text
   -> ResourceType
   -> FindingStatus
   -> POSIX
   -> Finding)
-> Parser (Maybe (HashMap Text Text))
-> Parser
     (POSIX
      -> HashMap Text Text
      -> POSIX
      -> Text
      -> Text
      -> ResourceType
      -> FindingStatus
      -> POSIX
      -> Finding)
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
   -> Finding)
-> Parser POSIX
-> Parser
     (HashMap Text Text
      -> POSIX
      -> Text
      -> Text
      -> ResourceType
      -> FindingStatus
      -> 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
"analyzedAt")
            Parser
  (HashMap Text Text
   -> POSIX
   -> Text
   -> Text
   -> ResourceType
   -> FindingStatus
   -> POSIX
   -> Finding)
-> Parser (HashMap Text Text)
-> Parser
     (POSIX
      -> Text
      -> Text
      -> ResourceType
      -> FindingStatus
      -> POSIX
      -> Finding)
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
   -> Finding)
-> Parser POSIX
-> Parser
     (Text -> Text -> ResourceType -> FindingStatus -> 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
  (Text -> Text -> ResourceType -> FindingStatus -> POSIX -> Finding)
-> Parser Text
-> Parser
     (Text -> ResourceType -> FindingStatus -> 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
"id")
            Parser (Text -> ResourceType -> FindingStatus -> POSIX -> Finding)
-> Parser Text
-> Parser (ResourceType -> FindingStatus -> 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
"resourceOwnerAccount")
            Parser (ResourceType -> FindingStatus -> POSIX -> Finding)
-> Parser ResourceType
-> Parser (FindingStatus -> POSIX -> Finding)
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 -> Finding)
-> Parser FindingStatus -> Parser (POSIX -> Finding)
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 -> 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