{-# 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.SSO.Types.RoleInfo
-- 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.SSO.Types.RoleInfo 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

-- | Provides information about the role that is assigned to the user.
--
-- /See:/ 'newRoleInfo' smart constructor.
data RoleInfo = RoleInfo'
  { -- | The identifier of the AWS account assigned to the user.
    RoleInfo -> Maybe Text
accountId :: Prelude.Maybe Prelude.Text,
    -- | The friendly name of the role that is assigned to the user.
    RoleInfo -> Maybe Text
roleName :: Prelude.Maybe Prelude.Text
  }
  deriving (RoleInfo -> RoleInfo -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RoleInfo -> RoleInfo -> Bool
$c/= :: RoleInfo -> RoleInfo -> Bool
== :: RoleInfo -> RoleInfo -> Bool
$c== :: RoleInfo -> RoleInfo -> Bool
Prelude.Eq, ReadPrec [RoleInfo]
ReadPrec RoleInfo
Int -> ReadS RoleInfo
ReadS [RoleInfo]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RoleInfo]
$creadListPrec :: ReadPrec [RoleInfo]
readPrec :: ReadPrec RoleInfo
$creadPrec :: ReadPrec RoleInfo
readList :: ReadS [RoleInfo]
$creadList :: ReadS [RoleInfo]
readsPrec :: Int -> ReadS RoleInfo
$creadsPrec :: Int -> ReadS RoleInfo
Prelude.Read, Int -> RoleInfo -> ShowS
[RoleInfo] -> ShowS
RoleInfo -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RoleInfo] -> ShowS
$cshowList :: [RoleInfo] -> ShowS
show :: RoleInfo -> String
$cshow :: RoleInfo -> String
showsPrec :: Int -> RoleInfo -> ShowS
$cshowsPrec :: Int -> RoleInfo -> ShowS
Prelude.Show, forall x. Rep RoleInfo x -> RoleInfo
forall x. RoleInfo -> Rep RoleInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RoleInfo x -> RoleInfo
$cfrom :: forall x. RoleInfo -> Rep RoleInfo x
Prelude.Generic)

-- |
-- Create a value of 'RoleInfo' 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:
--
-- 'accountId', 'roleInfo_accountId' - The identifier of the AWS account assigned to the user.
--
-- 'roleName', 'roleInfo_roleName' - The friendly name of the role that is assigned to the user.
newRoleInfo ::
  RoleInfo
newRoleInfo :: RoleInfo
newRoleInfo =
  RoleInfo'
    { $sel:accountId:RoleInfo' :: Maybe Text
accountId = forall a. Maybe a
Prelude.Nothing,
      $sel:roleName:RoleInfo' :: Maybe Text
roleName = forall a. Maybe a
Prelude.Nothing
    }

-- | The identifier of the AWS account assigned to the user.
roleInfo_accountId :: Lens.Lens' RoleInfo (Prelude.Maybe Prelude.Text)
roleInfo_accountId :: Lens' RoleInfo (Maybe Text)
roleInfo_accountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RoleInfo' {Maybe Text
accountId :: Maybe Text
$sel:accountId:RoleInfo' :: RoleInfo -> Maybe Text
accountId} -> Maybe Text
accountId) (\s :: RoleInfo
s@RoleInfo' {} Maybe Text
a -> RoleInfo
s {$sel:accountId:RoleInfo' :: Maybe Text
accountId = Maybe Text
a} :: RoleInfo)

-- | The friendly name of the role that is assigned to the user.
roleInfo_roleName :: Lens.Lens' RoleInfo (Prelude.Maybe Prelude.Text)
roleInfo_roleName :: Lens' RoleInfo (Maybe Text)
roleInfo_roleName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RoleInfo' {Maybe Text
roleName :: Maybe Text
$sel:roleName:RoleInfo' :: RoleInfo -> Maybe Text
roleName} -> Maybe Text
roleName) (\s :: RoleInfo
s@RoleInfo' {} Maybe Text
a -> RoleInfo
s {$sel:roleName:RoleInfo' :: Maybe Text
roleName = Maybe Text
a} :: RoleInfo)

instance Data.FromJSON RoleInfo where
  parseJSON :: Value -> Parser RoleInfo
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"RoleInfo"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> RoleInfo
RoleInfo'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"accountId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"roleName")
      )

instance Prelude.Hashable RoleInfo where
  hashWithSalt :: Int -> RoleInfo -> Int
hashWithSalt Int
_salt RoleInfo' {Maybe Text
roleName :: Maybe Text
accountId :: Maybe Text
$sel:roleName:RoleInfo' :: RoleInfo -> Maybe Text
$sel:accountId:RoleInfo' :: RoleInfo -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
accountId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
roleName

instance Prelude.NFData RoleInfo where
  rnf :: RoleInfo -> ()
rnf RoleInfo' {Maybe Text
roleName :: Maybe Text
accountId :: Maybe Text
$sel:roleName:RoleInfo' :: RoleInfo -> Maybe Text
$sel:accountId:RoleInfo' :: RoleInfo -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
accountId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
roleName