{-# 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.OpsWorks.Types.SelfUserProfile
-- 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.OpsWorks.Types.SelfUserProfile where

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

-- | Describes a user\'s SSH information.
--
-- /See:/ 'newSelfUserProfile' smart constructor.
data SelfUserProfile = SelfUserProfile'
  { -- | The user\'s SSH public key.
    SelfUserProfile -> Maybe Text
sshPublicKey :: Prelude.Maybe Prelude.Text,
    -- | The user\'s SSH user name.
    SelfUserProfile -> Maybe Text
sshUsername :: Prelude.Maybe Prelude.Text,
    -- | The user\'s IAM ARN.
    SelfUserProfile -> Maybe Text
iamUserArn :: Prelude.Maybe Prelude.Text,
    -- | The user\'s name.
    SelfUserProfile -> Maybe Text
name :: Prelude.Maybe Prelude.Text
  }
  deriving (SelfUserProfile -> SelfUserProfile -> Bool
(SelfUserProfile -> SelfUserProfile -> Bool)
-> (SelfUserProfile -> SelfUserProfile -> Bool)
-> Eq SelfUserProfile
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SelfUserProfile -> SelfUserProfile -> Bool
$c/= :: SelfUserProfile -> SelfUserProfile -> Bool
== :: SelfUserProfile -> SelfUserProfile -> Bool
$c== :: SelfUserProfile -> SelfUserProfile -> Bool
Prelude.Eq, ReadPrec [SelfUserProfile]
ReadPrec SelfUserProfile
Int -> ReadS SelfUserProfile
ReadS [SelfUserProfile]
(Int -> ReadS SelfUserProfile)
-> ReadS [SelfUserProfile]
-> ReadPrec SelfUserProfile
-> ReadPrec [SelfUserProfile]
-> Read SelfUserProfile
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SelfUserProfile]
$creadListPrec :: ReadPrec [SelfUserProfile]
readPrec :: ReadPrec SelfUserProfile
$creadPrec :: ReadPrec SelfUserProfile
readList :: ReadS [SelfUserProfile]
$creadList :: ReadS [SelfUserProfile]
readsPrec :: Int -> ReadS SelfUserProfile
$creadsPrec :: Int -> ReadS SelfUserProfile
Prelude.Read, Int -> SelfUserProfile -> ShowS
[SelfUserProfile] -> ShowS
SelfUserProfile -> String
(Int -> SelfUserProfile -> ShowS)
-> (SelfUserProfile -> String)
-> ([SelfUserProfile] -> ShowS)
-> Show SelfUserProfile
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SelfUserProfile] -> ShowS
$cshowList :: [SelfUserProfile] -> ShowS
show :: SelfUserProfile -> String
$cshow :: SelfUserProfile -> String
showsPrec :: Int -> SelfUserProfile -> ShowS
$cshowsPrec :: Int -> SelfUserProfile -> ShowS
Prelude.Show, (forall x. SelfUserProfile -> Rep SelfUserProfile x)
-> (forall x. Rep SelfUserProfile x -> SelfUserProfile)
-> Generic SelfUserProfile
forall x. Rep SelfUserProfile x -> SelfUserProfile
forall x. SelfUserProfile -> Rep SelfUserProfile x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SelfUserProfile x -> SelfUserProfile
$cfrom :: forall x. SelfUserProfile -> Rep SelfUserProfile x
Prelude.Generic)

-- |
-- Create a value of 'SelfUserProfile' 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', 'selfUserProfile_sshPublicKey' - The user\'s SSH public key.
--
-- 'sshUsername', 'selfUserProfile_sshUsername' - The user\'s SSH user name.
--
-- 'iamUserArn', 'selfUserProfile_iamUserArn' - The user\'s IAM ARN.
--
-- 'name', 'selfUserProfile_name' - The user\'s name.
newSelfUserProfile ::
  SelfUserProfile
newSelfUserProfile :: SelfUserProfile
newSelfUserProfile =
  SelfUserProfile' :: Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> SelfUserProfile
SelfUserProfile'
    { $sel:sshPublicKey:SelfUserProfile' :: Maybe Text
sshPublicKey = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sshUsername:SelfUserProfile' :: Maybe Text
sshUsername = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:iamUserArn:SelfUserProfile' :: Maybe Text
iamUserArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:SelfUserProfile' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The user\'s SSH public key.
selfUserProfile_sshPublicKey :: Lens.Lens' SelfUserProfile (Prelude.Maybe Prelude.Text)
selfUserProfile_sshPublicKey :: (Maybe Text -> f (Maybe Text))
-> SelfUserProfile -> f SelfUserProfile
selfUserProfile_sshPublicKey = (SelfUserProfile -> Maybe Text)
-> (SelfUserProfile -> Maybe Text -> SelfUserProfile)
-> Lens SelfUserProfile SelfUserProfile (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SelfUserProfile' {Maybe Text
sshPublicKey :: Maybe Text
$sel:sshPublicKey:SelfUserProfile' :: SelfUserProfile -> Maybe Text
sshPublicKey} -> Maybe Text
sshPublicKey) (\s :: SelfUserProfile
s@SelfUserProfile' {} Maybe Text
a -> SelfUserProfile
s {$sel:sshPublicKey:SelfUserProfile' :: Maybe Text
sshPublicKey = Maybe Text
a} :: SelfUserProfile)

