{-# 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.IAM.Types.RoleDetail
-- 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.IAM.Types.RoleDetail where

import qualified Amazonka.Core as Core
import Amazonka.IAM.Types.AttachedPermissionsBoundary
import Amazonka.IAM.Types.AttachedPolicy
import Amazonka.IAM.Types.InstanceProfile
import Amazonka.IAM.Types.PolicyDetail
import Amazonka.IAM.Types.RoleLastUsed
import Amazonka.IAM.Types.Tag
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains information about an IAM role, including all of the role\'s
-- policies.
--
-- This data type is used as a response element in the
-- GetAccountAuthorizationDetails operation.
--
-- /See:/ 'newRoleDetail' smart constructor.
data RoleDetail = RoleDetail'
  { -- | The trust policy that grants permission to assume the role.
    RoleDetail -> Maybe Text
assumeRolePolicyDocument :: Prelude.Maybe Prelude.Text,
    RoleDetail -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The path to the role. For more information about paths, see
    -- <https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html IAM identifiers>
    -- in the /IAM User Guide/.
    RoleDetail -> Maybe Text
path :: Prelude.Maybe Prelude.Text,
    -- | A list of instance profiles that contain this role.
    RoleDetail -> Maybe [InstanceProfile]
instanceProfileList :: Prelude.Maybe [InstanceProfile],
    -- | The date and time, in
    -- <http://www.iso.org/iso/iso8601 ISO 8601 date-time format>, when the
    -- role was created.
    RoleDetail -> Maybe ISO8601
createDate :: Prelude.Maybe Core.ISO8601,
    -- | The friendly name that identifies the role.
    RoleDetail -> Maybe Text
roleName :: Prelude.Maybe Prelude.Text,
    -- | The stable and unique string identifying the role. For more information
    -- about IDs, see
    -- <https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html IAM identifiers>
    -- in the /IAM User Guide/.
    RoleDetail -> Maybe Text
roleId :: Prelude.Maybe Prelude.Text,
    -- | Contains information about the last time that an IAM role was used. This
    -- includes the date and time and the Region in which the role was last
    -- used. Activity is only reported for the trailing 400 days. This period
    -- can be shorter if your Region began supporting these features within the
    -- last year. The role might have been used more than 400 days ago. For
    -- more information, see
    -- <https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_access-advisor.html#access-advisor_tracking-period Regions where data is tracked>
    -- in the /IAM User Guide/.
    RoleDetail -> Maybe RoleLastUsed
roleLastUsed :: Prelude.Maybe RoleLastUsed,
    -- | The ARN of the policy used to set the permissions boundary for the role.
    --
    -- For more information about permissions boundaries, see
    -- <https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_boundaries.html Permissions boundaries for IAM identities>
    -- in the /IAM User Guide/.
    RoleDetail -> Maybe AttachedPermissionsBoundary
permissionsBoundary :: Prelude.Maybe AttachedPermissionsBoundary,
    -- | A list of inline policies embedded in the role. These policies are the
    -- role\'s access (permissions) policies.
    RoleDetail -> Maybe [PolicyDetail]
rolePolicyList :: Prelude.Maybe [PolicyDetail],
    -- | A list of tags that are attached to the role. For more information about
    -- tagging, see
    -- <https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html Tagging IAM resources>
    -- in the /IAM User Guide/.
    RoleDetail -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | A list of managed policies attached to the role. These policies are the
    -- role\'s access (permissions) policies.
    RoleDetail -> Maybe [AttachedPolicy]
attachedManagedPolicies :: Prelude.Maybe [AttachedPolicy]
  }
  deriving (RoleDetail -> RoleDetail -> Bool
(RoleDetail -> RoleDetail -> Bool)
-> (RoleDetail -> RoleDetail -> Bool) -> Eq RoleDetail
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RoleDetail -> RoleDetail -> Bool
$c/= :: RoleDetail -> RoleDetail -> Bool
== :: RoleDetail -> RoleDetail -> Bool
$c== :: RoleDetail -> RoleDetail -> Bool
Prelude.Eq, ReadPrec [RoleDetail]
ReadPrec RoleDetail
Int -> ReadS RoleDetail
ReadS [RoleDetail]
(Int -> ReadS RoleDetail)
-> ReadS [RoleDetail]
-> ReadPrec RoleDetail
-> ReadPrec [RoleDetail]
-> Read RoleDetail
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RoleDetail]
$creadListPrec :: ReadPrec [RoleDetail]
readPrec :: ReadPrec RoleDetail
$creadPrec :: ReadPrec RoleDetail
readList :: ReadS [RoleDetail]
$creadList :: ReadS [RoleDetail]
readsPrec :: Int -> ReadS RoleDetail
$creadsPrec :: Int -> ReadS RoleDetail
Prelude.Read, Int -> RoleDetail -> ShowS
[RoleDetail] -> ShowS
RoleDetail -> String
(Int -> RoleDetail -> ShowS)
-> (RoleDetail -> String)
-> ([RoleDetail] -> ShowS)
-> Show RoleDetail
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RoleDetail] -> ShowS
$cshowList :: [RoleDetail] -> ShowS
show :: RoleDetail -> String
$cshow :: RoleDetail -> String
showsPrec :: Int -> RoleDetail -> ShowS
$cshowsPrec :: Int -> RoleDetail -> ShowS
Prelude.Show, (forall x. RoleDetail -> Rep RoleDetail x)
-> (forall x. Rep RoleDetail x -> RoleDetail) -> Generic RoleDetail
forall x. Rep RoleDetail x -> RoleDetail
forall x. RoleDetail -> Rep RoleDetail x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RoleDetail x -> RoleDetail
$cfrom :: forall x. RoleDetail -> Rep RoleDetail x
Prelude.Generic)

