{-# 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.Greengrass.DeleteSubscriptionDefinition
-- 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 a subscription definition.
module Amazonka.Greengrass.DeleteSubscriptionDefinition
  ( -- * Creating a Request
    DeleteSubscriptionDefinition (..),
    newDeleteSubscriptionDefinition,

    -- * Request Lenses
    deleteSubscriptionDefinition_subscriptionDefinitionId,

    -- * Destructuring the Response
    DeleteSubscriptionDefinitionResponse (..),
    newDeleteSubscriptionDefinitionResponse,

    -- * Response Lenses
    deleteSubscriptionDefinitionResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.Greengrass.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

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

-- |
-- Create a value of 'DeleteSubscriptionDefinition' 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:
--
-- 'subscriptionDefinitionId', 'deleteSubscriptionDefinition_subscriptionDefinitionId' - The ID of the subscription definition.
newDeleteSubscriptionDefinition ::
  -- | 'subscriptionDefinitionId'
  Prelude.Text ->
  DeleteSubscriptionDefinition
newDeleteSubscriptionDefinition :: Text -> DeleteSubscriptionDefinition
newDeleteSubscriptionDefinition
  Text
pSubscriptionDefinitionId_ =
    DeleteSubscriptionDefinition' :: Text -> DeleteSubscriptionDefinition
DeleteSubscriptionDefinition'
      { $sel:subscriptionDefinitionId:DeleteSubscriptionDefinition' :: Text
subscriptionDefinitionId =
          Text
pSubscriptionDefinitionId_
      }

-- | The ID of the subscription definition.
deleteSubscriptionDefinition_subscriptionDefinitionId :: Lens.Lens' DeleteSubscriptionDefinition Prelude.Text
deleteSubscriptionDefinition_subscriptionDefinitionId :: (Text -> f Text)
-> DeleteSubscriptionDefinition -> f DeleteSubscriptionDefinition
deleteSubscriptionDefinition_subscriptionDefinitionId = (DeleteSubscriptionDefinition -> Text)
-> (DeleteSubscriptionDefinition
    -> Text -> DeleteSubscriptionDefinition)
-> Lens
     DeleteSubscriptionDefinition DeleteSubscriptionDefinition Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSubscriptionDefinition' {Text
subscriptionDefinitionId :: Text
$sel:subscriptionDefinitionId:DeleteSubscriptionDefinition' :: DeleteSubscriptionDefinition -> Text
subscriptionDefinitionId} -> Text
subscriptionDefinitionId) (\s :: DeleteSubscriptionDefinition
s@DeleteSubscriptionDefinition' {} Text
a -> DeleteSubscriptionDefinition
s {$sel:subscriptionDefinitionId:DeleteSubscriptionDefinition' :: Text
subscriptionDefinitionId = Text
a} :: DeleteSubscriptionDefinition)

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

instance Prelude.NFData DeleteSubscriptionDefinition

instance Core.ToHeaders DeleteSubscriptionDefinition where
  toHeaders :: DeleteSubscriptionDefinition -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteSubscriptionDefinition -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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.ToPath DeleteSubscriptionDefinition where
  toPath :: DeleteSubscriptionDefinition -> ByteString
toPath DeleteSubscriptionDefinition' {Text
subscriptionDefinitionId :: Text
$sel:subscriptionDefinitionId:DeleteSubscriptionDefinition' :: DeleteSubscriptionDefinition -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/greengrass/definition/subscriptions/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
subscriptionDefinitionId
      ]

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

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

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

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

instance
  Prelude.NFData
    DeleteSubscriptionDefinitionResponse