{-# 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.RemoveSourceServerAction
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Remove source server post migration custom action.
module Amazonka.MGN.RemoveSourceServerAction
  ( -- * Creating a Request
    RemoveSourceServerAction (..),
    newRemoveSourceServerAction,

    -- * Request Lenses
    removeSourceServerAction_actionID,
    removeSourceServerAction_sourceServerID,

    -- * Destructuring the Response
    RemoveSourceServerActionResponse (..),
    newRemoveSourceServerActionResponse,

    -- * Response Lenses
    removeSourceServerActionResponse_httpStatus,
  )
where

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

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

-- |
-- Create a value of 'RemoveSourceServerAction' 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:
--
-- 'actionID', 'removeSourceServerAction_actionID' - Source server post migration custom action ID to remove.
--
-- 'sourceServerID', 'removeSourceServerAction_sourceServerID' - Source server ID of the post migration custom action to remove.
newRemoveSourceServerAction ::
  -- | 'actionID'
  Prelude.Text ->
  -- | 'sourceServerID'
  Prelude.Text ->
  RemoveSourceServerAction
newRemoveSourceServerAction :: Text -> Text -> RemoveSourceServerAction
newRemoveSourceServerAction
  Text
pActionID_
  Text
pSourceServerID_ =
    RemoveSourceServerAction'
      { $sel:actionID:RemoveSourceServerAction' :: Text
actionID = Text
pActionID_,
        $sel:sourceServerID:RemoveSourceServerAction' :: Text
sourceServerID = Text
pSourceServerID_
      }

-- | Source server post migration custom action ID to remove.
removeSourceServerAction_actionID :: Lens.Lens' RemoveSourceServerAction Prelude.Text
removeSourceServerAction_actionID :: Lens' RemoveSourceServerAction Text
removeSourceServerAction_actionID = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoveSourceServerAction' {Text
actionID :: Text
$sel:actionID:RemoveSourceServerAction' :: RemoveSourceServerAction -> Text
actionID} -> Text
actionID) (\s :: RemoveSourceServerAction
s@RemoveSourceServerAction' {} Text
a -> RemoveSourceServerAction
s {$sel:actionID:RemoveSourceServerAction' :: Text
actionID = Text
a} :: RemoveSourceServerAction)

-- | Source server ID of the post migration custom action to remove.
removeSourceServerAction_sourceServerID :: Lens.Lens' RemoveSourceServerAction Prelude.Text
removeSourceServerAction_sourceServerID :: Lens' RemoveSourceServerAction Text
removeSourceServerAction_sourceServerID = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoveSourceServerAction' {Text
sourceServerID :: Text
$sel:sourceServerID:RemoveSourceServerAction' :: RemoveSourceServerAction -> Text
sourceServerID} -> Text
sourceServerID) (\s :: RemoveSourceServerAction
s@RemoveSourceServerAction' {} Text
a -> RemoveSourceServerAction
s {$sel:sourceServerID:RemoveSourceServerAction' :: Text
sourceServerID = Text
a} :: RemoveSourceServerAction)

instance Core.AWSRequest RemoveSourceServerAction where
  type
    AWSResponse RemoveSourceServerAction =
      RemoveSourceServerActionResponse
  request :: (Service -> Service)
-> RemoveSourceServerAction -> Request RemoveSourceServerAction
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 RemoveSourceServerAction
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse RemoveSourceServerAction)))
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 -> RemoveSourceServerActionResponse
RemoveSourceServerActionResponse'
            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 RemoveSourceServerAction where
  hashWithSalt :: Int -> RemoveSourceServerAction -> Int
hashWithSalt Int
_salt RemoveSourceServerAction' {Text
sourceServerID :: Text
actionID :: Text
$sel:sourceServerID:RemoveSourceServerAction' :: RemoveSourceServerAction -> Text
$sel:actionID:RemoveSourceServerAction' :: RemoveSourceServerAction -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
actionID
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
sourceServerID

instance Prelude.NFData RemoveSourceServerAction where
  rnf :: RemoveSourceServerAction -> ()
rnf RemoveSourceServerAction' {Text
sourceServerID :: Text
actionID :: Text
$sel:sourceServerID:RemoveSourceServerAction' :: RemoveSourceServerAction -> Text
$sel:actionID:RemoveSourceServerAction' :: RemoveSourceServerAction -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
actionID
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
sourceServerID

instance Data.ToHeaders RemoveSourceServerAction where
  toHeaders :: RemoveSourceServerAction -> 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 RemoveSourceServerAction where
  toJSON :: RemoveSourceServerAction -> Value
toJSON RemoveSourceServerAction' {Text
sourceServerID :: Text
actionID :: Text
$sel:sourceServerID:RemoveSourceServerAction' :: RemoveSourceServerAction -> Text
$sel:actionID:RemoveSourceServerAction' :: RemoveSourceServerAction -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"actionID" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
actionID),
            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 RemoveSourceServerAction where
  toPath :: RemoveSourceServerAction -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/RemoveSourceServerAction"

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

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

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

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

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