{-# 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.TerminateApp
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Terminates the stack for the specified application.
module Amazonka.SMS.TerminateApp
  ( -- * Creating a Request
    TerminateApp (..),
    newTerminateApp,

    -- * Request Lenses
    terminateApp_appId,

    -- * Destructuring the Response
    TerminateAppResponse (..),
    newTerminateAppResponse,

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

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

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

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

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

instance Data.ToHeaders TerminateApp where
  toHeaders :: TerminateApp -> 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.TerminateApp" ::
                          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 TerminateApp where
  toJSON :: TerminateApp -> Value
toJSON TerminateApp' {Maybe Text
appId :: Maybe Text
$sel:appId:TerminateApp' :: TerminateApp -> 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 TerminateApp where
  toPath :: TerminateApp -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

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

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

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