{-# 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.Budgets.DeleteNotification
-- 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 a notification.
--
-- Deleting a notification also deletes the subscribers that are associated
-- with the notification.
module Amazonka.Budgets.DeleteNotification
  ( -- * Creating a Request
    DeleteNotification (..),
    newDeleteNotification,

    -- * Request Lenses
    deleteNotification_accountId,
    deleteNotification_budgetName,
    deleteNotification_notification,

    -- * Destructuring the Response
    DeleteNotificationResponse (..),
    newDeleteNotificationResponse,

    -- * Response Lenses
    deleteNotificationResponse_httpStatus,
  )
where

import Amazonka.Budgets.Types
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

-- | Request of DeleteNotification
--
-- /See:/ 'newDeleteNotification' smart constructor.
data DeleteNotification = DeleteNotification'
  { -- | The @accountId@ that is associated with the budget whose notification
    -- you want to delete.
    DeleteNotification -> Text
accountId :: Prelude.Text,
    -- | The name of the budget whose notification you want to delete.
    DeleteNotification -> Text
budgetName :: Prelude.Text,
    -- | The notification that you want to delete.
    DeleteNotification -> Notification
notification :: Notification
  }
  deriving (DeleteNotification -> DeleteNotification -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteNotification -> DeleteNotification -> Bool
$c/= :: DeleteNotification -> DeleteNotification -> Bool
== :: DeleteNotification -> DeleteNotification -> Bool
$c== :: DeleteNotification -> DeleteNotification -> Bool
Prelude.Eq, ReadPrec [DeleteNotification]
ReadPrec DeleteNotification
Int -> ReadS DeleteNotification
ReadS [DeleteNotification]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteNotification]
$creadListPrec :: ReadPrec [DeleteNotification]
readPrec :: ReadPrec DeleteNotification
$creadPrec :: ReadPrec DeleteNotification
readList :: ReadS [DeleteNotification]
$creadList :: ReadS [DeleteNotification]
readsPrec :: Int -> ReadS DeleteNotification
$creadsPrec :: Int -> ReadS DeleteNotification
Prelude.Read, Int -> DeleteNotification -> ShowS
[DeleteNotification] -> ShowS
DeleteNotification -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteNotification] -> ShowS
$cshowList :: [DeleteNotification] -> ShowS
show :: DeleteNotification -> String
$cshow :: DeleteNotification -> String
showsPrec :: Int -> DeleteNotification -> ShowS
$cshowsPrec :: Int -> DeleteNotification -> ShowS
Prelude.Show, forall x. Rep DeleteNotification x -> DeleteNotification
forall x. DeleteNotification -> Rep DeleteNotification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteNotification x -> DeleteNotification
$cfrom :: forall x. DeleteNotification -> Rep DeleteNotification x
Prelude.Generic)

-- |
-- Create a value of 'DeleteNotification' 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:
--
-- 'accountId', 'deleteNotification_accountId' - The @accountId@ that is associated with the budget whose notification
-- you want to delete.
--
-- 'budgetName', 'deleteNotification_budgetName' - The name of the budget whose notification you want to delete.
--
-- 'notification', 'deleteNotification_notification' - The notification that you want to delete.
newDeleteNotification ::
  -- | 'accountId'
  Prelude.Text ->
  -- | 'budgetName'
  Prelude.Text ->
  -- | 'notification'
  Notification ->
  DeleteNotification
newDeleteNotification :: Text -> Text -> Notification -> DeleteNotification
newDeleteNotification
  Text
pAccountId_
  Text
pBudgetName_
  Notification
pNotification_ =
    DeleteNotification'
      { $sel:accountId:DeleteNotification' :: Text
accountId = Text
pAccountId_,
        $sel:budgetName:DeleteNotification' :: Text
budgetName = Text
pBudgetName_,
        $sel:notification:DeleteNotification' :: Notification
notification = Notification
pNotification_
      }

-- | The @accountId@ that is associated with the budget whose notification
-- you want to delete.
deleteNotification_accountId :: Lens.Lens' DeleteNotification Prelude.Text
deleteNotification_accountId :: Lens' DeleteNotification Text
deleteNotification_accountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteNotification' {Text
accountId :: Text
$sel:accountId:DeleteNotification' :: DeleteNotification -> Text
accountId} -> Text
accountId) (\s :: DeleteNotification
s@DeleteNotification' {} Text
a -> DeleteNotification
s {$sel:accountId:DeleteNotification' :: Text
accountId = Text
a} :: DeleteNotification)

-- | The name of the budget whose notification you want to delete.
deleteNotification_budgetName :: Lens.Lens' DeleteNotification Prelude.Text
deleteNotification_budgetName :: Lens' DeleteNotification Text
deleteNotification_budgetName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteNotification' {Text
budgetName :: Text
$sel:budgetName:DeleteNotification' :: DeleteNotification -> Text
budgetName} -> Text
budgetName) (\s :: DeleteNotification
s@DeleteNotification' {} Text
a -> DeleteNotification
s {$sel:budgetName:DeleteNotification' :: Text
budgetName = Text
a} :: DeleteNotification)

-- | The notification that you want to delete.
deleteNotification_notification :: Lens.Lens' DeleteNotification Notification
deleteNotification_notification :: Lens' DeleteNotification Notification
deleteNotification_notification = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteNotification' {Notification
notification :: Notification
$sel:notification:DeleteNotification' :: DeleteNotification -> Notification
notification} -> Notification
notification) (\s :: DeleteNotification
s@DeleteNotification' {} Notification
a -> DeleteNotification
s {$sel:notification:DeleteNotification' :: Notification
notification = Notification
a} :: DeleteNotification)

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

instance Prelude.NFData DeleteNotification where
  rnf :: DeleteNotification -> ()
rnf DeleteNotification' {Text
Notification
notification :: Notification
budgetName :: Text
accountId :: Text
$sel:notification:DeleteNotification' :: DeleteNotification -> Notification
$sel:budgetName:DeleteNotification' :: DeleteNotification -> Text
$sel:accountId:DeleteNotification' :: DeleteNotification -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
accountId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
budgetName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Notification
notification

instance Data.ToHeaders DeleteNotification where
  toHeaders :: DeleteNotification -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AWSBudgetServiceGateway.DeleteNotification" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON DeleteNotification where
  toJSON :: DeleteNotification -> Value
toJSON DeleteNotification' {Text
Notification
notification :: Notification
budgetName :: Text
accountId :: Text
$sel:notification:DeleteNotification' :: DeleteNotification -> Notification
$sel:budgetName:DeleteNotification' :: DeleteNotification -> Text
$sel:accountId:DeleteNotification' :: DeleteNotification -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"AccountId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
accountId),
            forall a. a -> Maybe a
Prelude.Just (Key
"BudgetName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
budgetName),
            forall a. a -> Maybe a
Prelude.Just (Key
"Notification" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Notification
notification)
          ]
      )

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

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

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

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

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

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