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

import qualified Amazonka.Core as Core
import Amazonka.IAM.Types.AttachedPermissionsBoundary
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. This structure is returned as a
-- response element in several API operations that interact with roles.
--
-- /See:/ 'newRole' smart constructor.
data Role = Role'
  { -- | The maximum session duration (in seconds) for the specified role. Anyone
    -- who uses the CLI, or API to assume the role can specify the duration
    -- using the optional @DurationSeconds@ API parameter or @duration-seconds@
    -- CLI parameter.
    Role -> Maybe Natural
maxSessionDuration :: Prelude.Maybe Prelude.Natural,
    -- | The policy that grants an entity permission to assume the role.
    Role -> Maybe Text
assumeRolePolicyDocument :: 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/.
    Role -> 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/.
    Role -> Maybe AttachedPermissionsBoundary
permissionsBoundary :: Prelude.Maybe AttachedPermissionsBoundary,
    -- | A description of the role that you provide.
    Role -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | 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/.
    Role -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | 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/.
    Role -> Text
path :: Prelude.Text,
    -- | The friendly name that identifies the role.
    Role -> Text
roleName :: 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/.
    Role -> Text
roleId :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) specifying the role. For more information
    -- about ARNs and how to use them in policies, see
    -- <https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html IAM identifiers>
    -- in the /IAM User Guide/ guide.
    Role -> Text
arn :: Prelude.Text,
    -- | The date and time, in
    -- <http://www.iso.org/iso/iso8601 ISO 8601 date-time format>, when the
    -- role was created.
    Role -> ISO8601
createDate :: Core.ISO8601
  }
  deriving (Role -> Role -> Bool
(Role -> Role -> Bool) -> (Role -> Role -> Bool) -> Eq Role
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Role -> Role -> Bool
$c/= :: Role -> Role -> Bool
== :: Role -> Role -> Bool
$c== :: Role -> Role -> Bool
Prelude.Eq, ReadPrec [Role]
ReadPrec Role
Int -> ReadS Role
ReadS [Role]
(Int -> ReadS Role)
-> ReadS [Role] -> ReadPrec Role -> ReadPrec [Role] -> Read Role
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Role]
$creadListPrec :: ReadPrec [Role]
readPrec :: ReadPrec Role
$creadPrec :: ReadPrec Role
readList :: ReadS [Role]
$creadList :: ReadS [Role]
readsPrec :: Int -> ReadS Role
$creadsPrec :: Int -> ReadS Role
Prelude.Read, Int -> Role -> ShowS
[Role] -> ShowS
Role -> String
(Int -> Role -> ShowS)
-> (Role -> String) -> ([Role] -> ShowS) -> Show Role
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Role] -> ShowS
$cshowList :: [Role] -> ShowS
show :: Role -> String
$cshow :: Role -> String
showsPrec :: Int -> Role -> ShowS
$cshowsPrec :: Int -> Role -> ShowS
Prelude.Show, (forall x. Role -> Rep Role x)
-> (forall x. Rep Role x -> Role) -> Generic Role
forall x. Rep Role x -> Role
forall x. Role -> Rep Role x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Role x -> Role
$cfrom :: forall x. Role -> Rep Role x
Prelude.Generic)

-- |
-- Create a value of 'Role' 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:
--
-- 'maxSessionDuration', 'role_maxSessionDuration' - The maximum session duration (in seconds) for the specified role. Anyone
-- who uses the CLI, or API to assume the role can specify the duration
-- using the optional @DurationSeconds@ API parameter or @duration-seconds@
-- CLI parameter.
--
-- 'assumeRolePolicyDocument', 'role_assumeRolePolicyDocument' - The policy that grants an entity permission to assume the role.
--
-- 'roleLastUsed', 'role_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', 'role_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/.
--
-- 'description', 'role_description' - A description of the role that you provide.
--
-- 'tags', 'role_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/.
--
-- 'path', 'role_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/.
--
-- 'roleName', 'role_roleName' - The friendly name that identifies the role.
--
-- 'roleId', 'role_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/.
--
-- 'arn', 'role_arn' - The Amazon Resource Name (ARN) specifying the role. For more information
-- about ARNs and how to use them in policies, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html IAM identifiers>
-- in the /IAM User Guide/ guide.
--
-- 'createDate', 'role_createDate' - The date and time, in
-- <http://www.iso.org/iso/iso8601 ISO 8601 date-time format>, when the
-- role was created.
newRole ::
  -- | 'path'
  Prelude.Text ->
  -- | 'roleName'
  Prelude.Text ->
  -- | 'roleId'
  Prelude.Text ->
  -- | 'arn'
  Prelude.Text ->
  -- | 'createDate'
  Prelude.UTCTime ->
  Role