-- |
-- Create a value of 'RoleDetail' 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:
--
-- 'assumeRolePolicyDocument', 'roleDetail_assumeRolePolicyDocument' - The trust policy that grants permission to assume the role.
--
-- 'arn', 'roleDetail_arn' - Undocumented member.
--
-- 'path', 'roleDetail_path' - The path to the role. For more information about paths, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html IAM identifiers>
-- in the /IAM User Guide/.
--
-- 'instanceProfileList', 'roleDetail_instanceProfileList' - A list of instance profiles that contain this role.
--
-- 'createDate', 'roleDetail_createDate' - The date and time, in
-- <http://www.iso.org/iso/iso8601 ISO 8601 date-time format>, when the
-- role was created.
--
-- 'roleName', 'roleDetail_roleName' - The friendly name that identifies the role.
--
-- 'roleId', 'roleDetail_roleId' - The stable and unique string identifying the role. For more information
-- about IDs, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html IAM identifiers>
-- in the /IAM User Guide/.
--
-- 'roleLastUsed', 'roleDetail_roleLastUsed' - Contains information about the last time that an IAM role was used. This
-- includes the date and time and the Region in which the role was last
-- used. Activity is only reported for the trailing 400 days. This period
-- can be shorter if your Region began supporting these features within the
-- last year. The role might have been used more than 400 days ago. For
-- more information, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_access-advisor.html#access-advisor_tracking-period Regions where data is tracked>
-- in the /IAM User Guide/.
--
-- 'permissionsBoundary', 'roleDetail_permissionsBoundary' - The ARN of the policy used to set the permissions boundary for the role.
--
-- For more information about permissions boundaries, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_boundaries.html Permissions boundaries for IAM identities>
-- in the /IAM User Guide/.
--
-- 'rolePolicyList', 'roleDetail_rolePolicyList' - A list of inline policies embedded in the role. These policies are the
-- role\'s access (permissions) policies.
--
-- 'tags', 'roleDetail_tags' - A list of tags that are attached to the role. For more information about
-- tagging, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html Tagging IAM resources>
-- in the /IAM User Guide/.
--
-- 'attachedManagedPolicies', 'roleDetail_attachedManagedPolicies' - A list of managed policies attached to the role. These policies are the
-- role\'s access (permissions) policies.
newRoleDetail ::
  RoleDetail
newRoleDetail :: RoleDetail
newRoleDetail =
  RoleDetail' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [InstanceProfile]
