{-# 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.SecurityHub.Types.AwsIamRoleDetails
-- 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.SecurityHub.Types.AwsIamRoleDetails where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SecurityHub.Types.AwsIamAttachedManagedPolicy
import Amazonka.SecurityHub.Types.AwsIamInstanceProfile
import Amazonka.SecurityHub.Types.AwsIamPermissionsBoundary
import Amazonka.SecurityHub.Types.AwsIamRolePolicy

-- | Contains information about an IAM role, including all of the role\'s
-- policies.
--
-- /See:/ 'newAwsIamRoleDetails' smart constructor.
data AwsIamRoleDetails = AwsIamRoleDetails'
  { -- | The maximum session duration (in seconds) that you want to set for the
    -- specified role.
    AwsIamRoleDetails -> Maybe Int
maxSessionDuration :: Prelude.Maybe Prelude.Int,
    -- | The trust policy that grants permission to assume the role.
    AwsIamRoleDetails -> Maybe Text
assumeRolePolicyDocument :: Prelude.Maybe Prelude.Text,
    -- | The path to the role.
    AwsIamRoleDetails -> Maybe Text
path :: Prelude.Maybe Prelude.Text,
    -- | The list of instance profiles that contain this role.
    AwsIamRoleDetails -> Maybe [AwsIamInstanceProfile]
instanceProfileList :: Prelude.Maybe [AwsIamInstanceProfile],
    -- | Indicates when the role was created.
    --
    -- Uses the @date-time@ format specified in
    -- <https://tools.ietf.org/html/rfc3339#section-5.6 RFC 3339 section 5.6, Internet Date\/Time Format>.
    -- The value cannot contain spaces. For example,
    -- @2020-03-22T13:22:13.933Z@.
    AwsIamRoleDetails -> Maybe Text
createDate :: Prelude.Maybe Prelude.Text,
    -- | The friendly name that identifies the role.
    AwsIamRoleDetails -> Maybe Text
roleName :: Prelude.Maybe Prelude.Text,
    -- | The stable and unique string identifying the role.
    AwsIamRoleDetails -> Maybe Text
roleId :: Prelude.Maybe Prelude.Text,
    AwsIamRoleDetails -> Maybe AwsIamPermissionsBoundary
permissionsBoundary :: Prelude.Maybe AwsIamPermissionsBoundary,
    -- | The list of inline policies that are embedded in the role.
    AwsIamRoleDetails -> Maybe [AwsIamRolePolicy]
rolePolicyList :: Prelude.Maybe [AwsIamRolePolicy],
    -- | The list of the managed policies that are attached to the role.
    AwsIamRoleDetails -> Maybe [AwsIamAttachedManagedPolicy]
attachedManagedPolicies :: Prelude.Maybe [AwsIamAttachedManagedPolicy]
  }
  deriving (AwsIamRoleDetails -> AwsIamRoleDetails -> Bool
(AwsIamRoleDetails -> AwsIamRoleDetails -> Bool)
-> (AwsIamRoleDetails -> AwsIamRoleDetails -> Bool)
-> Eq AwsIamRoleDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsIamRoleDetails -> AwsIamRoleDetails -> Bool
$c/= :: AwsIamRoleDetails -> AwsIamRoleDetails -> Bool
== :: AwsIamRoleDetails -> AwsIamRoleDetails -> Bool
$c== :: AwsIamRoleDetails -> AwsIamRoleDetails -> Bool
Prelude.Eq, ReadPrec [AwsIamRoleDetails]
ReadPrec AwsIamRoleDetails
Int -> ReadS AwsIamRoleDetails
ReadS [AwsIamRoleDetails]
(Int -> ReadS AwsIamRoleDetails)
-> ReadS [AwsIamRoleDetails]
-> ReadPrec AwsIamRoleDetails
-> ReadPrec [AwsIamRoleDetails]
-> Read AwsIamRoleDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsIamRoleDetails]
$creadListPrec :: ReadPrec [AwsIamRoleDetails]
readPrec :: ReadPrec AwsIamRoleDetails
$creadPrec :: ReadPrec AwsIamRoleDetails
readList :: ReadS [AwsIamRoleDetails]
$creadList :: ReadS [AwsIamRoleDetails]
readsPrec :: Int -> ReadS AwsIamRoleDetails
$creadsPrec :: Int -> ReadS AwsIamRoleDetails
Prelude.Read, Int -> AwsIamRoleDetails -> ShowS
[AwsIamRoleDetails] -> ShowS
AwsIamRoleDetails -> String
(Int -> AwsIamRoleDetails -> ShowS)
-> (AwsIamRoleDetails -> String)
-> ([AwsIamRoleDetails] -> ShowS)
-> Show AwsIamRoleDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsIamRoleDetails] -> ShowS
$cshowList :: [AwsIamRoleDetails] -> ShowS
show :: AwsIamRoleDetails -> String
$cshow :: AwsIamRoleDetails -> String
showsPrec :: Int -> AwsIamRoleDetails -> ShowS
$cshowsPrec :: Int -> AwsIamRoleDetails -> ShowS
Prelude.Show, (forall x. AwsIamRoleDetails -> Rep AwsIamRoleDetails x)
-> (forall x. Rep AwsIamRoleDetails x -> AwsIamRoleDetails)
-> Generic AwsIamRoleDetails
forall x. Rep AwsIamRoleDetails x -> AwsIamRoleDetails
forall x. AwsIamRoleDetails -> Rep AwsIamRoleDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AwsIamRoleDetails x -> AwsIamRoleDetails
$cfrom :: forall x. AwsIamRoleDetails -> Rep AwsIamRoleDetails x
Prelude.Generic)

