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

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

-- | Contains the ARN details about the IAM entity for which the policy is
-- generated.
--
-- /See:/ 'newPolicyGenerationDetails' smart constructor.
data PolicyGenerationDetails = PolicyGenerationDetails'
  { -- | The ARN of the IAM entity (user or role) for which you are generating a
    -- policy.
    PolicyGenerationDetails -> Text
principalArn :: Prelude.Text
  }
  deriving (PolicyGenerationDetails -> PolicyGenerationDetails -> Bool
(PolicyGenerationDetails -> PolicyGenerationDetails -> Bool)
-> (PolicyGenerationDetails -> PolicyGenerationDetails -> Bool)
-> Eq PolicyGenerationDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PolicyGenerationDetails -> PolicyGenerationDetails -> Bool
$c/= :: PolicyGenerationDetails -> PolicyGenerationDetails -> Bool
== :: PolicyGenerationDetails -> PolicyGenerationDetails -> Bool
$c== :: PolicyGenerationDetails -> PolicyGenerationDetails -> Bool
Prelude.Eq, ReadPrec [PolicyGenerationDetails]
ReadPrec PolicyGenerationDetails
Int -> ReadS PolicyGenerationDetails
ReadS [PolicyGenerationDetails]
(Int -> ReadS PolicyGenerationDetails)
-> ReadS [PolicyGenerationDetails]
-> ReadPrec PolicyGenerationDetails
-> ReadPrec [PolicyGenerationDetails]
-> Read PolicyGenerationDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PolicyGenerationDetails]
$creadListPrec :: ReadPrec [PolicyGenerationDetails]
readPrec :: ReadPrec PolicyGenerationDetails
$creadPrec :: ReadPrec PolicyGenerationDetails
readList :: ReadS [PolicyGenerationDetails]
$creadList :: ReadS [PolicyGenerationDetails]
readsPrec :: Int -> ReadS PolicyGenerationDetails
$creadsPrec :: Int -> ReadS PolicyGenerationDetails
Prelude.Read, Int -> PolicyGenerationDetails -> ShowS
[PolicyGenerationDetails] -> ShowS
PolicyGenerationDetails -> String
(Int -> PolicyGenerationDetails -> ShowS)
-> (PolicyGenerationDetails -> String)
-> ([PolicyGenerationDetails] -> ShowS)
-> Show PolicyGenerationDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PolicyGenerationDetails] -> ShowS
$cshowList :: [PolicyGenerationDetails] -> ShowS
show :: PolicyGenerationDetails -> String
$cshow :: PolicyGenerationDetails -> String
showsPrec :: Int -> PolicyGenerationDetails -> ShowS
$cshowsPrec :: Int -> PolicyGenerationDetails -> ShowS
Prelude.Show, (forall x.
 PolicyGenerationDetails -> Rep PolicyGenerationDetails x)
-> (forall x.
    Rep PolicyGenerationDetails x -> PolicyGenerationDetails)
-> Generic PolicyGenerationDetails
forall x. Rep PolicyGenerationDetails x -> PolicyGenerationDetails
forall x. PolicyGenerationDetails -> Rep PolicyGenerationDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PolicyGenerationDetails x -> PolicyGenerationDetails
$cfrom :: forall x. PolicyGenerationDetails -> Rep PolicyGenerationDetails x
Prelude.Generic)

-- |
-- Create a value of 'PolicyGenerationDetails' 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:
--
-- 'principalArn', 'policyGenerationDetails_principalArn' - The ARN of the IAM entity (user or role) for which you are generating a
-- policy.
newPolicyGenerationDetails ::
  -- | 'principalArn'
  Prelude.Text ->
  PolicyGenerationDetails
newPolicyGenerationDetails :: Text -> PolicyGenerationDetails
newPolicyGenerationDetails Text
pPrincipalArn_ =
  PolicyGenerationDetails' :: Text -> PolicyGenerationDetails
PolicyGenerationDetails'
    { $sel:principalArn:PolicyGenerationDetails' :: Text
principalArn =
        Text
pPrincipalArn_
    }

-- | The ARN of the IAM entity (user or role) for which you are generating a
-- policy.
policyGenerationDetails_principalArn :: Lens.Lens' PolicyGenerationDetails Prelude.Text
policyGenerationDetails_principalArn :: (Text -> f Text)
-> PolicyGenerationDetails -> f PolicyGenerationDetails
policyGenerationDetails_principalArn = (PolicyGenerationDetails -> Text)
-> (PolicyGenerationDetails -> Text -> PolicyGenerationDetails)
-> Lens PolicyGenerationDetails PolicyGenerationDetails Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PolicyGenerationDetails' {Text
principalArn :: Text
$sel:principalArn:PolicyGenerationDetails' :: PolicyGenerationDetails -> Text
principalArn} -> Text
principalArn) (\s :: PolicyGenerationDetails
s@PolicyGenerationDetails' {} Text
a -> PolicyGenerationDetails
s {$sel:principalArn:PolicyGenerationDetails' :: Text
principalArn = Text
a} :: PolicyGenerationDetails)

instance Prelude.Hashable PolicyGenerationDetails

instance Prelude.NFData PolicyGenerationDetails

instance Core.ToJSON PolicyGenerationDetails where
  toJSON :: PolicyGenerationDetails -> Value
toJSON PolicyGenerationDetails' {Text
principalArn :: Text
$sel:principalArn:PolicyGenerationDetails' :: PolicyGenerationDetails -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"principalArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
principalArn)]
      )