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

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

instance Prelude.NFData PolicyDescriptorType

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