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

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

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

-- |
-- Create a value of 'AccountInfo' 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:
--
-- 'accountName', 'accountInfo_accountName' - The display name of the AWS account that is assigned to the user.
--
-- 'accountId', 'accountInfo_accountId' - The identifier of the AWS account that is assigned to the user.
--
-- 'emailAddress', 'accountInfo_emailAddress' - The email address of the AWS account that is assigned to the user.
newAccountInfo ::
  AccountInfo
newAccountInfo :: AccountInfo
newAccountInfo =
  AccountInfo' :: Maybe Text -> Maybe Text -> Maybe Text -> AccountInfo
AccountInfo'
    { $sel:accountName:AccountInfo' :: Maybe Text
accountName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:accountId:AccountInfo' :: Maybe Text
accountId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:emailAddress:AccountInfo' :: Maybe Text
emailAddress = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The display name of the AWS account that is assigned to the user.
accountInfo_accountName :: Lens.Lens' AccountInfo (Prelude.Maybe Prelude.Text)
accountInfo_accountName :: (Maybe Text -> f (Maybe Text)) -> AccountInfo -> f AccountInfo
accountInfo_accountName = (AccountInfo -> Maybe Text)
-> (AccountInfo -> Maybe Text -> AccountInfo)
-> Lens AccountInfo AccountInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountInfo' {Maybe Text
accountName :: Maybe Text
$sel:accountName:AccountInfo' :: AccountInfo -> Maybe Text
accountName} -> Maybe Text
accountName) (\s :: AccountInfo
s@AccountInfo' {} Maybe Text
a -> AccountInfo
s {$sel:accountName:AccountInfo' :: Maybe Text
accountName = Maybe Text
a} :: AccountInfo)

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

-- | The email address of the AWS account that is assigned to the user.
accountInfo_emailAddress :: Lens.Lens' AccountInfo (Prelude.Maybe Prelude.Text)
accountInfo_emailAddress :: (Maybe Text -> f (Maybe Text)) -> AccountInfo -> f AccountInfo
accountInfo_emailAddress = (AccountInfo -> Maybe Text)
-> (AccountInfo -> Maybe Text -> AccountInfo)
-> Lens AccountInfo AccountInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountInfo' {Maybe Text
emailAddress :: Maybe Text
$sel:emailAddress:AccountInfo' :: AccountInfo -> Maybe Text
emailAddress} -> Maybe Text
emailAddress) (\s :: AccountInfo
s@AccountInfo' {} Maybe Text
a -> AccountInfo
s {$sel:emailAddress:AccountInfo' :: Maybe Text
emailAddress = Maybe Text
a} :: AccountInfo)

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

instance Prelude.Hashable AccountInfo

instance Prelude.NFData AccountInfo