-- |
-- Create a value of 'AwsIamRoleDetails' 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', 'awsIamRoleDetails_maxSessionDuration' - The maximum session duration (in seconds) that you want to set for the
-- specified role.
--
-- 'assumeRolePolicyDocument', 'awsIamRoleDetails_assumeRolePolicyDocument' - The trust policy that grants permission to assume the role.
--
-- 'path', 'awsIamRoleDetails_path' - The path to the role.
--
-- 'instanceProfileList', 'awsIamRoleDetails_instanceProfileList' - The list of instance profiles that contain this role.
--
-- 'createDate', 'awsIamRoleDetails_createDate' - Indicates when the role was created.
--
-- Uses the @date-time@ format specified in
-- <https://tools.ietf.org/html/rfc3339#section-5.6 RFC 3339 section 5.6, Internet Date\/Time Format>.
-- The value cannot contain spaces. For example,
-- @2020-03-22T13:22:13.933Z@.
--
-- 'roleName', 'awsIamRoleDetails_roleName' - The friendly name that identifies the role.
--
-- 'roleId', 'awsIamRoleDetails_roleId' - The stable and unique string identifying the role.
--
-- 'permissionsBoundary', 'awsIamRoleDetails_permissionsBoundary' - Undocumented member.
--
-- 'rolePolicyList', 'awsIamRoleDetails_rolePolicyList' - The list of inline policies that are embedded in the role.
--
-- 'attachedManagedPolicies', 'awsIamRoleDetails_attachedManagedPolicies' - The list of the managed policies that are attached to the role.
newAwsIamRoleDetails ::
  AwsIamRoleDetails
newAwsIamRoleDetails :: AwsIamRoleDetails
newAwsIamRoleDetails =
  AwsIamRoleDetails' :: Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe [AwsIamInstanceProfile]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe AwsIamPermissionsBoundary
-> Maybe [AwsIamRolePolicy]
-> Maybe [AwsIamAttachedManagedPolicy]
-> AwsIamRoleDetails
AwsIamRoleDetails'
    { $sel:maxSessionDuration:AwsIamRoleDetails' :: Maybe Int
maxSessionDuration =
        Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:assumeRolePolicyDocument:AwsIamRoleDetails' :: Maybe Text
assumeRolePolicyDocument = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:path:AwsIamRoleDetails' :: Maybe Text
path = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:instanceProfileList:AwsIamRoleDetails' :: Maybe [AwsIamInstanceProfile]
instanceProfileList = Maybe [AwsIamInstanceProfile]
forall a. Maybe a
Prelude.Nothing,
      $sel:createDate:AwsIamRoleDetails' :: Maybe Text
createDate = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:roleName:AwsIamRoleDetails' :: Maybe Text
roleName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:roleId:AwsIamRoleDetails' :: Maybe Text
roleId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:permissionsBoundary:AwsIamRoleDetails' :: Maybe AwsIamPermissionsBoundary
permissionsBoundary = Maybe AwsIamPermissionsBoundary
forall a. Maybe a
Prelude.Nothing,
      $sel:rolePolicyList:AwsIamRoleDetails' :: Maybe [AwsIamRolePolicy]
rolePolicyList = Maybe [AwsIamRolePolicy]
forall a. Maybe a
Prelude.Nothing,
      $sel:attachedManagedPolicies:AwsIamRoleDetails' :: Maybe [AwsIamAttachedManagedPolicy]
attachedManagedPolicies = Maybe [AwsIamAttachedManagedPolicy]
forall a. Maybe a
Prelude.Nothing
    }

