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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(FederatedUser -> FederatedUser -> Bool)
-> (FederatedUser -> FederatedUser -> Bool) -> Eq FederatedUser
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]
(Int -> ReadS FederatedUser)
-> ReadS [FederatedUser]
-> ReadPrec FederatedUser
-> ReadPrec [FederatedUser]
-> Read 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
(Int -> FederatedUser -> ShowS)
-> (FederatedUser -> String)
-> ([FederatedUser] -> ShowS)
-> Show FederatedUser
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. FederatedUser -> Rep FederatedUser x)
-> (forall x. Rep FederatedUser x -> FederatedUser)
-> Generic FederatedUser
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' :: Text -> Text -> FederatedUser
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 :: (Text -> f Text) -> FederatedUser -> f FederatedUser
federatedUser_federatedUserId = (FederatedUser -> Text)
-> (FederatedUser -> Text -> FederatedUser)
-> Lens FederatedUser FederatedUser Text Text
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 :: (Text -> f Text) -> FederatedUser -> f FederatedUser
federatedUser_arn = (FederatedUser -> Text)
-> (FederatedUser -> Text -> FederatedUser)
-> Lens FederatedUser FederatedUser Text Text
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 Core.FromXML FederatedUser where
  parseXML :: [Node] -> Either String FederatedUser
parseXML [Node]
x =
    Text -> Text -> FederatedUser
FederatedUser'
      (Text -> Text -> FederatedUser)
-> Either String Text -> Either String (Text -> FederatedUser)
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
"FederatedUserId")
      Either String (Text -> FederatedUser)
-> Either String Text -> Either String FederatedUser
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 FederatedUser

instance Prelude.NFData FederatedUser