-> Maybe ISO8601
-> Maybe Text
-> Maybe Text
-> Maybe RoleLastUsed
-> Maybe AttachedPermissionsBoundary
-> Maybe [PolicyDetail]
-> Maybe [Tag]
-> Maybe [AttachedPolicy]
-> RoleDetail
RoleDetail'
    { $sel:assumeRolePolicyDocument:RoleDetail' :: Maybe Text
assumeRolePolicyDocument =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:RoleDetail' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:path:RoleDetail' :: Maybe Text
path = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:instanceProfileList:RoleDetail' :: Maybe [InstanceProfile]
instanceProfileList = Maybe [InstanceProfile]
forall a. Maybe a
Prelude.Nothing,
      $sel:createDate:RoleDetail' :: Maybe ISO8601
createDate = Maybe ISO8601
forall a. Maybe a
Prelude.Nothing,
      $sel:roleName:RoleDetail' :: Maybe Text
roleName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:roleId:RoleDetail' :: Maybe Text
roleId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:roleLastUsed:RoleDetail' :: Maybe RoleLastUsed
roleLastUsed = Maybe RoleLastUsed
forall a. Maybe a
Prelude.Nothing,
      $sel:permissionsBoundary:RoleDetail' :: Maybe AttachedPermissionsBoundary
permissionsBoundary = Maybe AttachedPermissionsBoundary
forall a. Maybe a
Prelude.Nothing,
      $sel:rolePolicyList:RoleDetail' :: Maybe [PolicyDetail]
rolePolicyList = Maybe [PolicyDetail]
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:RoleDetail' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
      $sel:attachedManagedPolicies:RoleDetail' :: Maybe [AttachedPolicy]
attachedManagedPolicies = Maybe [AttachedPolicy]
forall a. Maybe a
Prelude.Nothing
    }

-- | The trust policy that grants permission to assume the role.
roleDetail_assumeRolePolicyDocument :: Lens.Lens' RoleDetail (Prelude.Maybe Prelude.Text)
roleDetail_assumeRolePolicyDocument :: (Maybe Text -> f (Maybe Text)) -> RoleDetail -> f RoleDetail
roleDetail_assumeRolePolicyDocument = (RoleDetail -> Maybe Text)
-> (RoleDetail -> Maybe Text -> RoleDetail)
-> Lens RoleDetail RoleDetail (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RoleDetail' {Maybe Text
assumeRolePolicyDocument :: Maybe Text
$sel:assumeRolePolicyDocument:RoleDetail' :: RoleDetail -> Maybe Text
assumeRolePolicyDocument} -> Maybe Text
assumeRolePolicyDocument) (\s :: RoleDetail
s@RoleDetail' {} Maybe Text
a -> RoleDetail
s {$sel:assumeRolePolicyDocument:RoleDetail' :: Maybe Text
assumeRolePolicyDocument = Maybe Text
a} :: RoleDetail)

-- | Undocumented member.
roleDetail_arn :: Lens.Lens' RoleDetail (Prelude.Maybe Prelude.Text)
roleDetail_arn :: (Maybe Text -> f (Maybe Text)) -> RoleDetail -> f RoleDetail
roleDetail_arn = (RoleDetail -> Maybe Text)
-> (RoleDetail -> Maybe Text -> RoleDetail)
-> Lens RoleDetail RoleDetail (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RoleDetail' {Maybe Text
arn :: Maybe Text
$sel:arn:RoleDetail' :: RoleDetail -> Maybe Text
arn} -> Maybe Text
arn) (\s :: RoleDetail
s@RoleDetail' {} Maybe Text
a -> RoleDetail
s {$sel:arn:RoleDetail' :: Maybe Text
arn = Maybe Text
a} :: RoleDetail)

-- | The path to the role. For more information about paths, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html IAM identifiers>
-- in the /IAM User Guide/.
roleDetail_path :: Lens.Lens' RoleDetail (Prelude.Maybe Prelude.Text)
roleDetail_path :: (Maybe Text -> f (Maybe Text)) -> RoleDetail -> f RoleDetail
roleDetail_path = (RoleDetail -> Maybe Text)
-> (RoleDetail -> Maybe Text -> RoleDetail)
-> Lens RoleDetail RoleDetail (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RoleDetail' {Maybe Text
path :: Maybe Text
$sel:path:RoleDetail' :: RoleDetail -> Maybe Text
path} -> Maybe Text
path) (\s :: RoleDetail
s@RoleDetail' {} Maybe Text
a -> RoleDetail
s {$sel:path:RoleDetail' :: Maybe Text
path = Maybe Text
a} :: RoleDetail)

