{-# 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.SSMSAP.DeregisterApplication
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deregister an SAP application with AWS Systems Manager for SAP. This
-- action does not affect the existing setup of your SAP workloads on Amazon
-- EC2.
module Amazonka.SSMSAP.DeregisterApplication
  ( -- * Creating a Request
    DeregisterApplication (..),
    newDeregisterApplication,

    -- * Request Lenses
    deregisterApplication_applicationId,

    -- * Destructuring the Response
    DeregisterApplicationResponse (..),
    newDeregisterApplicationResponse,

    -- * Response Lenses
    deregisterApplicationResponse_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.SSMSAP.Types

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

-- |
-- Create a value of 'DeregisterApplication' 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:
--
-- 'applicationId', 'deregisterApplication_applicationId' -
newDeregisterApplication ::
  -- | 'applicationId'
  Prelude.Text ->
  DeregisterApplication
newDeregisterApplication :: Text -> DeregisterApplication
newDeregisterApplication Text
pApplicationId_ =
  DeregisterApplication'
    { $sel:applicationId:DeregisterApplication' :: Text
applicationId =
        Text
pApplicationId_
    }

deregisterApplication_applicationId :: Lens.Lens' DeregisterApplication Prelude.Text
deregisterApplication_applicationId :: Lens' DeregisterApplication Text
deregisterApplication_applicationId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeregisterApplication' {Text
applicationId :: Text
$sel:applicationId:DeregisterApplication' :: DeregisterApplication -> Text
applicationId} -> Text
applicationId) (\s :: DeregisterApplication
s@DeregisterApplication' {} Text
a -> DeregisterApplication
s {$sel:applicationId:DeregisterApplication' :: Text
applicationId = Text
a} :: DeregisterApplication)

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

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

instance Data.ToHeaders DeregisterApplication where
  toHeaders :: DeregisterApplication -> 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 DeregisterApplication where
  toJSON :: DeregisterApplication -> Value
toJSON DeregisterApplication' {Text
applicationId :: Text
$sel:applicationId:DeregisterApplication' :: DeregisterApplication -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"ApplicationId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
applicationId)
          ]
      )

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

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

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

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

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

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