{-# 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-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.UserProfile 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:/ '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 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,
    -- | 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
  }
  deriving (UserProfile -> UserProfile -> Bool
(UserProfile -> UserProfile -> Bool)
-> (UserProfile -> UserProfile -> Bool) -> Eq UserProfile
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]
(Int -> ReadS UserProfile)
-> ReadS [UserProfile]
-> ReadPrec UserProfile
-> ReadPrec [UserProfile]
-> Read 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
(Int -> UserProfile -> ShowS)
-> (UserProfile -> String)
-> ([UserProfile] -> ShowS)
-> Show UserProfile
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. UserProfile -> Rep UserProfile x)
-> (forall x. Rep UserProfile x -> UserProfile)
-> Generic UserProfile
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>.
--
-- 'sshPublicKey', 'userProfile_sshPublicKey' - The user\'s SSH public key.
--
-- 'sshUsername', 'userProfile_sshUsername' - The user\'s SSH user name.
--
-- 'iamUserArn', 'userProfile_iamUserArn' - The user\'s IAM ARN.
--
-- 'name', 'userProfile_name' - The user\'s name.
newUserProfile ::
  UserProfile
newUserProfile :: UserProfile
newUserProfile =
  UserProfile' :: Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> UserProfile
UserProfile'
    { $sel:allowSelfManagement:UserProfile' :: Maybe Bool
allowSelfManagement = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:sshPublicKey:UserProfile' :: Maybe Text
sshPublicKey = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sshUsername:UserProfile' :: Maybe Text
sshUsername = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:iamUserArn:UserProfile' :: Maybe Text
iamUserArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:UserProfile' :: Maybe Text
name = Maybe Text
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 :: (Maybe Bool -> f (Maybe Bool)) -> UserProfile -> f UserProfile
userProfile_allowSelfManagement = (UserProfile -> Maybe Bool)
-> (UserProfile -> Maybe Bool -> UserProfile)
-> Lens UserProfile UserProfile (Maybe Bool) (Maybe Bool)
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 SSH public key.
userProfile_sshPublicKey :: Lens.Lens' UserProfile (Prelude.Maybe Prelude.Text)
userProfile_sshPublicKey :: (Maybe Text -> f (Maybe Text)) -> UserProfile -> f UserProfile
userProfile_sshPublicKey = (UserProfile -> Maybe Text)
-> (UserProfile -> Maybe Text -> UserProfile)
-> Lens UserProfile UserProfile (Maybe Text) (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text)) -> UserProfile -> f UserProfile
userProfile_sshUsername = (UserProfile -> Maybe Text)
-> (UserProfile -> Maybe Text -> UserProfile)
-> Lens UserProfile UserProfile (Maybe Text) (Maybe Text)
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)

-- | The user\'s IAM ARN.
userProfile_iamUserArn :: Lens.Lens' UserProfile (Prelude.Maybe Prelude.Text)
userProfile_iamUserArn :: (Maybe Text -> f (Maybe Text)) -> UserProfile -> f UserProfile
userProfile_iamUserArn = (UserProfile -> Maybe Text)
-> (UserProfile -> Maybe Text -> UserProfile)
-> Lens UserProfile UserProfile (Maybe Text) (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text)) -> UserProfile -> f UserProfile
userProfile_name = (UserProfile -> Maybe Text)
-> (UserProfile -> Maybe Text -> UserProfile)
-> Lens UserProfile UserProfile (Maybe Text) (Maybe Text)
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)

instance Core.FromJSON UserProfile where
  parseJSON :: Value -> Parser UserProfile
parseJSON =
    String
-> (Object -> Parser UserProfile) -> Value -> Parser UserProfile
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"UserProfile"
      ( \Object
x ->
          Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> UserProfile
UserProfile'
            (Maybe Bool
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> UserProfile)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Text -> Maybe Text -> UserProfile)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AllowSelfManagement")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Text -> Maybe Text -> UserProfile)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> Maybe Text -> UserProfile)
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
"SshPublicKey")
            Parser (Maybe Text -> Maybe Text -> Maybe Text -> UserProfile)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> UserProfile)
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 -> UserProfile)
-> Parser (Maybe Text) -> Parser (Maybe Text -> UserProfile)
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 -> UserProfile)
-> Parser (Maybe Text) -> Parser UserProfile
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 UserProfile

instance Prelude.NFData UserProfile