{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.UpdateMyUserProfile
-- 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)
--
-- Updates a user\'s SSH public key.
--
-- __Required Permissions__: To use this action, an IAM user must have
-- self-management enabled or an attached policy that explicitly grants
-- permissions. For more information about user permissions, see
-- <https://docs.aws.amazon.com/opsworks/latest/userguide/opsworks-security-users.html Managing User Permissions>.
module Amazonka.OpsWorks.UpdateMyUserProfile
  ( -- * Creating a Request
    UpdateMyUserProfile (..),
    newUpdateMyUserProfile,

    -- * Request Lenses
    updateMyUserProfile_sshPublicKey,

    -- * Destructuring the Response
    UpdateMyUserProfileResponse (..),
    newUpdateMyUserProfileResponse,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.OpsWorks.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

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

-- |
-- Create a value of 'UpdateMyUserProfile' 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', 'updateMyUserProfile_sshPublicKey' - The user\'s SSH public key.
newUpdateMyUserProfile ::
  UpdateMyUserProfile
newUpdateMyUserProfile :: UpdateMyUserProfile
newUpdateMyUserProfile =
  UpdateMyUserProfile' :: Maybe Text -> UpdateMyUserProfile
UpdateMyUserProfile'
    { $sel:sshPublicKey:UpdateMyUserProfile' :: Maybe Text
sshPublicKey =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

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

instance Core.AWSRequest UpdateMyUserProfile where
  type
    AWSResponse UpdateMyUserProfile =
      UpdateMyUserProfileResponse
  request :: UpdateMyUserProfile -> Request UpdateMyUserProfile
request = Service -> UpdateMyUserProfile -> Request UpdateMyUserProfile
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateMyUserProfile
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateMyUserProfile)))
response =
    AWSResponse UpdateMyUserProfile
-> Logger
-> Service
-> Proxy UpdateMyUserProfile
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateMyUserProfile)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse UpdateMyUserProfile
UpdateMyUserProfileResponse
UpdateMyUserProfileResponse'

instance Prelude.Hashable UpdateMyUserProfile

instance Prelude.NFData UpdateMyUserProfile

instance Core.ToHeaders UpdateMyUserProfile where
  toHeaders :: UpdateMyUserProfile -> [Header]
toHeaders =
    [Header] -> UpdateMyUserProfile -> [Header]
forall a b. a -> b -> a
Prelude.const
      ( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"OpsWorks_20130218.UpdateMyUserProfile" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON UpdateMyUserProfile where
  toJSON :: UpdateMyUserProfile -> Value
toJSON UpdateMyUserProfile' {Maybe Text
sshPublicKey :: Maybe Text
$sel:sshPublicKey:UpdateMyUserProfile' :: UpdateMyUserProfile -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"SshPublicKey" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
sshPublicKey]
      )

instance Core.ToPath UpdateMyUserProfile where
  toPath :: UpdateMyUserProfile -> ByteString
toPath = ByteString -> UpdateMyUserProfile -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery UpdateMyUserProfile where
  toQuery :: UpdateMyUserProfile -> QueryString
toQuery = QueryString -> UpdateMyUserProfile -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newUpdateMyUserProfileResponse' smart constructor.
data UpdateMyUserProfileResponse = UpdateMyUserProfileResponse'
  {
  }
  deriving (UpdateMyUserProfileResponse -> UpdateMyUserProfileResponse -> Bool
(UpdateMyUserProfileResponse
 -> UpdateMyUserProfileResponse -> Bool)
-> (UpdateMyUserProfileResponse
    -> UpdateMyUserProfileResponse -> Bool)
-> Eq UpdateMyUserProfileResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateMyUserProfileResponse -> UpdateMyUserProfileResponse -> Bool
$c/= :: UpdateMyUserProfileResponse -> UpdateMyUserProfileResponse -> Bool
== :: UpdateMyUserProfileResponse -> UpdateMyUserProfileResponse -> Bool
$c== :: UpdateMyUserProfileResponse -> UpdateMyUserProfileResponse -> Bool
Prelude.Eq, ReadPrec [UpdateMyUserProfileResponse]
ReadPrec UpdateMyUserProfileResponse
Int -> ReadS UpdateMyUserProfileResponse
ReadS [UpdateMyUserProfileResponse]
(Int -> ReadS UpdateMyUserProfileResponse)
-> ReadS [UpdateMyUserProfileResponse]
-> ReadPrec UpdateMyUserProfileResponse
-> ReadPrec [UpdateMyUserProfileResponse]
-> Read UpdateMyUserProfileResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateMyUserProfileResponse]
$creadListPrec :: ReadPrec [UpdateMyUserProfileResponse]
readPrec :: ReadPrec UpdateMyUserProfileResponse
$creadPrec :: ReadPrec UpdateMyUserProfileResponse
readList :: ReadS [UpdateMyUserProfileResponse]
$creadList :: ReadS [UpdateMyUserProfileResponse]
readsPrec :: Int -> ReadS UpdateMyUserProfileResponse
$creadsPrec :: Int -> ReadS UpdateMyUserProfileResponse
Prelude.Read, Int -> UpdateMyUserProfileResponse -> ShowS
[UpdateMyUserProfileResponse] -> ShowS
UpdateMyUserProfileResponse -> String
(Int -> UpdateMyUserProfileResponse -> ShowS)
-> (UpdateMyUserProfileResponse -> String)
-> ([UpdateMyUserProfileResponse] -> ShowS)
-> Show UpdateMyUserProfileResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateMyUserProfileResponse] -> ShowS
$cshowList :: [UpdateMyUserProfileResponse] -> ShowS
show :: UpdateMyUserProfileResponse -> String
$cshow :: UpdateMyUserProfileResponse -> String
showsPrec :: Int -> UpdateMyUserProfileResponse -> ShowS
$cshowsPrec :: Int -> UpdateMyUserProfileResponse -> ShowS
Prelude.Show, (forall x.
 UpdateMyUserProfileResponse -> Rep UpdateMyUserProfileResponse x)
-> (forall x.
    Rep UpdateMyUserProfileResponse x -> UpdateMyUserProfileResponse)
-> Generic UpdateMyUserProfileResponse
forall x.
Rep UpdateMyUserProfileResponse x -> UpdateMyUserProfileResponse
forall x.
UpdateMyUserProfileResponse -> Rep UpdateMyUserProfileResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateMyUserProfileResponse x -> UpdateMyUserProfileResponse
$cfrom :: forall x.
UpdateMyUserProfileResponse -> Rep UpdateMyUserProfileResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateMyUserProfileResponse' 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.
newUpdateMyUserProfileResponse ::
  UpdateMyUserProfileResponse
newUpdateMyUserProfileResponse :: UpdateMyUserProfileResponse
newUpdateMyUserProfileResponse =
  UpdateMyUserProfileResponse
UpdateMyUserProfileResponse'

instance Prelude.NFData UpdateMyUserProfileResponse