{-# 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.SMS.StopAppReplication
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Stops replicating the specified application by deleting the replication
-- job for each server in the application.
module Amazonka.SMS.StopAppReplication
  ( -- * Creating a Request
    StopAppReplication (..),
    newStopAppReplication,

    -- * Request Lenses
    stopAppReplication_appId,

    -- * Destructuring the Response
    StopAppReplicationResponse (..),
    newStopAppReplicationResponse,

    -- * Response Lenses
    stopAppReplicationResponse_httpStatus,
  )
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.SMS.Types

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

-- |
-- Create a value of 'StopAppReplication' 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:
--
-- 'appId', 'stopAppReplication_appId' - The ID of the application.
newStopAppReplication ::
  StopAppReplication
newStopAppReplication :: StopAppReplication
newStopAppReplication =
  StopAppReplication' {$sel:appId:StopAppReplication' :: Maybe Text
appId = forall a. Maybe a
Prelude.Nothing}

-- | The ID of the application.
stopAppReplication_appId :: Lens.Lens' StopAppReplication (Prelude.Maybe Prelude.Text)
stopAppReplication_appId :: Lens' StopAppReplication (Maybe Text)
stopAppReplication_appId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopAppReplication' {Maybe Text
appId :: Maybe Text
$sel:appId:StopAppReplication' :: StopAppReplication -> Maybe Text
appId} -> Maybe Text
appId) (\s :: StopAppReplication
s@StopAppReplication' {} Maybe Text
a -> StopAppReplication
s {$sel:appId:StopAppReplication' :: Maybe Text
appId = Maybe Text
a} :: StopAppReplication)

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

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

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

instance Data.ToJSON StopAppReplication where
  toJSON :: StopAppReplication -> Value
toJSON StopAppReplication' {Maybe Text
appId :: Maybe Text
$sel:appId:StopAppReplication' :: StopAppReplication -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"appId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
appId]
      )

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

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

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

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

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

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