-- | A list of instance profiles that contain this role.
roleDetail_instanceProfileList :: Lens.Lens' RoleDetail (Prelude.Maybe [InstanceProfile])
roleDetail_instanceProfileList :: (Maybe [InstanceProfile] -> f (Maybe [InstanceProfile]))
-> RoleDetail -> f RoleDetail
roleDetail_instanceProfileList = (RoleDetail -> Maybe [InstanceProfile])
-> (RoleDetail -> Maybe [InstanceProfile] -> RoleDetail)
-> Lens
     RoleDetail
     RoleDetail
     (Maybe [InstanceProfile])
     (Maybe [InstanceProfile])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RoleDetail' {Maybe [InstanceProfile]
instanceProfileList :: Maybe [InstanceProfile]
$sel:instanceProfileList:RoleDetail' :: RoleDetail -> Maybe [InstanceProfile]
instanceProfileList} -> Maybe [InstanceProfile]
instanceProfileList) (\s :: RoleDetail
s@RoleDetail' {} Maybe [InstanceProfile]
a -> RoleDetail
s {$sel:instanceProfileList:RoleDetail' :: Maybe [InstanceProfile]
instanceProfileList = Maybe [InstanceProfile]
a} :: RoleDetail) ((Maybe [InstanceProfile] -> f (Maybe [InstanceProfile]))
 -> RoleDetail -> f RoleDetail)
-> ((Maybe [InstanceProfile] -> f (Maybe [InstanceProfile]))
    -> Maybe [InstanceProfile] -> f (Maybe [InstanceProfile]))
-> (Maybe [InstanceProfile] -> f (Maybe [InstanceProfile]))
-> RoleDetail
-> f RoleDetail
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [InstanceProfile]
  [InstanceProfile]
  [InstanceProfile]
  [InstanceProfile]
-> Iso
     (Maybe [InstanceProfile])
     (Maybe [InstanceProfile])
     (Maybe [InstanceProfile])
     (Maybe [InstanceProfile])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [InstanceProfile]
  [InstanceProfile]
  [InstanceProfile]
  [InstanceProfile]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The date and time, in
-- <http://www.iso.org/iso/iso8601 ISO 8601 date-time format>, when the
-- role was created.
roleDetail_createDate :: Lens.Lens' RoleDetail (Prelude.Maybe Prelude.UTCTime)
roleDetail_createDate :: (Maybe UTCTime -> f (Maybe UTCTime)) -> RoleDetail -> f RoleDetail
roleDetail_createDate = (RoleDetail -> Maybe ISO8601)
-> (RoleDetail -> Maybe ISO8601 -> RoleDetail)
-> Lens RoleDetail RoleDetail (Maybe ISO8601) (Maybe ISO8601)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RoleDetail' {Maybe ISO8601
createDate :: Maybe ISO8601
$sel:createDate:RoleDetail' :: RoleDetail -> Maybe ISO8601
createDate} -> Maybe ISO8601
createDate) (\s :: RoleDetail
s@RoleDetail' {} Maybe ISO8601
a -> RoleDetail
s {$sel:createDate:RoleDetail' :: Maybe ISO8601
createDate = Maybe ISO8601
a} :: RoleDetail) ((Maybe ISO8601 -> f (Maybe ISO8601))
 -> RoleDetail -> f RoleDetail)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe ISO8601 -> f (Maybe ISO8601))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> RoleDetail
-> f RoleDetail
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso ISO8601 ISO8601 UTCTime UTCTime
-> Iso
     (Maybe ISO8601) (Maybe ISO8601) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso ISO8601 ISO8601 UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The friendly name that identifies the role.
roleDetail_roleName :: Lens.Lens' RoleDetail (Prelude.Maybe Prelude.Text)
roleDetail_roleName :: (Maybe Text -> f (Maybe Text)) -> RoleDetail -> f RoleDetail
roleDetail_roleName = (RoleDetail -> Maybe Text)
-> (RoleDetail -> Maybe Text -> RoleDetail)
-> Lens RoleDetail RoleDetail (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RoleDetail' {Maybe Text
roleName :: Maybe Text
$sel:roleName:RoleDetail' :: RoleDetail -> Maybe Text
roleName} -> Maybe Text
roleName) (\s :: RoleDetail
s@RoleDetail' {} Maybe Text
a -> RoleDetail
s {$sel:roleName:RoleDetail' :: Maybe Text
roleName = Maybe Text
a} :: RoleDetail)

