{-# 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.ServiceCatalog.DisassociateBudgetFromResource
-- 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)
--
-- Disassociates the specified budget from the specified resource.
module Amazonka.ServiceCatalog.DisassociateBudgetFromResource
  ( -- * Creating a Request
    DisassociateBudgetFromResource (..),
    newDisassociateBudgetFromResource,

    -- * Request Lenses
    disassociateBudgetFromResource_budgetName,
    disassociateBudgetFromResource_resourceId,

    -- * Destructuring the Response
    DisassociateBudgetFromResourceResponse (..),
    newDisassociateBudgetFromResourceResponse,

    -- * Response Lenses
    disassociateBudgetFromResourceResponse_httpStatus,
  )
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.ServiceCatalog.Types

-- | /See:/ 'newDisassociateBudgetFromResource' smart constructor.
data DisassociateBudgetFromResource = DisassociateBudgetFromResource'
  { -- | The name of the budget you want to disassociate.
    DisassociateBudgetFromResource -> Text
budgetName :: Prelude.Text,
    -- | The resource identifier you want to disassociate from. Either a
    -- portfolio-id or a product-id.
    DisassociateBudgetFromResource -> Text
resourceId :: Prelude.Text
  }
  deriving (DisassociateBudgetFromResource
-> DisassociateBudgetFromResource -> Bool
(DisassociateBudgetFromResource
 -> DisassociateBudgetFromResource -> Bool)
-> (DisassociateBudgetFromResource
    -> DisassociateBudgetFromResource -> Bool)
-> Eq DisassociateBudgetFromResource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisassociateBudgetFromResource
-> DisassociateBudgetFromResource -> Bool
$c/= :: DisassociateBudgetFromResource
-> DisassociateBudgetFromResource -> Bool
== :: DisassociateBudgetFromResource
-> DisassociateBudgetFromResource -> Bool
$c== :: DisassociateBudgetFromResource
-> DisassociateBudgetFromResource -> Bool
Prelude.Eq, ReadPrec [DisassociateBudgetFromResource]
ReadPrec DisassociateBudgetFromResource
Int -> ReadS DisassociateBudgetFromResource
ReadS [DisassociateBudgetFromResource]
(Int -> ReadS DisassociateBudgetFromResource)
-> ReadS [DisassociateBudgetFromResource]
-> ReadPrec DisassociateBudgetFromResource
-> ReadPrec [DisassociateBudgetFromResource]
-> Read DisassociateBudgetFromResource
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisassociateBudgetFromResource]
$creadListPrec :: ReadPrec [DisassociateBudgetFromResource]
readPrec :: ReadPrec DisassociateBudgetFromResource
$creadPrec :: ReadPrec DisassociateBudgetFromResource
readList :: ReadS [DisassociateBudgetFromResource]
$creadList :: ReadS [DisassociateBudgetFromResource]
readsPrec :: Int -> ReadS DisassociateBudgetFromResource
$creadsPrec :: Int -> ReadS DisassociateBudgetFromResource
Prelude.Read, Int -> DisassociateBudgetFromResource -> ShowS
[DisassociateBudgetFromResource] -> ShowS
DisassociateBudgetFromResource -> String
(Int -> DisassociateBudgetFromResource -> ShowS)
-> (DisassociateBudgetFromResource -> String)
-> ([DisassociateBudgetFromResource] -> ShowS)
-> Show DisassociateBudgetFromResource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisassociateBudgetFromResource] -> ShowS
$cshowList :: [DisassociateBudgetFromResource] -> ShowS
show :: DisassociateBudgetFromResource -> String
$cshow :: DisassociateBudgetFromResource -> String
showsPrec :: Int -> DisassociateBudgetFromResource -> ShowS
$cshowsPrec :: Int -> DisassociateBudgetFromResource -> ShowS
Prelude.Show, (forall x.
 DisassociateBudgetFromResource
 -> Rep DisassociateBudgetFromResource x)
-> (forall x.
    Rep DisassociateBudgetFromResource x
    -> DisassociateBudgetFromResource)
-> Generic DisassociateBudgetFromResource
forall x.
Rep DisassociateBudgetFromResource x
-> DisassociateBudgetFromResource
forall x.
DisassociateBudgetFromResource
-> Rep DisassociateBudgetFromResource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DisassociateBudgetFromResource x
-> DisassociateBudgetFromResource
$cfrom :: forall x.
DisassociateBudgetFromResource
-> Rep DisassociateBudgetFromResource x
Prelude.Generic)