-- | The maximum session duration (in seconds) that you want to set for the
-- specified role.
awsIamRoleDetails_maxSessionDuration :: Lens.Lens' AwsIamRoleDetails (Prelude.Maybe Prelude.Int)
awsIamRoleDetails_maxSessionDuration :: (Maybe Int -> f (Maybe Int))
-> AwsIamRoleDetails -> f AwsIamRoleDetails
awsIamRoleDetails_maxSessionDuration = (AwsIamRoleDetails -> Maybe Int)
-> (AwsIamRoleDetails -> Maybe Int -> AwsIamRoleDetails)
-> Lens AwsIamRoleDetails AwsIamRoleDetails (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsIamRoleDetails' {Maybe Int
maxSessionDuration :: Maybe Int
$sel:maxSessionDuration:AwsIamRoleDetails' :: AwsIamRoleDetails -> Maybe Int
maxSessionDuration} -> Maybe Int
maxSessionDuration) (\s :: AwsIamRoleDetails
s@AwsIamRoleDetails' {} Maybe Int
a -> AwsIamRoleDetails
s {$sel:maxSessionDuration:AwsIamRoleDetails' :: Maybe Int
maxSessionDuration = Maybe Int
a} :: AwsIamRoleDetails)

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

-- | The path to the role.
awsIamRoleDetails_path :: Lens.Lens' AwsIamRoleDetails (Prelude.Maybe Prelude.Text)
awsIamRoleDetails_path :: (Maybe Text -> f (Maybe Text))
-> AwsIamRoleDetails -> f AwsIamRoleDetails
awsIamRoleDetails_path = (AwsIamRoleDetails -> Maybe Text)
-> (AwsIamRoleDetails -> Maybe Text -> AwsIamRoleDetails)
-> Lens
     AwsIamRoleDetails AwsIamRoleDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsIamRoleDetails' {Maybe Text
path :: Maybe Text
$sel:path:AwsIamRoleDetails' :: AwsIamRoleDetails -> Maybe Text
path} -> Maybe Text
path) (\s :: AwsIamRoleDetails
s@AwsIamRoleDetails' {} Maybe Text
a -> AwsIamRoleDetails
s {$sel:path:AwsIamRoleDetails' :: Maybe Text
path = Maybe Text
a} :: AwsIamRoleDetails)

-- | The list of instance profiles that contain this role.
awsIamRoleDetails_instanceProfileList :: Lens.Lens' AwsIamRoleDetails (Prelude.Maybe [AwsIamInstanceProfile])
awsIamRoleDetails_instanceProfileList :: (Maybe [AwsIamInstanceProfile]
 -> f (Maybe [AwsIamInstanceProfile]))
-> AwsIamRoleDetails -> f AwsIamRoleDetails
awsIamRoleDetails_instanceProfileList = (AwsIamRoleDetails -> Maybe [AwsIamInstanceProfile])
-> (AwsIamRoleDetails
    -> Maybe [AwsIamInstanceProfile] -> AwsIamRoleDetails)
-> Lens
     AwsIamRoleDetails
     AwsIamRoleDetails
     (Maybe [AwsIamInstanceProfile])
     (Maybe [AwsIamInstanceProfile])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsIamRoleDetails' {Maybe [AwsIamInstanceProfile]
