{-# 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 #-}
module Amazonka.Budgets.UpdateBudget
(
UpdateBudget (..),
newUpdateBudget,
updateBudget_accountId,
updateBudget_newBudget,
UpdateBudgetResponse (..),
newUpdateBudgetResponse,
updateBudgetResponse_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
data UpdateBudget = UpdateBudget'
{
UpdateBudget -> Text
accountId :: Prelude.Text,
UpdateBudget -> Budget
newBudget' :: Budget
}
deriving (UpdateBudget -> UpdateBudget -> Bool
(UpdateBudget -> UpdateBudget -> Bool)
-> (UpdateBudget -> UpdateBudget -> Bool) -> Eq UpdateBudget
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateBudget -> UpdateBudget -> Bool
$c/= :: UpdateBudget -> UpdateBudget -> Bool
== :: UpdateBudget -> UpdateBudget -> Bool
$c== :: UpdateBudget -> UpdateBudget -> Bool
Prelude.Eq, ReadPrec [UpdateBudget]
ReadPrec UpdateBudget
Int -> ReadS UpdateBudget
ReadS [UpdateBudget]
(Int -> ReadS UpdateBudget)
-> ReadS [UpdateBudget]
-> ReadPrec UpdateBudget
-> ReadPrec [UpdateBudget]
-> Read UpdateBudget
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateBudget]
$creadListPrec :: ReadPrec [UpdateBudget]
readPrec :: ReadPrec UpdateBudget
$creadPrec :: ReadPrec UpdateBudget
readList :: ReadS [UpdateBudget]
$creadList :: ReadS [UpdateBudget]
readsPrec :: Int -> ReadS UpdateBudget
$creadsPrec :: Int -> ReadS UpdateBudget
Prelude.Read, Int -> UpdateBudget -> ShowS
[UpdateBudget] -> ShowS
UpdateBudget -> String
(Int -> UpdateBudget -> ShowS)
-> (UpdateBudget -> String)
-> ([UpdateBudget] -> ShowS)
-> Show UpdateBudget
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateBudget] -> ShowS
$cshowList :: [UpdateBudget] -> ShowS
show :: UpdateBudget -> String
$cshow :: UpdateBudget -> String
showsPrec :: Int -> UpdateBudget -> ShowS
$cshowsPrec :: Int -> UpdateBudget -> ShowS
Prelude.Show, (forall x. UpdateBudget -> Rep UpdateBudget x)
-> (forall x. Rep UpdateBudget x -> UpdateBudget)
-> Generic UpdateBudget
forall x. Rep UpdateBudget x -> UpdateBudget
forall x. UpdateBudget -> Rep UpdateBudget x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateBudget x -> UpdateBudget
$cfrom :: forall x. UpdateBudget -> Rep UpdateBudget x
Prelude.Generic)
newUpdateBudget ::
Prelude.Text ->
Budget ->
UpdateBudget
newUpdateBudget :: Text -> Budget -> UpdateBudget
newUpdateBudget Text
pAccountId_ Budget
pNewBudget_ =
UpdateBudget' :: Text -> Budget -> UpdateBudget
UpdateBudget'
{ $sel:accountId:UpdateBudget' :: Text
accountId = Text
pAccountId_,
$sel:newBudget':UpdateBudget' :: Budget
newBudget' = Budget
pNewBudget_
}
updateBudget_accountId :: Lens.Lens' UpdateBudget Prelude.Text
updateBudget_accountId :: (Text -> f Text) -> UpdateBudget -> f UpdateBudget
updateBudget_accountId = (UpdateBudget -> Text)
-> (UpdateBudget -> Text -> UpdateBudget)
-> Lens UpdateBudget UpdateBudget Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateBudget' {Text
accountId :: Text
$sel:accountId:UpdateBudget' :: UpdateBudget -> Text
accountId} -> Text
accountId) (\s :: UpdateBudget
s@UpdateBudget' {} Text
a -> UpdateBudget
s {$sel:accountId:UpdateBudget' :: Text
accountId = Text
a} :: UpdateBudget)
updateBudget_newBudget :: Lens.Lens' UpdateBudget Budget
updateBudget_newBudget :: (Budget -> f Budget) -> UpdateBudget -> f UpdateBudget
updateBudget_newBudget = (UpdateBudget -> Budget)
-> (UpdateBudget -> Budget -> UpdateBudget)
-> Lens UpdateBudget UpdateBudget Budget Budget
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateBudget' {Budget
newBudget' :: Budget
$sel:newBudget':UpdateBudget' :: UpdateBudget -> Budget
newBudget'} -> Budget
newBudget') (\s :: UpdateBudget
s@UpdateBudget' {} Budget
a -> UpdateBudget
s {$sel:newBudget':UpdateBudget' :: Budget
newBudget' = Budget
a} :: UpdateBudget)
instance Core.AWSRequest UpdateBudget where
type AWSResponse UpdateBudget = UpdateBudgetResponse
request :: UpdateBudget -> Request UpdateBudget
request = Service -> UpdateBudget -> Request UpdateBudget
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateBudget
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateBudget)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse UpdateBudget))
-> Logger
-> Service
-> Proxy UpdateBudget
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateBudget)))
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 -> UpdateBudgetResponse
UpdateBudgetResponse'
(Int -> UpdateBudgetResponse)
-> Either String Int -> Either String UpdateBudgetResponse
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 UpdateBudget
instance Prelude.NFData UpdateBudget
instance Core.ToHeaders UpdateBudget where
toHeaders :: UpdateBudget -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateBudget -> 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.UpdateBudget" ::
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 UpdateBudget where
toJSON :: UpdateBudget -> Value
toJSON UpdateBudget' {Text
Budget
newBudget' :: Budget
accountId :: Text
$sel:newBudget':UpdateBudget' :: UpdateBudget -> Budget
$sel:accountId:UpdateBudget' :: UpdateBudget -> 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
"NewBudget" Text -> Budget -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Budget
newBudget')
]
)
instance Core.ToPath UpdateBudget where
toPath :: UpdateBudget -> ByteString
toPath = ByteString -> UpdateBudget -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UpdateBudget where
toQuery :: UpdateBudget -> QueryString
toQuery = QueryString -> UpdateBudget -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateBudgetResponse = UpdateBudgetResponse'
{
UpdateBudgetResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateBudgetResponse -> UpdateBudgetResponse -> Bool
(UpdateBudgetResponse -> UpdateBudgetResponse -> Bool)
-> (UpdateBudgetResponse -> UpdateBudgetResponse -> Bool)
-> Eq UpdateBudgetResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateBudgetResponse -> UpdateBudgetResponse -> Bool
$c/= :: UpdateBudgetResponse -> UpdateBudgetResponse -> Bool
== :: UpdateBudgetResponse -> UpdateBudgetResponse -> Bool
$c== :: UpdateBudgetResponse -> UpdateBudgetResponse -> Bool
Prelude.Eq, ReadPrec [UpdateBudgetResponse]
ReadPrec UpdateBudgetResponse
Int -> ReadS UpdateBudgetResponse
ReadS [UpdateBudgetResponse]
(Int -> ReadS UpdateBudgetResponse)
-> ReadS [UpdateBudgetResponse]
-> ReadPrec UpdateBudgetResponse
-> ReadPrec [UpdateBudgetResponse]
-> Read UpdateBudgetResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateBudgetResponse]
$creadListPrec :: ReadPrec [UpdateBudgetResponse]
readPrec :: ReadPrec UpdateBudgetResponse
$creadPrec :: ReadPrec UpdateBudgetResponse
readList :: ReadS [UpdateBudgetResponse]
$creadList :: ReadS [UpdateBudgetResponse]
readsPrec :: Int -> ReadS UpdateBudgetResponse
$creadsPrec :: Int -> ReadS UpdateBudgetResponse
Prelude.Read, Int -> UpdateBudgetResponse -> ShowS
[UpdateBudgetResponse] -> ShowS
UpdateBudgetResponse -> String
(Int -> UpdateBudgetResponse -> ShowS)
-> (UpdateBudgetResponse -> String)
-> ([UpdateBudgetResponse] -> ShowS)
-> Show UpdateBudgetResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateBudgetResponse] -> ShowS
$cshowList :: [UpdateBudgetResponse] -> ShowS
show :: UpdateBudgetResponse -> String
$cshow :: UpdateBudgetResponse -> String
showsPrec :: Int -> UpdateBudgetResponse -> ShowS
$cshowsPrec :: Int -> UpdateBudgetResponse -> ShowS
Prelude.Show, (forall x. UpdateBudgetResponse -> Rep UpdateBudgetResponse x)
-> (forall x. Rep UpdateBudgetResponse x -> UpdateBudgetResponse)
-> Generic UpdateBudgetResponse
forall x. Rep UpdateBudgetResponse x -> UpdateBudgetResponse
forall x. UpdateBudgetResponse -> Rep UpdateBudgetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateBudgetResponse x -> UpdateBudgetResponse
$cfrom :: forall x. UpdateBudgetResponse -> Rep UpdateBudgetResponse x
Prelude.Generic)
newUpdateBudgetResponse ::
Prelude.Int ->
UpdateBudgetResponse
newUpdateBudgetResponse :: Int -> UpdateBudgetResponse
newUpdateBudgetResponse Int
pHttpStatus_ =
UpdateBudgetResponse' :: Int -> UpdateBudgetResponse
UpdateBudgetResponse' {$sel:httpStatus:UpdateBudgetResponse' :: Int
httpStatus = Int
pHttpStatus_}
updateBudgetResponse_httpStatus :: Lens.Lens' UpdateBudgetResponse Prelude.Int
updateBudgetResponse_httpStatus :: (Int -> f Int) -> UpdateBudgetResponse -> f UpdateBudgetResponse
updateBudgetResponse_httpStatus = (UpdateBudgetResponse -> Int)
-> (UpdateBudgetResponse -> Int -> UpdateBudgetResponse)
-> Lens UpdateBudgetResponse UpdateBudgetResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateBudgetResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateBudgetResponse' :: UpdateBudgetResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateBudgetResponse
s@UpdateBudgetResponse' {} Int
a -> UpdateBudgetResponse
s {$sel:httpStatus:UpdateBudgetResponse' :: Int
httpStatus = Int
a} :: UpdateBudgetResponse)
instance Prelude.NFData UpdateBudgetResponse