{-# 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.DevOpsGuru.AddNotificationChannel
(
AddNotificationChannel (..),
newAddNotificationChannel,
addNotificationChannel_config,
AddNotificationChannelResponse (..),
newAddNotificationChannelResponse,
addNotificationChannelResponse_httpStatus,
addNotificationChannelResponse_id,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DevOpsGuru.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data AddNotificationChannel = AddNotificationChannel'
{
AddNotificationChannel -> NotificationChannelConfig
config :: NotificationChannelConfig
}
deriving (AddNotificationChannel -> AddNotificationChannel -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddNotificationChannel -> AddNotificationChannel -> Bool
$c/= :: AddNotificationChannel -> AddNotificationChannel -> Bool
== :: AddNotificationChannel -> AddNotificationChannel -> Bool
$c== :: AddNotificationChannel -> AddNotificationChannel -> Bool
Prelude.Eq, ReadPrec [AddNotificationChannel]
ReadPrec AddNotificationChannel
Int -> ReadS AddNotificationChannel
ReadS [AddNotificationChannel]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddNotificationChannel]
$creadListPrec :: ReadPrec [AddNotificationChannel]
readPrec :: ReadPrec AddNotificationChannel
$creadPrec :: ReadPrec AddNotificationChannel
readList :: ReadS [AddNotificationChannel]
$creadList :: ReadS [AddNotificationChannel]
readsPrec :: Int -> ReadS AddNotificationChannel
$creadsPrec :: Int -> ReadS AddNotificationChannel
Prelude.Read, Int -> AddNotificationChannel -> ShowS
[AddNotificationChannel] -> ShowS
AddNotificationChannel -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddNotificationChannel] -> ShowS
$cshowList :: [AddNotificationChannel] -> ShowS
show :: AddNotificationChannel -> String
$cshow :: AddNotificationChannel -> String
showsPrec :: Int -> AddNotificationChannel -> ShowS
$cshowsPrec :: Int -> AddNotificationChannel -> ShowS
Prelude.Show, forall x. Rep AddNotificationChannel x -> AddNotificationChannel
forall x. AddNotificationChannel -> Rep AddNotificationChannel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AddNotificationChannel x -> AddNotificationChannel
$cfrom :: forall x. AddNotificationChannel -> Rep AddNotificationChannel x
Prelude.Generic)
newAddNotificationChannel ::
NotificationChannelConfig ->
AddNotificationChannel
newAddNotificationChannel :: NotificationChannelConfig -> AddNotificationChannel
newAddNotificationChannel NotificationChannelConfig
pConfig_ =
AddNotificationChannel' {$sel:config:AddNotificationChannel' :: NotificationChannelConfig
config = NotificationChannelConfig
pConfig_}
addNotificationChannel_config :: Lens.Lens' AddNotificationChannel NotificationChannelConfig
addNotificationChannel_config :: Lens' AddNotificationChannel NotificationChannelConfig
addNotificationChannel_config = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddNotificationChannel' {NotificationChannelConfig
config :: NotificationChannelConfig
$sel:config:AddNotificationChannel' :: AddNotificationChannel -> NotificationChannelConfig
config} -> NotificationChannelConfig
config) (\s :: AddNotificationChannel
s@AddNotificationChannel' {} NotificationChannelConfig
a -> AddNotificationChannel
s {$sel:config:AddNotificationChannel' :: NotificationChannelConfig
config = NotificationChannelConfig
a} :: AddNotificationChannel)
instance Core.AWSRequest AddNotificationChannel where
type
AWSResponse AddNotificationChannel =
AddNotificationChannelResponse
request :: (Service -> Service)
-> AddNotificationChannel -> Request AddNotificationChannel
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy AddNotificationChannel
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AddNotificationChannel)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Int -> Text -> AddNotificationChannelResponse
AddNotificationChannelResponse'
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))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"Id")
)
instance Prelude.Hashable AddNotificationChannel where
hashWithSalt :: Int -> AddNotificationChannel -> Int
hashWithSalt Int
_salt AddNotificationChannel' {NotificationChannelConfig
config :: NotificationChannelConfig
$sel:config:AddNotificationChannel' :: AddNotificationChannel -> NotificationChannelConfig
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NotificationChannelConfig
config
instance Prelude.NFData AddNotificationChannel where
rnf :: AddNotificationChannel -> ()
rnf AddNotificationChannel' {NotificationChannelConfig
config :: NotificationChannelConfig
$sel:config:AddNotificationChannel' :: AddNotificationChannel -> NotificationChannelConfig
..} = forall a. NFData a => a -> ()
Prelude.rnf NotificationChannelConfig
config
instance Data.ToHeaders AddNotificationChannel where
toHeaders :: AddNotificationChannel -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON AddNotificationChannel where
toJSON :: AddNotificationChannel -> Value
toJSON AddNotificationChannel' {NotificationChannelConfig
config :: NotificationChannelConfig
$sel:config:AddNotificationChannel' :: AddNotificationChannel -> NotificationChannelConfig
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"Config" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NotificationChannelConfig
config)]
)
instance Data.ToPath AddNotificationChannel where
toPath :: AddNotificationChannel -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/channels"
instance Data.ToQuery AddNotificationChannel where
toQuery :: AddNotificationChannel -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data AddNotificationChannelResponse = AddNotificationChannelResponse'
{
AddNotificationChannelResponse -> Int
httpStatus :: Prelude.Int,
AddNotificationChannelResponse -> Text
id :: Prelude.Text
}
deriving (AddNotificationChannelResponse
-> AddNotificationChannelResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddNotificationChannelResponse
-> AddNotificationChannelResponse -> Bool
$c/= :: AddNotificationChannelResponse
-> AddNotificationChannelResponse -> Bool
== :: AddNotificationChannelResponse
-> AddNotificationChannelResponse -> Bool
$c== :: AddNotificationChannelResponse
-> AddNotificationChannelResponse -> Bool
Prelude.Eq, ReadPrec [AddNotificationChannelResponse]
ReadPrec AddNotificationChannelResponse
Int -> ReadS AddNotificationChannelResponse
ReadS [AddNotificationChannelResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddNotificationChannelResponse]
$creadListPrec :: ReadPrec [AddNotificationChannelResponse]
readPrec :: ReadPrec AddNotificationChannelResponse
$creadPrec :: ReadPrec AddNotificationChannelResponse
readList :: ReadS [AddNotificationChannelResponse]
$creadList :: ReadS [AddNotificationChannelResponse]
readsPrec :: Int -> ReadS AddNotificationChannelResponse
$creadsPrec :: Int -> ReadS AddNotificationChannelResponse
Prelude.Read, Int -> AddNotificationChannelResponse -> ShowS
[AddNotificationChannelResponse] -> ShowS
AddNotificationChannelResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddNotificationChannelResponse] -> ShowS
$cshowList :: [AddNotificationChannelResponse] -> ShowS
show :: AddNotificationChannelResponse -> String
$cshow :: AddNotificationChannelResponse -> String
showsPrec :: Int -> AddNotificationChannelResponse -> ShowS
$cshowsPrec :: Int -> AddNotificationChannelResponse -> ShowS
Prelude.Show, forall x.
Rep AddNotificationChannelResponse x
-> AddNotificationChannelResponse
forall x.
AddNotificationChannelResponse
-> Rep AddNotificationChannelResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AddNotificationChannelResponse x
-> AddNotificationChannelResponse
$cfrom :: forall x.
AddNotificationChannelResponse
-> Rep AddNotificationChannelResponse x
Prelude.Generic)
newAddNotificationChannelResponse ::
Prelude.Int ->
Prelude.Text ->
AddNotificationChannelResponse
newAddNotificationChannelResponse :: Int -> Text -> AddNotificationChannelResponse
newAddNotificationChannelResponse Int
pHttpStatus_ Text
pId_ =
AddNotificationChannelResponse'
{ $sel:httpStatus:AddNotificationChannelResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:id:AddNotificationChannelResponse' :: Text
id = Text
pId_
}
addNotificationChannelResponse_httpStatus :: Lens.Lens' AddNotificationChannelResponse Prelude.Int
addNotificationChannelResponse_httpStatus :: Lens' AddNotificationChannelResponse Int
addNotificationChannelResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddNotificationChannelResponse' {Int
httpStatus :: Int
$sel:httpStatus:AddNotificationChannelResponse' :: AddNotificationChannelResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AddNotificationChannelResponse
s@AddNotificationChannelResponse' {} Int
a -> AddNotificationChannelResponse
s {$sel:httpStatus:AddNotificationChannelResponse' :: Int
httpStatus = Int
a} :: AddNotificationChannelResponse)
addNotificationChannelResponse_id :: Lens.Lens' AddNotificationChannelResponse Prelude.Text
addNotificationChannelResponse_id :: Lens' AddNotificationChannelResponse Text
addNotificationChannelResponse_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddNotificationChannelResponse' {Text
id :: Text
$sel:id:AddNotificationChannelResponse' :: AddNotificationChannelResponse -> Text
id} -> Text
id) (\s :: AddNotificationChannelResponse
s@AddNotificationChannelResponse' {} Text
a -> AddNotificationChannelResponse
s {$sel:id:AddNotificationChannelResponse' :: Text
id = Text
a} :: AddNotificationChannelResponse)
instance
Prelude.NFData
AddNotificationChannelResponse
where
rnf :: AddNotificationChannelResponse -> ()
rnf AddNotificationChannelResponse' {Int
Text
id :: Text
httpStatus :: Int
$sel:id:AddNotificationChannelResponse' :: AddNotificationChannelResponse -> Text
$sel:httpStatus:AddNotificationChannelResponse' :: AddNotificationChannelResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
id