{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.STS.Types.AssumedRoleUser where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
    { $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 :: Lens' AssumedRoleUser Text
assumedRoleUser_assumedRoleId = 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 :: Lens' AssumedRoleUser Text
assumedRoleUser_arn = 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 Data.FromXML AssumedRoleUser where
  parseXML :: [Node] -> Either String AssumedRoleUser
parseXML [Node]
x =
    Text -> Text -> AssumedRoleUser
AssumedRoleUser'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"AssumedRoleId")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"Arn")

instance Prelude.Hashable AssumedRoleUser where
  hashWithSalt :: Int -> AssumedRoleUser -> Int
hashWithSalt Int
_salt AssumedRoleUser' {Text
arn :: Text
assumedRoleId :: Text
$sel:arn:AssumedRoleUser' :: AssumedRoleUser -> Text
$sel:assumedRoleId:AssumedRoleUser' :: AssumedRoleUser -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
assumedRoleId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
arn

instance Prelude.NFData AssumedRoleUser where
  rnf :: AssumedRoleUser -> ()
rnf AssumedRoleUser' {Text
arn :: Text
assumedRoleId :: Text
$sel:arn:AssumedRoleUser' :: AssumedRoleUser -> Text
$sel:assumedRoleId:AssumedRoleUser' :: AssumedRoleUser -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
assumedRoleId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
arn