-- | The stable and unique string identifying the role. For more information
-- about IDs, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html IAM identifiers>
-- in the /IAM User Guide/.
roleDetail_roleId :: Lens.Lens' RoleDetail (Prelude.Maybe Prelude.Text)
roleDetail_roleId :: (Maybe Text -> f (Maybe Text)) -> RoleDetail -> f RoleDetail
roleDetail_roleId = (RoleDetail -> Maybe Text)
-> (RoleDetail -> Maybe Text -> RoleDetail)
-> Lens RoleDetail RoleDetail (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RoleDetail' {Maybe Text
roleId :: Maybe Text
$sel:roleId:RoleDetail' :: RoleDetail -> Maybe Text
roleId} -> Maybe Text
roleId) (\s :: RoleDetail
s@RoleDetail' {} Maybe Text
a -> RoleDetail
s {$sel:roleId:RoleDetail' :: Maybe Text
roleId = Maybe Text
a} :: RoleDetail)

-- | Contains information about the last time that an IAM role was used. This
-- includes the date and time and the Region in which the role was last
-- used. Activity is only reported for the trailing 400 days. This period
-- can be shorter if your Region began supporting these features within the
-- last year. The role might have been used more than 400 days ago. For
-- more information, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_access-advisor.html#access-advisor_tracking-period Regions where data is tracked>
-- in the /IAM User Guide/.
roleDetail_roleLastUsed :: Lens.Lens' RoleDetail (Prelude.Maybe RoleLastUsed)
roleDetail_roleLastUsed :: (Maybe RoleLastUsed -> f (Maybe RoleLastUsed))
-> RoleDetail -> f RoleDetail
roleDetail_roleLastUsed = (RoleDetail -> Maybe RoleLastUsed)
-> (RoleDetail -> Maybe RoleLastUsed -> RoleDetail)
-> Lens
     RoleDetail RoleDetail (Maybe RoleLastUsed) (Maybe RoleLastUsed)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RoleDetail' {Maybe RoleLastUsed
roleLastUsed :: Maybe RoleLastUsed
$sel:roleLastUsed:RoleDetail' :: RoleDetail -> Maybe RoleLastUsed
roleLastUsed} -> Maybe RoleLastUsed
roleLastUsed) (\s :: RoleDetail
s@RoleDetail' {} Maybe RoleLastUsed
a -> RoleDetail
s {$sel:roleLastUsed:RoleDetail' :: Maybe RoleLastUsed
roleLastUsed = Maybe RoleLastUsed
a} :: RoleDetail)

-- | The ARN of the policy used to set the permissions boundary for the role.
--
-- For more information about permissions boundaries, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_boundaries.html Permissions boundaries for IAM identities>
-- in the /IAM User Guide/.
roleDetail_permissionsBoundary :: Lens.Lens' RoleDetail (Prelude.Maybe AttachedPermissionsBoundary)
roleDetail_permissionsBoundary :: (Maybe AttachedPermissionsBoundary
 -> f (Maybe AttachedPermissionsBoundary))
-> RoleDetail -> f RoleDetail
roleDetail_permissionsBoundary = (RoleDetail -> Maybe AttachedPermissionsBoundary)
-> (RoleDetail -> Maybe AttachedPermissionsBoundary -> RoleDetail)
-> Lens
     RoleDetail
     RoleDetail
     (Maybe AttachedPermissionsBoundary)
     (Maybe AttachedPermissionsBoundary)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RoleDetail' {Maybe AttachedPermissionsBoundary
permissionsBoundary :: Maybe AttachedPermissionsBoundary
$sel:permissionsBoundary:RoleDetail' :: RoleDetail -> Maybe AttachedPermissionsBoundary
permissionsBoundary} -> Maybe AttachedPermissionsBoundary
permissionsBoundary) (\s :: RoleDetail
s@RoleDetail' {} Maybe AttachedPermissionsBoundary
a -> RoleDetail
s {$sel:permissionsBoundary:RoleDetail' :: Maybe AttachedPermissionsBoundary
permissionsBoundary = Maybe AttachedPermissionsBoundary
a} :: RoleDetail)

-- | A list of inline policies embedded in the role. These policies are the
-- role\'s access (permissions) policies.
roleDetail_rolePolicyList :: Lens.Lens' RoleDetail (Prelude.Maybe [PolicyDetail])
roleDetail_rolePolicyList :: (Maybe [PolicyDetail] -> f (Maybe [PolicyDetail]))
-> RoleDetail -> f RoleDetail
roleDetail_rolePolicyList = (RoleDetail -> Maybe [PolicyDetail])
-> (RoleDetail -> Maybe [PolicyDetail] -> RoleDetail)
-> Lens
     RoleDetail RoleDetail (Maybe [PolicyDetail]) (Maybe [PolicyDetail])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RoleDetail' {Maybe [PolicyDetail]
