{-# 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.CreateSubscriber
(
CreateSubscriber (..),
newCreateSubscriber,
createSubscriber_accountId,
createSubscriber_budgetName,
createSubscriber_notification,
createSubscriber_subscriber,
CreateSubscriberResponse (..),
newCreateSubscriberResponse,
createSubscriberResponse_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 CreateSubscriber = CreateSubscriber'
{
CreateSubscriber -> Text
accountId :: Prelude.Text,
CreateSubscriber -> Text
budgetName :: Prelude.Text,
CreateSubscriber -> Notification
notification :: Notification,
CreateSubscriber -> Subscriber
subscriber :: Subscriber
}
deriving (CreateSubscriber -> CreateSubscriber -> Bool
(CreateSubscriber -> CreateSubscriber -> Bool)
-> (CreateSubscriber -> CreateSubscriber -> Bool)
-> Eq CreateSubscriber
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateSubscriber -> CreateSubscriber -> Bool
$c/= :: CreateSubscriber -> CreateSubscriber -> Bool
== :: CreateSubscriber -> CreateSubscriber -> Bool
$c== :: CreateSubscriber -> CreateSubscriber -> Bool
Prelude.Eq, Int -> CreateSubscriber -> ShowS
[CreateSubscriber] -> ShowS
CreateSubscriber -> String
(Int -> CreateSubscriber -> ShowS)
-> (CreateSubscriber -> String)
-> ([CreateSubscriber] -> ShowS)
-> Show CreateSubscriber
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateSubscriber] -> ShowS
$cshowList :: [CreateSubscriber] -> ShowS
show :: CreateSubscriber -> String
$cshow :: CreateSubscriber -> String
showsPrec :: Int -> CreateSubscriber -> ShowS
$cshowsPrec :: Int -> CreateSubscriber -> ShowS
Prelude.Show, (forall x. CreateSubscriber -> Rep CreateSubscriber x)
-> (forall x. Rep CreateSubscriber x -> CreateSubscriber)
-> Generic CreateSubscriber
forall x. Rep CreateSubscriber x -> CreateSubscriber
forall x. CreateSubscriber -> Rep CreateSubscriber x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateSubscriber x -> CreateSubscriber
$cfrom :: forall x. CreateSubscriber -> Rep CreateSubscriber x
Prelude.Generic)
newCreateSubscriber ::
Prelude.Text ->
Prelude.Text ->
Notification ->
Subscriber ->
CreateSubscriber
newCreateSubscriber :: Text -> Text -> Notification -> Subscriber -> CreateSubscriber
newCreateSubscriber
Text
pAccountId_
Text
pBudgetName_
Notification
pNotification_
Subscriber
pSubscriber_ =
CreateSubscriber' :: Text -> Text -> Notification -> Subscriber -> CreateSubscriber
CreateSubscriber'
{ $sel:accountId:CreateSubscriber' :: Text
accountId = Text
pAccountId_,
$sel:budgetName:CreateSubscriber' :: Text
budgetName = Text
pBudgetName_,
$sel:notification:CreateSubscriber' :: Notification
notification = Notification
pNotification_,
$sel:subscriber:CreateSubscriber' :: Subscriber
subscriber = Subscriber
pSubscriber_
}
createSubscriber_accountId :: Lens.Lens' CreateSubscriber Prelude.Text
createSubscriber_accountId :: (Text -> f Text) -> CreateSubscriber -> f CreateSubscriber
createSubscriber_accountId = (CreateSubscriber -> Text)
-> (CreateSubscriber -> Text -> CreateSubscriber)
-> Lens CreateSubscriber CreateSubscriber Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSubscriber' {Text
accountId :: Text
$sel:accountId:CreateSubscriber' :: CreateSubscriber -> Text
accountId} -> Text
accountId) (\s :: CreateSubscriber
s@CreateSubscriber' {} Text
a -> CreateSubscriber
s {$sel:accountId:CreateSubscriber' :: Text
accountId = Text
a} :: CreateSubscriber)
createSubscriber_budgetName :: Lens.Lens' CreateSubscriber Prelude.Text
createSubscriber_budgetName :: (Text -> f Text) -> CreateSubscriber -> f CreateSubscriber
createSubscriber_budgetName = (CreateSubscriber -> Text)
-> (CreateSubscriber -> Text -> CreateSubscriber)
-> Lens CreateSubscriber CreateSubscriber Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSubscriber' {Text
budgetName :: Text
$sel:budgetName:CreateSubscriber' :: CreateSubscriber -> Text
budgetName} -> Text
budgetName) (\s :: CreateSubscriber
s@CreateSubscriber' {} Text
a -> CreateSubscriber
s {$sel:budgetName:CreateSubscriber' :: Text
budgetName = Text
a} :: CreateSubscriber)
createSubscriber_notification :: Lens.Lens' CreateSubscriber Notification
createSubscriber_notification :: (Notification -> f Notification)
-> CreateSubscriber -> f CreateSubscriber
createSubscriber_notification = (CreateSubscriber -> Notification)
-> (CreateSubscriber -> Notification -> CreateSubscriber)
-> Lens CreateSubscriber CreateSubscriber Notification Notification
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSubscriber' {Notification
notification :: Notification
$sel:notification:CreateSubscriber' :: CreateSubscriber -> Notification
notification} -> Notification
notification) (\s :: CreateSubscriber
s@CreateSubscriber' {} Notification
a -> CreateSubscriber
s {$sel:notification:CreateSubscriber' :: Notification
notification = Notification
a} :: CreateSubscriber)
createSubscriber_subscriber :: Lens.Lens' CreateSubscriber Subscriber
createSubscriber_subscriber :: (Subscriber -> f Subscriber)
-> CreateSubscriber -> f CreateSubscriber
createSubscriber_subscriber = (CreateSubscriber -> Subscriber)
-> (CreateSubscriber -> Subscriber -> CreateSubscriber)
-> Lens CreateSubscriber CreateSubscriber Subscriber Subscriber
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSubscriber' {Subscriber
subscriber :: Subscriber
$sel:subscriber:CreateSubscriber' :: CreateSubscriber -> Subscriber
subscriber} -> Subscriber
subscriber) (\s :: CreateSubscriber
s@CreateSubscriber' {} Subscriber
a -> CreateSubscriber
s {$sel:subscriber:CreateSubscriber' :: Subscriber
subscriber = Subscriber
a} :: CreateSubscriber)
instance Core.AWSRequest CreateSubscriber where
type
AWSResponse CreateSubscriber =
CreateSubscriberResponse
request :: CreateSubscriber -> Request CreateSubscriber
request = Service -> CreateSubscriber -> Request CreateSubscriber
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateSubscriber
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateSubscriber)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse CreateSubscriber))
-> Logger
-> Service
-> Proxy CreateSubscriber
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateSubscriber)))
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 -> CreateSubscriberResponse
CreateSubscriberResponse'
(Int -> CreateSubscriberResponse)
-> Either String Int -> Either String CreateSubscriberResponse
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 CreateSubscriber
instance Prelude.NFData CreateSubscriber
instance Core.ToHeaders CreateSubscriber where
toHeaders :: CreateSubscriber -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateSubscriber -> 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.CreateSubscriber" ::
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 CreateSubscriber where
toJSON :: CreateSubscriber -> Value
toJSON CreateSubscriber' {Text
Subscriber
Notification
subscriber :: Subscriber
notification :: Notification
budgetName :: Text
accountId :: Text
$sel:subscriber:CreateSubscriber' :: CreateSubscriber -> Subscriber
$sel:notification:CreateSubscriber' :: CreateSubscriber -> Notification
$sel:budgetName:CreateSubscriber' :: CreateSubscriber -> Text
$sel:accountId:CreateSubscriber' :: CreateSubscriber -> 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
"Subscriber" Text -> Subscriber -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Subscriber
subscriber)
]
)
instance Core.ToPath CreateSubscriber where
toPath :: CreateSubscriber -> ByteString
toPath = ByteString -> CreateSubscriber -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateSubscriber where
toQuery :: CreateSubscriber -> QueryString
toQuery = QueryString -> CreateSubscriber -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateSubscriberResponse = CreateSubscriberResponse'
{
CreateSubscriberResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateSubscriberResponse -> CreateSubscriberResponse -> Bool
(CreateSubscriberResponse -> CreateSubscriberResponse -> Bool)
-> (CreateSubscriberResponse -> CreateSubscriberResponse -> Bool)
-> Eq CreateSubscriberResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateSubscriberResponse -> CreateSubscriberResponse -> Bool
$c/= :: CreateSubscriberResponse -> CreateSubscriberResponse -> Bool
== :: CreateSubscriberResponse -> CreateSubscriberResponse -> Bool
$c== :: CreateSubscriberResponse -> CreateSubscriberResponse -> Bool
Prelude.Eq, ReadPrec [CreateSubscriberResponse]
ReadPrec CreateSubscriberResponse
Int -> ReadS CreateSubscriberResponse
ReadS [CreateSubscriberResponse]
(Int -> ReadS CreateSubscriberResponse)
-> ReadS [CreateSubscriberResponse]
-> ReadPrec CreateSubscriberResponse
-> ReadPrec [CreateSubscriberResponse]
-> Read CreateSubscriberResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateSubscriberResponse]
$creadListPrec :: ReadPrec [CreateSubscriberResponse]
readPrec :: ReadPrec CreateSubscriberResponse
$creadPrec :: ReadPrec CreateSubscriberResponse
readList :: ReadS [CreateSubscriberResponse]
$creadList :: ReadS [CreateSubscriberResponse]
readsPrec :: Int -> ReadS CreateSubscriberResponse
$creadsPrec :: Int -> ReadS CreateSubscriberResponse
Prelude.Read, Int -> CreateSubscriberResponse -> ShowS
[CreateSubscriberResponse] -> ShowS
CreateSubscriberResponse -> String
(Int -> CreateSubscriberResponse -> ShowS)
-> (CreateSubscriberResponse -> String)
-> ([CreateSubscriberResponse] -> ShowS)
-> Show CreateSubscriberResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateSubscriberResponse] -> ShowS
$cshowList :: [CreateSubscriberResponse] -> ShowS
show :: CreateSubscriberResponse -> String
$cshow :: CreateSubscriberResponse -> String
showsPrec :: Int -> CreateSubscriberResponse -> ShowS
$cshowsPrec :: Int -> CreateSubscriberResponse -> ShowS
Prelude.Show, (forall x.
CreateSubscriberResponse -> Rep CreateSubscriberResponse x)
-> (forall x.
Rep CreateSubscriberResponse x -> CreateSubscriberResponse)
-> Generic CreateSubscriberResponse
forall x.
Rep CreateSubscriberResponse x -> CreateSubscriberResponse
forall x.
CreateSubscriberResponse -> Rep CreateSubscriberResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateSubscriberResponse x -> CreateSubscriberResponse
$cfrom :: forall x.
CreateSubscriberResponse -> Rep CreateSubscriberResponse x
Prelude.Generic)
newCreateSubscriberResponse ::
Prelude.Int ->
CreateSubscriberResponse
newCreateSubscriberResponse :: Int -> CreateSubscriberResponse
newCreateSubscriberResponse Int
pHttpStatus_ =
CreateSubscriberResponse' :: Int -> CreateSubscriberResponse
CreateSubscriberResponse'
{ $sel:httpStatus:CreateSubscriberResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
createSubscriberResponse_httpStatus :: Lens.Lens' CreateSubscriberResponse Prelude.Int
createSubscriberResponse_httpStatus :: (Int -> f Int)
-> CreateSubscriberResponse -> f CreateSubscriberResponse
createSubscriberResponse_httpStatus = (CreateSubscriberResponse -> Int)
-> (CreateSubscriberResponse -> Int -> CreateSubscriberResponse)
-> Lens CreateSubscriberResponse CreateSubscriberResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSubscriberResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateSubscriberResponse' :: CreateSubscriberResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateSubscriberResponse
s@CreateSubscriberResponse' {} Int
a -> CreateSubscriberResponse
s {$sel:httpStatus:CreateSubscriberResponse' :: Int
httpStatus = Int
a} :: CreateSubscriberResponse)
instance Prelude.NFData CreateSubscriberResponse