{-# 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.STS.Types.PolicyDescriptorType
-- 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.STS.Types.PolicyDescriptorType 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

-- | A reference to the IAM managed policy that is passed as a session policy
-- for a role session or a federated user session.
--
-- /See:/ 'newPolicyDescriptorType' smart constructor.
data PolicyDescriptorType = PolicyDescriptorType'
  { -- | The Amazon Resource Name (ARN) of the IAM managed policy to use as a
    -- session policy for the role. For more information about ARNs, see
    -- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html Amazon Resource Names (ARNs) and Amazon Web Services Service Namespaces>
    -- in the /Amazon Web Services General Reference/.
    PolicyDescriptorType -> Maybe Text
arn :: Prelude.Maybe Prelude.Text
  }
  deriving (PolicyDescriptorType -> PolicyDescriptorType -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PolicyDescriptorType -> PolicyDescriptorType -> Bool
$c/= :: PolicyDescriptorType -> PolicyDescriptorType -> Bool
== :: PolicyDescriptorType -> PolicyDescriptorType -> Bool
$c== :: PolicyDescriptorType -> PolicyDescriptorType -> Bool
Prelude.Eq, ReadPrec [PolicyDescriptorType]
ReadPrec PolicyDescriptorType
Int -> ReadS PolicyDescriptorType
ReadS [PolicyDescriptorType]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PolicyDescriptorType]
$creadListPrec :: ReadPrec [PolicyDescriptorType]
readPrec :: ReadPrec PolicyDescriptorType
$creadPrec :: ReadPrec PolicyDescriptorType
readList :: ReadS [PolicyDescriptorType]
$creadList :: ReadS [PolicyDescriptorType]
readsPrec :: Int -> ReadS PolicyDescriptorType
$creadsPrec :: Int -> ReadS PolicyDescriptorType
Prelude.Read, Int -> PolicyDescriptorType -> ShowS
[PolicyDescriptorType] -> ShowS
PolicyDescriptorType -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PolicyDescriptorType] -> ShowS
$cshowList :: [PolicyDescriptorType] -> ShowS
show :: PolicyDescriptorType -> String
$cshow :: PolicyDescriptorType -> String
showsPrec :: Int -> PolicyDescriptorType -> ShowS
$cshowsPrec :: Int -> PolicyDescriptorType -> ShowS
Prelude.Show, forall x. Rep PolicyDescriptorType x -> PolicyDescriptorType
forall x. PolicyDescriptorType -> Rep PolicyDescriptorType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PolicyDescriptorType x -> PolicyDescriptorType
$cfrom :: forall x. PolicyDescriptorType -> Rep PolicyDescriptorType x
Prelude.Generic)

-- |
-- Create a value of 'PolicyDescriptorType' 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:
--
-- 'arn', 'policyDescriptorType_arn' - The Amazon Resource Name (ARN) of the IAM managed policy to use as a
-- session policy for the role. For more information about ARNs, see
-- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html Amazon Resource Names (ARNs) and Amazon Web Services Service Namespaces>
-- in the /Amazon Web Services General Reference/.
newPolicyDescriptorType ::
  PolicyDescriptorType
newPolicyDescriptorType :: PolicyDescriptorType
newPolicyDescriptorType =
  PolicyDescriptorType' {$sel:arn:PolicyDescriptorType' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing}

-- | The Amazon Resource Name (ARN) of the IAM managed policy to use as a
-- session policy for the role. For more information about ARNs, see
-- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html Amazon Resource Names (ARNs) and Amazon Web Services Service Namespaces>
-- in the /Amazon Web Services General Reference/.
policyDescriptorType_arn :: Lens.Lens' PolicyDescriptorType (Prelude.Maybe Prelude.Text)
policyDescriptorType_arn :: Lens' PolicyDescriptorType (Maybe Text)
policyDescriptorType_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PolicyDescriptorType' {Maybe Text
arn :: Maybe Text
$sel:arn:PolicyDescriptorType' :: PolicyDescriptorType -> Maybe Text
arn} -> Maybe Text
arn) (\s :: PolicyDescriptorType
s@PolicyDescriptorType' {} Maybe Text
a -> PolicyDescriptorType
s {$sel:arn:PolicyDescriptorType' :: Maybe Text
arn = Maybe Text
a} :: PolicyDescriptorType)

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

instance Prelude.NFData PolicyDescriptorType where
  rnf :: PolicyDescriptorType -> ()
rnf PolicyDescriptorType' {Maybe Text
arn :: Maybe Text
$sel:arn:PolicyDescriptorType' :: PolicyDescriptorType -> Maybe Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn

instance Data.ToQuery PolicyDescriptorType where
  toQuery :: PolicyDescriptorType -> QueryString
toQuery PolicyDescriptorType' {Maybe Text
arn :: Maybe Text
$sel:arn:PolicyDescriptorType' :: PolicyDescriptorType -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"arn" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
arn]