newRole :: Text -> Text -> Text -> Text -> UTCTime -> Role
newRole Text
pPath_ Text
pRoleName_ Text
pRoleId_ Text
pArn_ UTCTime
pCreateDate_ =
  Role' :: Maybe Natural
-> Maybe Text
-> Maybe RoleLastUsed
-> Maybe AttachedPermissionsBoundary
-> Maybe Text
-> Maybe [Tag]
-> Text
-> Text
-> Text
-> Text
-> ISO8601
-> Role
Role'
    { $sel:maxSessionDuration:Role' :: Maybe Natural
maxSessionDuration = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:assumeRolePolicyDocument:Role' :: Maybe Text
assumeRolePolicyDocument = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:roleLastUsed:Role' :: Maybe RoleLastUsed
roleLastUsed = Maybe RoleLastUsed
forall a. Maybe a
Prelude.Nothing,
      $sel:permissionsBoundary:Role' :: Maybe AttachedPermissionsBoundary
permissionsBoundary = Maybe AttachedPermissionsBoundary
forall a. Maybe a
Prelude.Nothing,
      $sel:description:Role' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:Role' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
      $sel:path:Role' :: Text
path = Text
pPath_,
      $sel:roleName:Role' :: Text
roleName = Text
pRoleName_,
      $sel:roleId:Role' :: Text
roleId = Text
pRoleId_,
      $sel:arn:Role' :: Text
arn = Text
pArn_,
      $sel:createDate:Role' :: ISO8601
createDate = Tagged UTCTime (Identity UTCTime)
-> Tagged ISO8601 (Identity ISO8601)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged ISO8601 (Identity ISO8601))
-> UTCTime -> ISO8601
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreateDate_
    }

-- | The maximum session duration (in seconds) for the specified role. Anyone
-- who uses the CLI, or API to assume the role can specify the duration
-- using the optional @DurationSeconds@ API parameter or @duration-seconds@
-- CLI parameter.
role_maxSessionDuration :: Lens.Lens' Role (Prelude.Maybe Prelude.Natural)
role_maxSessionDuration :: (Maybe Natural -> f (Maybe Natural)) -> Role -> f Role
role_maxSessionDuration = (Role -> Maybe Natural)
-> (Role -> Maybe Natural -> Role)
-> Lens Role Role (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Role' {Maybe Natural
maxSessionDuration :: Maybe Natural
$sel:maxSessionDuration:Role' :: Role -> Maybe Natural
maxSessionDuration} -> Maybe Natural
maxSessionDuration) (\s :: Role
s@Role' {} Maybe Natural
a -> Role
s {$sel:maxSessionDuration:Role' :: Maybe Natural
maxSessionDuration = Maybe Natural
a} :: Role)

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

-- | 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/.
role_roleLastUsed :: Lens.Lens' Role (Prelude.Maybe RoleLastUsed)
role_roleLastUsed :: (Maybe RoleLastUsed -> f (Maybe RoleLastUsed)) -> Role -> f Role
role_roleLastUsed = (Role -> Maybe RoleLastUsed)
-> (Role -> Maybe RoleLastUsed -> Role)
-> Lens Role Role (Maybe RoleLastUsed) (Maybe RoleLastUsed)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Role' {Maybe RoleLastUsed
roleLastUsed :: Maybe RoleLastUsed
$sel:roleLastUsed:Role' :: Role -> Maybe RoleLastUsed
roleLastUsed} -> Maybe RoleLastUsed
roleLastUsed) (\s :: Role
s@Role' {} Maybe RoleLastUsed
a -> Role
s {$sel:roleLastUsed:Role' :: Maybe RoleLastUsed
roleLastUsed = Maybe RoleLastUsed
a} :: Role)

