{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.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.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
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]
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
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.
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'
      { $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 :: Lens' DeleteNotificationSubscription Text
deleteNotificationSubscription_subscriptionId = 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 :: Lens' DeleteNotificationSubscription Text
deleteNotificationSubscription_organizationId = 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 :: (Service -> Service)
-> DeleteNotificationSubscription
-> Request DeleteNotificationSubscription
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.delete (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteNotificationSubscription
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DeleteNotificationSubscription)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      DeleteNotificationSubscriptionResponse
DeleteNotificationSubscriptionResponse'

instance
  Prelude.Hashable
    DeleteNotificationSubscription
  where
  hashWithSalt :: Int -> DeleteNotificationSubscription -> Int
hashWithSalt
    Int
_salt
    DeleteNotificationSubscription' {Text
organizationId :: Text
subscriptionId :: Text
$sel:organizationId:DeleteNotificationSubscription' :: DeleteNotificationSubscription -> Text
$sel:subscriptionId:DeleteNotificationSubscription' :: DeleteNotificationSubscription -> Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
subscriptionId
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
organizationId

instance
  Prelude.NFData
    DeleteNotificationSubscription
  where
  rnf :: DeleteNotificationSubscription -> ()
rnf DeleteNotificationSubscription' {Text
organizationId :: Text
subscriptionId :: Text
$sel:organizationId:DeleteNotificationSubscription' :: DeleteNotificationSubscription -> Text
$sel:subscriptionId:DeleteNotificationSubscription' :: DeleteNotificationSubscription -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
subscriptionId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
organizationId

instance
  Data.ToHeaders
    DeleteNotificationSubscription
  where
  toHeaders :: DeleteNotificationSubscription -> [Header]
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 -> [Header]
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

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

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

-- | /See:/ 'newDeleteNotificationSubscriptionResponse' smart constructor.
data DeleteNotificationSubscriptionResponse = DeleteNotificationSubscriptionResponse'
  {
  }
  deriving (DeleteNotificationSubscriptionResponse
-> DeleteNotificationSubscriptionResponse -> Bool
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]
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
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.
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
  where
  rnf :: DeleteNotificationSubscriptionResponse -> ()
rnf DeleteNotificationSubscriptionResponse
_ = ()