{-# 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.WorkDocs.DeleteNotificationSubscription
-- 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 the specified subscription from the specified organization.
module Amazonka.WorkDocs.DeleteNotificationSubscription
  ( -- * Creating a Request
    DeleteNotificationSubscription (..),
    newDeleteNotificationSubscription,

    -- * Request Lenses
    deleteNotificationSubscription_subscriptionId,
    deleteNotificationSubscription_organizationId,

    -- * Destructuring the Response
    DeleteNotificationSubscriptionResponse (..),
    newDeleteNotificationSubscriptionResponse,
  )
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.WorkDocs.Types

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

-- |
-- Create a value of 'DeleteNotificationSubscription' 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:
--
-- 'subscriptionId', 'deleteNotificationSubscription_subscriptionId' - The ID of the subscription.
--
-- 'organizationId', 'deleteNotificationSubscription_organizationId' - The ID of the organization.
newDeleteNotificationSubscription ::
  -- | 'subscriptionId'
  Prelude.Text ->
  -- | 'organizationId'
  Prelude.Text ->
  DeleteNotificationSubscription
newDeleteNotificationSubscription :: Text -> Text -> DeleteNotificationSubscription
newDeleteNotificationSubscription
  Text
pSubscriptionId_
  Text
pOrganizationId_ =
    DeleteNotificationSubscription' :: Text -> Text -> DeleteNotificationSubscription
DeleteNotificationSubscription'
      { $sel:subscriptionId:DeleteNotificationSubscription' :: Text
subscriptionId =
          Text
pSubscriptionId_,
        $sel:organizationId:DeleteNotificationSubscription' :: Text
organizationId = Text
pOrganizationId_
      }

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

-- | The ID of the organization.
deleteNotificationSubscription_organizationId :: Lens.Lens' DeleteNotificationSubscription Prelude.Text
deleteNotificationSubscription_organizationId :: (Text -> f Text)
-> DeleteNotificationSubscription
-> f DeleteNotificationSubscription
deleteNotificationSubscription_organizationId = (DeleteNotificationSubscription -> Text)
-> (DeleteNotificationSubscription
    -> Text -> DeleteNotificationSubscription)
-> Lens
     DeleteNotificationSubscription
     DeleteNotificationSubscription
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteNotificationSubscription' {Text
organizationId :: Text
$sel:organizationId:DeleteNotificationSubscription' :: DeleteNotificationSubscription -> Text
organizationId} -> Text
organizationId) (\s :: DeleteNotificationSubscription
s@DeleteNotificationSubscription' {} Text
a -> DeleteNotificationSubscription
s {$sel:organizationId:DeleteNotificationSubscription' :: Text
organizationId = Text
a} :: DeleteNotificationSubscription)

instance
  Core.AWSRequest
    DeleteNotificationSubscription
  where
  type
    AWSResponse DeleteNotificationSubscription =
      DeleteNotificationSubscriptionResponse
  request :: DeleteNotificationSubscription
-> Request DeleteNotificationSubscription
request = Service
-> DeleteNotificationSubscription
-> Request DeleteNotificationSubscription
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteNotificationSubscription
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DeleteNotificationSubscription)))
response =
    AWSResponse DeleteNotificationSubscription
-> Logger
-> Service
-> Proxy DeleteNotificationSubscription
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DeleteNotificationSubscription)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      AWSResponse DeleteNotificationSubscription
DeleteNotificationSubscriptionResponse
DeleteNotificationSubscriptionResponse'

instance
  Prelude.Hashable
    DeleteNotificationSubscription

instance
  Prelude.NFData
    DeleteNotificationSubscription

instance
  Core.ToHeaders
    DeleteNotificationSubscription
  where
  toHeaders :: DeleteNotificationSubscription -> [Header]
toHeaders =
    [Header] -> DeleteNotificationSubscription -> [Header]
forall a b. a -> b -> a
Prelude.const
      ( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToPath DeleteNotificationSubscription where
  toPath :: DeleteNotificationSubscription -> ByteString
toPath DeleteNotificationSubscription' {Text
organizationId :: Text
subscriptionId :: Text
$sel:organizationId:DeleteNotificationSubscription' :: DeleteNotificationSubscription -> Text
$sel:subscriptionId:DeleteNotificationSubscription' :: DeleteNotificationSubscription -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/api/v1/organizations/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
organizationId,
        ByteString
"/subscriptions/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
subscriptionId
      ]

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

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

-- |
-- Create a value of 'DeleteNotificationSubscriptionResponse' 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.
newDeleteNotificationSubscriptionResponse ::
  DeleteNotificationSubscriptionResponse
newDeleteNotificationSubscriptionResponse :: DeleteNotificationSubscriptionResponse
newDeleteNotificationSubscriptionResponse =
  DeleteNotificationSubscriptionResponse
DeleteNotificationSubscriptionResponse'

instance
  Prelude.NFData
    DeleteNotificationSubscriptionResponse