{-# 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.CodeStar.DeleteUserProfile
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes a user profile in AWS CodeStar, including all personal
-- preference data associated with that profile, such as display name and
-- email address. It does not delete the history of that user, for example
-- the history of commits made by that user.
module Amazonka.CodeStar.DeleteUserProfile
  ( -- * Creating a Request
    DeleteUserProfile (..),
    newDeleteUserProfile,

    -- * Request Lenses
    deleteUserProfile_userArn,

    -- * Destructuring the Response
    DeleteUserProfileResponse (..),
    newDeleteUserProfileResponse,

    -- * Response Lenses
    deleteUserProfileResponse_httpStatus,
    deleteUserProfileResponse_userArn,
  )
where

import Amazonka.CodeStar.Types
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
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDeleteUserProfile' smart constructor.
data DeleteUserProfile = DeleteUserProfile'
  { -- | The Amazon Resource Name (ARN) of the user to delete from AWS CodeStar.
    DeleteUserProfile -> Text
userArn :: Prelude.Text
  }
  deriving (DeleteUserProfile -> DeleteUserProfile -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteUserProfile -> DeleteUserProfile -> Bool
$c/= :: DeleteUserProfile -> DeleteUserProfile -> Bool
== :: DeleteUserProfile -> DeleteUserProfile -> Bool
$c== :: DeleteUserProfile -> DeleteUserProfile -> Bool
Prelude.Eq, ReadPrec [DeleteUserProfile]
ReadPrec DeleteUserProfile
Int -> ReadS DeleteUserProfile
ReadS [DeleteUserProfile]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteUserProfile]
$creadListPrec :: ReadPrec [DeleteUserProfile]
readPrec :: ReadPrec DeleteUserProfile
$creadPrec :: ReadPrec DeleteUserProfile
readList :: ReadS [DeleteUserProfile]
$creadList :: ReadS [DeleteUserProfile]
readsPrec :: Int -> ReadS DeleteUserProfile
$creadsPrec :: Int -> ReadS DeleteUserProfile
Prelude.Read, Int -> DeleteUserProfile -> ShowS
[DeleteUserProfile] -> ShowS
DeleteUserProfile -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteUserProfile] -> ShowS
$cshowList :: [DeleteUserProfile] -> ShowS
show :: DeleteUserProfile -> String
$cshow :: DeleteUserProfile -> String
showsPrec :: Int -> DeleteUserProfile -> ShowS
$cshowsPrec :: Int -> DeleteUserProfile -> ShowS
Prelude.Show, forall x. Rep DeleteUserProfile x -> DeleteUserProfile
forall x. DeleteUserProfile -> Rep DeleteUserProfile x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteUserProfile x -> DeleteUserProfile
$cfrom :: forall x. DeleteUserProfile -> Rep DeleteUserProfile x
Prelude.Generic)

-- |
-- Create a value of 'DeleteUserProfile' 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:
--
-- 'userArn', 'deleteUserProfile_userArn' - The Amazon Resource Name (ARN) of the user to delete from AWS CodeStar.
newDeleteUserProfile ::
  -- | 'userArn'
  Prelude.Text ->
  DeleteUserProfile
newDeleteUserProfile :: Text -> DeleteUserProfile
newDeleteUserProfile Text
pUserArn_ =
  DeleteUserProfile' {$sel:userArn:DeleteUserProfile' :: Text
userArn = Text
pUserArn_}

-- | The Amazon Resource Name (ARN) of the user to delete from AWS CodeStar.
deleteUserProfile_userArn :: Lens.Lens' DeleteUserProfile Prelude.Text
deleteUserProfile_userArn :: Lens' DeleteUserProfile Text
deleteUserProfile_userArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteUserProfile' {Text
userArn :: Text
$sel:userArn:DeleteUserProfile' :: DeleteUserProfile -> Text
userArn} -> Text
userArn) (\s :: DeleteUserProfile
s@DeleteUserProfile' {} Text
a -> DeleteUserProfile
s {$sel:userArn:DeleteUserProfile' :: Text
userArn = Text
a} :: DeleteUserProfile)

instance Core.AWSRequest DeleteUserProfile where
  type
    AWSResponse DeleteUserProfile =
      DeleteUserProfileResponse
  request :: (Service -> Service)
-> DeleteUserProfile -> Request DeleteUserProfile
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteUserProfile
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteUserProfile)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int -> Text -> DeleteUserProfileResponse
DeleteUserProfileResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"userArn")
      )

instance Prelude.Hashable DeleteUserProfile where
  hashWithSalt :: Int -> DeleteUserProfile -> Int
hashWithSalt Int
_salt DeleteUserProfile' {Text
userArn :: Text
$sel:userArn:DeleteUserProfile' :: DeleteUserProfile -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
userArn

instance Prelude.NFData DeleteUserProfile where
  rnf :: DeleteUserProfile -> ()
rnf DeleteUserProfile' {Text
userArn :: Text
$sel:userArn:DeleteUserProfile' :: DeleteUserProfile -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
userArn

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

instance Data.ToJSON DeleteUserProfile where
  toJSON :: DeleteUserProfile -> Value
toJSON DeleteUserProfile' {Text
userArn :: Text
$sel:userArn:DeleteUserProfile' :: DeleteUserProfile -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"userArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
userArn)]
      )

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

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

