{-# 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.UpdateNotification
(
UpdateNotification (..),
newUpdateNotification,
updateNotification_accountId,
updateNotification_budgetName,
updateNotification_oldNotification,
updateNotification_newNotification,
UpdateNotificationResponse (..),
newUpdateNotificationResponse,
updateNotificationResponse_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 UpdateNotification = UpdateNotification'
{
UpdateNotification -> Text
accountId :: Prelude.Text,
UpdateNotification -> Text
budgetName :: Prelude.Text,
UpdateNotification -> Notification
oldNotification :: Notification,
UpdateNotification -> Notification
newNotification' :: Notification
}
deriving (UpdateNotification -> UpdateNotification -> Bool
(UpdateNotification -> UpdateNotification -> Bool)
-> (UpdateNotification -> UpdateNotification -> Bool)
-> Eq UpdateNotification
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateNotification -> UpdateNotification -> Bool
$c/= :: UpdateNotification -> UpdateNotification -> Bool
== :: UpdateNotification -> UpdateNotification -> Bool
$c== :: UpdateNotification -> UpdateNotification -> Bool
Prelude.Eq, ReadPrec [UpdateNotification]
ReadPrec UpdateNotification
Int -> ReadS UpdateNotification
ReadS [UpdateNotification]
(Int -> ReadS UpdateNotification)
-> ReadS [UpdateNotification]
-> ReadPrec UpdateNotification
-> ReadPrec [UpdateNotification]
-> Read UpdateNotification
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateNotification]
$creadListPrec :: ReadPrec [UpdateNotification]
readPrec :: ReadPrec UpdateNotification
$creadPrec :: ReadPrec UpdateNotification
readList :: ReadS [UpdateNotification]
$creadList :: ReadS [UpdateNotification]
readsPrec :: Int -> ReadS UpdateNotification
$creadsPrec :: Int -> ReadS UpdateNotification
Prelude.Read, Int -> UpdateNotification -> ShowS
[UpdateNotification] -> ShowS
UpdateNotification -> String
(Int -> UpdateNotification -> ShowS)
-> (UpdateNotification -> String)
-> ([UpdateNotification] -> ShowS)
-> Show UpdateNotification
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateNotification] -> ShowS
$cshowList :: [UpdateNotification] -> ShowS
show :: UpdateNotification -> String
$cshow :: UpdateNotification -> String
showsPrec :: Int -> UpdateNotification -> ShowS
$cshowsPrec :: Int -> UpdateNotification -> ShowS
Prelude.Show, (forall x. UpdateNotification -> Rep UpdateNotification x)
-> (forall x. Rep UpdateNotification x -> UpdateNotification)
-> Generic UpdateNotification
forall x. Rep UpdateNotification x -> UpdateNotification
forall x. UpdateNotification -> Rep UpdateNotification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateNotification x -> UpdateNotification
$cfrom :: forall x. UpdateNotification -> Rep UpdateNotification x
Prelude.Generic)
newUpdateNotification ::
Prelude.Text ->
Prelude.Text ->
Notification ->
Notification ->
UpdateNotification
newUpdateNotification :: Text -> Text -> Notification -> Notification -> UpdateNotification
newUpdateNotification
Text
pAccountId_
Text
pBudgetName_
Notification
pOldNotification_
Notification
pNewNotification_ =
UpdateNotification' :: Text -> Text -> Notification -> Notification -> UpdateNotification
UpdateNotification'
{ $sel:accountId:UpdateNotification' :: Text
accountId = Text
pAccountId_,
$sel:budgetName:UpdateNotification' :: Text
budgetName = Text
pBudgetName_,
$sel:oldNotification:UpdateNotification' :: Notification
oldNotification = Notification
pOldNotification_,
$sel:newNotification':UpdateNotification' :: Notification
newNotification' = Notification
pNewNotification_
}
updateNotification_accountId :: Lens.Lens' UpdateNotification Prelude.Text
updateNotification_accountId :: (Text -> f Text) -> UpdateNotification -> f UpdateNotification
updateNotification_accountId = (UpdateNotification -> Text)
-> (UpdateNotification -> Text -> UpdateNotification)
-> Lens UpdateNotification UpdateNotification Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateNotification' {Text
accountId :: Text
$sel:accountId:UpdateNotification' :: UpdateNotification -> Text
accountId} -> Text
accountId) (\s :: UpdateNotification
s@UpdateNotification' {} Text
a -> UpdateNotification
s {$sel:accountId:UpdateNotification' :: Text
accountId = Text
a} :: UpdateNotification)
updateNotification_budgetName :: Lens.Lens' UpdateNotification Prelude.Text
updateNotification_budgetName :: (Text -> f Text) -> UpdateNotification -> f UpdateNotification
updateNotification_budgetName = (UpdateNotification -> Text)
-> (UpdateNotification -> Text -> UpdateNotification)
-> Lens UpdateNotification UpdateNotification Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateNotification' {Text
budgetName :: Text
$sel:budgetName:UpdateNotification' :: UpdateNotification -> Text
budgetName} -> Text
budgetName) (\s :: UpdateNotification
s@UpdateNotification' {} Text
a -> UpdateNotification
s {$sel:budgetName:UpdateNotification' :: Text
budgetName = Text
a} :: UpdateNotification)
updateNotification_oldNotification :: Lens.Lens' UpdateNotification Notification
updateNotification_oldNotification :: (Notification -> f Notification)
-> UpdateNotification -> f UpdateNotification
updateNotification_oldNotification = (UpdateNotification -> Notification)
-> (UpdateNotification -> Notification -> UpdateNotification)
-> Lens
UpdateNotification UpdateNotification Notification Notification
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateNotification' {Notification
oldNotification :: Notification
$sel:oldNotification:UpdateNotification' :: UpdateNotification -> Notification
oldNotification} -> Notification
oldNotification) (\s :: UpdateNotification
s@UpdateNotification' {} Notification
a -> UpdateNotification
s {$sel:oldNotification:UpdateNotification' :: Notification
oldNotification = Notification
a} :: UpdateNotification)
updateNotification_newNotification :: Lens.Lens' UpdateNotification Notification
updateNotification_newNotification :: (Notification -> f Notification)
-> UpdateNotification -> f UpdateNotification
updateNotification_newNotification = (UpdateNotification -> Notification)
-> (UpdateNotification -> Notification -> UpdateNotification)
-> Lens
UpdateNotification UpdateNotification Notification Notification
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateNotification' {Notification
newNotification' :: Notification
$sel:newNotification':UpdateNotification' :: UpdateNotification -> Notification
newNotification'} -> Notification
newNotification') (\s :: UpdateNotification
s@UpdateNotification' {} Notification
a -> UpdateNotification
s {$sel:newNotification':UpdateNotification' :: Notification
newNotification' = Notification
a} :: UpdateNotification)
instance Core.AWSRequest UpdateNotification where
type
AWSResponse UpdateNotification =
UpdateNotificationResponse
request :: UpdateNotification -> Request UpdateNotification
request = Service -> UpdateNotification -> Request UpdateNotification
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateNotification
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateNotification)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse UpdateNotification))
-> Logger
-> Service
-> Proxy UpdateNotification
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateNotification)))
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 -> UpdateNotificationResponse
UpdateNotificationResponse'
(Int -> UpdateNotificationResponse)
-> Either String Int -> Either String UpdateNotificationResponse
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 UpdateNotification
instance Prelude.NFData UpdateNotification
instance Core.ToHeaders UpdateNotification where
toHeaders :: UpdateNotification -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateNotification -> 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.UpdateNotification" ::
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 UpdateNotification where
toJSON :: UpdateNotification -> Value
toJSON UpdateNotification' {Text
Notification
newNotification' :: Notification
oldNotification :: Notification
budgetName :: Text
accountId :: Text
$sel:newNotification':UpdateNotification' :: UpdateNotification -> Notification
$sel:oldNotification:UpdateNotification' :: UpdateNotification -> Notification
$sel:budgetName:UpdateNotification' :: UpdateNotification -> Text
$sel:accountId:UpdateNotification' :: UpdateNotification -> 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
"OldNotification" Text -> Notification -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Notification
oldNotification),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"NewNotification" Text -> Notification -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Notification
newNotification')
]
)
instance Core.ToPath UpdateNotification where
toPath :: UpdateNotification -> ByteString
toPath = ByteString -> UpdateNotification -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UpdateNotification where
toQuery :: UpdateNotification -> QueryString
toQuery = QueryString -> UpdateNotification -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateNotificationResponse = UpdateNotificationResponse'
{
UpdateNotificationResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateNotificationResponse -> UpdateNotificationResponse -> Bool
(UpdateNotificationResponse -> UpdateNotificationResponse -> Bool)
-> (UpdateNotificationResponse
-> UpdateNotificationResponse -> Bool)
-> Eq UpdateNotificationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateNotificationResponse -> UpdateNotificationResponse -> Bool
$c/= :: UpdateNotificationResponse -> UpdateNotificationResponse -> Bool
== :: UpdateNotificationResponse -> UpdateNotificationResponse -> Bool
$c== :: UpdateNotificationResponse -> UpdateNotificationResponse -> Bool
Prelude.Eq, ReadPrec [UpdateNotificationResponse]
ReadPrec UpdateNotificationResponse
Int -> ReadS UpdateNotificationResponse
ReadS [UpdateNotificationResponse]
(Int -> ReadS UpdateNotificationResponse)
-> ReadS [UpdateNotificationResponse]
-> ReadPrec UpdateNotificationResponse
-> ReadPrec [UpdateNotificationResponse]
-> Read UpdateNotificationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateNotificationResponse]
$creadListPrec :: ReadPrec [UpdateNotificationResponse]
readPrec :: ReadPrec UpdateNotificationResponse
$creadPrec :: ReadPrec UpdateNotificationResponse
readList :: ReadS [UpdateNotificationResponse]
$creadList :: ReadS [UpdateNotificationResponse]
readsPrec :: Int -> ReadS UpdateNotificationResponse
$creadsPrec :: Int -> ReadS UpdateNotificationResponse
Prelude.Read, Int -> UpdateNotificationResponse -> ShowS
[UpdateNotificationResponse] -> ShowS
UpdateNotificationResponse -> String
(Int -> UpdateNotificationResponse -> ShowS)
-> (UpdateNotificationResponse -> String)
-> ([UpdateNotificationResponse] -> ShowS)
-> Show UpdateNotificationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateNotificationResponse] -> ShowS
$cshowList :: [UpdateNotificationResponse] -> ShowS
show :: UpdateNotificationResponse -> String
$cshow :: UpdateNotificationResponse -> String
showsPrec :: Int -> UpdateNotificationResponse -> ShowS
$cshowsPrec :: Int -> UpdateNotificationResponse -> ShowS
Prelude.Show, (forall x.
UpdateNotificationResponse -> Rep UpdateNotificationResponse x)
-> (forall x.
Rep UpdateNotificationResponse x -> UpdateNotificationResponse)
-> Generic UpdateNotificationResponse
forall x.
Rep UpdateNotificationResponse x -> UpdateNotificationResponse
forall x.
UpdateNotificationResponse -> Rep UpdateNotificationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateNotificationResponse x -> UpdateNotificationResponse
$cfrom :: forall x.
UpdateNotificationResponse -> Rep UpdateNotificationResponse x
Prelude.Generic)
newUpdateNotificationResponse ::
Prelude.Int ->
UpdateNotificationResponse
newUpdateNotificationResponse :: Int -> UpdateNotificationResponse
newUpdateNotificationResponse Int
pHttpStatus_ =
UpdateNotificationResponse' :: Int -> UpdateNotificationResponse
UpdateNotificationResponse'
{ $sel:httpStatus:UpdateNotificationResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
updateNotificationResponse_httpStatus :: Lens.Lens' UpdateNotificationResponse Prelude.Int
updateNotificationResponse_httpStatus :: (Int -> f Int)
-> UpdateNotificationResponse -> f UpdateNotificationResponse
updateNotificationResponse_httpStatus = (UpdateNotificationResponse -> Int)
-> (UpdateNotificationResponse
-> Int -> UpdateNotificationResponse)
-> Lens
UpdateNotificationResponse UpdateNotificationResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateNotificationResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateNotificationResponse' :: UpdateNotificationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateNotificationResponse
s@UpdateNotificationResponse' {} Int
a -> UpdateNotificationResponse
s {$sel:httpStatus:UpdateNotificationResponse' :: Int
httpStatus = Int
a} :: UpdateNotificationResponse)
instance Prelude.NFData UpdateNotificationResponse