{-# 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.Transfer.DeleteHostKey
-- 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 the host key that\'s specified in the @HoskKeyId@ parameter.
module Amazonka.Transfer.DeleteHostKey
  ( -- * Creating a Request
    DeleteHostKey (..),
    newDeleteHostKey,

    -- * Request Lenses
    deleteHostKey_serverId,
    deleteHostKey_hostKeyId,

    -- * Destructuring the Response
    DeleteHostKeyResponse (..),
    newDeleteHostKeyResponse,
  )
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
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.Transfer.Types

-- | /See:/ 'newDeleteHostKey' smart constructor.
data DeleteHostKey = DeleteHostKey'
  { -- | The identifier of the server that contains the host key that you are
    -- deleting.
    DeleteHostKey -> Text
serverId :: Prelude.Text,
    -- | The identifier of the host key that you are deleting.
    DeleteHostKey -> Text
hostKeyId :: Prelude.Text
  }
  deriving (DeleteHostKey -> DeleteHostKey -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteHostKey -> DeleteHostKey -> Bool
$c/= :: DeleteHostKey -> DeleteHostKey -> Bool
== :: DeleteHostKey -> DeleteHostKey -> Bool
$c== :: DeleteHostKey -> DeleteHostKey -> Bool
Prelude.Eq, ReadPrec [DeleteHostKey]
ReadPrec DeleteHostKey
Int -> ReadS DeleteHostKey
ReadS [DeleteHostKey]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteHostKey]
$creadListPrec :: ReadPrec [DeleteHostKey]
readPrec :: ReadPrec DeleteHostKey
$creadPrec :: ReadPrec DeleteHostKey
readList :: ReadS [DeleteHostKey]
$creadList :: ReadS [DeleteHostKey]
readsPrec :: Int -> ReadS DeleteHostKey
$creadsPrec :: Int -> ReadS DeleteHostKey
Prelude.Read, Int -> DeleteHostKey -> ShowS
[DeleteHostKey] -> ShowS
DeleteHostKey -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteHostKey] -> ShowS
$cshowList :: [DeleteHostKey] -> ShowS
show :: DeleteHostKey -> String
$cshow :: DeleteHostKey -> String
showsPrec :: Int -> DeleteHostKey -> ShowS
$cshowsPrec :: Int -> DeleteHostKey -> ShowS
Prelude.Show, forall x. Rep DeleteHostKey x -> DeleteHostKey
forall x. DeleteHostKey -> Rep DeleteHostKey x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteHostKey x -> DeleteHostKey
$cfrom :: forall x. DeleteHostKey -> Rep DeleteHostKey x
Prelude.Generic)

-- |
-- Create a value of 'DeleteHostKey' 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:
--
-- 'serverId', 'deleteHostKey_serverId' - The identifier of the server that contains the host key that you are
-- deleting.
--
-- 'hostKeyId', 'deleteHostKey_hostKeyId' - The identifier of the host key that you are deleting.
newDeleteHostKey ::
  -- | 'serverId'
  Prelude.Text ->
  -- | 'hostKeyId'
  Prelude.Text ->
  DeleteHostKey
newDeleteHostKey :: Text -> Text -> DeleteHostKey
newDeleteHostKey Text
pServerId_ Text
pHostKeyId_ =
  DeleteHostKey'
    { $sel:serverId:DeleteHostKey' :: Text
serverId = Text
pServerId_,
      $sel:hostKeyId:DeleteHostKey' :: Text
hostKeyId = Text
pHostKeyId_
    }

-- | The identifier of the server that contains the host key that you are
-- deleting.
deleteHostKey_serverId :: Lens.Lens' DeleteHostKey Prelude.Text
deleteHostKey_serverId :: Lens' DeleteHostKey Text
deleteHostKey_serverId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteHostKey' {Text
serverId :: Text
$sel:serverId:DeleteHostKey' :: DeleteHostKey -> Text
serverId} -> Text
serverId) (\s :: DeleteHostKey
s@DeleteHostKey' {} Text
a -> DeleteHostKey
s {$sel:serverId:DeleteHostKey' :: Text
serverId = Text
a} :: DeleteHostKey)

-- | The identifier of the host key that you are deleting.
deleteHostKey_hostKeyId :: Lens.Lens' DeleteHostKey Prelude.Text
deleteHostKey_hostKeyId :: Lens' DeleteHostKey Text
deleteHostKey_hostKeyId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteHostKey' {Text
hostKeyId :: Text
$sel:hostKeyId:DeleteHostKey' :: DeleteHostKey -> Text
hostKeyId} -> Text
hostKeyId) (\s :: DeleteHostKey
s@DeleteHostKey' {} Text
a -> DeleteHostKey
s {$sel:hostKeyId:DeleteHostKey' :: Text
hostKeyId = Text
a} :: DeleteHostKey)

instance Core.AWSRequest DeleteHostKey where
  type
    AWSResponse DeleteHostKey =
      DeleteHostKeyResponse
  request :: (Service -> Service) -> DeleteHostKey -> Request DeleteHostKey
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 DeleteHostKey
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteHostKey)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull DeleteHostKeyResponse
DeleteHostKeyResponse'

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

instance Prelude.NFData DeleteHostKey where
  rnf :: DeleteHostKey -> ()
rnf DeleteHostKey' {Text
hostKeyId :: Text
serverId :: Text
$sel:hostKeyId:DeleteHostKey' :: DeleteHostKey -> Text
$sel:serverId:DeleteHostKey' :: DeleteHostKey -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
serverId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
hostKeyId

instance Data.ToHeaders DeleteHostKey where
  toHeaders :: DeleteHostKey -> [Header]
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 -> [Header]
Data.=# ( ByteString
"TransferService.DeleteHostKey" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> [Header]
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

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

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

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

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

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

instance Prelude.NFData DeleteHostKeyResponse where
  rnf :: DeleteHostKeyResponse -> ()
rnf DeleteHostKeyResponse
_ = ()