instanceProfileList :: Maybe [AwsIamInstanceProfile]
$sel:instanceProfileList:AwsIamRoleDetails' :: AwsIamRoleDetails -> Maybe [AwsIamInstanceProfile]
instanceProfileList} -> Maybe [AwsIamInstanceProfile]
instanceProfileList) (\s :: AwsIamRoleDetails
s@AwsIamRoleDetails' {} Maybe [AwsIamInstanceProfile]
a -> AwsIamRoleDetails
s {$sel:instanceProfileList:AwsIamRoleDetails' :: Maybe [AwsIamInstanceProfile]
instanceProfileList = Maybe [AwsIamInstanceProfile]
a} :: AwsIamRoleDetails) ((Maybe [AwsIamInstanceProfile]
  -> f (Maybe [AwsIamInstanceProfile]))
 -> AwsIamRoleDetails -> f AwsIamRoleDetails)
-> ((Maybe [AwsIamInstanceProfile]
     -> f (Maybe [AwsIamInstanceProfile]))
    -> Maybe [AwsIamInstanceProfile]
    -> f (Maybe [AwsIamInstanceProfile]))
-> (Maybe [AwsIamInstanceProfile]
    -> f (Maybe [AwsIamInstanceProfile]))
-> AwsIamRoleDetails
-> f AwsIamRoleDetails
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AwsIamInstanceProfile]
  [AwsIamInstanceProfile]
  [AwsIamInstanceProfile]
  [AwsIamInstanceProfile]
-> Iso
     (Maybe [AwsIamInstanceProfile])
     (Maybe [AwsIamInstanceProfile])
     (Maybe [AwsIamInstanceProfile])
     (Maybe [AwsIamInstanceProfile])
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
  [AwsIamInstanceProfile]
  [AwsIamInstanceProfile]
  [AwsIamInstanceProfile]
  [AwsIamInstanceProfile]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Indicates when the role was created.
--
-- Uses the @date-time@ format specified in
-- <https://tools.ietf.org/html/rfc3339#section-5.6 RFC 3339 section 5.6, Internet Date\/Time Format>.
-- The value cannot contain spaces. For example,
-- @2020-03-22T13:22:13.933Z@.
awsIamRoleDetails_createDate :: Lens.Lens' AwsIamRoleDetails (Prelude.Maybe Prelude.Text)
awsIamRoleDetails_createDate :: (Maybe Text -> f (Maybe Text))
-> AwsIamRoleDetails -> f AwsIamRoleDetails
awsIamRoleDetails_createDate = (AwsIamRoleDetails -> Maybe Text)
-> (AwsIamRoleDetails -> Maybe Text -> AwsIamRoleDetails)
-> Lens
     AwsIamRoleDetails AwsIamRoleDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsIamRoleDetails' {Maybe Text
createDate :: Maybe Text
$sel:createDate:AwsIamRoleDetails' :: AwsIamRoleDetails -> Maybe Text
createDate} -> Maybe Text
createDate) (\s :: AwsIamRoleDetails
s@AwsIamRoleDetails' {} Maybe Text
a -> AwsIamRoleDetails
s {$sel:createDate:AwsIamRoleDetails' :: Maybe Text
createDate = Maybe Text
a} :: AwsIamRoleDetails)

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

-- | The stable and unique string identifying the role.
awsIamRoleDetails_roleId :: Lens.Lens' AwsIamRoleDetails (Prelude.Maybe Prelude.Text)
awsIamRoleDetails_roleId :: (Maybe Text -> f (Maybe Text))
-> AwsIamRoleDetails -> f AwsIamRoleDetails
awsIamRoleDetails_roleId = (AwsIamRoleDetails -> Maybe Text)
-> (AwsIamRoleDetails -> Maybe Text -> AwsIamRoleDetails)
-> Lens
     AwsIamRoleDetails AwsIamRoleDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsIamRoleDetails' {Maybe Text
roleId :: Maybe Text
$sel:roleId:AwsIamRoleDetails' :: AwsIamRoleDetails -> Maybe Text
roleId} -> Maybe Text
roleId) (\s :: AwsIamRoleDetails
s@AwsIamRoleDetails' {} Maybe Text
a -> AwsIamRoleDetails
s {$sel:roleId:AwsIamRoleDetails' :: Maybe Text
roleId = Maybe Text
a} :: AwsIamRoleDetails)

-- | Undocumented member.
awsIamRoleDetails_permissionsBoundary :: Lens.Lens' AwsIamRoleDetails (Prelude.Maybe AwsIamPermissionsBoundary)
awsIamRoleDetails_permissionsBoundary :: (Maybe AwsIamPermissionsBoundary
 -> f (Maybe AwsIamPermissionsBoundary))
