{-# 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.DrS.DeleteSourceServer
-- 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 single Source Server by ID. The Source Server must be
-- disconnected first.
module Amazonka.DrS.DeleteSourceServer
  ( -- * Creating a Request
    DeleteSourceServer (..),
    newDeleteSourceServer,

    -- * Request Lenses
    deleteSourceServer_sourceServerID,

    -- * Destructuring the Response
    DeleteSourceServerResponse (..),
    newDeleteSourceServerResponse,

    -- * Response Lenses
    deleteSourceServerResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DrS.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDeleteSourceServer' smart constructor.
data DeleteSourceServer = DeleteSourceServer'
  { -- | The ID of the Source Server to be deleted.
    DeleteSourceServer -> Text
sourceServerID :: Prelude.Text
  }
  deriving (DeleteSourceServer -> DeleteSourceServer -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteSourceServer -> DeleteSourceServer -> Bool
$c/= :: DeleteSourceServer -> DeleteSourceServer -> Bool
== :: DeleteSourceServer -> DeleteSourceServer -> Bool
$c== :: DeleteSourceServer -> DeleteSourceServer -> Bool
Prelude.Eq, ReadPrec [DeleteSourceServer]
ReadPrec DeleteSourceServer
Int -> ReadS DeleteSourceServer
ReadS [DeleteSourceServer]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteSourceServer]
$creadListPrec :: ReadPrec [DeleteSourceServer]
readPrec :: ReadPrec DeleteSourceServer
$creadPrec :: ReadPrec DeleteSourceServer
readList :: ReadS [DeleteSourceServer]
$creadList :: ReadS [DeleteSourceServer]
readsPrec :: Int -> ReadS DeleteSourceServer
$creadsPrec :: Int -> ReadS DeleteSourceServer
Prelude.Read, Int -> DeleteSourceServer -> ShowS
[DeleteSourceServer] -> ShowS
DeleteSourceServer -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteSourceServer] -> ShowS
$cshowList :: [DeleteSourceServer] -> ShowS
show :: DeleteSourceServer -> String
$cshow :: DeleteSourceServer -> String
showsPrec :: Int -> DeleteSourceServer -> ShowS
$cshowsPrec :: Int -> DeleteSourceServer -> ShowS
Prelude.Show, forall x. Rep DeleteSourceServer x -> DeleteSourceServer
forall x. DeleteSourceServer -> Rep DeleteSourceServer x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteSourceServer x -> DeleteSourceServer
$cfrom :: forall x. DeleteSourceServer -> Rep DeleteSourceServer x
Prelude.Generic)

-- |
-- Create a value of 'DeleteSourceServer' 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:
--
-- 'sourceServerID', 'deleteSourceServer_sourceServerID' - The ID of the Source Server to be deleted.
newDeleteSourceServer ::
  -- | 'sourceServerID'
  Prelude.Text ->
  DeleteSourceServer
newDeleteSourceServer :: Text -> DeleteSourceServer
newDeleteSourceServer Text
pSourceServerID_ =
  DeleteSourceServer'
    { $sel:sourceServerID:DeleteSourceServer' :: Text
sourceServerID =
        Text
pSourceServerID_
    }

-- | The ID of the Source Server to be deleted.
deleteSourceServer_sourceServerID :: Lens.Lens' DeleteSourceServer Prelude.Text
deleteSourceServer_sourceServerID :: Lens' DeleteSourceServer Text
deleteSourceServer_sourceServerID = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSourceServer' {Text
sourceServerID :: Text
$sel:sourceServerID:DeleteSourceServer' :: DeleteSourceServer -> Text
sourceServerID} -> Text
sourceServerID) (\s :: DeleteSourceServer
s@DeleteSourceServer' {} Text
a -> DeleteSourceServer
s {$sel:sourceServerID:DeleteSourceServer' :: Text
sourceServerID = Text
a} :: DeleteSourceServer)

instance Core.AWSRequest DeleteSourceServer where
  type
    AWSResponse DeleteSourceServer =
      DeleteSourceServerResponse
  request :: (Service -> Service)
-> DeleteSourceServer -> Request DeleteSourceServer
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 DeleteSourceServer
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteSourceServer)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteSourceServerResponse
DeleteSourceServerResponse'
            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))
      )

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

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

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

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

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

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

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

-- |
-- Create a value of 'DeleteSourceServerResponse' 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', 'deleteSourceServerResponse_httpStatus' - The response's http status code.
newDeleteSourceServerResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteSourceServerResponse
newDeleteSourceServerResponse :: Int -> DeleteSourceServerResponse
newDeleteSourceServerResponse Int
pHttpStatus_ =
  DeleteSourceServerResponse'
    { $sel:httpStatus:DeleteSourceServerResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

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

instance Prelude.NFData DeleteSourceServerResponse where
  rnf :: DeleteSourceServerResponse -> ()
rnf DeleteSourceServerResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteSourceServerResponse' :: DeleteSourceServerResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus