{-# 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-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)
--
-- 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.Lens as Lens
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
(StopAppReplication -> StopAppReplication -> Bool)
-> (StopAppReplication -> StopAppReplication -> Bool)
-> Eq StopAppReplication
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]
(Int -> ReadS StopAppReplication)
-> ReadS [StopAppReplication]
-> ReadPrec StopAppReplication
-> ReadPrec [StopAppReplication]
-> Read 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
(Int -> StopAppReplication -> ShowS)
-> (StopAppReplication -> String)
-> ([StopAppReplication] -> ShowS)
-> Show StopAppReplication
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. StopAppReplication -> Rep StopAppReplication x)
-> (forall x. Rep StopAppReplication x -> StopAppReplication)
-> Generic StopAppReplication
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' :: Maybe Text -> StopAppReplication
StopAppReplication' {$sel:appId:StopAppReplication' :: Maybe Text
appId = Maybe Text
forall a. Maybe a
Prelude.Nothing}

-- | The ID of the application.
stopAppReplication_appId :: Lens.Lens' StopAppReplication (Prelude.Maybe Prelude.Text)
stopAppReplication_appId :: (Maybe Text -> f (Maybe Text))
-> StopAppReplication -> f StopAppReplication
stopAppReplication_appId = (StopAppReplication -> Maybe Text)
-> (StopAppReplication -> Maybe Text -> StopAppReplication)
-> Lens
     StopAppReplication StopAppReplication (Maybe Text) (Maybe Text)
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 :: StopAppReplication -> Request StopAppReplication
request = Service -> StopAppReplication -> Request StopAppReplication
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy StopAppReplication
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StopAppReplication)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse StopAppReplication))
-> Logger
-> Service
-> Proxy StopAppReplication
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StopAppReplication)))
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 -> StopAppReplicationResponse
StopAppReplicationResponse'
            (Int -> StopAppReplicationResponse)
-> Either String Int -> Either String StopAppReplicationResponse
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 StopAppReplication

instance Prelude.NFData StopAppReplication

instance Core.ToHeaders StopAppReplication where
  toHeaders :: StopAppReplication -> ResponseHeaders
toHeaders =
    ResponseHeaders -> StopAppReplication -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AWSServerMigrationService_V2016_10_24.StopAppReplication" ::
                          Prelude.ByteString
                      ),
            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 StopAppReplication where
  toJSON :: StopAppReplication -> Value
toJSON StopAppReplication' {Maybe Text
appId :: Maybe Text
$sel:appId:StopAppReplication' :: StopAppReplication -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"appId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
appId]
      )

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

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

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