-> AwsIamRoleDetails -> f AwsIamRoleDetails
awsIamRoleDetails_permissionsBoundary = (AwsIamRoleDetails -> Maybe AwsIamPermissionsBoundary)
-> (AwsIamRoleDetails
    -> Maybe AwsIamPermissionsBoundary -> AwsIamRoleDetails)
-> Lens
     AwsIamRoleDetails
     AwsIamRoleDetails
     (Maybe AwsIamPermissionsBoundary)
     (Maybe AwsIamPermissionsBoundary)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsIamRoleDetails' {Maybe AwsIamPermissionsBoundary
permissionsBoundary :: Maybe AwsIamPermissionsBoundary
$sel:permissionsBoundary:AwsIamRoleDetails' :: AwsIamRoleDetails -> Maybe AwsIamPermissionsBoundary
permissionsBoundary} -> Maybe AwsIamPermissionsBoundary
permissionsBoundary) (\s :: AwsIamRoleDetails
s@AwsIamRoleDetails' {} Maybe AwsIamPermissionsBoundary
a -> AwsIamRoleDetails
s {$sel:permissionsBoundary:AwsIamRoleDetails' :: Maybe AwsIamPermissionsBoundary
permissionsBoundary = Maybe AwsIamPermissionsBoundary
a} :: AwsIamRoleDetails)

-- | The list of inline policies that are embedded in the role.
awsIamRoleDetails_rolePolicyList :: Lens.Lens' AwsIamRoleDetails (Prelude.Maybe [AwsIamRolePolicy])
awsIamRoleDetails_rolePolicyList :: (Maybe [AwsIamRolePolicy] -> f (Maybe [AwsIamRolePolicy]))
-> AwsIamRoleDetails -> f AwsIamRoleDetails
awsIamRoleDetails_rolePolicyList = (AwsIamRoleDetails -> Maybe [AwsIamRolePolicy])
-> (AwsIamRoleDetails
    -> Maybe [AwsIamRolePolicy] -> AwsIamRoleDetails)
-> Lens
     AwsIamRoleDetails
     AwsIamRoleDetails
     (Maybe [AwsIamRolePolicy])
     (Maybe [AwsIamRolePolicy])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsIamRoleDetails' {Maybe [AwsIamRolePolicy]
rolePolicyList :: Maybe [AwsIamRolePolicy]
$sel:rolePolicyList:AwsIamRoleDetails' :: AwsIamRoleDetails -> Maybe [AwsIamRolePolicy]
rolePolicyList} -> Maybe [AwsIamRolePolicy]
rolePolicyList) (\s :: AwsIamRoleDetails
s@AwsIamRoleDetails' {} Maybe [AwsIamRolePolicy]
a -> AwsIamRoleDetails
s {$sel:rolePolicyList:AwsIamRoleDetails' :: Maybe [AwsIamRolePolicy]
rolePolicyList = Maybe [AwsIamRolePolicy]
a} :: AwsIamRoleDetails) ((Maybe [AwsIamRolePolicy] -> f (Maybe [AwsIamRolePolicy]))
 -> AwsIamRoleDetails -> f AwsIamRoleDetails)
-> ((Maybe [AwsIamRolePolicy] -> f (Maybe [AwsIamRolePolicy]))
    -> Maybe [AwsIamRolePolicy] -> f (Maybe [AwsIamRolePolicy]))
-> (Maybe [AwsIamRolePolicy] -> f (Maybe [AwsIamRolePolicy]))
-> AwsIamRoleDetails
-> f AwsIamRoleDetails
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AwsIamRolePolicy]
  [AwsIamRolePolicy]
  [AwsIamRolePolicy]
  [AwsIamRolePolicy]
-> Iso
     (Maybe [AwsIamRolePolicy])
     (Maybe [AwsIamRolePolicy])
     (Maybe [AwsIamRolePolicy])
     (Maybe [AwsIamRolePolicy])
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
  [AwsIamRolePolicy]
  [AwsIamRolePolicy]
  [AwsIamRolePolicy]
  [AwsIamRolePolicy]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The list of the managed policies that are attached to the role.
awsIamRoleDetails_attachedManagedPolicies :: Lens.Lens' AwsIamRoleDetails (Prelude.Maybe [AwsIamAttachedManagedPolicy])
awsIamRoleDetails_attachedManagedPolicies :: (Maybe [AwsIamAttachedManagedPolicy]
 -> f (Maybe [AwsIamAttachedManagedPolicy]))