-- | The user\'s SSH user name.
selfUserProfile_sshUsername :: Lens.Lens' SelfUserProfile (Prelude.Maybe Prelude.Text)
selfUserProfile_sshUsername :: (Maybe Text -> f (Maybe Text))
-> SelfUserProfile -> f SelfUserProfile
selfUserProfile_sshUsername = (SelfUserProfile -> Maybe Text)
-> (SelfUserProfile -> Maybe Text -> SelfUserProfile)
-> Lens SelfUserProfile SelfUserProfile (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SelfUserProfile' {Maybe Text
sshUsername :: Maybe Text
$sel:sshUsername:SelfUserProfile' :: SelfUserProfile -> Maybe Text
sshUsername} -> Maybe Text
sshUsername) (\s :: SelfUserProfile
s@SelfUserProfile' {} Maybe Text
a -> SelfUserProfile
s {$sel:sshUsername:SelfUserProfile' :: Maybe Text
sshUsername = Maybe Text
a} :: SelfUserProfile)

-- | The user\'s IAM ARN.
selfUserProfile_iamUserArn :: Lens.Lens' SelfUserProfile (Prelude.Maybe Prelude.Text)
selfUserProfile_iamUserArn :: (Maybe Text -> f (Maybe Text))
-> SelfUserProfile -> f SelfUserProfile
selfUserProfile_iamUserArn = (SelfUserProfile -> Maybe Text)
-> (SelfUserProfile -> Maybe Text -> SelfUserProfile)
-> Lens SelfUserProfile SelfUserProfile (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SelfUserProfile' {Maybe Text
iamUserArn :: Maybe Text
$sel:iamUserArn:SelfUserProfile' :: SelfUserProfile -> Maybe Text
iamUserArn} -> Maybe Text
iamUserArn) (\s :: SelfUserProfile
s@SelfUserProfile' {} Maybe Text
a -> SelfUserProfile
s {$sel:iamUserArn:SelfUserProfile' :: Maybe Text
iamUserArn = Maybe Text
a} :: SelfUserProfile)

-- | The user\'s name.
selfUserProfile_name :: Lens.Lens' SelfUserProfile (Prelude.Maybe Prelude.Text)
selfUserProfile_name :: (Maybe Text -> f (Maybe Text))
-> SelfUserProfile -> f SelfUserProfile
selfUserProfile_name = (SelfUserProfile -> Maybe Text)
-> (SelfUserProfile -> Maybe Text -> SelfUserProfile)
-> Lens SelfUserProfile SelfUserProfile (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SelfUserProfile' {Maybe Text
name :: Maybe Text
$sel:name:SelfUserProfile' :: SelfUserProfile -> Maybe Text
name} -> Maybe Text
name) (\s :: SelfUserProfile
s@SelfUserProfile' {} Maybe Text
a -> SelfUserProfile
s {$sel:name:SelfUserProfile' :: Maybe Text
name = Maybe Text
a} :: SelfUserProfile)

instance Core.FromJSON SelfUserProfile where
  parseJSON :: Value -> Parser SelfUserProfile
parseJSON =
    String
-> (Object -> Parser SelfUserProfile)
-> Value
-> Parser SelfUserProfile
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SelfUserProfile"
      ( \Object
x ->
          Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> SelfUserProfile
SelfUserProfile'
            (Maybe Text
 -> Maybe Text -> Maybe Text -> Maybe Text -> SelfUserProfile)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe Text -> SelfUserProfile)
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 Text -> Maybe Text -> SelfUserProfile)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> SelfUserProfile)
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
"SshUsername")
            Parser (Maybe Text -> Maybe Text -> SelfUserProfile)
-> Parser (Maybe Text) -> Parser (Maybe Text -> SelfUserProfile)
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
"IamUserArn")
            Parser (Maybe Text -> SelfUserProfile)
-> Parser (Maybe Text) -> Parser SelfUserProfile
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
"Name")
      )

instance Prelude.Hashable SelfUserProfile

instance Prelude.NFData SelfUserProfile