{-# 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.UpdateSubscriber
(
UpdateSubscriber (..),
newUpdateSubscriber,
updateSubscriber_accountId,
updateSubscriber_budgetName,
updateSubscriber_notification,
updateSubscriber_oldSubscriber,
updateSubscriber_newSubscriber,
UpdateSubscriberResponse (..),
newUpdateSubscriberResponse,
updateSubscriberResponse_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 UpdateSubscriber = UpdateSubscriber'
{
UpdateSubscriber -> Text
accountId :: Prelude.Text,
UpdateSubscriber -> Text
budgetName :: Prelude.Text,
UpdateSubscriber -> Notification
notification :: Notification,
UpdateSubscriber -> Subscriber
oldSubscriber :: Subscriber,
UpdateSubscriber -> Subscriber
newSubscriber' :: Subscriber
}
deriving (UpdateSubscriber -> UpdateSubscriber -> Bool
(UpdateSubscriber -> UpdateSubscriber -> Bool)
-> (UpdateSubscriber -> UpdateSubscriber -> Bool)
-> Eq UpdateSubscriber
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateSubscriber -> UpdateSubscriber -> Bool
$c/= :: UpdateSubscriber -> UpdateSubscriber -> Bool
== :: UpdateSubscriber -> UpdateSubscriber -> Bool
$c== :: UpdateSubscriber -> UpdateSubscriber -> Bool
Prelude.Eq, Int -> UpdateSubscriber -> ShowS
[UpdateSubscriber] -> ShowS
UpdateSubscriber -> String
(Int -> UpdateSubscriber -> ShowS)
-> (UpdateSubscriber -> String)
-> ([UpdateSubscriber] -> ShowS)
-> Show UpdateSubscriber
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateSubscriber] -> ShowS
$cshowList :: [UpdateSubscriber] -> ShowS
show :: UpdateSubscriber -> String
$cshow :: UpdateSubscriber -> String
showsPrec :: Int -> UpdateSubscriber -> ShowS
$cshowsPrec :: Int -> UpdateSubscriber -> ShowS
Prelude.Show, (forall x. UpdateSubscriber -> Rep UpdateSubscriber x)
-> (forall x. Rep UpdateSubscriber x -> UpdateSubscriber)
-> Generic UpdateSubscriber
forall x. Rep UpdateSubscriber x -> UpdateSubscriber
forall x. UpdateSubscriber -> Rep UpdateSubscriber x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateSubscriber x -> UpdateSubscriber
$cfrom :: forall x. UpdateSubscriber -> Rep UpdateSubscriber x
Prelude.Generic)
newUpdateSubscriber ::
Prelude.Text ->
Prelude.Text ->
Notification ->
Subscriber ->
Subscriber ->
UpdateSubscriber
newUpdateSubscriber :: Text
-> Text
-> Notification
-> Subscriber
-> Subscriber
-> UpdateSubscriber
newUpdateSubscriber
Text
pAccountId_
Text
pBudgetName_
Notification
pNotification_
Subscriber
pOldSubscriber_
Subscriber
pNewSubscriber_ =
UpdateSubscriber' :: Text
-> Text
-> Notification
-> Subscriber
-> Subscriber
-> UpdateSubscriber
UpdateSubscriber'
{ $sel:accountId:UpdateSubscriber' :: Text
accountId = Text
pAccountId_,
$sel:budgetName:UpdateSubscriber' :: Text
budgetName = Text
pBudgetName_,
$sel:notification:UpdateSubscriber' :: Notification
notification = Notification
pNotification_,
$sel:oldSubscriber:UpdateSubscriber' :: Subscriber
oldSubscriber = Subscriber
pOldSubscriber_,
$sel:newSubscriber':UpdateSubscriber' :: Subscriber
newSubscriber' = Subscriber
pNewSubscriber_
}
updateSubscriber_accountId :: Lens.Lens' UpdateSubscriber Prelude.Text
updateSubscriber_accountId :: (Text -> f Text) -> UpdateSubscriber -> f UpdateSubscriber
updateSubscriber_accountId = (UpdateSubscriber -> Text)
-> (UpdateSubscriber -> Text -> UpdateSubscriber)
-> Lens UpdateSubscriber UpdateSubscriber Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSubscriber' {Text
accountId :: Text
$sel:accountId:UpdateSubscriber' :: UpdateSubscriber -> Text
accountId} -> Text
accountId) (\s :: UpdateSubscriber
s@UpdateSubscriber' {} Text
a -> UpdateSubscriber
s {$sel:accountId:UpdateSubscriber' :: Text
accountId = Text
a} :: UpdateSubscriber)
updateSubscriber_budgetName :: Lens.Lens' UpdateSubscriber Prelude.Text
updateSubscriber_budgetName :: (Text -> f Text) -> UpdateSubscriber -> f UpdateSubscriber
updateSubscriber_budgetName = (UpdateSubscriber -> Text)
-> (UpdateSubscriber -> Text -> UpdateSubscriber)
-> Lens UpdateSubscriber UpdateSubscriber Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSubscriber' {Text
budgetName :: Text
$sel:budgetName:UpdateSubscriber' :: UpdateSubscriber -> Text
budgetName} -> Text
budgetName) (\s :: UpdateSubscriber
s@UpdateSubscriber' {} Text
a -> UpdateSubscriber
s {$sel:budgetName:UpdateSubscriber' :: Text
budgetName = Text
a} :: UpdateSubscriber)
updateSubscriber_notification :: Lens.Lens' UpdateSubscriber Notification
updateSubscriber_notification :: (Notification -> f Notification)
-> UpdateSubscriber -> f UpdateSubscriber
updateSubscriber_notification = (UpdateSubscriber -> Notification)
-> (UpdateSubscriber -> Notification -> UpdateSubscriber)
-> Lens UpdateSubscriber UpdateSubscriber Notification Notification
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSubscriber' {Notification
notification :: Notification
$sel:notification:UpdateSubscriber' :: UpdateSubscriber -> Notification
notification} -> Notification
notification) (\s :: UpdateSubscriber
s@UpdateSubscriber' {} Notification
a -> UpdateSubscriber
s {$sel:notification:UpdateSubscriber' :: Notification
notification = Notification
a} :: UpdateSubscriber)
updateSubscriber_oldSubscriber :: Lens.Lens' UpdateSubscriber Subscriber
updateSubscriber_oldSubscriber :: (Subscriber -> f Subscriber)
-> UpdateSubscriber -> f UpdateSubscriber
updateSubscriber_oldSubscriber = (UpdateSubscriber -> Subscriber)
-> (UpdateSubscriber -> Subscriber -> UpdateSubscriber)
-> Lens UpdateSubscriber UpdateSubscriber Subscriber Subscriber
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSubscriber' {Subscriber
oldSubscriber :: Subscriber
$sel:oldSubscriber:UpdateSubscriber' :: UpdateSubscriber -> Subscriber
oldSubscriber} -> Subscriber
oldSubscriber) (\s :: UpdateSubscriber
s@UpdateSubscriber' {} Subscriber
a -> UpdateSubscriber
s {$sel:oldSubscriber:UpdateSubscriber' :: Subscriber
oldSubscriber = Subscriber
a} :: UpdateSubscriber)
updateSubscriber_newSubscriber :: Lens.Lens' UpdateSubscriber Subscriber
updateSubscriber_newSubscriber :: (Subscriber -> f Subscriber)
-> UpdateSubscriber -> f UpdateSubscriber
updateSubscriber_newSubscriber = (UpdateSubscriber -> Subscriber)
-> (UpdateSubscriber -> Subscriber -> UpdateSubscriber)
-> Lens UpdateSubscriber UpdateSubscriber Subscriber Subscriber
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSubscriber' {Subscriber
newSubscriber' :: Subscriber
$sel:newSubscriber':UpdateSubscriber' :: UpdateSubscriber -> Subscriber
newSubscriber'} -> Subscriber
newSubscriber') (\s :: UpdateSubscriber
s@UpdateSubscriber' {} Subscriber
a -> UpdateSubscriber
s {$sel:newSubscriber':UpdateSubscriber' :: Subscriber
newSubscriber' = Subscriber
a} :: UpdateSubscriber)
instance Core.AWSRequest UpdateSubscriber where
type
AWSResponse UpdateSubscriber =
UpdateSubscriberResponse
request :: UpdateSubscriber -> Request UpdateSubscriber
request = Service -> UpdateSubscriber -> Request UpdateSubscriber
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateSubscriber
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateSubscriber)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse UpdateSubscriber))
-> Logger
-> Service
-> Proxy UpdateSubscriber
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateSubscriber)))
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 -> UpdateSubscriberResponse
UpdateSubscriberResponse'
(Int -> UpdateSubscriberResponse)
-> Either String Int -> Either String UpdateSubscriberResponse
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 UpdateSubscriber
instance Prelude.NFData UpdateSubscriber
instance Core.ToHeaders UpdateSubscriber where
toHeaders :: UpdateSubscriber -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateSubscriber -> 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.UpdateSubscriber" ::
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 UpdateSubscriber where
toJSON :: UpdateSubscriber -> Value
toJSON UpdateSubscriber' {Text
Subscriber
Notification
newSubscriber' :: Subscriber
oldSubscriber :: Subscriber
notification :: Notification
budgetName :: Text
accountId :: Text
$sel:newSubscriber':UpdateSubscriber' :: UpdateSubscriber -> Subscriber
$sel:oldSubscriber:UpdateSubscriber' :: UpdateSubscriber -> Subscriber
$sel:notification:UpdateSubscriber' :: UpdateSubscriber -> Notification
$sel:budgetName:UpdateSubscriber' :: UpdateSubscriber -> Text
$sel:accountId:UpdateSubscriber' :: UpdateSubscriber -> 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
"Notification" Text -> Notification -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Notification
notification),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"OldSubscriber" Text -> Subscriber -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Subscriber
oldSubscriber),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"NewSubscriber" Text -> Subscriber -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Subscriber
newSubscriber')
]
)
instance Core.ToPath UpdateSubscriber where
toPath :: UpdateSubscriber -> ByteString
toPath = ByteString -> UpdateSubscriber -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UpdateSubscriber where
toQuery :: UpdateSubscriber -> QueryString
toQuery = QueryString -> UpdateSubscriber -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateSubscriberResponse = UpdateSubscriberResponse'
{
UpdateSubscriberResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateSubscriberResponse -> UpdateSubscriberResponse -> Bool
(UpdateSubscriberResponse -> UpdateSubscriberResponse -> Bool)
-> (UpdateSubscriberResponse -> UpdateSubscriberResponse -> Bool)
-> Eq UpdateSubscriberResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateSubscriberResponse -> UpdateSubscriberResponse -> Bool
$c/= :: UpdateSubscriberResponse -> UpdateSubscriberResponse -> Bool
== :: UpdateSubscriberResponse -> UpdateSubscriberResponse -> Bool
$c== :: UpdateSubscriberResponse -> UpdateSubscriberResponse -> Bool
Prelude.Eq, ReadPrec [UpdateSubscriberResponse]
ReadPrec UpdateSubscriberResponse
Int -> ReadS UpdateSubscriberResponse
ReadS [UpdateSubscriberResponse]
(Int -> ReadS UpdateSubscriberResponse)
-> ReadS [UpdateSubscriberResponse]
-> ReadPrec UpdateSubscriberResponse
-> ReadPrec [UpdateSubscriberResponse]
-> Read UpdateSubscriberResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateSubscriberResponse]
$creadListPrec :: ReadPrec [UpdateSubscriberResponse]
readPrec :: ReadPrec UpdateSubscriberResponse
$creadPrec :: ReadPrec UpdateSubscriberResponse
readList :: ReadS [UpdateSubscriberResponse]
$creadList :: ReadS [UpdateSubscriberResponse]
readsPrec :: Int -> ReadS UpdateSubscriberResponse
$creadsPrec :: Int -> ReadS UpdateSubscriberResponse
Prelude.Read, Int -> UpdateSubscriberResponse -> ShowS
[UpdateSubscriberResponse] -> ShowS
UpdateSubscriberResponse -> String
(Int -> UpdateSubscriberResponse -> ShowS)
-> (UpdateSubscriberResponse -> String)
-> ([UpdateSubscriberResponse] -> ShowS)
-> Show UpdateSubscriberResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateSubscriberResponse] -> ShowS
$cshowList :: [UpdateSubscriberResponse] -> ShowS
show :: UpdateSubscriberResponse -> String
$cshow :: UpdateSubscriberResponse -> String
showsPrec :: Int -> UpdateSubscriberResponse -> ShowS
$cshowsPrec :: Int -> UpdateSubscriberResponse -> ShowS
Prelude.Show, (forall x.
UpdateSubscriberResponse -> Rep UpdateSubscriberResponse x)
-> (forall x.
Rep UpdateSubscriberResponse x -> UpdateSubscriberResponse)
-> Generic UpdateSubscriberResponse
forall x.
Rep UpdateSubscriberResponse x -> UpdateSubscriberResponse
forall x.
UpdateSubscriberResponse -> Rep UpdateSubscriberResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateSubscriberResponse x -> UpdateSubscriberResponse
$cfrom :: forall x.
UpdateSubscriberResponse -> Rep UpdateSubscriberResponse x
Prelude.Generic)
newUpdateSubscriberResponse ::
Prelude.Int ->
UpdateSubscriberResponse
newUpdateSubscriberResponse :: Int -> UpdateSubscriberResponse
newUpdateSubscriberResponse Int
pHttpStatus_ =
UpdateSubscriberResponse' :: Int -> UpdateSubscriberResponse
UpdateSubscriberResponse'
{ $sel:httpStatus:UpdateSubscriberResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
updateSubscriberResponse_httpStatus :: Lens.Lens' UpdateSubscriberResponse Prelude.Int
updateSubscriberResponse_httpStatus :: (Int -> f Int)
-> UpdateSubscriberResponse -> f UpdateSubscriberResponse
updateSubscriberResponse_httpStatus = (UpdateSubscriberResponse -> Int)
-> (UpdateSubscriberResponse -> Int -> UpdateSubscriberResponse)
-> Lens UpdateSubscriberResponse UpdateSubscriberResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSubscriberResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateSubscriberResponse' :: UpdateSubscriberResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateSubscriberResponse
s@UpdateSubscriberResponse' {} Int
a -> UpdateSubscriberResponse
s {$sel:httpStatus:UpdateSubscriberResponse' :: Int
httpStatus = Int
a} :: UpdateSubscriberResponse)
instance Prelude.NFData UpdateSubscriberResponse