{-# 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.MGN.DeleteSourceServer
-- 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 a single source server by ID.
module Amazonka.MGN.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.Lens as Lens
import Amazonka.MGN.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'
  { -- | Request to delete Source Server from service by Server ID.
    DeleteSourceServer -> Text
sourceServerID :: Prelude.Text
  }
  deriving (DeleteSourceServer -> DeleteSourceServer -> Bool
(DeleteSourceServer -> DeleteSourceServer -> Bool)
-> (DeleteSourceServer -> DeleteSourceServer -> Bool)
-> Eq DeleteSourceServer
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]
(Int -> ReadS DeleteSourceServer)
-> ReadS [DeleteSourceServer]
-> ReadPrec DeleteSourceServer
-> ReadPrec [DeleteSourceServer]
-> Read 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
(Int -> DeleteSourceServer -> ShowS)
-> (DeleteSourceServer -> String)
-> ([DeleteSourceServer] -> ShowS)
-> Show DeleteSourceServer
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. DeleteSourceServer -> Rep DeleteSourceServer x)
-> (forall x. Rep DeleteSourceServer x -> DeleteSourceServer)
-> Generic DeleteSourceServer
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' - Request to delete Source Server from service by Server ID.
newDeleteSourceServer ::
  -- | 'sourceServerID'
  Prelude.Text ->
  DeleteSourceServer
newDeleteSourceServer :: Text -> DeleteSourceServer
newDeleteSourceServer Text
pSourceServerID_ =
  DeleteSourceServer' :: Text -> DeleteSourceServer
DeleteSourceServer'
    { $sel:sourceServerID:DeleteSourceServer' :: Text
sourceServerID =
        Text
pSourceServerID_
    }

-- | Request to delete Source Server from service by Server ID.
deleteSourceServer_sourceServerID :: Lens.Lens' DeleteSourceServer Prelude.Text
deleteSourceServer_sourceServerID :: (Text -> f Text) -> DeleteSourceServer -> f DeleteSourceServer
deleteSourceServer_sourceServerID = (DeleteSourceServer -> Text)
-> (DeleteSourceServer -> Text -> DeleteSourceServer)
-> Lens DeleteSourceServer DeleteSourceServer Text Text
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 :: DeleteSourceServer -> Request DeleteSourceServer
request = Service -> DeleteSourceServer -> Request DeleteSourceServer
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteSourceServer
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteSourceServer)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteSourceServer))
-> Logger
-> Service
-> Proxy DeleteSourceServer
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteSourceServer)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteSourceServerResponse
DeleteSourceServerResponse'
            (Int -> DeleteSourceServerResponse)
-> Either String Int -> Either String DeleteSourceServerResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DeleteSourceServer

instance Prelude.NFData DeleteSourceServer

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

instance Core.ToJSON DeleteSourceServer where
  toJSON :: DeleteSourceServer -> Value
toJSON DeleteSourceServer' {Text
sourceServerID :: Text
$sel:sourceServerID:DeleteSourceServer' :: DeleteSourceServer -> 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
"sourceServerID" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
sourceServerID)
          ]
      )

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

instance Core.ToQuery DeleteSourceServer where
  toQuery :: DeleteSourceServer -> QueryString
toQuery = QueryString -> DeleteSourceServer -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(DeleteSourceServerResponse -> DeleteSourceServerResponse -> Bool)
-> (DeleteSourceServerResponse
    -> DeleteSourceServerResponse -> Bool)
-> Eq DeleteSourceServerResponse
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]
(Int -> ReadS DeleteSourceServerResponse)
-> ReadS [DeleteSourceServerResponse]
-> ReadPrec DeleteSourceServerResponse
-> ReadPrec [DeleteSourceServerResponse]
-> Read 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
(Int -> DeleteSourceServerResponse -> ShowS)
-> (DeleteSourceServerResponse -> String)
-> ([DeleteSourceServerResponse] -> ShowS)
-> Show DeleteSourceServerResponse
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.
 DeleteSourceServerResponse -> Rep DeleteSourceServerResponse x)
-> (forall x.
    Rep DeleteSourceServerResponse x -> DeleteSourceServerResponse)
-> Generic DeleteSourceServerResponse
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' :: Int -> DeleteSourceServerResponse
DeleteSourceServerResponse'
    { $sel:httpStatus:DeleteSourceServerResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
deleteSourceServerResponse_httpStatus :: Lens.Lens' DeleteSourceServerResponse Prelude.Int
deleteSourceServerResponse_httpStatus :: (Int -> f Int)
-> DeleteSourceServerResponse -> f DeleteSourceServerResponse
deleteSourceServerResponse_httpStatus = (DeleteSourceServerResponse -> Int)
-> (DeleteSourceServerResponse
    -> Int -> DeleteSourceServerResponse)
-> Lens
     DeleteSourceServerResponse DeleteSourceServerResponse Int Int
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