{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.STS.Types.AssumedRoleUser
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.STS.Types.AssumedRoleUser where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The identifiers for the temporary security credentials that the
-- operation returns.
--
-- /See:/ 'newAssumedRoleUser' smart constructor.
data AssumedRoleUser = AssumedRoleUser'
  { -- | A unique identifier that contains the role ID and the role session name
    -- of the role that is being assumed. The role ID is generated by Amazon
    -- Web Services when the role is created.
    AssumedRoleUser -> Text
assumedRoleId :: Prelude.Text,
    -- | The ARN of the temporary security credentials that are returned from the
    -- AssumeRole action. For more information about ARNs and how to use them
    -- in policies, see
    -- <https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html IAM Identifiers>
    -- in the /IAM User Guide/.
    AssumedRoleUser -> Text
arn :: Prelude.Text
  }
  deriving (AssumedRoleUser -> AssumedRoleUser -> Bool
(AssumedRoleUser -> AssumedRoleUser -> Bool)
-> (AssumedRoleUser -> AssumedRoleUser -> Bool)
-> Eq AssumedRoleUser
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssumedRoleUser -> AssumedRoleUser -> Bool
$c/= :: AssumedRoleUser -> AssumedRoleUser -> Bool
== :: AssumedRoleUser -> AssumedRoleUser -> Bool
$c== :: AssumedRoleUser -> AssumedRoleUser -> Bool
Prelude.Eq, ReadPrec [AssumedRoleUser]
ReadPrec AssumedRoleUser
Int -> ReadS AssumedRoleUser
ReadS [AssumedRoleUser]
(Int -> ReadS AssumedRoleUser)
-> ReadS [AssumedRoleUser]
-> ReadPrec AssumedRoleUser
-> ReadPrec [AssumedRoleUser]
-> Read AssumedRoleUser
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssumedRoleUser]
$creadListPrec :: ReadPrec [AssumedRoleUser]
readPrec :: ReadPrec AssumedRoleUser
$creadPrec :: ReadPrec AssumedRoleUser
readList :: ReadS [AssumedRoleUser]
$creadList :: ReadS [AssumedRoleUser]
readsPrec :: Int -> ReadS AssumedRoleUser
$creadsPrec :: Int -> ReadS AssumedRoleUser
Prelude.Read, Int -> AssumedRoleUser -> ShowS
[AssumedRoleUser] -> ShowS
AssumedRoleUser -> String
(Int -> AssumedRoleUser -> ShowS)
-> (AssumedRoleUser -> String)
-> ([AssumedRoleUser] -> ShowS)
-> Show AssumedRoleUser
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssumedRoleUser] -> ShowS
$cshowList :: [AssumedRoleUser] -> ShowS
show :: AssumedRoleUser -> String
$cshow :: AssumedRoleUser -> String
showsPrec :: Int -> AssumedRoleUser -> ShowS
$cshowsPrec :: Int -> AssumedRoleUser -> ShowS
Prelude.Show, (forall x. AssumedRoleUser -> Rep AssumedRoleUser x)
-> (forall x. Rep AssumedRoleUser x -> AssumedRoleUser)
-> Generic AssumedRoleUser
forall x. Rep AssumedRoleUser x -> AssumedRoleUser
forall x. AssumedRoleUser -> Rep AssumedRoleUser x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AssumedRoleUser x -> AssumedRoleUser
$cfrom :: forall x. AssumedRoleUser -> Rep AssumedRoleUser x
Prelude.Generic)

-- |
-- Create a value of 'AssumedRoleUser' 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:
--
-- 'assumedRoleId', 'assumedRoleUser_assumedRoleId' - A unique identifier that contains the role ID and the role session name
-- of the role that is being assumed. The role ID is generated by Amazon
-- Web Services when the role is created.
--
-- 'arn', 'assumedRoleUser_arn' - The ARN of the temporary security credentials that are returned from the
-- AssumeRole action. For more information about ARNs and how to use them
-- in policies, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html IAM Identifiers>
-- in the /IAM User Guide/.
newAssumedRoleUser ::
  -- | 'assumedRoleId'
  Prelude.Text ->
  -- | 'arn'
  Prelude.Text ->
  AssumedRoleUser
newAssumedRoleUser :: Text -> Text -> AssumedRoleUser
newAssumedRoleUser Text
pAssumedRoleId_ Text
pArn_ =
  AssumedRoleUser' :: Text -> Text -> AssumedRoleUser
AssumedRoleUser'
    { $sel:assumedRoleId:AssumedRoleUser' :: Text
assumedRoleId = Text
pAssumedRoleId_,
      $sel:arn:AssumedRoleUser' :: Text
arn = Text
pArn_
    }

-- | A unique identifier that contains the role ID and the role session name
-- of the role that is being assumed. The role ID is generated by Amazon
-- Web Services when the role is created.
assumedRoleUser_assumedRoleId :: Lens.Lens' AssumedRoleUser Prelude.Text
assumedRoleUser_assumedRoleId :: (Text -> f Text) -> AssumedRoleUser -> f AssumedRoleUser
assumedRoleUser_assumedRoleId = (AssumedRoleUser -> Text)
-> (AssumedRoleUser -> Text -> AssumedRoleUser)
-> Lens AssumedRoleUser AssumedRoleUser Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssumedRoleUser' {Text
assumedRoleId :: Text
$sel:assumedRoleId:AssumedRoleUser' :: AssumedRoleUser -> Text
assumedRoleId} -> Text
assumedRoleId) (\s :: AssumedRoleUser
s@AssumedRoleUser' {} Text
a -> AssumedRoleUser
s {$sel:assumedRoleId:AssumedRoleUser' :: Text
assumedRoleId = Text
a} :: AssumedRoleUser)

-- | The ARN of the temporary security credentials that are returned from the
-- AssumeRole action. For more information about ARNs and how to use them
-- in policies, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html IAM Identifiers>
-- in the /IAM User Guide/.
assumedRoleUser_arn :: Lens.Lens' AssumedRoleUser Prelude.Text
assumedRoleUser_arn :: (Text -> f Text) -> AssumedRoleUser -> f AssumedRoleUser
assumedRoleUser_arn = (AssumedRoleUser -> Text)
-> (AssumedRoleUser -> Text -> AssumedRoleUser)
-> Lens AssumedRoleUser AssumedRoleUser Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssumedRoleUser' {Text
arn :: Text
$sel:arn:AssumedRoleUser' :: AssumedRoleUser -> Text
arn} -> Text
arn) (\s :: AssumedRoleUser
s@AssumedRoleUser' {} Text
a -> AssumedRoleUser
s {$sel:arn:AssumedRoleUser' :: Text
arn = Text
a} :: AssumedRoleUser)

instance Core.FromXML AssumedRoleUser where
  parseXML :: [Node] -> Either String AssumedRoleUser
parseXML [Node]
x =
    Text -> Text -> AssumedRoleUser
AssumedRoleUser'
      (Text -> Text -> AssumedRoleUser)
-> Either String Text -> Either String (Text -> AssumedRoleUser)
forall (f :: * -> *) a b. Functor 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
"AssumedRoleId")
      Either String (Text -> AssumedRoleUser)
-> Either String Text -> Either String AssumedRoleUser
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")

instance Prelude.Hashable AssumedRoleUser

instance Prelude.NFData AssumedRoleUser