{-# 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.CodeGuruProfiler.AddNotificationChannels
(
AddNotificationChannels (..),
newAddNotificationChannels,
addNotificationChannels_channels,
addNotificationChannels_profilingGroupName,
AddNotificationChannelsResponse (..),
newAddNotificationChannelsResponse,
addNotificationChannelsResponse_notificationConfiguration,
addNotificationChannelsResponse_httpStatus,
)
where
import Amazonka.CodeGuruProfiler.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 AddNotificationChannels = AddNotificationChannels'
{
AddNotificationChannels -> NonEmpty Channel
channels :: Prelude.NonEmpty Channel,
AddNotificationChannels -> Text
profilingGroupName :: Prelude.Text
}
deriving (AddNotificationChannels -> AddNotificationChannels -> Bool
(AddNotificationChannels -> AddNotificationChannels -> Bool)
-> (AddNotificationChannels -> AddNotificationChannels -> Bool)
-> Eq AddNotificationChannels
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddNotificationChannels -> AddNotificationChannels -> Bool
$c/= :: AddNotificationChannels -> AddNotificationChannels -> Bool
== :: AddNotificationChannels -> AddNotificationChannels -> Bool
$c== :: AddNotificationChannels -> AddNotificationChannels -> Bool
Prelude.Eq, ReadPrec [AddNotificationChannels]
ReadPrec AddNotificationChannels
Int -> ReadS AddNotificationChannels
ReadS [AddNotificationChannels]
(Int -> ReadS AddNotificationChannels)
-> ReadS [AddNotificationChannels]
-> ReadPrec AddNotificationChannels
-> ReadPrec [AddNotificationChannels]
-> Read AddNotificationChannels
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddNotificationChannels]
$creadListPrec :: ReadPrec [AddNotificationChannels]
readPrec :: ReadPrec AddNotificationChannels
$creadPrec :: ReadPrec AddNotificationChannels
readList :: ReadS [AddNotificationChannels]
$creadList :: ReadS [AddNotificationChannels]
readsPrec :: Int -> ReadS AddNotificationChannels
$creadsPrec :: Int -> ReadS AddNotificationChannels
Prelude.Read, Int -> AddNotificationChannels -> ShowS
[AddNotificationChannels] -> ShowS
AddNotificationChannels -> String
(Int -> AddNotificationChannels -> ShowS)
-> (AddNotificationChannels -> String)
-> ([AddNotificationChannels] -> ShowS)
-> Show AddNotificationChannels
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddNotificationChannels] -> ShowS
$cshowList :: [AddNotificationChannels] -> ShowS
show :: AddNotificationChannels -> String
$cshow :: AddNotificationChannels -> String
showsPrec :: Int -> AddNotificationChannels -> ShowS
$cshowsPrec :: Int -> AddNotificationChannels -> ShowS
Prelude.Show, (forall x.
AddNotificationChannels -> Rep AddNotificationChannels x)
-> (forall x.
Rep AddNotificationChannels x -> AddNotificationChannels)
-> Generic AddNotificationChannels
forall x. Rep AddNotificationChannels x -> AddNotificationChannels
forall x. AddNotificationChannels -> Rep AddNotificationChannels x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AddNotificationChannels x -> AddNotificationChannels
$cfrom :: forall x. AddNotificationChannels -> Rep AddNotificationChannels x
Prelude.Generic)
newAddNotificationChannels ::
Prelude.NonEmpty Channel ->
Prelude.Text ->
AddNotificationChannels
newAddNotificationChannels :: NonEmpty Channel -> Text -> AddNotificationChannels
newAddNotificationChannels
NonEmpty Channel
pChannels_
Text
pProfilingGroupName_ =
AddNotificationChannels' :: NonEmpty Channel -> Text -> AddNotificationChannels
AddNotificationChannels'
{ $sel:channels:AddNotificationChannels' :: NonEmpty Channel
channels =
Tagged (NonEmpty Channel) (Identity (NonEmpty Channel))
-> Tagged (NonEmpty Channel) (Identity (NonEmpty Channel))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Channel) (Identity (NonEmpty Channel))
-> Tagged (NonEmpty Channel) (Identity (NonEmpty Channel)))
-> NonEmpty Channel -> NonEmpty Channel
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Channel
pChannels_,
$sel:profilingGroupName:AddNotificationChannels' :: Text
profilingGroupName = Text
pProfilingGroupName_
}
addNotificationChannels_channels :: Lens.Lens' AddNotificationChannels (Prelude.NonEmpty Channel)
addNotificationChannels_channels :: (NonEmpty Channel -> f (NonEmpty Channel))
-> AddNotificationChannels -> f AddNotificationChannels
addNotificationChannels_channels = (AddNotificationChannels -> NonEmpty Channel)
-> (AddNotificationChannels
-> NonEmpty Channel -> AddNotificationChannels)
-> Lens
AddNotificationChannels
AddNotificationChannels
(NonEmpty Channel)
(NonEmpty Channel)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddNotificationChannels' {NonEmpty Channel
channels :: NonEmpty Channel
$sel:channels:AddNotificationChannels' :: AddNotificationChannels -> NonEmpty Channel
channels} -> NonEmpty Channel
channels) (\s :: AddNotificationChannels
s@AddNotificationChannels' {} NonEmpty Channel
a -> AddNotificationChannels
s {$sel:channels:AddNotificationChannels' :: NonEmpty Channel
channels = NonEmpty Channel
a} :: AddNotificationChannels) ((NonEmpty Channel -> f (NonEmpty Channel))
-> AddNotificationChannels -> f AddNotificationChannels)
-> ((NonEmpty Channel -> f (NonEmpty Channel))
-> NonEmpty Channel -> f (NonEmpty Channel))
-> (NonEmpty Channel -> f (NonEmpty Channel))
-> AddNotificationChannels
-> f AddNotificationChannels
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Channel -> f (NonEmpty Channel))
-> NonEmpty Channel -> f (NonEmpty Channel)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
addNotificationChannels_profilingGroupName :: Lens.Lens' AddNotificationChannels Prelude.Text
addNotificationChannels_profilingGroupName :: (Text -> f Text)
-> AddNotificationChannels -> f AddNotificationChannels
addNotificationChannels_profilingGroupName = (AddNotificationChannels -> Text)
-> (AddNotificationChannels -> Text -> AddNotificationChannels)
-> Lens AddNotificationChannels AddNotificationChannels Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddNotificationChannels' {Text
profilingGroupName :: Text
$sel:profilingGroupName:AddNotificationChannels' :: AddNotificationChannels -> Text
profilingGroupName} -> Text
profilingGroupName) (\s :: AddNotificationChannels
s@AddNotificationChannels' {} Text
a -> AddNotificationChannels
s {$sel:profilingGroupName:AddNotificationChannels' :: Text
profilingGroupName = Text
a} :: AddNotificationChannels)
instance Core.AWSRequest AddNotificationChannels where
type
AWSResponse AddNotificationChannels =
AddNotificationChannelsResponse
request :: AddNotificationChannels -> Request AddNotificationChannels
request = Service
-> AddNotificationChannels -> Request AddNotificationChannels
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AddNotificationChannels
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AddNotificationChannels)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse AddNotificationChannels))
-> Logger
-> Service
-> Proxy AddNotificationChannels
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AddNotificationChannels)))
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 ->
Maybe NotificationConfiguration
-> Int -> AddNotificationChannelsResponse
AddNotificationChannelsResponse'
(Maybe NotificationConfiguration
-> Int -> AddNotificationChannelsResponse)
-> Either String (Maybe NotificationConfiguration)
-> Either String (Int -> AddNotificationChannelsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe NotificationConfiguration)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"notificationConfiguration")
Either String (Int -> AddNotificationChannelsResponse)
-> Either String Int
-> Either String AddNotificationChannelsResponse
forall (f :: * -> *) a b. Applicative f => 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 AddNotificationChannels
instance Prelude.NFData AddNotificationChannels
instance Core.ToHeaders AddNotificationChannels where
toHeaders :: AddNotificationChannels -> ResponseHeaders
toHeaders =
ResponseHeaders -> AddNotificationChannels -> 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 AddNotificationChannels where
toJSON :: AddNotificationChannels -> Value
toJSON AddNotificationChannels' {NonEmpty Channel
Text
profilingGroupName :: Text
channels :: NonEmpty Channel
$sel:profilingGroupName:AddNotificationChannels' :: AddNotificationChannels -> Text
$sel:channels:AddNotificationChannels' :: AddNotificationChannels -> NonEmpty Channel
..} =
[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
"channels" Text -> NonEmpty Channel -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Channel
channels)]
)
instance Core.ToPath AddNotificationChannels where
toPath :: AddNotificationChannels -> ByteString
toPath AddNotificationChannels' {NonEmpty Channel
Text
profilingGroupName :: Text
channels :: NonEmpty Channel
$sel:profilingGroupName:AddNotificationChannels' :: AddNotificationChannels -> Text
$sel:channels:AddNotificationChannels' :: AddNotificationChannels -> NonEmpty Channel
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/profilingGroups/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
profilingGroupName,
ByteString
"/notificationConfiguration"
]
instance Core.ToQuery AddNotificationChannels where
toQuery :: AddNotificationChannels -> QueryString
toQuery = QueryString -> AddNotificationChannels -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AddNotificationChannelsResponse = AddNotificationChannelsResponse'
{
AddNotificationChannelsResponse -> Maybe NotificationConfiguration
notificationConfiguration :: Prelude.Maybe NotificationConfiguration,
AddNotificationChannelsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AddNotificationChannelsResponse
-> AddNotificationChannelsResponse -> Bool
(AddNotificationChannelsResponse
-> AddNotificationChannelsResponse -> Bool)
-> (AddNotificationChannelsResponse
-> AddNotificationChannelsResponse -> Bool)
-> Eq AddNotificationChannelsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddNotificationChannelsResponse
-> AddNotificationChannelsResponse -> Bool
$c/= :: AddNotificationChannelsResponse
-> AddNotificationChannelsResponse -> Bool
== :: AddNotificationChannelsResponse
-> AddNotificationChannelsResponse -> Bool
$c== :: AddNotificationChannelsResponse
-> AddNotificationChannelsResponse -> Bool
Prelude.Eq, ReadPrec [AddNotificationChannelsResponse]
ReadPrec AddNotificationChannelsResponse
Int -> ReadS AddNotificationChannelsResponse
ReadS [AddNotificationChannelsResponse]
(Int -> ReadS AddNotificationChannelsResponse)
-> ReadS [AddNotificationChannelsResponse]
-> ReadPrec AddNotificationChannelsResponse
-> ReadPrec [AddNotificationChannelsResponse]
-> Read AddNotificationChannelsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddNotificationChannelsResponse]
$creadListPrec :: ReadPrec [AddNotificationChannelsResponse]
readPrec :: ReadPrec AddNotificationChannelsResponse
$creadPrec :: ReadPrec AddNotificationChannelsResponse
readList :: ReadS [AddNotificationChannelsResponse]
$creadList :: ReadS [AddNotificationChannelsResponse]
readsPrec :: Int -> ReadS AddNotificationChannelsResponse
$creadsPrec :: Int -> ReadS AddNotificationChannelsResponse
Prelude.Read, Int -> AddNotificationChannelsResponse -> ShowS
[AddNotificationChannelsResponse] -> ShowS
AddNotificationChannelsResponse -> String
(Int -> AddNotificationChannelsResponse -> ShowS)
-> (AddNotificationChannelsResponse -> String)
-> ([AddNotificationChannelsResponse] -> ShowS)
-> Show AddNotificationChannelsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddNotificationChannelsResponse] -> ShowS
$cshowList :: [AddNotificationChannelsResponse] -> ShowS
show :: AddNotificationChannelsResponse -> String
$cshow :: AddNotificationChannelsResponse -> String
showsPrec :: Int -> AddNotificationChannelsResponse -> ShowS
$cshowsPrec :: Int -> AddNotificationChannelsResponse -> ShowS
Prelude.Show, (forall x.
AddNotificationChannelsResponse
-> Rep AddNotificationChannelsResponse x)
-> (forall x.
Rep AddNotificationChannelsResponse x
-> AddNotificationChannelsResponse)
-> Generic AddNotificationChannelsResponse
forall x.
Rep AddNotificationChannelsResponse x
-> AddNotificationChannelsResponse
forall x.
AddNotificationChannelsResponse
-> Rep AddNotificationChannelsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AddNotificationChannelsResponse x
-> AddNotificationChannelsResponse
$cfrom :: forall x.
AddNotificationChannelsResponse
-> Rep AddNotificationChannelsResponse x
Prelude.Generic)
newAddNotificationChannelsResponse ::
Prelude.Int ->
AddNotificationChannelsResponse
newAddNotificationChannelsResponse :: Int -> AddNotificationChannelsResponse
newAddNotificationChannelsResponse Int
pHttpStatus_ =
AddNotificationChannelsResponse' :: Maybe NotificationConfiguration
-> Int -> AddNotificationChannelsResponse
AddNotificationChannelsResponse'
{ $sel:notificationConfiguration:AddNotificationChannelsResponse' :: Maybe NotificationConfiguration
notificationConfiguration =
Maybe NotificationConfiguration
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:AddNotificationChannelsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
addNotificationChannelsResponse_notificationConfiguration :: Lens.Lens' AddNotificationChannelsResponse (Prelude.Maybe NotificationConfiguration)
addNotificationChannelsResponse_notificationConfiguration :: (Maybe NotificationConfiguration
-> f (Maybe NotificationConfiguration))
-> AddNotificationChannelsResponse
-> f AddNotificationChannelsResponse
addNotificationChannelsResponse_notificationConfiguration = (AddNotificationChannelsResponse
-> Maybe NotificationConfiguration)
-> (AddNotificationChannelsResponse
-> Maybe NotificationConfiguration
-> AddNotificationChannelsResponse)
-> Lens
AddNotificationChannelsResponse
AddNotificationChannelsResponse
(Maybe NotificationConfiguration)
(Maybe NotificationConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddNotificationChannelsResponse' {Maybe NotificationConfiguration
notificationConfiguration :: Maybe NotificationConfiguration
$sel:notificationConfiguration:AddNotificationChannelsResponse' :: AddNotificationChannelsResponse -> Maybe NotificationConfiguration
notificationConfiguration} -> Maybe NotificationConfiguration
notificationConfiguration) (\s :: AddNotificationChannelsResponse
s@AddNotificationChannelsResponse' {} Maybe NotificationConfiguration
a -> AddNotificationChannelsResponse
s {$sel:notificationConfiguration:AddNotificationChannelsResponse' :: Maybe NotificationConfiguration
notificationConfiguration = Maybe NotificationConfiguration
a} :: AddNotificationChannelsResponse)
addNotificationChannelsResponse_httpStatus :: Lens.Lens' AddNotificationChannelsResponse Prelude.Int
addNotificationChannelsResponse_httpStatus :: (Int -> f Int)
-> AddNotificationChannelsResponse
-> f AddNotificationChannelsResponse
addNotificationChannelsResponse_httpStatus = (AddNotificationChannelsResponse -> Int)
-> (AddNotificationChannelsResponse
-> Int -> AddNotificationChannelsResponse)
-> Lens
AddNotificationChannelsResponse
AddNotificationChannelsResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddNotificationChannelsResponse' {Int
httpStatus :: Int
$sel:httpStatus:AddNotificationChannelsResponse' :: AddNotificationChannelsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AddNotificationChannelsResponse
s@AddNotificationChannelsResponse' {} Int
a -> AddNotificationChannelsResponse
s {$sel:httpStatus:AddNotificationChannelsResponse' :: Int
httpStatus = Int
a} :: AddNotificationChannelsResponse)
instance
Prelude.NFData
AddNotificationChannelsResponse