rolePolicyList :: Maybe [PolicyDetail]
$sel:rolePolicyList:RoleDetail' :: RoleDetail -> Maybe [PolicyDetail]
rolePolicyList} -> Maybe [PolicyDetail]
rolePolicyList) (\s :: RoleDetail
s@RoleDetail' {} Maybe [PolicyDetail]
a -> RoleDetail
s {$sel:rolePolicyList:RoleDetail' :: Maybe [PolicyDetail]
rolePolicyList = Maybe [PolicyDetail]
a} :: RoleDetail) ((Maybe [PolicyDetail] -> f (Maybe [PolicyDetail]))
 -> RoleDetail -> f RoleDetail)
-> ((Maybe [PolicyDetail] -> f (Maybe [PolicyDetail]))
    -> Maybe [PolicyDetail] -> f (Maybe [PolicyDetail]))
-> (Maybe [PolicyDetail] -> f (Maybe [PolicyDetail]))
-> RoleDetail
-> f RoleDetail
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [PolicyDetail] [PolicyDetail] [PolicyDetail] [PolicyDetail]
-> Iso
     (Maybe [PolicyDetail])
     (Maybe [PolicyDetail])
     (Maybe [PolicyDetail])
     (Maybe [PolicyDetail])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [PolicyDetail] [PolicyDetail] [PolicyDetail] [PolicyDetail]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A list of tags that are attached to the role. For more information about
-- tagging, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html Tagging IAM resources>
-- in the /IAM User Guide/.
roleDetail_tags :: Lens.Lens' RoleDetail (Prelude.Maybe [Tag])
roleDetail_tags :: (Maybe [Tag] -> f (Maybe [Tag])) -> RoleDetail -> f RoleDetail
roleDetail_tags = (RoleDetail -> Maybe [Tag])
-> (RoleDetail -> Maybe [Tag] -> RoleDetail)
-> Lens RoleDetail RoleDetail (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RoleDetail' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:RoleDetail' :: RoleDetail -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: RoleDetail
s@RoleDetail' {} Maybe [Tag]
a -> RoleDetail
s {$sel:tags:RoleDetail' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: RoleDetail) ((Maybe [Tag] -> f (Maybe [Tag])) -> RoleDetail -> f RoleDetail)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> RoleDetail
-> f RoleDetail
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A list of managed policies attached to the role. These policies are the
-- role\'s access (permissions) policies.
roleDetail_attachedManagedPolicies :: Lens.Lens' RoleDetail (Prelude.Maybe [AttachedPolicy])
roleDetail_attachedManagedPolicies :: (Maybe [AttachedPolicy] -> f (Maybe [AttachedPolicy]))
-> RoleDetail -> f RoleDetail
roleDetail_attachedManagedPolicies = (RoleDetail -> Maybe [AttachedPolicy])
-> (RoleDetail -> Maybe [AttachedPolicy] -> RoleDetail)
-> Lens
     RoleDetail
     RoleDetail
     (Maybe [AttachedPolicy])
     (Maybe [AttachedPolicy])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RoleDetail' {Maybe [AttachedPolicy]
attachedManagedPolicies :: Maybe [AttachedPolicy]
$sel:attachedManagedPolicies:RoleDetail' :: RoleDetail -> Maybe [AttachedPolicy]
attachedManagedPolicies} -> Maybe [AttachedPolicy]
attachedManagedPolicies) (\s :: RoleDetail
s@RoleDetail' {} Maybe [AttachedPolicy]
a -> RoleDetail
s {$sel:attachedManagedPolicies:RoleDetail' :: Maybe [AttachedPolicy]
attachedManagedPolicies = Maybe [AttachedPolicy]
a} :: RoleDetail) ((Maybe [AttachedPolicy] -> f (Maybe [AttachedPolicy]))
 -> RoleDetail -> f RoleDetail)
-> ((Maybe [AttachedPolicy] -> f (Maybe [AttachedPolicy]))
    -> Maybe [AttachedPolicy] -> f (Maybe [AttachedPolicy]))