-- | /See:/ 'newDeleteUserProfileResponse' smart constructor.
data DeleteUserProfileResponse = DeleteUserProfileResponse'
  { -- | The response's http status code.
    DeleteUserProfileResponse -> Int
httpStatus :: Prelude.Int,
    -- | The Amazon Resource Name (ARN) of the user deleted from AWS CodeStar.
    DeleteUserProfileResponse -> Text
userArn :: Prelude.Text
  }
  deriving (DeleteUserProfileResponse -> DeleteUserProfileResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteUserProfileResponse -> DeleteUserProfileResponse -> Bool
$c/= :: DeleteUserProfileResponse -> DeleteUserProfileResponse -> Bool
== :: DeleteUserProfileResponse -> DeleteUserProfileResponse -> Bool
$c== :: DeleteUserProfileResponse -> DeleteUserProfileResponse -> Bool
Prelude.Eq, ReadPrec [DeleteUserProfileResponse]
ReadPrec DeleteUserProfileResponse
Int -> ReadS DeleteUserProfileResponse
ReadS [DeleteUserProfileResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteUserProfileResponse]
$creadListPrec :: ReadPrec [DeleteUserProfileResponse]
readPrec :: ReadPrec DeleteUserProfileResponse
$creadPrec :: ReadPrec DeleteUserProfileResponse
readList :: ReadS [DeleteUserProfileResponse]
$creadList :: ReadS [DeleteUserProfileResponse]
readsPrec :: Int -> ReadS DeleteUserProfileResponse
$creadsPrec :: Int -> ReadS DeleteUserProfileResponse
Prelude.Read, Int -> DeleteUserProfileResponse -> ShowS
[DeleteUserProfileResponse] -> ShowS
DeleteUserProfileResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteUserProfileResponse] -> ShowS
$cshowList :: [DeleteUserProfileResponse] -> ShowS
show :: DeleteUserProfileResponse -> String
$cshow :: DeleteUserProfileResponse -> String
showsPrec :: Int -> DeleteUserProfileResponse -> ShowS
$cshowsPrec :: Int -> DeleteUserProfileResponse -> ShowS
Prelude.Show, forall x.
Rep DeleteUserProfileResponse x -> DeleteUserProfileResponse
forall x.
DeleteUserProfileResponse -> Rep DeleteUserProfileResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteUserProfileResponse x -> DeleteUserProfileResponse
$cfrom :: forall x.
DeleteUserProfileResponse -> Rep DeleteUserProfileResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteUserProfileResponse' 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:
--
-- 'httpStatus', 'deleteUserProfileResponse_httpStatus' - The response's http status code.
--
-- 'userArn', 'deleteUserProfileResponse_userArn' - The Amazon Resource Name (ARN) of the user deleted from AWS CodeStar.
newDeleteUserProfileResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'userArn'
  Prelude.Text ->
  DeleteUserProfileResponse
newDeleteUserProfileResponse :: Int -> Text -> DeleteUserProfileResponse
newDeleteUserProfileResponse Int
pHttpStatus_ Text
pUserArn_ =
  DeleteUserProfileResponse'
    { $sel:httpStatus:DeleteUserProfileResponse' :: Int
httpStatus =
        Int
pHttpStatus_,
      $sel:userArn:DeleteUserProfileResponse' :: Text
userArn = Text
pUserArn_
    }

-- | The response's http status code.
deleteUserProfileResponse_httpStatus :: Lens.Lens' DeleteUserProfileResponse Prelude.Int
deleteUserProfileResponse_httpStatus :: Lens' DeleteUserProfileResponse Int
deleteUserProfileResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteUserProfileResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteUserProfileResponse' :: DeleteUserProfileResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteUserProfileResponse
s@DeleteUserProfileResponse' {} Int
a -> DeleteUserProfileResponse
s {$sel:httpStatus:DeleteUserProfileResponse' :: Int
httpStatus = Int
a} :: DeleteUserProfileResponse)

-- | The Amazon Resource Name (ARN) of the user deleted from AWS CodeStar.
deleteUserProfileResponse_userArn :: Lens.Lens' DeleteUserProfileResponse Prelude.Text
deleteUserProfileResponse_userArn :: Lens' DeleteUserProfileResponse Text
deleteUserProfileResponse_userArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteUserProfileResponse' {Text
userArn :: Text
$sel:userArn:DeleteUserProfileResponse' :: DeleteUserProfileResponse -> Text
userArn} -> Text
userArn) (\s :: DeleteUserProfileResponse
s@DeleteUserProfileResponse' {} Text
a -> DeleteUserProfileResponse
s {$sel:userArn:DeleteUserProfileResponse' :: Text
userArn = Text
a} :: DeleteUserProfileResponse)

instance Prelude.NFData DeleteUserProfileResponse where
  rnf :: DeleteUserProfileResponse -> ()
rnf DeleteUserProfileResponse' {Int
Text
userArn :: Text
httpStatus :: Int
$sel:userArn:DeleteUserProfileResponse' :: DeleteUserProfileResponse -> Text
$sel:httpStatus:DeleteUserProfileResponse' :: DeleteUserProfileResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
userArn