{-# 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.DeleteBudget
-- 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 budget. You can delete your budget at any time.
--
-- Deleting a budget also deletes the notifications and subscribers that
-- are associated with that budget.
module Amazonka.Budgets.DeleteBudget
  ( -- * Creating a Request
    DeleteBudget (..),
    newDeleteBudget,

    -- * Request Lenses
    deleteBudget_accountId,
    deleteBudget_budgetName,

    -- * Destructuring the Response
    DeleteBudgetResponse (..),
    newDeleteBudgetResponse,

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

-- |
-- Create a value of 'DeleteBudget' 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', 'deleteBudget_accountId' - The @accountId@ that is associated with the budget that you want to
-- delete.
--
-- 'budgetName', 'deleteBudget_budgetName' - The name of the budget that you want to delete.
newDeleteBudget ::
  -- | 'accountId'
  Prelude.Text ->
  -- | 'budgetName'
  Prelude.Text ->
  DeleteBudget
newDeleteBudget :: Text -> Text -> DeleteBudget
newDeleteBudget Text
pAccountId_ Text
pBudgetName_ =
  DeleteBudget'
    { $sel:accountId:DeleteBudget' :: Text
accountId = Text
pAccountId_,
      $sel:budgetName:DeleteBudget' :: Text
budgetName = Text
pBudgetName_
    }

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

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

instance Core.AWSRequest DeleteBudget where
  type AWSResponse DeleteBudget = DeleteBudgetResponse
  request :: (Service -> Service) -> DeleteBudget -> Request DeleteBudget
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 DeleteBudget
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteBudget)))
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 -> DeleteBudgetResponse
DeleteBudgetResponse'
            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 DeleteBudget where
  hashWithSalt :: Int -> DeleteBudget -> Int
hashWithSalt Int
_salt DeleteBudget' {Text
budgetName :: Text
accountId :: Text
$sel:budgetName:DeleteBudget' :: DeleteBudget -> Text
$sel:accountId:DeleteBudget' :: DeleteBudget -> 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

instance Prelude.NFData DeleteBudget where
  rnf :: DeleteBudget -> ()
rnf DeleteBudget' {Text
budgetName :: Text
accountId :: Text
$sel:budgetName:DeleteBudget' :: DeleteBudget -> Text
$sel:accountId:DeleteBudget' :: DeleteBudget -> 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

instance Data.ToHeaders DeleteBudget where
  toHeaders :: DeleteBudget -> 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.DeleteBudget" ::
                          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 DeleteBudget where
  toJSON :: DeleteBudget -> Value
toJSON DeleteBudget' {Text
budgetName :: Text
accountId :: Text
$sel:budgetName:DeleteBudget' :: DeleteBudget -> Text
$sel:accountId:DeleteBudget' :: DeleteBudget -> 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)
          ]
      )

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

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

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

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

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

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