{-# 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.SSM.DeleteActivation
-- 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)
--
-- Deletes an activation. You aren\'t required to delete an activation. If
-- you delete an activation, you can no longer use it to register
-- additional managed instances. Deleting an activation doesn\'t
-- de-register managed instances. You must manually de-register managed
-- instances.
module Amazonka.SSM.DeleteActivation
  ( -- * Creating a Request
    DeleteActivation (..),
    newDeleteActivation,

    -- * Request Lenses
    deleteActivation_activationId,

    -- * Destructuring the Response
    DeleteActivationResponse (..),
    newDeleteActivationResponse,

    -- * Response Lenses
    deleteActivationResponse_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.SSM.Types

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

-- |
-- Create a value of 'DeleteActivation' 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:
--
-- 'activationId', 'deleteActivation_activationId' - The ID of the activation that you want to delete.
newDeleteActivation ::
  -- | 'activationId'
  Prelude.Text ->
  DeleteActivation
newDeleteActivation :: Text -> DeleteActivation
newDeleteActivation Text
pActivationId_ =
  DeleteActivation' :: Text -> DeleteActivation
DeleteActivation' {$sel:activationId:DeleteActivation' :: Text
activationId = Text
pActivationId_}

-- | The ID of the activation that you want to delete.
deleteActivation_activationId :: Lens.Lens' DeleteActivation Prelude.Text
deleteActivation_activationId :: (Text -> f Text) -> DeleteActivation -> f DeleteActivation
deleteActivation_activationId = (DeleteActivation -> Text)
-> (DeleteActivation -> Text -> DeleteActivation)
-> Lens DeleteActivation DeleteActivation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteActivation' {Text
activationId :: Text
$sel:activationId:DeleteActivation' :: DeleteActivation -> Text
activationId} -> Text
activationId) (\s :: DeleteActivation
s@DeleteActivation' {} Text
a -> DeleteActivation
s {$sel:activationId:DeleteActivation' :: Text
activationId = Text
a} :: DeleteActivation)

instance Core.AWSRequest DeleteActivation where
  type
    AWSResponse DeleteActivation =
      DeleteActivationResponse
  request :: DeleteActivation -> Request DeleteActivation
request = Service -> DeleteActivation -> Request DeleteActivation
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteActivation
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteActivation)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteActivation))
-> Logger
-> Service
-> Proxy DeleteActivation
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteActivation)))
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 -> DeleteActivationResponse
DeleteActivationResponse'
            (Int -> DeleteActivationResponse)
-> Either String Int -> Either String DeleteActivationResponse
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 DeleteActivation

instance Prelude.NFData DeleteActivation

instance Core.ToHeaders DeleteActivation where
  toHeaders :: DeleteActivation -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteActivation -> 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
"AmazonSSM.DeleteActivation" :: 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 DeleteActivation where
  toJSON :: DeleteActivation -> Value
toJSON DeleteActivation' {Text
activationId :: Text
$sel:activationId:DeleteActivation' :: DeleteActivation -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ActivationId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
activationId)]
      )

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

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

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

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

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

instance Prelude.NFData DeleteActivationResponse