{-# 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-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 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.Lens as Lens
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
(DeleteNotification -> DeleteNotification -> Bool)
-> (DeleteNotification -> DeleteNotification -> Bool)
-> Eq DeleteNotification
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]
(Int -> ReadS DeleteNotification)
-> ReadS [DeleteNotification]
-> ReadPrec DeleteNotification
-> ReadPrec [DeleteNotification]
-> Read 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
(Int -> DeleteNotification -> ShowS)
-> (DeleteNotification -> String)
-> ([DeleteNotification] -> ShowS)
-> Show DeleteNotification
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. DeleteNotification -> Rep DeleteNotification x)
-> (forall x. Rep DeleteNotification x -> DeleteNotification)
-> Generic DeleteNotification
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' :: Text -> Text -> Notification -> DeleteNotification
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 :: (Text -> f Text) -> DeleteNotification -> f DeleteNotification
deleteNotification_accountId = (DeleteNotification -> Text)
-> (DeleteNotification -> Text -> DeleteNotification)
-> Lens DeleteNotification DeleteNotification Text Text
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 :: (Text -> f Text) -> DeleteNotification -> f DeleteNotification
deleteNotification_budgetName = (DeleteNotification -> Text)
-> (DeleteNotification -> Text -> DeleteNotification)
-> Lens DeleteNotification DeleteNotification Text Text
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 :: (Notification -> f Notification)
-> DeleteNotification -> f DeleteNotification
deleteNotification_notification = (DeleteNotification -> Notification)
-> (DeleteNotification -> Notification -> DeleteNotification)
-> Lens
     DeleteNotification DeleteNotification Notification 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 :: DeleteNotification -> Request DeleteNotification
request = Service -> DeleteNotification -> Request DeleteNotification
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteNotification
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteNotification)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteNotification))
-> Logger
-> Service
-> Proxy DeleteNotification
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteNotification)))
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 -> DeleteNotificationResponse
DeleteNotificationResponse'
            (Int -> DeleteNotificationResponse)
-> Either String Int -> Either String DeleteNotificationResponse
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 DeleteNotification

instance Prelude.NFData DeleteNotification

instance Core.ToHeaders DeleteNotification where
  toHeaders :: DeleteNotification -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteNotification -> 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
"AWSBudgetServiceGateway.DeleteNotification" ::
                          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 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
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"AccountId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
accountId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"BudgetName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
budgetName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Notification" Text -> Notification -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Notification
notification)
          ]
      )

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

instance Core.ToQuery DeleteNotification where
  toQuery :: DeleteNotification -> QueryString
toQuery = QueryString -> DeleteNotification -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(DeleteNotificationResponse -> DeleteNotificationResponse -> Bool)
-> (DeleteNotificationResponse
    -> DeleteNotificationResponse -> Bool)
-> Eq DeleteNotificationResponse
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]
(Int -> ReadS DeleteNotificationResponse)
-> ReadS [DeleteNotificationResponse]
-> ReadPrec DeleteNotificationResponse
-> ReadPrec [DeleteNotificationResponse]
-> Read 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
(Int -> DeleteNotificationResponse -> ShowS)
-> (DeleteNotificationResponse -> String)
-> ([DeleteNotificationResponse] -> ShowS)
-> Show DeleteNotificationResponse
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.
 DeleteNotificationResponse -> Rep DeleteNotificationResponse x)
-> (forall x.
    Rep DeleteNotificationResponse x -> DeleteNotificationResponse)
-> Generic DeleteNotificationResponse
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' :: Int -> DeleteNotificationResponse
DeleteNotificationResponse'
    { $sel:httpStatus:DeleteNotificationResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
deleteNotificationResponse_httpStatus :: Lens.Lens' DeleteNotificationResponse Prelude.Int
deleteNotificationResponse_httpStatus :: (Int -> f Int)
-> DeleteNotificationResponse -> f DeleteNotificationResponse
deleteNotificationResponse_httpStatus = (DeleteNotificationResponse -> Int)
-> (DeleteNotificationResponse
    -> Int -> DeleteNotificationResponse)
-> Lens
     DeleteNotificationResponse DeleteNotificationResponse Int Int
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