{-# 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.CreateNotification
(
CreateNotification (..),
newCreateNotification,
createNotification_accountId,
createNotification_budgetName,
createNotification_notification,
createNotification_subscribers,
CreateNotificationResponse (..),
newCreateNotificationResponse,
createNotificationResponse_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 CreateNotification = CreateNotification'
{
CreateNotification -> Text
accountId :: Prelude.Text,
CreateNotification -> Text
budgetName :: Prelude.Text,
CreateNotification -> Notification
notification :: Notification,
CreateNotification -> NonEmpty Subscriber
subscribers :: Prelude.NonEmpty Subscriber
}
deriving (CreateNotification -> CreateNotification -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateNotification -> CreateNotification -> Bool
$c/= :: CreateNotification -> CreateNotification -> Bool
== :: CreateNotification -> CreateNotification -> Bool
$c== :: CreateNotification -> CreateNotification -> Bool
Prelude.Eq, Int -> CreateNotification -> ShowS
[CreateNotification] -> ShowS
CreateNotification -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateNotification] -> ShowS
$cshowList :: [CreateNotification] -> ShowS
show :: CreateNotification -> String
$cshow :: CreateNotification -> String
showsPrec :: Int -> CreateNotification -> ShowS
$cshowsPrec :: Int -> CreateNotification -> ShowS
Prelude.Show, forall x. Rep CreateNotification x -> CreateNotification
forall x. CreateNotification -> Rep CreateNotification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateNotification x -> CreateNotification
$cfrom :: forall x. CreateNotification -> Rep CreateNotification x
Prelude.Generic)
newCreateNotification ::
Prelude.Text ->
Prelude.Text ->
Notification ->
Prelude.NonEmpty Subscriber ->
CreateNotification
newCreateNotification :: Text
-> Text
-> Notification
-> NonEmpty Subscriber
-> CreateNotification
newCreateNotification
Text
pAccountId_
Text
pBudgetName_
Notification
pNotification_
NonEmpty Subscriber
pSubscribers_ =
CreateNotification'
{ $sel:accountId:CreateNotification' :: Text
accountId = Text
pAccountId_,
$sel:budgetName:CreateNotification' :: Text
budgetName = Text
pBudgetName_,
$sel:notification:CreateNotification' :: Notification
notification = Notification
pNotification_,
$sel:subscribers:CreateNotification' :: NonEmpty Subscriber
subscribers = forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty Subscriber
pSubscribers_
}
createNotification_accountId :: Lens.Lens' CreateNotification Prelude.Text
createNotification_accountId :: Lens' CreateNotification Text
createNotification_accountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateNotification' {Text
accountId :: Text
$sel:accountId:CreateNotification' :: CreateNotification -> Text
accountId} -> Text
accountId) (\s :: CreateNotification
s@CreateNotification' {} Text
a -> CreateNotification
s {$sel:accountId:CreateNotification' :: Text
accountId = Text
a} :: CreateNotification)
createNotification_budgetName :: Lens.Lens' CreateNotification Prelude.Text
createNotification_budgetName :: Lens' CreateNotification Text
createNotification_budgetName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateNotification' {Text
budgetName :: Text
$sel:budgetName:CreateNotification' :: CreateNotification -> Text
budgetName} -> Text
budgetName) (\s :: CreateNotification
s@CreateNotification' {} Text
a -> CreateNotification
s {$sel:budgetName:CreateNotification' :: Text
budgetName = Text
a} :: CreateNotification)
createNotification_notification :: Lens.Lens' CreateNotification Notification
createNotification_notification :: Lens' CreateNotification Notification
createNotification_notification = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateNotification' {Notification
notification :: Notification
$sel:notification:CreateNotification' :: CreateNotification -> Notification
notification} -> Notification
notification) (\s :: CreateNotification
s@CreateNotification' {} Notification
a -> CreateNotification
s {$sel:notification:CreateNotification' :: Notification
notification = Notification
a} :: CreateNotification)
createNotification_subscribers :: Lens.Lens' CreateNotification (Prelude.NonEmpty Subscriber)
createNotification_subscribers :: Lens' CreateNotification (NonEmpty Subscriber)
createNotification_subscribers = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateNotification' {NonEmpty Subscriber
subscribers :: NonEmpty Subscriber
$sel:subscribers:CreateNotification' :: CreateNotification -> NonEmpty Subscriber
subscribers} -> NonEmpty Subscriber
subscribers) (\s :: CreateNotification
s@CreateNotification' {} NonEmpty Subscriber
a -> CreateNotification
s {$sel:subscribers:CreateNotification' :: NonEmpty Subscriber
subscribers = NonEmpty Subscriber
a} :: CreateNotification) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest CreateNotification where
type
AWSResponse CreateNotification =
CreateNotificationResponse
request :: (Service -> Service)
-> CreateNotification -> Request CreateNotification
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 CreateNotification
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateNotification)))
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 -> CreateNotificationResponse
CreateNotificationResponse'
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 CreateNotification where
hashWithSalt :: Int -> CreateNotification -> Int
hashWithSalt Int
_salt CreateNotification' {NonEmpty Subscriber
Text
Notification
subscribers :: NonEmpty Subscriber
notification :: Notification
budgetName :: Text
accountId :: Text
$sel:subscribers:CreateNotification' :: CreateNotification -> NonEmpty Subscriber
$sel:notification:CreateNotification' :: CreateNotification -> Notification
$sel:budgetName:CreateNotification' :: CreateNotification -> Text
$sel:accountId:CreateNotification' :: CreateNotification -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
accountId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
budgetName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Notification
notification
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty Subscriber
subscribers
instance Prelude.NFData CreateNotification where
rnf :: CreateNotification -> ()
rnf CreateNotification' {NonEmpty Subscriber
Text
Notification
subscribers :: NonEmpty Subscriber
notification :: Notification
budgetName :: Text
accountId :: Text
$sel:subscribers:CreateNotification' :: CreateNotification -> NonEmpty Subscriber
$sel:notification:CreateNotification' :: CreateNotification -> Notification
$sel:budgetName:CreateNotification' :: CreateNotification -> Text
$sel:accountId:CreateNotification' :: CreateNotification -> 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 Text
budgetName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Notification
notification
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NonEmpty Subscriber
subscribers
instance Data.ToHeaders CreateNotification where
toHeaders :: CreateNotification -> 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.CreateNotification" ::
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 CreateNotification where
toJSON :: CreateNotification -> Value
toJSON CreateNotification' {NonEmpty Subscriber
Text
Notification
subscribers :: NonEmpty Subscriber
notification :: Notification
budgetName :: Text
accountId :: Text
$sel:subscribers:CreateNotification' :: CreateNotification -> NonEmpty Subscriber
$sel:notification:CreateNotification' :: CreateNotification -> Notification
$sel:budgetName:CreateNotification' :: CreateNotification -> Text
$sel:accountId:CreateNotification' :: CreateNotification -> 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
"BudgetName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
budgetName),
forall a. a -> Maybe a
Prelude.Just (Key
"Notification" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Notification
notification),
forall a. a -> Maybe a
Prelude.Just (Key
"Subscribers" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty Subscriber
subscribers)
]
)
instance Data.ToPath CreateNotification where
toPath :: CreateNotification -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery CreateNotification where
toQuery :: CreateNotification -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data CreateNotificationResponse = CreateNotificationResponse'
{
CreateNotificationResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateNotificationResponse -> CreateNotificationResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateNotificationResponse -> CreateNotificationResponse -> Bool
$c/= :: CreateNotificationResponse -> CreateNotificationResponse -> Bool
== :: CreateNotificationResponse -> CreateNotificationResponse -> Bool
$c== :: CreateNotificationResponse -> CreateNotificationResponse -> Bool
Prelude.Eq, ReadPrec [CreateNotificationResponse]
ReadPrec CreateNotificationResponse
Int -> ReadS CreateNotificationResponse
ReadS [CreateNotificationResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateNotificationResponse]
$creadListPrec :: ReadPrec [CreateNotificationResponse]
readPrec :: ReadPrec CreateNotificationResponse
$creadPrec :: ReadPrec CreateNotificationResponse
readList :: ReadS [CreateNotificationResponse]
$creadList :: ReadS [CreateNotificationResponse]
readsPrec :: Int -> ReadS CreateNotificationResponse
$creadsPrec :: Int -> ReadS CreateNotificationResponse
Prelude.Read, Int -> CreateNotificationResponse -> ShowS
[CreateNotificationResponse] -> ShowS
CreateNotificationResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateNotificationResponse] -> ShowS
$cshowList :: [CreateNotificationResponse] -> ShowS
show :: CreateNotificationResponse -> String
$cshow :: CreateNotificationResponse -> String
showsPrec :: Int -> CreateNotificationResponse -> ShowS
$cshowsPrec :: Int -> CreateNotificationResponse -> ShowS
Prelude.Show, forall x.
Rep CreateNotificationResponse x -> CreateNotificationResponse
forall x.
CreateNotificationResponse -> Rep CreateNotificationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateNotificationResponse x -> CreateNotificationResponse
$cfrom :: forall x.
CreateNotificationResponse -> Rep CreateNotificationResponse x
Prelude.Generic)
newCreateNotificationResponse ::
Prelude.Int ->
CreateNotificationResponse
newCreateNotificationResponse :: Int -> CreateNotificationResponse
newCreateNotificationResponse Int
pHttpStatus_ =
CreateNotificationResponse'
{ $sel:httpStatus:CreateNotificationResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
createNotificationResponse_httpStatus :: Lens.Lens' CreateNotificationResponse Prelude.Int
createNotificationResponse_httpStatus :: Lens' CreateNotificationResponse Int
createNotificationResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateNotificationResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateNotificationResponse' :: CreateNotificationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateNotificationResponse
s@CreateNotificationResponse' {} Int
a -> CreateNotificationResponse
s {$sel:httpStatus:CreateNotificationResponse' :: Int
httpStatus = Int
a} :: CreateNotificationResponse)
instance Prelude.NFData CreateNotificationResponse where
rnf :: CreateNotificationResponse -> ()
rnf CreateNotificationResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateNotificationResponse' :: CreateNotificationResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus