{-# 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.FindingSourceDetail
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.AccessAnalyzer.Types.FindingSourceDetail where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Includes details about how the access that generated the finding is
-- granted. This is populated for Amazon S3 bucket findings.
--
-- /See:/ 'newFindingSourceDetail' smart constructor.
data FindingSourceDetail = FindingSourceDetail'
  { -- | The account of the cross-account access point that generated the
    -- finding.
    FindingSourceDetail -> Maybe Text
accessPointAccount :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the access point that generated the finding. The ARN format
    -- depends on whether the ARN represents an access point or a multi-region
    -- access point.
    FindingSourceDetail -> Maybe Text
accessPointArn :: Prelude.Maybe Prelude.Text
  }
  deriving (FindingSourceDetail -> FindingSourceDetail -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FindingSourceDetail -> FindingSourceDetail -> Bool
$c/= :: FindingSourceDetail -> FindingSourceDetail -> Bool
== :: FindingSourceDetail -> FindingSourceDetail -> Bool
$c== :: FindingSourceDetail -> FindingSourceDetail -> Bool
Prelude.Eq, ReadPrec [FindingSourceDetail]
ReadPrec FindingSourceDetail
Int -> ReadS FindingSourceDetail
ReadS [FindingSourceDetail]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FindingSourceDetail]
$creadListPrec :: ReadPrec [FindingSourceDetail]
readPrec :: ReadPrec FindingSourceDetail
$creadPrec :: ReadPrec FindingSourceDetail
readList :: ReadS [FindingSourceDetail]
$creadList :: ReadS [FindingSourceDetail]
readsPrec :: Int -> ReadS FindingSourceDetail
$creadsPrec :: Int -> ReadS FindingSourceDetail
Prelude.Read, Int -> FindingSourceDetail -> ShowS
[FindingSourceDetail] -> ShowS
FindingSourceDetail -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FindingSourceDetail] -> ShowS
$cshowList :: [FindingSourceDetail] -> ShowS
show :: FindingSourceDetail -> String
$cshow :: FindingSourceDetail -> String
showsPrec :: Int -> FindingSourceDetail -> ShowS
$cshowsPrec :: Int -> FindingSourceDetail -> ShowS
Prelude.Show, forall x. Rep FindingSourceDetail x -> FindingSourceDetail
forall x. FindingSourceDetail -> Rep FindingSourceDetail x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FindingSourceDetail x -> FindingSourceDetail
$cfrom :: forall x. FindingSourceDetail -> Rep FindingSourceDetail x
Prelude.Generic)

-- |
-- Create a value of 'FindingSourceDetail' 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:
--
-- 'accessPointAccount', 'findingSourceDetail_accessPointAccount' - The account of the cross-account access point that generated the
-- finding.
--
-- 'accessPointArn', 'findingSourceDetail_accessPointArn' - The ARN of the access point that generated the finding. The ARN format
-- depends on whether the ARN represents an access point or a multi-region
-- access point.
newFindingSourceDetail ::
  FindingSourceDetail
newFindingSourceDetail :: FindingSourceDetail
newFindingSourceDetail =
  FindingSourceDetail'
    { $sel:accessPointAccount:FindingSourceDetail' :: Maybe Text
accessPointAccount =
        forall a. Maybe a
Prelude.Nothing,
      $sel:accessPointArn:FindingSourceDetail' :: Maybe Text
accessPointArn = forall a. Maybe a
Prelude.Nothing
    }

-- | The account of the cross-account access point that generated the
-- finding.
findingSourceDetail_accessPointAccount :: Lens.Lens' FindingSourceDetail (Prelude.Maybe Prelude.Text)
findingSourceDetail_accessPointAccount :: Lens' FindingSourceDetail (Maybe Text)
findingSourceDetail_accessPointAccount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FindingSourceDetail' {Maybe Text
accessPointAccount :: Maybe Text
$sel:accessPointAccount:FindingSourceDetail' :: FindingSourceDetail -> Maybe Text
accessPointAccount} -> Maybe Text
accessPointAccount) (\s :: FindingSourceDetail
s@FindingSourceDetail' {} Maybe Text
a -> FindingSourceDetail
s {$sel:accessPointAccount:FindingSourceDetail' :: Maybe Text
accessPointAccount = Maybe Text
a} :: FindingSourceDetail)

-- | The ARN of the access point that generated the finding. The ARN format
-- depends on whether the ARN represents an access point or a multi-region
-- access point.
findingSourceDetail_accessPointArn :: Lens.Lens' FindingSourceDetail (Prelude.Maybe Prelude.Text)
findingSourceDetail_accessPointArn :: Lens' FindingSourceDetail (Maybe Text)
findingSourceDetail_accessPointArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FindingSourceDetail' {Maybe Text
accessPointArn :: Maybe Text
$sel:accessPointArn:FindingSourceDetail' :: FindingSourceDetail -> Maybe Text
accessPointArn} -> Maybe Text
accessPointArn) (\s :: FindingSourceDetail
s@FindingSourceDetail' {} Maybe Text
a -> FindingSourceDetail
s {$sel:accessPointArn:FindingSourceDetail' :: Maybe Text
accessPointArn = Maybe Text
a} :: FindingSourceDetail)

instance Data.FromJSON FindingSourceDetail where
  parseJSON :: Value -> Parser FindingSourceDetail
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"FindingSourceDetail"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> FindingSourceDetail
FindingSourceDetail'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"accessPointAccount")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"accessPointArn")
      )

instance Prelude.Hashable FindingSourceDetail where
  hashWithSalt :: Int -> FindingSourceDetail -> Int
hashWithSalt Int
_salt FindingSourceDetail' {Maybe Text
accessPointArn :: Maybe Text
accessPointAccount :: Maybe Text
$sel:accessPointArn:FindingSourceDetail' :: FindingSourceDetail -> Maybe Text
$sel:accessPointAccount:FindingSourceDetail' :: FindingSourceDetail -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
accessPointAccount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
accessPointArn

instance Prelude.NFData FindingSourceDetail where
  rnf :: FindingSourceDetail -> ()
rnf FindingSourceDetail' {Maybe Text
accessPointArn :: Maybe Text
accessPointAccount :: Maybe Text
$sel:accessPointArn:FindingSourceDetail' :: FindingSourceDetail -> Maybe Text
$sel:accessPointAccount:FindingSourceDetail' :: FindingSourceDetail -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
accessPointAccount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
accessPointArn