{-# 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.CodeStar.Types.UserProfileSummary
-- 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.CodeStar.Types.UserProfileSummary where

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

-- | Information about a user\'s profile in AWS CodeStar.
--
-- /See:/ 'newUserProfileSummary' smart constructor.
data UserProfileSummary = UserProfileSummary'
  { -- | The SSH public key associated with the user in AWS CodeStar. If a
    -- project owner allows the user remote access to project resources, this
    -- public key will be used along with the user\'s private key for SSH
    -- access.
    UserProfileSummary -> Maybe Text
sshPublicKey :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the user in IAM.
    UserProfileSummary -> Maybe Text
userArn :: Prelude.Maybe Prelude.Text,
    -- | The email address associated with the user.
    UserProfileSummary -> Maybe (Sensitive Text)
emailAddress :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The display name of a user in AWS CodeStar. For example, this could be
    -- set to both first and last name (\"Mary Major\") or a single name
    -- (\"Mary\"). The display name is also used to generate the initial icon
    -- associated with the user in AWS CodeStar projects. If spaces are
    -- included in the display name, the first character that appears after the
    -- space will be used as the second character in the user initial icon. The
    -- initial icon displays a maximum of two characters, so a display name
    -- with more than one space (for example \"Mary Jane Major\") would
    -- generate an initial icon using the first character and the first
    -- character after the space (\"MJ\", not \"MM\").
    UserProfileSummary -> Maybe (Sensitive Text)
displayName :: Prelude.Maybe (Core.Sensitive Prelude.Text)
  }
  deriving (UserProfileSummary -> UserProfileSummary -> Bool
(UserProfileSummary -> UserProfileSummary -> Bool)
-> (UserProfileSummary -> UserProfileSummary -> Bool)
-> Eq UserProfileSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UserProfileSummary -> UserProfileSummary -> Bool
$c/= :: UserProfileSummary -> UserProfileSummary -> Bool
== :: UserProfileSummary -> UserProfileSummary -> Bool
$c== :: UserProfileSummary -> UserProfileSummary -> Bool
Prelude.Eq, Int -> UserProfileSummary -> ShowS
[UserProfileSummary] -> ShowS
UserProfileSummary -> String
(Int -> UserProfileSummary -> ShowS)
-> (UserProfileSummary -> String)
-> ([UserProfileSummary] -> ShowS)
-> Show UserProfileSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UserProfileSummary] -> ShowS
$cshowList :: [UserProfileSummary] -> ShowS
show :: UserProfileSummary -> String
$cshow :: UserProfileSummary -> String
showsPrec :: Int -> UserProfileSummary -> ShowS
$cshowsPrec :: Int -> UserProfileSummary -> ShowS
Prelude.Show, (forall x. UserProfileSummary -> Rep UserProfileSummary x)
-> (forall x. Rep UserProfileSummary x -> UserProfileSummary)
-> Generic UserProfileSummary
forall x. Rep UserProfileSummary x -> UserProfileSummary
forall x. UserProfileSummary -> Rep UserProfileSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UserProfileSummary x -> UserProfileSummary
$cfrom :: forall x. UserProfileSummary -> Rep UserProfileSummary x
Prelude.Generic)

-- |
-- Create a value of 'UserProfileSummary' 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:
--
-- 'sshPublicKey', 'userProfileSummary_sshPublicKey' - The SSH public key associated with the user in AWS CodeStar. If a
-- project owner allows the user remote access to project resources, this
-- public key will be used along with the user\'s private key for SSH
-- access.
--
-- 'userArn', 'userProfileSummary_userArn' - The Amazon Resource Name (ARN) of the user in IAM.
--
-- 'emailAddress', 'userProfileSummary_emailAddress' - The email address associated with the user.
--
-- 'displayName', 'userProfileSummary_displayName' - The display name of a user in AWS CodeStar. For example, this could be
-- set to both first and last name (\"Mary Major\") or a single name
-- (\"Mary\"). The display name is also used to generate the initial icon
-- associated with the user in AWS CodeStar projects. If spaces are
-- included in the display name, the first character that appears after the
-- space will be used as the second character in the user initial icon. The
-- initial icon displays a maximum of two characters, so a display name
-- with more than one space (for example \"Mary Jane Major\") would
-- generate an initial icon using the first character and the first
-- character after the space (\"MJ\", not \"MM\").
newUserProfileSummary ::
  UserProfileSummary
newUserProfileSummary :: UserProfileSummary
newUserProfileSummary =
  UserProfileSummary' :: Maybe Text
-> Maybe Text
-> Maybe (Sensitive Text)
-> Maybe (Sensitive Text)
-> UserProfileSummary
UserProfileSummary'
    { $sel:sshPublicKey:UserProfileSummary' :: Maybe Text
sshPublicKey = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:userArn:UserProfileSummary' :: Maybe Text
userArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:emailAddress:UserProfileSummary' :: Maybe (Sensitive Text)
emailAddress = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:displayName:UserProfileSummary' :: Maybe (Sensitive Text)
displayName = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing
    }

-- | The SSH public key associated with the user in AWS CodeStar. If a
-- project owner allows the user remote access to project resources, this
-- public key will be used along with the user\'s private key for SSH
-- access.
userProfileSummary_sshPublicKey :: Lens.Lens' UserProfileSummary (Prelude.Maybe Prelude.Text)
userProfileSummary_sshPublicKey :: (Maybe Text -> f (Maybe Text))
-> UserProfileSummary -> f UserProfileSummary
userProfileSummary_sshPublicKey = (UserProfileSummary -> Maybe Text)
-> (UserProfileSummary -> Maybe Text -> UserProfileSummary)
-> Lens
     UserProfileSummary UserProfileSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserProfileSummary' {Maybe Text
sshPublicKey :: Maybe Text
$sel:sshPublicKey:UserProfileSummary' :: UserProfileSummary -> Maybe Text
sshPublicKey} -> Maybe Text
sshPublicKey) (\s :: UserProfileSummary
s@UserProfileSummary' {} Maybe Text
a -> UserProfileSummary
s {$sel:sshPublicKey:UserProfileSummary' :: Maybe Text
sshPublicKey = Maybe Text
a} :: UserProfileSummary)

-- | The Amazon Resource Name (ARN) of the user in IAM.
userProfileSummary_userArn :: Lens.Lens' UserProfileSummary (Prelude.Maybe Prelude.Text)
userProfileSummary_userArn :: (Maybe Text -> f (Maybe Text))
-> UserProfileSummary -> f UserProfileSummary
userProfileSummary_userArn = (UserProfileSummary -> Maybe Text)
-> (UserProfileSummary -> Maybe Text -> UserProfileSummary)
-> Lens
     UserProfileSummary UserProfileSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserProfileSummary' {Maybe Text
userArn :: Maybe Text
$sel:userArn:UserProfileSummary' :: UserProfileSummary -> Maybe Text
userArn} -> Maybe Text
userArn) (\s :: UserProfileSummary
s@UserProfileSummary' {} Maybe Text
a -> UserProfileSummary
s {$sel:userArn:UserProfileSummary' :: Maybe Text
userArn = Maybe Text
a} :: UserProfileSummary)

-- | The email address associated with the user.
userProfileSummary_emailAddress :: Lens.Lens' UserProfileSummary (Prelude.Maybe Prelude.Text)
userProfileSummary_emailAddress :: (Maybe Text -> f (Maybe Text))
-> UserProfileSummary -> f UserProfileSummary
userProfileSummary_emailAddress = (UserProfileSummary -> Maybe (Sensitive Text))
-> (UserProfileSummary
    -> Maybe (Sensitive Text) -> UserProfileSummary)
-> Lens
     UserProfileSummary
     UserProfileSummary
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserProfileSummary' {Maybe (Sensitive Text)
emailAddress :: Maybe (Sensitive Text)
$sel:emailAddress:UserProfileSummary' :: UserProfileSummary -> Maybe (Sensitive Text)
emailAddress} -> Maybe (Sensitive Text)
emailAddress) (\s :: UserProfileSummary
s@UserProfileSummary' {} Maybe (Sensitive Text)
a -> UserProfileSummary
s {$sel:emailAddress:UserProfileSummary' :: Maybe (Sensitive Text)
emailAddress = Maybe (Sensitive Text)
a} :: UserProfileSummary) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> UserProfileSummary -> f UserProfileSummary)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> UserProfileSummary
-> f UserProfileSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe Text)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | The display name of a user in AWS CodeStar. For example, this could be
-- set to both first and last name (\"Mary Major\") or a single name
-- (\"Mary\"). The display name is also used to generate the initial icon
-- associated with the user in AWS CodeStar projects. If spaces are
-- included in the display name, the first character that appears after the
-- space will be used as the second character in the user initial icon. The
-- initial icon displays a maximum of two characters, so a display name
-- with more than one space (for example \"Mary Jane Major\") would
-- generate an initial icon using the first character and the first
-- character after the space (\"MJ\", not \"MM\").
userProfileSummary_displayName :: Lens.Lens' UserProfileSummary (Prelude.Maybe Prelude.Text)
userProfileSummary_displayName :: (Maybe Text -> f (Maybe Text))
-> UserProfileSummary -> f UserProfileSummary
userProfileSummary_displayName = (UserProfileSummary -> Maybe (Sensitive Text))
-> (UserProfileSummary
    -> Maybe (Sensitive Text) -> UserProfileSummary)
-> Lens
     UserProfileSummary
     UserProfileSummary
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserProfileSummary' {Maybe (Sensitive Text)
displayName :: Maybe (Sensitive Text)
$sel:displayName:UserProfileSummary' :: UserProfileSummary -> Maybe (Sensitive Text)
displayName} -> Maybe (Sensitive Text)
displayName) (\s :: UserProfileSummary
s@UserProfileSummary' {} Maybe (Sensitive Text)
a -> UserProfileSummary
s {$sel:displayName:UserProfileSummary' :: Maybe (Sensitive Text)
displayName = Maybe (Sensitive Text)
a} :: UserProfileSummary) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> UserProfileSummary -> f UserProfileSummary)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> UserProfileSummary
-> f UserProfileSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe Text)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

