{-# 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.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
data UpdateBudget = UpdateBudget'
{
UpdateBudget -> Text
accountId :: Prelude.Text,
UpdateBudget -> Budget
newBudget' :: Budget
}
deriving (UpdateBudget -> UpdateBudget -> Bool
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]
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
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. 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'
{ $sel:accountId:UpdateBudget' :: Text
accountId = Text
pAccountId_,
$sel:newBudget':UpdateBudget' :: Budget
newBudget' = Budget
pNewBudget_
}
updateBudget_accountId :: Lens.Lens' UpdateBudget Prelude.Text
updateBudget_accountId :: Lens' UpdateBudget Text
updateBudget_accountId = 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 :: Lens' UpdateBudget Budget
updateBudget_newBudget = 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 :: (Service -> Service) -> UpdateBudget -> Request UpdateBudget
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 UpdateBudget
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateBudget)))
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 -> UpdateBudgetResponse
UpdateBudgetResponse'
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 UpdateBudget where
hashWithSalt :: Int -> UpdateBudget -> Int
hashWithSalt Int
_salt UpdateBudget' {Text
Budget
newBudget' :: Budget
accountId :: Text
$sel:newBudget':UpdateBudget' :: UpdateBudget -> Budget
$sel:accountId:UpdateBudget' :: UpdateBudget -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
accountId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Budget
newBudget'
instance Prelude.NFData UpdateBudget where
rnf :: UpdateBudget -> ()
rnf UpdateBudget' {Text
Budget
newBudget' :: Budget
accountId :: Text
$sel:newBudget':UpdateBudget' :: UpdateBudget -> Budget
$sel:accountId:UpdateBudget' :: UpdateBudget -> 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 Budget
newBudget'
instance Data.ToHeaders UpdateBudget where
toHeaders :: UpdateBudget -> 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.UpdateBudget" ::
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 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
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
"NewBudget" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Budget
newBudget')
]
)
instance Data.ToPath UpdateBudget where
toPath :: UpdateBudget -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery UpdateBudget where
toQuery :: UpdateBudget -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data UpdateBudgetResponse = UpdateBudgetResponse'
{
UpdateBudgetResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateBudgetResponse -> UpdateBudgetResponse -> Bool
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]
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
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. 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' {$sel:httpStatus:UpdateBudgetResponse' :: Int
httpStatus = Int
pHttpStatus_}
updateBudgetResponse_httpStatus :: Lens.Lens' UpdateBudgetResponse Prelude.Int
updateBudgetResponse_httpStatus :: Lens' UpdateBudgetResponse Int
updateBudgetResponse_httpStatus = 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 where
rnf :: UpdateBudgetResponse -> ()
rnf UpdateBudgetResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateBudgetResponse' :: UpdateBudgetResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus