{-# 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.IAM.DeleteSSHPublicKey
-- 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)
--
-- Deletes the specified SSH public key.
--
-- The SSH public key deleted by this operation is used only for
-- authenticating the associated IAM user to an CodeCommit repository. For
-- more information about using SSH keys to authenticate to an CodeCommit
-- repository, see
-- <https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-credentials-ssh.html Set up CodeCommit for SSH connections>
-- in the /CodeCommit User Guide/.
module Amazonka.IAM.DeleteSSHPublicKey
  ( -- * Creating a Request
    DeleteSSHPublicKey (..),
    newDeleteSSHPublicKey,

    -- * Request Lenses
    deleteSSHPublicKey_userName,
    deleteSSHPublicKey_sSHPublicKeyId,

    -- * Destructuring the Response
    DeleteSSHPublicKeyResponse (..),
    newDeleteSSHPublicKeyResponse,
  )
where

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

-- | /See:/ 'newDeleteSSHPublicKey' smart constructor.
data DeleteSSHPublicKey = DeleteSSHPublicKey'
  { -- | The name of the IAM user associated with the SSH public key.
    --
    -- This parameter allows (through its
    -- <http://wikipedia.org/wiki/regex regex pattern>) a string of characters
    -- consisting of upper and lowercase alphanumeric characters with no
    -- spaces. You can also include any of the following characters: _+=,.\@-
    DeleteSSHPublicKey -> Text
userName :: Prelude.Text,
    -- | The unique identifier for the SSH public key.
    --
    -- This parameter allows (through its
    -- <http://wikipedia.org/wiki/regex regex pattern>) a string of characters
    -- that can consist of any upper or lowercased letter or digit.
    DeleteSSHPublicKey -> Text
sSHPublicKeyId :: Prelude.Text
  }
  deriving (DeleteSSHPublicKey -> DeleteSSHPublicKey -> Bool
(DeleteSSHPublicKey -> DeleteSSHPublicKey -> Bool)
-> (DeleteSSHPublicKey -> DeleteSSHPublicKey -> Bool)
-> Eq DeleteSSHPublicKey
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteSSHPublicKey -> DeleteSSHPublicKey -> Bool
$c/= :: DeleteSSHPublicKey -> DeleteSSHPublicKey -> Bool
== :: DeleteSSHPublicKey -> DeleteSSHPublicKey -> Bool
$c== :: DeleteSSHPublicKey -> DeleteSSHPublicKey -> Bool
Prelude.Eq, ReadPrec [DeleteSSHPublicKey]
ReadPrec DeleteSSHPublicKey
Int -> ReadS DeleteSSHPublicKey
ReadS [DeleteSSHPublicKey]
(Int -> ReadS DeleteSSHPublicKey)
-> ReadS [DeleteSSHPublicKey]
-> ReadPrec DeleteSSHPublicKey
-> ReadPrec [DeleteSSHPublicKey]
-> Read DeleteSSHPublicKey
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteSSHPublicKey]
$creadListPrec :: ReadPrec [DeleteSSHPublicKey]
readPrec :: ReadPrec DeleteSSHPublicKey
$creadPrec :: ReadPrec DeleteSSHPublicKey
readList :: ReadS [DeleteSSHPublicKey]
$creadList :: ReadS [DeleteSSHPublicKey]
readsPrec :: Int -> ReadS DeleteSSHPublicKey
$creadsPrec :: Int -> ReadS DeleteSSHPublicKey
Prelude.Read, Int -> DeleteSSHPublicKey -> ShowS
[DeleteSSHPublicKey] -> ShowS
DeleteSSHPublicKey -> String
(Int -> DeleteSSHPublicKey -> ShowS)
-> (DeleteSSHPublicKey -> String)
-> ([DeleteSSHPublicKey] -> ShowS)
-> Show DeleteSSHPublicKey
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteSSHPublicKey] -> ShowS
$cshowList :: [DeleteSSHPublicKey] -> ShowS
show :: DeleteSSHPublicKey -> String
$cshow :: DeleteSSHPublicKey -> String
showsPrec :: Int -> DeleteSSHPublicKey -> ShowS
$cshowsPrec :: Int -> DeleteSSHPublicKey -> ShowS
Prelude.Show, (forall x. DeleteSSHPublicKey -> Rep DeleteSSHPublicKey x)
-> (forall x. Rep DeleteSSHPublicKey x -> DeleteSSHPublicKey)
-> Generic DeleteSSHPublicKey
forall x. Rep DeleteSSHPublicKey x -> DeleteSSHPublicKey
forall x. DeleteSSHPublicKey -> Rep DeleteSSHPublicKey x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteSSHPublicKey x -> DeleteSSHPublicKey
$cfrom :: forall x. DeleteSSHPublicKey -> Rep DeleteSSHPublicKey x
Prelude.Generic)

-- |
-- Create a value of 'DeleteSSHPublicKey' 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:
--
-- 'userName', 'deleteSSHPublicKey_userName' - The name of the IAM user associated with the SSH public key.
--
-- This parameter allows (through its
-- <http://wikipedia.org/wiki/regex regex pattern>) a string of characters
-- consisting of upper and lowercase alphanumeric characters with no
-- spaces. You can also include any of the following characters: _+=,.\@-
--
-- 'sSHPublicKeyId', 'deleteSSHPublicKey_sSHPublicKeyId' - The unique identifier for the SSH public key.
--
-- This parameter allows (through its
-- <http://wikipedia.org/wiki/regex regex pattern>) a string of characters
-- that can consist of any upper or lowercased letter or digit.
newDeleteSSHPublicKey ::
  -- | 'userName'
  Prelude.Text ->
  -- | 'sSHPublicKeyId'
  Prelude.Text ->
  DeleteSSHPublicKey
newDeleteSSHPublicKey :: Text -> Text -> DeleteSSHPublicKey
newDeleteSSHPublicKey Text
pUserName_ Text
pSSHPublicKeyId_ =
  DeleteSSHPublicKey' :: Text -> Text -> DeleteSSHPublicKey
DeleteSSHPublicKey'
    { $sel:userName:DeleteSSHPublicKey' :: Text
userName = Text
pUserName_,
      $sel:sSHPublicKeyId:DeleteSSHPublicKey' :: Text
sSHPublicKeyId = Text
pSSHPublicKeyId_
    }

-- | The name of the IAM user associated with the SSH public key.
--
-- This parameter allows (through its
-- <http://wikipedia.org/wiki/regex regex pattern>) a string of characters
-- consisting of upper and lowercase alphanumeric characters with no
-- spaces. You can also include any of the following characters: _+=,.\@-
deleteSSHPublicKey_userName :: Lens.Lens' DeleteSSHPublicKey Prelude.Text
deleteSSHPublicKey_userName :: (Text -> f Text) -> DeleteSSHPublicKey -> f DeleteSSHPublicKey
deleteSSHPublicKey_userName = (DeleteSSHPublicKey -> Text)
-> (DeleteSSHPublicKey -> Text -> DeleteSSHPublicKey)
-> Lens DeleteSSHPublicKey DeleteSSHPublicKey Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSSHPublicKey' {Text
userName :: Text
$sel:userName:DeleteSSHPublicKey' :: DeleteSSHPublicKey -> Text
userName} -> Text
userName) (\s :: DeleteSSHPublicKey
s@DeleteSSHPublicKey' {} Text
a -> DeleteSSHPublicKey
s {$sel:userName:DeleteSSHPublicKey' :: Text
userName = Text
a} :: DeleteSSHPublicKey)

-- | The unique identifier for the SSH public key.
--
-- This parameter allows (through its
-- <http://wikipedia.org/wiki/regex regex pattern>) a string of characters
-- that can consist of any upper or lowercased letter or digit.
deleteSSHPublicKey_sSHPublicKeyId :: Lens.Lens' DeleteSSHPublicKey Prelude.Text
deleteSSHPublicKey_sSHPublicKeyId :: (Text -> f Text) -> DeleteSSHPublicKey -> f DeleteSSHPublicKey
deleteSSHPublicKey_sSHPublicKeyId = (DeleteSSHPublicKey -> Text)
-> (DeleteSSHPublicKey -> Text -> DeleteSSHPublicKey)
-> Lens DeleteSSHPublicKey DeleteSSHPublicKey Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSSHPublicKey' {Text
sSHPublicKeyId :: Text
$sel:sSHPublicKeyId:DeleteSSHPublicKey' :: DeleteSSHPublicKey -> Text
sSHPublicKeyId} -> Text
sSHPublicKeyId) (\s :: DeleteSSHPublicKey
s@DeleteSSHPublicKey' {} Text
a -> DeleteSSHPublicKey
s {$sel:sSHPublicKeyId:DeleteSSHPublicKey' :: Text
sSHPublicKeyId = Text
a} :: DeleteSSHPublicKey)

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

instance Prelude.Hashable DeleteSSHPublicKey

instance Prelude.NFData DeleteSSHPublicKey

instance Core.ToHeaders DeleteSSHPublicKey where
  toHeaders :: DeleteSSHPublicKey -> [Header]
toHeaders = [Header] -> DeleteSSHPublicKey -> [Header]
forall a b. a -> b -> a
Prelude.const [Header]
forall a. Monoid a => a
Prelude.mempty

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

instance Core.ToQuery DeleteSSHPublicKey where
  toQuery :: DeleteSSHPublicKey -> QueryString
toQuery DeleteSSHPublicKey' {Text
sSHPublicKeyId :: Text
userName :: Text
$sel:sSHPublicKeyId:DeleteSSHPublicKey' :: DeleteSSHPublicKey -> Text
$sel:userName:DeleteSSHPublicKey' :: DeleteSSHPublicKey -> Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"DeleteSSHPublicKey" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-05-08" :: Prelude.ByteString),
        ByteString
"UserName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
userName,
        ByteString
"SSHPublicKeyId" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
sSHPublicKeyId
      ]

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

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

instance Prelude.NFData DeleteSSHPublicKeyResponse