-> (Maybe [AttachedPolicy] -> f (Maybe [AttachedPolicy]))
-> RoleDetail
-> f RoleDetail
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AttachedPolicy] [AttachedPolicy] [AttachedPolicy] [AttachedPolicy]
-> Iso
     (Maybe [AttachedPolicy])
     (Maybe [AttachedPolicy])
     (Maybe [AttachedPolicy])
     (Maybe [AttachedPolicy])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [AttachedPolicy] [AttachedPolicy] [AttachedPolicy] [AttachedPolicy]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromXML RoleDetail where
  parseXML :: [Node] -> Either String RoleDetail
parseXML [Node]
x =
    Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [InstanceProfile]
-> Maybe ISO8601
-> Maybe Text
-> Maybe Text
-> Maybe RoleLastUsed
-> Maybe AttachedPermissionsBoundary
-> Maybe [PolicyDetail]
-> Maybe [Tag]
-> Maybe [AttachedPolicy]
-> RoleDetail
RoleDetail'
      (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe [InstanceProfile]
 -> Maybe ISO8601
 -> Maybe Text
 -> Maybe Text
 -> Maybe RoleLastUsed
 -> Maybe AttachedPermissionsBoundary
 -> Maybe [PolicyDetail]
 -> Maybe [Tag]
 -> Maybe [AttachedPolicy]
 -> RoleDetail)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe [InstanceProfile]
      -> Maybe ISO8601
      -> Maybe Text
      -> Maybe Text
      -> Maybe RoleLastUsed
      -> Maybe AttachedPermissionsBoundary
      -> Maybe [PolicyDetail]
      -> Maybe [Tag]
      -> Maybe [AttachedPolicy]
      -> RoleDetail)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"AssumeRolePolicyDocument")
      Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe [InstanceProfile]
   -> Maybe ISO8601
   -> Maybe Text
   -> Maybe Text
   -> Maybe RoleLastUsed
   -> Maybe AttachedPermissionsBoundary
   -> Maybe [PolicyDetail]
   -> Maybe [Tag]
   -> Maybe [AttachedPolicy]
   -> RoleDetail)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe [InstanceProfile]
      -> Maybe ISO8601
      -> Maybe Text
      -> Maybe Text
      -> Maybe RoleLastUsed
      -> Maybe AttachedPermissionsBoundary
      -> Maybe [PolicyDetail]
      -> Maybe [Tag]
      -> Maybe [AttachedPolicy]
      -> RoleDetail)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Arn")
      Either
  String
  (Maybe Text
   -> Maybe [InstanceProfile]
   -> Maybe ISO8601
   -> Maybe Text
   -> Maybe Text
   -> Maybe RoleLastUsed
   -> Maybe AttachedPermissionsBoundary
   -> Maybe [PolicyDetail]
   -> Maybe [Tag]
   -> Maybe [AttachedPolicy]
   -> RoleDetail)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [InstanceProfile]
      -> Maybe ISO8601
      -> Maybe Text
      -> Maybe Text
      -> Maybe RoleLastUsed
      -> Maybe AttachedPermissionsBoundary
      -> Maybe [PolicyDetail]
      -> Maybe [Tag]
      -> Maybe [AttachedPolicy]
      -> RoleDetail)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Path")
      Either
  String
  (Maybe [InstanceProfile]
   -> Maybe ISO8601
   -> Maybe Text
   -> Maybe Text
   -> Maybe RoleLastUsed
   -> Maybe AttachedPermissionsBoundary
   -> Maybe [PolicyDetail]
   -> Maybe [Tag]
   -> Maybe [AttachedPolicy]
   -> RoleDetail)
-> Either String (Maybe [InstanceProfile])
-> Either
     String
     (Maybe ISO8601
      -> Maybe Text
      -> Maybe Text
      -> Maybe RoleLastUsed
      -> Maybe AttachedPermissionsBoundary
      -> Maybe [PolicyDetail]
      -> Maybe [Tag]
      -> Maybe [AttachedPolicy]
      -> RoleDetail)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"InstanceProfileList"
                      Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                      Either String [Node]