-- |
-- Create a value of 'DisassociateBudgetFromResource' 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:
--
-- 'budgetName', 'disassociateBudgetFromResource_budgetName' - The name of the budget you want to disassociate.
--
-- 'resourceId', 'disassociateBudgetFromResource_resourceId' - The resource identifier you want to disassociate from. Either a
-- portfolio-id or a product-id.
newDisassociateBudgetFromResource ::
  -- | 'budgetName'
  Prelude.Text ->
  -- | 'resourceId'
  Prelude.Text ->
  DisassociateBudgetFromResource
newDisassociateBudgetFromResource :: Text -> Text -> DisassociateBudgetFromResource
newDisassociateBudgetFromResource
  Text
pBudgetName_
  Text
pResourceId_ =
    DisassociateBudgetFromResource' :: Text -> Text -> DisassociateBudgetFromResource
DisassociateBudgetFromResource'
      { $sel:budgetName:DisassociateBudgetFromResource' :: Text
budgetName =
          Text
pBudgetName_,
        $sel:resourceId:DisassociateBudgetFromResource' :: Text
resourceId = Text
pResourceId_
      }

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

-- | The resource identifier you want to disassociate from. Either a
-- portfolio-id or a product-id.
disassociateBudgetFromResource_resourceId :: Lens.Lens' DisassociateBudgetFromResource Prelude.Text
disassociateBudgetFromResource_resourceId :: (Text -> f Text)
-> DisassociateBudgetFromResource
-> f DisassociateBudgetFromResource
disassociateBudgetFromResource_resourceId = (DisassociateBudgetFromResource -> Text)
-> (DisassociateBudgetFromResource
    -> Text -> DisassociateBudgetFromResource)
-> Lens
     DisassociateBudgetFromResource
     DisassociateBudgetFromResource
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociateBudgetFromResource' {Text
resourceId :: Text
$sel:resourceId:DisassociateBudgetFromResource' :: DisassociateBudgetFromResource -> Text
resourceId} -> Text
resourceId) (\s :: DisassociateBudgetFromResource
s@DisassociateBudgetFromResource' {} Text
a -> DisassociateBudgetFromResource
s {$sel:resourceId:DisassociateBudgetFromResource' :: Text
resourceId = Text
a} :: DisassociateBudgetFromResource)

instance
  Core.AWSRequest
    DisassociateBudgetFromResource
  where
  type
    AWSResponse DisassociateBudgetFromResource =
      DisassociateBudgetFromResourceResponse
  request :: DisassociateBudgetFromResource
-> Request DisassociateBudgetFromResource
request = Service
-> DisassociateBudgetFromResource
-> Request DisassociateBudgetFromResource
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DisassociateBudgetFromResource
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DisassociateBudgetFromResource)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DisassociateBudgetFromResource))
-> Logger
-> Service
-> Proxy DisassociateBudgetFromResource
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DisassociateBudgetFromResource)))
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 -> DisassociateBudgetFromResourceResponse
DisassociateBudgetFromResourceResponse'
            (Int -> DisassociateBudgetFromResourceResponse)
-> Either String Int
-> Either String DisassociateBudgetFromResourceResponse
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
    DisassociateBudgetFromResource

instance
  Prelude.NFData
    DisassociateBudgetFromResource

instance
  Core.ToHeaders
    DisassociateBudgetFromResource
  where
  toHeaders :: DisassociateBudgetFromResource -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> DisassociateBudgetFromResource -> 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
"AWS242ServiceCatalogService.DisassociateBudgetFromResource" ::
                          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 DisassociateBudgetFromResource where
  toJSON :: DisassociateBudgetFromResource -> Value
toJSON DisassociateBudgetFromResource' {Text
resourceId :: Text
budgetName :: Text
$sel:resourceId:DisassociateBudgetFromResource' :: DisassociateBudgetFromResource -> Text
$sel:budgetName:DisassociateBudgetFromResource' :: DisassociateBudgetFromResource -> 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
"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
"ResourceId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resourceId)
          ]
      )

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

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

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

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

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

instance
  Prelude.NFData
    DisassociateBudgetFromResourceResponse