{-# 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 Amazonka.DevOpsGuru.Types
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 AddNotificationChannel = AddNotificationChannel'
{
AddNotificationChannel -> NotificationChannelConfig
config :: NotificationChannelConfig
}
deriving (AddNotificationChannel -> AddNotificationChannel -> Bool
(AddNotificationChannel -> AddNotificationChannel -> Bool)
-> (AddNotificationChannel -> AddNotificationChannel -> Bool)
-> Eq AddNotificationChannel
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]
(Int -> ReadS AddNotificationChannel)
-> ReadS [AddNotificationChannel]
-> ReadPrec AddNotificationChannel
-> ReadPrec [AddNotificationChannel]
-> Read 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
(Int -> AddNotificationChannel -> ShowS)
-> (AddNotificationChannel -> String)
-> ([AddNotificationChannel] -> ShowS)
-> Show AddNotificationChannel
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. AddNotificationChannel -> Rep AddNotificationChannel x)
-> (forall x.
Rep AddNotificationChannel x -> AddNotificationChannel)
-> Generic AddNotificationChannel
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' :: NotificationChannelConfig -> AddNotificationChannel
AddNotificationChannel' {$sel:config:AddNotificationChannel' :: NotificationChannelConfig
config = NotificationChannelConfig
pConfig_}
addNotificationChannel_config :: Lens.Lens' AddNotificationChannel NotificationChannelConfig
addNotificationChannel_config :: (NotificationChannelConfig -> f NotificationChannelConfig)
-> AddNotificationChannel -> f AddNotificationChannel
addNotificationChannel_config = (AddNotificationChannel -> NotificationChannelConfig)
-> (AddNotificationChannel
-> NotificationChannelConfig -> AddNotificationChannel)
-> Lens
AddNotificationChannel
AddNotificationChannel
NotificationChannelConfig
NotificationChannelConfig
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 :: AddNotificationChannel -> Request AddNotificationChannel
request = Service -> AddNotificationChannel -> Request AddNotificationChannel
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AddNotificationChannel
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AddNotificationChannel)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse AddNotificationChannel))
-> Logger
-> Service
-> Proxy AddNotificationChannel
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AddNotificationChannel)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Int -> Text -> AddNotificationChannelResponse
AddNotificationChannelResponse'
(Int -> Text -> AddNotificationChannelResponse)
-> Either String Int
-> Either String (Text -> AddNotificationChannelResponse)
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))
Either String (Text -> AddNotificationChannelResponse)
-> Either String Text
-> Either String AddNotificationChannelResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"Id")
)
instance Prelude.Hashable AddNotificationChannel
instance Prelude.NFData AddNotificationChannel
instance Core.ToHeaders AddNotificationChannel where
toHeaders :: AddNotificationChannel -> ResponseHeaders
toHeaders =
ResponseHeaders -> AddNotificationChannel -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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 AddNotificationChannel where
toJSON :: AddNotificationChannel -> Value
toJSON AddNotificationChannel' {NotificationChannelConfig
config :: NotificationChannelConfig
$sel:config:AddNotificationChannel' :: AddNotificationChannel -> NotificationChannelConfig
..} =
[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
"Config" Text -> NotificationChannelConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NotificationChannelConfig
config)]
)
instance Core.ToPath AddNotificationChannel where
toPath :: AddNotificationChannel -> ByteString
toPath = ByteString -> AddNotificationChannel -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/channels"
instance Core.ToQuery AddNotificationChannel where
toQuery :: AddNotificationChannel -> QueryString
toQuery = QueryString -> AddNotificationChannel -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AddNotificationChannelResponse = AddNotificationChannelResponse'
{
AddNotificationChannelResponse -> Int
httpStatus :: Prelude.Int,
AddNotificationChannelResponse -> Text
id :: Prelude.Text
}
deriving (AddNotificationChannelResponse
-> AddNotificationChannelResponse -> Bool
(AddNotificationChannelResponse
-> AddNotificationChannelResponse -> Bool)
-> (AddNotificationChannelResponse
-> AddNotificationChannelResponse -> Bool)
-> Eq AddNotificationChannelResponse
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]
(Int -> ReadS AddNotificationChannelResponse)
-> ReadS [AddNotificationChannelResponse]
-> ReadPrec AddNotificationChannelResponse
-> ReadPrec [AddNotificationChannelResponse]
-> Read 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
(Int -> AddNotificationChannelResponse -> ShowS)
-> (AddNotificationChannelResponse -> String)
-> ([AddNotificationChannelResponse] -> ShowS)
-> Show AddNotificationChannelResponse
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.
AddNotificationChannelResponse
-> Rep AddNotificationChannelResponse x)
-> (forall x.
Rep AddNotificationChannelResponse x
-> AddNotificationChannelResponse)
-> Generic AddNotificationChannelResponse
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' :: Int -> Text -> AddNotificationChannelResponse
AddNotificationChannelResponse'
{ $sel:httpStatus:AddNotificationChannelResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:id:AddNotificationChannelResponse' :: Text
id = Text
pId_
}
addNotificationChannelResponse_httpStatus :: Lens.Lens' AddNotificationChannelResponse Prelude.Int
addNotificationChannelResponse_httpStatus :: (Int -> f Int)
-> AddNotificationChannelResponse
-> f AddNotificationChannelResponse
addNotificationChannelResponse_httpStatus = (AddNotificationChannelResponse -> Int)
-> (AddNotificationChannelResponse
-> Int -> AddNotificationChannelResponse)
-> Lens
AddNotificationChannelResponse
AddNotificationChannelResponse
Int
Int
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 :: (Text -> f Text)
-> AddNotificationChannelResponse
-> f AddNotificationChannelResponse
addNotificationChannelResponse_id = (AddNotificationChannelResponse -> Text)
-> (AddNotificationChannelResponse
-> Text -> AddNotificationChannelResponse)
-> Lens
AddNotificationChannelResponse
AddNotificationChannelResponse
Text
Text
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