-> ([Node] -> Either String (Maybe [InstanceProfile]))
-> Either String (Maybe [InstanceProfile])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [InstanceProfile])
-> [Node] -> Either String (Maybe [InstanceProfile])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [InstanceProfile]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
                  )
      Either
  String
  (Maybe ISO8601
   -> Maybe Text
   -> Maybe Text
   -> Maybe RoleLastUsed
   -> Maybe AttachedPermissionsBoundary
   -> Maybe [PolicyDetail]
   -> Maybe [Tag]
   -> Maybe [AttachedPolicy]
   -> RoleDetail)
-> Either String (Maybe ISO8601)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe RoleLastUsed
      -> Maybe AttachedPermissionsBoundary
      -> Maybe [PolicyDetail]
      -> Maybe [Tag]
      -> Maybe [AttachedPolicy]
      -> RoleDetail)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe ISO8601)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"CreateDate")
      Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe RoleLastUsed
   -> Maybe AttachedPermissionsBoundary
   -> Maybe [PolicyDetail]
   -> Maybe [Tag]
   -> Maybe [AttachedPolicy]
   -> RoleDetail)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe RoleLastUsed
      -> Maybe AttachedPermissionsBoundary
      -> Maybe [PolicyDetail]
      -> Maybe [Tag]
      -> Maybe [AttachedPolicy]
      -> RoleDetail)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"RoleName")
      Either
  String
  (Maybe Text
   -> Maybe RoleLastUsed
   -> Maybe AttachedPermissionsBoundary
   -> Maybe [PolicyDetail]
   -> Maybe [Tag]
   -> Maybe [AttachedPolicy]
   -> RoleDetail)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe RoleLastUsed
      -> Maybe AttachedPermissionsBoundary
      -> Maybe [PolicyDetail]
      -> Maybe [Tag]
      -> Maybe [AttachedPolicy]
      -> RoleDetail)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"RoleId")
      Either
  String
  (Maybe RoleLastUsed
   -> Maybe AttachedPermissionsBoundary
   -> Maybe [PolicyDetail]
   -> Maybe [Tag]
   -> Maybe [AttachedPolicy]
   -> RoleDetail)
-> Either String (Maybe RoleLastUsed)
-> Either
     String
     (Maybe AttachedPermissionsBoundary
      -> Maybe [PolicyDetail]
      -> Maybe [Tag]
      -> Maybe [AttachedPolicy]
      -> RoleDetail)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe RoleLastUsed)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"RoleLastUsed")
      Either
  String
  (Maybe AttachedPermissionsBoundary
   -> Maybe [PolicyDetail]
   -> Maybe [Tag]
   -> Maybe [AttachedPolicy]
   -> RoleDetail)
-> Either String (Maybe AttachedPermissionsBoundary)
-> Either
     String
     (Maybe [PolicyDetail]
      -> Maybe [Tag] -> Maybe [AttachedPolicy] -> RoleDetail)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe AttachedPermissionsBoundary)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"PermissionsBoundary")
      Either
  String
  (Maybe [PolicyDetail]
   -> Maybe [Tag] -> Maybe [AttachedPolicy] -> RoleDetail)
-> Either String (Maybe [PolicyDetail])
-> Either
     String (Maybe [Tag] -> Maybe [AttachedPolicy] -> RoleDetail)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"RolePolicyList" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                      Either String [Node]
-> ([Node] -> Either String (Maybe [PolicyDetail]))
-> Either String (Maybe [PolicyDetail])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [PolicyDetail])
-> [Node] -> Either String (Maybe [PolicyDetail])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [PolicyDetail]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
                  )
      Either String (Maybe [Tag] -> Maybe [AttachedPolicy] -> RoleDetail)
-> Either String (Maybe [Tag])
-> Either String (Maybe [AttachedPolicy] -> RoleDetail)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Tags" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                      Either String [Node]
-> ([Node] -> Either String (Maybe [Tag]))
-> Either String (Maybe [Tag])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [Tag])
-> [Node] -> Either String (Maybe [Tag])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [Tag]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
                  )
      Either String (Maybe [AttachedPolicy] -> RoleDetail)
-> Either String (Maybe [AttachedPolicy])
-> Either String RoleDetail
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"AttachedManagedPolicies"
                      Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                      Either String [Node]
-> ([Node] -> Either String (Maybe [AttachedPolicy]))
-> Either String (Maybe [AttachedPolicy])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [AttachedPolicy])
-> [Node] -> Either String (Maybe [AttachedPolicy])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [AttachedPolicy]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
                  )

instance Prelude.Hashable RoleDetail

instance Prelude.NFData RoleDetail