instance Core.FromJSON UserProfileSummary where
  parseJSON :: Value -> Parser UserProfileSummary
parseJSON =
    String
-> (Object -> Parser UserProfileSummary)
-> Value
-> Parser UserProfileSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"UserProfileSummary"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe (Sensitive Text)
-> Maybe (Sensitive Text)
-> UserProfileSummary
UserProfileSummary'
            (Maybe Text
 -> Maybe Text
 -> Maybe (Sensitive Text)
 -> Maybe (Sensitive Text)
 -> UserProfileSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe (Sensitive Text)
      -> Maybe (Sensitive Text)
      -> UserProfileSummary)
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
"sshPublicKey")
            Parser
  (Maybe Text
   -> Maybe (Sensitive Text)
   -> Maybe (Sensitive Text)
   -> UserProfileSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe (Sensitive Text)
      -> Maybe (Sensitive Text) -> UserProfileSummary)
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
"userArn")
            Parser
  (Maybe (Sensitive Text)
   -> Maybe (Sensitive Text) -> UserProfileSummary)
-> Parser (Maybe (Sensitive Text))
-> Parser (Maybe (Sensitive Text) -> UserProfileSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Sensitive Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"emailAddress")
            Parser (Maybe (Sensitive Text) -> UserProfileSummary)
-> Parser (Maybe (Sensitive Text)) -> Parser UserProfileSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Sensitive Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"displayName")
      )

instance Prelude.Hashable UserProfileSummary

instance Prelude.NFData UserProfileSummary