{-# 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.FederatedUser
-- 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.FederatedUser 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

-- | Identifiers for the federated user that is associated with the
-- credentials.
--
-- /See:/ 'newFederatedUser' smart constructor.
data FederatedUser = FederatedUser'
  { -- | The string that identifies the federated user associated with the
    -- credentials, similar to the unique ID of an IAM user.
    FederatedUser -> Text
federatedUserId :: Prelude.Text,
    -- | The ARN that specifies the federated user that is associated with the
    -- credentials. 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/.
    FederatedUser -> Text
arn :: Prelude.Text
  }
  deriving (FederatedUser -> FederatedUser -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FederatedUser -> FederatedUser -> Bool
$c/= :: FederatedUser -> FederatedUser -> Bool
== :: FederatedUser -> FederatedUser -> Bool
$c== :: FederatedUser -> FederatedUser -> Bool
Prelude.Eq, ReadPrec [FederatedUser]
ReadPrec FederatedUser
Int -> ReadS FederatedUser
ReadS [FederatedUser]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FederatedUser]
$creadListPrec :: ReadPrec [FederatedUser]
readPrec :: ReadPrec FederatedUser
$creadPrec :: ReadPrec FederatedUser
readList :: ReadS [FederatedUser]
$creadList :: ReadS [FederatedUser]
readsPrec :: Int -> ReadS FederatedUser
$creadsPrec :: Int -> ReadS FederatedUser
Prelude.Read, Int -> FederatedUser -> ShowS
[FederatedUser] -> ShowS
FederatedUser -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FederatedUser] -> ShowS
$cshowList :: [FederatedUser] -> ShowS
show :: FederatedUser -> String
$cshow :: FederatedUser -> String
showsPrec :: Int -> FederatedUser -> ShowS
$cshowsPrec :: Int -> FederatedUser -> ShowS
Prelude.Show, forall x. Rep FederatedUser x -> FederatedUser
forall x. FederatedUser -> Rep FederatedUser x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FederatedUser x -> FederatedUser
$cfrom :: forall x. FederatedUser -> Rep FederatedUser x
Prelude.Generic)

-- |
-- Create a value of 'FederatedUser' 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:
--
-- 'federatedUserId', 'federatedUser_federatedUserId' - The string that identifies the federated user associated with the
-- credentials, similar to the unique ID of an IAM user.
--
-- 'arn', 'federatedUser_arn' - The ARN that specifies the federated user that is associated with the
-- credentials. 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/.
newFederatedUser ::
  -- | 'federatedUserId'
  Prelude.Text ->
  -- | 'arn'
  Prelude.Text ->
  FederatedUser
newFederatedUser :: Text -> Text -> FederatedUser
newFederatedUser Text
pFederatedUserId_ Text
pArn_ =
  FederatedUser'
    { $sel:federatedUserId:FederatedUser' :: Text
federatedUserId = Text
pFederatedUserId_,
      $sel:arn:FederatedUser' :: Text
arn = Text
pArn_
    }

-- | The string that identifies the federated user associated with the
-- credentials, similar to the unique ID of an IAM user.
federatedUser_federatedUserId :: Lens.Lens' FederatedUser Prelude.Text
federatedUser_federatedUserId :: Lens' FederatedUser Text
federatedUser_federatedUserId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FederatedUser' {Text
federatedUserId :: Text
$sel:federatedUserId:FederatedUser' :: FederatedUser -> Text
federatedUserId} -> Text
federatedUserId) (\s :: FederatedUser
s@FederatedUser' {} Text
a -> FederatedUser
s {$sel:federatedUserId:FederatedUser' :: Text
federatedUserId = Text
a} :: FederatedUser)

-- | The ARN that specifies the federated user that is associated with the
-- credentials. 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/.
federatedUser_arn :: Lens.Lens' FederatedUser Prelude.Text
federatedUser_arn :: Lens' FederatedUser Text
federatedUser_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FederatedUser' {Text
arn :: Text
$sel:arn:FederatedUser' :: FederatedUser -> Text
arn} -> Text
arn) (\s :: FederatedUser
s@FederatedUser' {} Text
a -> FederatedUser
s {$sel:arn:FederatedUser' :: Text
arn = Text
a} :: FederatedUser)

instance Data.FromXML FederatedUser where
  parseXML :: [Node] -> Either String FederatedUser
parseXML [Node]
x =
    Text -> Text -> FederatedUser
FederatedUser'
      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
"FederatedUserId")
      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 FederatedUser where
  hashWithSalt :: Int -> FederatedUser -> Int
hashWithSalt Int
_salt FederatedUser' {Text
arn :: Text
federatedUserId :: Text
$sel:arn:FederatedUser' :: FederatedUser -> Text
$sel:federatedUserId:FederatedUser' :: FederatedUser -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
federatedUserId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
arn

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