{-# 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.DeleteServer
-- 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 file transfer protocol-enabled server that you specify.
--
-- No response returns from this operation.
module Amazonka.Transfer.DeleteServer
  ( -- * Creating a Request
    DeleteServer (..),
    newDeleteServer,

    -- * Request Lenses
    deleteServer_serverId,

    -- * Destructuring the Response
    DeleteServerResponse (..),
    newDeleteServerResponse,
  )
where

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

-- | /See:/ 'newDeleteServer' smart constructor.
data DeleteServer = DeleteServer'
  { -- | A unique system-assigned identifier for a server instance.
    DeleteServer -> Text
serverId :: Prelude.Text
  }
  deriving (DeleteServer -> DeleteServer -> Bool
(DeleteServer -> DeleteServer -> Bool)
-> (DeleteServer -> DeleteServer -> Bool) -> Eq DeleteServer
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteServer -> DeleteServer -> Bool
$c/= :: DeleteServer -> DeleteServer -> Bool
== :: DeleteServer -> DeleteServer -> Bool
$c== :: DeleteServer -> DeleteServer -> Bool
Prelude.Eq, ReadPrec [DeleteServer]
ReadPrec DeleteServer
Int -> ReadS DeleteServer
ReadS [DeleteServer]
(Int -> ReadS DeleteServer)
-> ReadS [DeleteServer]
-> ReadPrec DeleteServer
-> ReadPrec [DeleteServer]
-> Read DeleteServer
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteServer]
$creadListPrec :: ReadPrec [DeleteServer]
readPrec :: ReadPrec DeleteServer
$creadPrec :: ReadPrec DeleteServer
readList :: ReadS [DeleteServer]
$creadList :: ReadS [DeleteServer]
readsPrec :: Int -> ReadS DeleteServer
$creadsPrec :: Int -> ReadS DeleteServer
Prelude.Read, Int -> DeleteServer -> ShowS
[DeleteServer] -> ShowS
DeleteServer -> String
(Int -> DeleteServer -> ShowS)
-> (DeleteServer -> String)
-> ([DeleteServer] -> ShowS)
-> Show DeleteServer
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteServer] -> ShowS
$cshowList :: [DeleteServer] -> ShowS
show :: DeleteServer -> String
$cshow :: DeleteServer -> String
showsPrec :: Int -> DeleteServer -> ShowS
$cshowsPrec :: Int -> DeleteServer -> ShowS
Prelude.Show, (forall x. DeleteServer -> Rep DeleteServer x)
-> (forall x. Rep DeleteServer x -> DeleteServer)
-> Generic DeleteServer
forall x. Rep DeleteServer x -> DeleteServer
forall x. DeleteServer -> Rep DeleteServer x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteServer x -> DeleteServer
$cfrom :: forall x. DeleteServer -> Rep DeleteServer x
Prelude.Generic)

-- |
-- Create a value of 'DeleteServer' 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', 'deleteServer_serverId' - A unique system-assigned identifier for a server instance.
newDeleteServer ::
  -- | 'serverId'
  Prelude.Text ->
  DeleteServer
newDeleteServer :: Text -> DeleteServer
newDeleteServer Text
pServerId_ =
  DeleteServer' :: Text -> DeleteServer
DeleteServer' {$sel:serverId:DeleteServer' :: Text
serverId = Text
pServerId_}

-- | A unique system-assigned identifier for a server instance.
deleteServer_serverId :: Lens.Lens' DeleteServer Prelude.Text
deleteServer_serverId :: (Text -> f Text) -> DeleteServer -> f DeleteServer
deleteServer_serverId = (DeleteServer -> Text)
-> (DeleteServer -> Text -> DeleteServer)
-> Lens DeleteServer DeleteServer Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteServer' {Text
serverId :: Text
$sel:serverId:DeleteServer' :: DeleteServer -> Text
serverId} -> Text
serverId) (\s :: DeleteServer
s@DeleteServer' {} Text
a -> DeleteServer
s {$sel:serverId:DeleteServer' :: Text
serverId = Text
a} :: DeleteServer)

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

instance Prelude.Hashable DeleteServer

instance Prelude.NFData DeleteServer

instance Core.ToHeaders DeleteServer where
  toHeaders :: DeleteServer -> [Header]
toHeaders =
    [Header] -> DeleteServer -> [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
"TransferService.DeleteServer" ::
                          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 DeleteServer where
  toJSON :: DeleteServer -> Value
toJSON DeleteServer' {Text
serverId :: Text
$sel:serverId:DeleteServer' :: DeleteServer -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ServerId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
serverId)]
      )

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

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

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

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

instance Prelude.NFData DeleteServerResponse