-- | 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/.
role_permissionsBoundary :: Lens.Lens' Role (Prelude.Maybe AttachedPermissionsBoundary)
role_permissionsBoundary :: (Maybe AttachedPermissionsBoundary
 -> f (Maybe AttachedPermissionsBoundary))
-> Role -> f Role
role_permissionsBoundary = (Role -> Maybe AttachedPermissionsBoundary)
-> (Role -> Maybe AttachedPermissionsBoundary -> Role)
-> Lens
     Role
     Role
     (Maybe AttachedPermissionsBoundary)
     (Maybe AttachedPermissionsBoundary)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Role' {Maybe AttachedPermissionsBoundary
permissionsBoundary :: Maybe AttachedPermissionsBoundary
$sel:permissionsBoundary:Role' :: Role -> Maybe AttachedPermissionsBoundary
permissionsBoundary} -> Maybe AttachedPermissionsBoundary
permissionsBoundary) (\s :: Role
s@Role' {} Maybe AttachedPermissionsBoundary
a -> Role
s {$sel:permissionsBoundary:Role' :: Maybe AttachedPermissionsBoundary
permissionsBoundary = Maybe AttachedPermissionsBoundary
a} :: Role)

-- | A description of the role that you provide.
role_description :: Lens.Lens' Role (Prelude.Maybe Prelude.Text)
role_description :: (Maybe Text -> f (Maybe Text)) -> Role -> f Role
role_description = (Role -> Maybe Text)
-> (Role -> Maybe Text -> Role)
-> Lens Role Role (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Role' {Maybe Text
description :: Maybe Text
$sel:description:Role' :: Role -> Maybe Text
description} -> Maybe Text
description) (\s :: Role
s@Role' {} Maybe Text
a -> Role
s {$sel:description:Role' :: Maybe Text
description = Maybe Text
a} :: Role)

-- | 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/.
role_tags :: Lens.Lens' Role (Prelude.Maybe [Tag])
role_tags :: (Maybe [Tag] -> f (Maybe [Tag])) -> Role -> f Role
role_tags = (Role -> Maybe [Tag])
-> (Role -> Maybe [Tag] -> Role)
-> Lens Role Role (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Role' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:Role' :: Role -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: Role
s@Role' {} Maybe [Tag]
a -> Role
s {$sel:tags:Role' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: Role) ((Maybe [Tag] -> f (Maybe [Tag])) -> Role -> f Role)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> Role
-> f Role
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

-- | 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/.
role_path :: Lens.Lens' Role Prelude.Text
role_path :: (Text -> f Text) -> Role -> f Role
role_path = (Role -> Text)
-> (Role -> Text -> Role) -> Lens Role Role Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Role' {Text
path :: Text
$sel:path:Role' :: Role -> Text
path} -> Text
path) (\s :: Role
s@Role' {} Text
a -> Role
s {$sel:path:Role' :: Text
path = Text
a} :: Role)

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

-- | 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/.
role_roleId :: Lens.Lens' Role Prelude.Text
role_roleId :: (Text -> f Text) -> Role -> f Role
role_roleId = (Role -> Text)
-> (Role -> Text -> Role) -> Lens Role Role Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Role' {Text
roleId :: Text
$sel:roleId:Role' :: Role -> Text
roleId} -> Text
roleId) (\s :: Role
s@Role' {} Text
a -> Role
s {$sel:roleId:Role' :: Text
roleId = Text
a} :: Role)

-- | The Amazon Resource Name (ARN) specifying the role. For more information
-- about ARNs and how to use them in policies, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html IAM identifiers>
-- in the /IAM User Guide/ guide.
role_arn :: Lens.Lens' Role Prelude.Text
role_arn :: (Text -> f Text) -> Role -> f Role
role_arn = (Role -> Text)
-> (Role -> Text -> Role) -> Lens Role Role Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Role' {Text
arn :: Text
$sel:arn:Role' :: Role -> Text
arn} -> Text
arn) (\s :: Role
s@Role' {} Text
a -> Role
s {$sel:arn:Role' :: Text
arn = Text
a} :: Role)

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