-> AwsIamRoleDetails -> f AwsIamRoleDetails
awsIamRoleDetails_attachedManagedPolicies = (AwsIamRoleDetails -> Maybe [AwsIamAttachedManagedPolicy])
-> (AwsIamRoleDetails
    -> Maybe [AwsIamAttachedManagedPolicy] -> AwsIamRoleDetails)
-> Lens
     AwsIamRoleDetails
     AwsIamRoleDetails
     (Maybe [AwsIamAttachedManagedPolicy])
     (Maybe [AwsIamAttachedManagedPolicy])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsIamRoleDetails' {Maybe [AwsIamAttachedManagedPolicy]
attachedManagedPolicies :: Maybe [AwsIamAttachedManagedPolicy]
$sel:attachedManagedPolicies:AwsIamRoleDetails' :: AwsIamRoleDetails -> Maybe [AwsIamAttachedManagedPolicy]
attachedManagedPolicies} -> Maybe [AwsIamAttachedManagedPolicy]
attachedManagedPolicies) (\s :: AwsIamRoleDetails
s@AwsIamRoleDetails' {} Maybe [AwsIamAttachedManagedPolicy]
a -> AwsIamRoleDetails
s {$sel:attachedManagedPolicies:AwsIamRoleDetails' :: Maybe [AwsIamAttachedManagedPolicy]
attachedManagedPolicies = Maybe [AwsIamAttachedManagedPolicy]
a} :: AwsIamRoleDetails) ((Maybe [AwsIamAttachedManagedPolicy]
  -> f (Maybe [AwsIamAttachedManagedPolicy]))
 -> AwsIamRoleDetails -> f AwsIamRoleDetails)
-> ((Maybe [AwsIamAttachedManagedPolicy]
     -> f (Maybe [AwsIamAttachedManagedPolicy]))
    -> Maybe [AwsIamAttachedManagedPolicy]
    -> f (Maybe [AwsIamAttachedManagedPolicy]))
-> (Maybe [AwsIamAttachedManagedPolicy]
    -> f (Maybe [AwsIamAttachedManagedPolicy]))
-> AwsIamRoleDetails
-> f AwsIamRoleDetails
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AwsIamAttachedManagedPolicy]
  [AwsIamAttachedManagedPolicy]
  [AwsIamAttachedManagedPolicy]
  [AwsIamAttachedManagedPolicy]
-> Iso
     (Maybe [AwsIamAttachedManagedPolicy])
     (Maybe [AwsIamAttachedManagedPolicy])
     (Maybe [AwsIamAttachedManagedPolicy])
     (Maybe [AwsIamAttachedManagedPolicy])
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
  [AwsIamAttachedManagedPolicy]
  [AwsIamAttachedManagedPolicy]
  [AwsIamAttachedManagedPolicy]
  [AwsIamAttachedManagedPolicy]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON AwsIamRoleDetails where
  parseJSON :: Value -> Parser AwsIamRoleDetails
parseJSON =
    String
-> (Object -> Parser AwsIamRoleDetails)
-> Value
-> Parser AwsIamRoleDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsIamRoleDetails"
      ( \Object
x ->
          Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe [AwsIamInstanceProfile]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe AwsIamPermissionsBoundary
-> Maybe [AwsIamRolePolicy]
-> Maybe [AwsIamAttachedManagedPolicy]
-> AwsIamRoleDetails
AwsIamRoleDetails'
            (Maybe Int
 -> Maybe Text
 -> Maybe Text
 -> Maybe [AwsIamInstanceProfile]
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe AwsIamPermissionsBoundary
 -> Maybe [AwsIamRolePolicy]
 -> Maybe [AwsIamAttachedManagedPolicy]
 -> AwsIamRoleDetails)
-> Parser (Maybe Int)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe [AwsIamInstanceProfile]
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe AwsIamPermissionsBoundary
      -> Maybe [AwsIamRolePolicy]
      -> Maybe [AwsIamAttachedManagedPolicy]
      -> AwsIamRoleDetails)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"MaxSessionDuration")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe [AwsIamInstanceProfile]
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe AwsIamPermissionsBoundary
   -> Maybe [AwsIamRolePolicy]
   -> Maybe [AwsIamAttachedManagedPolicy]
   -> AwsIamRoleDetails)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe [AwsIamInstanceProfile]
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe AwsIamPermissionsBoundary
      -> Maybe [AwsIamRolePolicy]
      -> Maybe [AwsIamAttachedManagedPolicy]
      -> AwsIamRoleDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AssumeRolePolicyDocument")
            Parser
  (Maybe Text
   -> Maybe [AwsIamInstanceProfile]
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe AwsIamPermissionsBoundary
   -> Maybe [AwsIamRolePolicy]
   -> Maybe [AwsIamAttachedManagedPolicy]
   -> AwsIamRoleDetails)
-> Parser (Maybe Text)
-> Parser
     (Maybe [AwsIamInstanceProfile]
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe AwsIamPermissionsBoundary
      -> Maybe [AwsIamRolePolicy]
      -> Maybe [AwsIamAttachedManagedPolicy]
      -> AwsIamRoleDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Path")
            Parser
  (Maybe [AwsIamInstanceProfile]
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe AwsIamPermissionsBoundary
   -> Maybe [AwsIamRolePolicy]
   -> Maybe [AwsIamAttachedManagedPolicy]
   -> AwsIamRoleDetails)
-> Parser (Maybe [AwsIamInstanceProfile])
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe AwsIamPermissionsBoundary
      -> Maybe [AwsIamRolePolicy]
      -> Maybe [AwsIamAttachedManagedPolicy]
      -> AwsIamRoleDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [AwsIamInstanceProfile]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"InstanceProfileList"
                            Parser (Maybe (Maybe [AwsIamInstanceProfile]))
-> Maybe [AwsIamInstanceProfile]
-> Parser (Maybe [AwsIamInstanceProfile])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [AwsIamInstanceProfile]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe AwsIamPermissionsBoundary
   -> Maybe [AwsIamRolePolicy]
   -> Maybe [AwsIamAttachedManagedPolicy]
   -> AwsIamRoleDetails)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe AwsIamPermissionsBoundary
      -> Maybe [AwsIamRolePolicy]
      -> Maybe [AwsIamAttachedManagedPolicy]
      -> AwsIamRoleDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CreateDate")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe AwsIamPermissionsBoundary
   -> Maybe [AwsIamRolePolicy]
   -> Maybe [AwsIamAttachedManagedPolicy]
   -> AwsIamRoleDetails)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe AwsIamPermissionsBoundary
      -> Maybe [AwsIamRolePolicy]
      -> Maybe [AwsIamAttachedManagedPolicy]
      -> AwsIamRoleDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RoleName")
            Parser
  (Maybe Text
   -> Maybe AwsIamPermissionsBoundary
   -> Maybe [AwsIamRolePolicy]
   -> Maybe [AwsIamAttachedManagedPolicy]
   -> AwsIamRoleDetails)
