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

-- | Describes a user\'s SSH information.
--
-- /See:/ 'newUserProfile' smart constructor.
data UserProfile = UserProfile'
  { -- | Whether users can specify their own SSH public key through the My
    -- Settings page. For more information, see
    -- <https://docs.aws.amazon.com/opsworks/latest/userguide/security-settingsshkey.html Managing User Permissions>.
    UserProfile -> Maybe Bool
allowSelfManagement :: Prelude.Maybe Prelude.Bool,
    -- | The user\'s IAM ARN.
    UserProfile -> Maybe Text
iamUserArn :: Prelude.Maybe Prelude.Text,
    -- | The user\'s name.
    UserProfile -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The user\'s SSH public key.
    UserProfile -> Maybe Text
sshPublicKey :: Prelude.Maybe Prelude.Text,
    -- | The user\'s SSH user name.
    UserProfile -> Maybe Text
sshUsername :: Prelude.Maybe Prelude.Text
  }
  deriving (UserProfile -> UserProfile -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UserProfile -> UserProfile -> Bool
$c/= :: UserProfile -> UserProfile -> Bool
== :: UserProfile -> UserProfile -> Bool
$c== :: UserProfile -> UserProfile -> Bool
Prelude.Eq, ReadPrec [UserProfile]
ReadPrec UserProfile
Int -> ReadS UserProfile
ReadS [UserProfile]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UserProfile]
$creadListPrec :: ReadPrec [UserProfile]
readPrec :: ReadPrec UserProfile
$creadPrec :: ReadPrec UserProfile
readList :: ReadS [UserProfile]
$creadList :: ReadS [UserProfile]
readsPrec :: Int -> ReadS UserProfile
$creadsPrec :: Int -> ReadS UserProfile
Prelude.Read, Int -> UserProfile -> ShowS
[UserProfile] -> ShowS
UserProfile -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UserProfile] -> ShowS
$cshowList :: [UserProfile] -> ShowS
show :: UserProfile -> String
$cshow :: UserProfile -> String
showsPrec :: Int -> UserProfile -> ShowS
$cshowsPrec :: Int -> UserProfile -> ShowS
Prelude.Show, forall x. Rep UserProfile x -> UserProfile
forall x. UserProfile -> Rep UserProfile x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UserProfile x -> UserProfile
$cfrom :: forall x. UserProfile -> Rep UserProfile x
Prelude.Generic)

-- |
-- Create a value of 'UserProfile' 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:
--
-- 'allowSelfManagement', 'userProfile_allowSelfManagement' - Whether users can specify their own SSH public key through the My
-- Settings page. For more information, see
-- <https://docs.aws.amazon.com/opsworks/latest/userguide/security-settingsshkey.html Managing User Permissions>.
--
-- 'iamUserArn', 'userProfile_iamUserArn' - The user\'s IAM ARN.
--
-- 'name', 'userProfile_name' - The user\'s name.
--
-- 'sshPublicKey', 'userProfile_sshPublicKey' - The user\'s SSH public key.
--
-- 'sshUsername', 'userProfile_sshUsername' - The user\'s SSH user name.
newUserProfile ::
  UserProfile
newUserProfile :: UserProfile
newUserProfile =
  UserProfile'
    { $sel:allowSelfManagement:UserProfile' :: Maybe Bool
allowSelfManagement = forall a. Maybe a
Prelude.Nothing,
      $sel:iamUserArn:UserProfile' :: Maybe Text
iamUserArn = forall a. Maybe a
Prelude.Nothing,
      $sel:name:UserProfile' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:sshPublicKey:UserProfile' :: Maybe Text
sshPublicKey = forall a. Maybe a
Prelude.Nothing,
      $sel:sshUsername:UserProfile' :: Maybe Text
sshUsername = forall a. Maybe a
Prelude.Nothing
    }

-- | Whether users can specify their own SSH public key through the My
-- Settings page. For more information, see
-- <https://docs.aws.amazon.com/opsworks/latest/userguide/security-settingsshkey.html Managing User Permissions>.
userProfile_allowSelfManagement :: Lens.Lens' UserProfile (Prelude.Maybe Prelude.Bool)
userProfile_allowSelfManagement :: Lens' UserProfile (Maybe Bool)
userProfile_allowSelfManagement = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserProfile' {Maybe Bool
allowSelfManagement :: Maybe Bool
$sel:allowSelfManagement:UserProfile' :: UserProfile -> Maybe Bool
allowSelfManagement} -> Maybe Bool
allowSelfManagement) (\s :: UserProfile
s@UserProfile' {} Maybe Bool
a -> UserProfile
s {$sel:allowSelfManagement:UserProfile' :: Maybe Bool
allowSelfManagement = Maybe Bool
a} :: UserProfile)

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

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

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

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

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

instance Prelude.Hashable UserProfile where
  hashWithSalt :: Int -> UserProfile -> Int
hashWithSalt Int
_salt UserProfile' {Maybe Bool
Maybe Text
sshUsername :: Maybe Text
sshPublicKey :: Maybe Text
name :: Maybe Text
iamUserArn :: Maybe Text
allowSelfManagement :: Maybe Bool
$sel:sshUsername:UserProfile' :: UserProfile -> Maybe Text
$sel:sshPublicKey:UserProfile' :: UserProfile -> Maybe Text
$sel:name:UserProfile' :: UserProfile -> Maybe Text
$sel:iamUserArn:UserProfile' :: UserProfile -> Maybe Text
$sel:allowSelfManagement:UserProfile' :: UserProfile -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
allowSelfManagement
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
iamUserArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
sshPublicKey
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
sshUsername

instance Prelude.NFData UserProfile where
  rnf :: UserProfile -> ()
rnf UserProfile' {Maybe Bool
Maybe Text
sshUsername :: Maybe Text
sshPublicKey :: Maybe Text
name :: Maybe Text
iamUserArn :: Maybe Text
allowSelfManagement :: Maybe Bool
$sel:sshUsername:UserProfile' :: UserProfile -> Maybe Text
$sel:sshPublicKey:UserProfile' :: UserProfile -> Maybe Text
$sel:name:UserProfile' :: UserProfile -> Maybe Text
$sel:iamUserArn:UserProfile' :: UserProfile -> Maybe Text
$sel:allowSelfManagement:UserProfile' :: UserProfile -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
allowSelfManagement
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
iamUserArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
sshPublicKey
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
sshUsername