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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 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
(FindingSourceDetail -> FindingSourceDetail -> Bool)
-> (FindingSourceDetail -> FindingSourceDetail -> Bool)
-> Eq FindingSourceDetail
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]
(Int -> ReadS FindingSourceDetail)
-> ReadS [FindingSourceDetail]
-> ReadPrec FindingSourceDetail
-> ReadPrec [FindingSourceDetail]
-> Read 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
(Int -> FindingSourceDetail -> ShowS)
-> (FindingSourceDetail -> String)
-> ([FindingSourceDetail] -> ShowS)
-> Show FindingSourceDetail
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. FindingSourceDetail -> Rep FindingSourceDetail x)
-> (forall x. Rep FindingSourceDetail x -> FindingSourceDetail)
-> Generic FindingSourceDetail
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:
--
-- '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' :: Maybe Text -> FindingSourceDetail
FindingSourceDetail'
    { $sel:accessPointArn:FindingSourceDetail' :: Maybe Text
accessPointArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: (Maybe Text -> f (Maybe Text))
-> FindingSourceDetail -> f FindingSourceDetail
findingSourceDetail_accessPointArn = (FindingSourceDetail -> Maybe Text)
-> (FindingSourceDetail -> Maybe Text -> FindingSourceDetail)
-> Lens
     FindingSourceDetail FindingSourceDetail (Maybe Text) (Maybe Text)
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 Core.FromJSON FindingSourceDetail where
  parseJSON :: Value -> Parser FindingSourceDetail
parseJSON =
    String
-> (Object -> Parser FindingSourceDetail)
-> Value
-> Parser FindingSourceDetail
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"FindingSourceDetail"
      ( \Object
x ->
          Maybe Text -> FindingSourceDetail
FindingSourceDetail'
            (Maybe Text -> FindingSourceDetail)
-> Parser (Maybe Text) -> Parser FindingSourceDetail
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
"accessPointArn")
      )

instance Prelude.Hashable FindingSourceDetail

instance Prelude.NFData FindingSourceDetail