-> Parser (Maybe Text)
-> Parser
     (Maybe AwsIamPermissionsBoundary
      -> Maybe [AwsIamRolePolicy]
      -> Maybe [AwsIamAttachedManagedPolicy]
      -> AwsIamRoleDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RoleId")
            Parser
  (Maybe AwsIamPermissionsBoundary
   -> Maybe [AwsIamRolePolicy]
   -> Maybe [AwsIamAttachedManagedPolicy]
   -> AwsIamRoleDetails)
-> Parser (Maybe AwsIamPermissionsBoundary)
-> Parser
     (Maybe [AwsIamRolePolicy]
      -> Maybe [AwsIamAttachedManagedPolicy] -> AwsIamRoleDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe AwsIamPermissionsBoundary)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PermissionsBoundary")
            Parser
  (Maybe [AwsIamRolePolicy]
   -> Maybe [AwsIamAttachedManagedPolicy] -> AwsIamRoleDetails)
-> Parser (Maybe [AwsIamRolePolicy])
-> Parser
     (Maybe [AwsIamAttachedManagedPolicy] -> AwsIamRoleDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [AwsIamRolePolicy]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RolePolicyList" Parser (Maybe (Maybe [AwsIamRolePolicy]))
-> Maybe [AwsIamRolePolicy] -> Parser (Maybe [AwsIamRolePolicy])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [AwsIamRolePolicy]
forall a. Monoid a => a
Prelude.mempty)
            Parser (Maybe [AwsIamAttachedManagedPolicy] -> AwsIamRoleDetails)
-> Parser (Maybe [AwsIamAttachedManagedPolicy])
-> Parser AwsIamRoleDetails
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object
-> Text -> Parser (Maybe (Maybe [AwsIamAttachedManagedPolicy]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AttachedManagedPolicies"
                            Parser (Maybe (Maybe [AwsIamAttachedManagedPolicy]))
-> Maybe [AwsIamAttachedManagedPolicy]
-> Parser (Maybe [AwsIamAttachedManagedPolicy])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [AwsIamAttachedManagedPolicy]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable AwsIamRoleDetails

instance Prelude.NFData AwsIamRoleDetails

instance Core.ToJSON AwsIamRoleDetails where
  toJSON :: AwsIamRoleDetails -> Value
toJSON AwsIamRoleDetails' {Maybe Int
Maybe [AwsIamAttachedManagedPolicy]
Maybe [AwsIamInstanceProfile]
Maybe [AwsIamRolePolicy]
Maybe Text
Maybe AwsIamPermissionsBoundary
attachedManagedPolicies :: Maybe [AwsIamAttachedManagedPolicy]
rolePolicyList :: Maybe [AwsIamRolePolicy]
permissionsBoundary :: Maybe AwsIamPermissionsBoundary
roleId :: Maybe Text
roleName :: Maybe Text
createDate :: Maybe Text
instanceProfileList :: Maybe [AwsIamInstanceProfile]
path :: Maybe Text
assumeRolePolicyDocument :: Maybe Text
maxSessionDuration :: Maybe Int
$sel:attachedManagedPolicies:AwsIamRoleDetails' :: AwsIamRoleDetails -> Maybe [AwsIamAttachedManagedPolicy]
$sel:rolePolicyList:AwsIamRoleDetails' :: AwsIamRoleDetails -> Maybe [AwsIamRolePolicy]
$sel:permissionsBoundary:AwsIamRoleDetails' :: AwsIamRoleDetails -> Maybe AwsIamPermissionsBoundary
$sel:roleId:AwsIamRoleDetails' :: AwsIamRoleDetails -> Maybe Text
$sel:roleName:AwsIamRoleDetails' :: AwsIamRoleDetails -> Maybe Text
$sel:createDate:AwsIamRoleDetails' :: AwsIamRoleDetails -> Maybe Text
$sel:instanceProfileList:AwsIamRoleDetails' :: AwsIamRoleDetails -> Maybe [AwsIamInstanceProfile]
$sel:path:AwsIamRoleDetails' :: AwsIamRoleDetails -> Maybe Text
$sel:assumeRolePolicyDocument:AwsIamRoleDetails' :: AwsIamRoleDetails -> Maybe Text
$sel:maxSessionDuration:AwsIamRoleDetails' :: AwsIamRoleDetails -> Maybe Int
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"MaxSessionDuration" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
maxSessionDuration,
            (Text
"AssumeRolePolicyDocument" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
assumeRolePolicyDocument,
            (Text
"Path" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
path,
            (Text
"InstanceProfileList" Text -> [AwsIamInstanceProfile] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([AwsIamInstanceProfile] -> Pair)
-> Maybe [AwsIamInstanceProfile] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [AwsIamInstanceProfile]
instanceProfileList,
            (Text
"CreateDate" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
createDate,
            (Text
"RoleName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
roleName,
            (Text
"RoleId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
roleId,
            (Text
"PermissionsBoundary" Text -> AwsIamPermissionsBoundary -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (AwsIamPermissionsBoundary -> Pair)
-> Maybe AwsIamPermissionsBoundary -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AwsIamPermissionsBoundary
permissionsBoundary,
            (Text
"RolePolicyList" Text -> [AwsIamRolePolicy] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([AwsIamRolePolicy] -> Pair)
-> Maybe [AwsIamRolePolicy] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [AwsIamRolePolicy]
rolePolicyList,
            (Text
"AttachedManagedPolicies" Text -> [AwsIamAttachedManagedPolicy] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([AwsIamAttachedManagedPolicy] -> Pair)
-> Maybe [AwsIamAttachedManagedPolicy] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [AwsIamAttachedManagedPolicy]
attachedManagedPolicies
          ]
      )