instance Core.FromXML Role where
  parseXML :: [Node] -> Either String Role
parseXML [Node]
x =
    Maybe Natural
-> Maybe Text
-> Maybe RoleLastUsed
-> Maybe AttachedPermissionsBoundary
-> Maybe Text
-> Maybe [Tag]
-> Text
-> Text
-> Text
-> Text
-> ISO8601
-> Role
Role'
      (Maybe Natural
 -> Maybe Text
 -> Maybe RoleLastUsed
 -> Maybe AttachedPermissionsBoundary
 -> Maybe Text
 -> Maybe [Tag]
 -> Text
 -> Text
 -> Text
 -> Text
 -> ISO8601
 -> Role)
-> Either String (Maybe Natural)
-> Either
     String
     (Maybe Text
      -> Maybe RoleLastUsed
      -> Maybe AttachedPermissionsBoundary
      -> Maybe Text
      -> Maybe [Tag]
      -> Text
      -> Text
      -> Text
      -> Text
      -> ISO8601
      -> Role)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Natural)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"MaxSessionDuration")
      Either
  String
  (Maybe Text
   -> Maybe RoleLastUsed
   -> Maybe AttachedPermissionsBoundary
   -> Maybe Text
   -> Maybe [Tag]
   -> Text
   -> Text
   -> Text
   -> Text
   -> ISO8601
   -> Role)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe RoleLastUsed
      -> Maybe AttachedPermissionsBoundary
      -> Maybe Text
      -> Maybe [Tag]
      -> Text
      -> Text
      -> Text
      -> Text
      -> ISO8601
      -> Role)
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
"AssumeRolePolicyDocument")
      Either
  String
  (Maybe RoleLastUsed
   -> Maybe AttachedPermissionsBoundary
   -> Maybe Text
   -> Maybe [Tag]
   -> Text
   -> Text
   -> Text
   -> Text
   -> ISO8601
   -> Role)
-> Either String (Maybe RoleLastUsed)
-> Either
     String
     (Maybe AttachedPermissionsBoundary
      -> Maybe Text
      -> Maybe [Tag]
      -> Text
      -> Text
      -> Text
      -> Text
      -> ISO8601
      -> Role)
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 Text
   -> Maybe [Tag]
   -> Text
   -> Text
   -> Text
   -> Text
   -> ISO8601
   -> Role)
-> Either String (Maybe AttachedPermissionsBoundary)
-> Either
     String
     (Maybe Text
      -> Maybe [Tag] -> Text -> Text -> Text -> Text -> ISO8601 -> Role)
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 Text
   -> Maybe [Tag] -> Text -> Text -> Text -> Text -> ISO8601 -> Role)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [Tag] -> Text -> Text -> Text -> Text -> ISO8601 -> Role)
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
"Description")
      Either
  String
  (Maybe [Tag] -> Text -> Text -> Text -> Text -> ISO8601 -> Role)
-> Either String (Maybe [Tag])
-> Either String (Text -> Text -> Text -> Text -> ISO8601 -> Role)
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 (Text -> Text -> Text -> Text -> ISO8601 -> Role)
-> Either String Text
-> Either String (Text -> Text -> Text -> ISO8601 -> Role)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Path")
      Either String (Text -> Text -> Text -> ISO8601 -> Role)
-> Either String Text
-> Either String (Text -> Text -> ISO8601 -> Role)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"RoleName")
      Either String (Text -> Text -> ISO8601 -> Role)
-> Either String Text -> Either String (Text -> ISO8601 -> Role)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"RoleId")
      Either String (Text -> ISO8601 -> Role)
-> Either String Text -> Either String (ISO8601 -> Role)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Arn")
      Either String (ISO8601 -> Role)
-> Either String ISO8601 -> Either String Role
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String ISO8601
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"CreateDate")

instance Prelude.Hashable Role

instance Prelude.NFData Role