{-# 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.FMS.PutNotificationChannel
(
PutNotificationChannel (..),
newPutNotificationChannel,
putNotificationChannel_snsTopicArn,
putNotificationChannel_snsRoleName,
PutNotificationChannelResponse (..),
newPutNotificationChannelResponse,
)
where
import qualified Amazonka.Core as Core
import Amazonka.FMS.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 PutNotificationChannel = PutNotificationChannel'
{
PutNotificationChannel -> Text
snsTopicArn :: Prelude.Text,
PutNotificationChannel -> Text
snsRoleName :: Prelude.Text
}
deriving (PutNotificationChannel -> PutNotificationChannel -> Bool
(PutNotificationChannel -> PutNotificationChannel -> Bool)
-> (PutNotificationChannel -> PutNotificationChannel -> Bool)
-> Eq PutNotificationChannel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutNotificationChannel -> PutNotificationChannel -> Bool
$c/= :: PutNotificationChannel -> PutNotificationChannel -> Bool
== :: PutNotificationChannel -> PutNotificationChannel -> Bool
$c== :: PutNotificationChannel -> PutNotificationChannel -> Bool
Prelude.Eq, ReadPrec [PutNotificationChannel]
ReadPrec PutNotificationChannel
Int -> ReadS PutNotificationChannel
ReadS [PutNotificationChannel]
(Int -> ReadS PutNotificationChannel)
-> ReadS [PutNotificationChannel]
-> ReadPrec PutNotificationChannel
-> ReadPrec [PutNotificationChannel]
-> Read PutNotificationChannel
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutNotificationChannel]
$creadListPrec :: ReadPrec [PutNotificationChannel]
readPrec :: ReadPrec PutNotificationChannel
$creadPrec :: ReadPrec PutNotificationChannel
readList :: ReadS [PutNotificationChannel]
$creadList :: ReadS [PutNotificationChannel]
readsPrec :: Int -> ReadS PutNotificationChannel
$creadsPrec :: Int -> ReadS PutNotificationChannel
Prelude.Read, Int -> PutNotificationChannel -> ShowS
[PutNotificationChannel] -> ShowS
PutNotificationChannel -> String
(Int -> PutNotificationChannel -> ShowS)
-> (PutNotificationChannel -> String)
-> ([PutNotificationChannel] -> ShowS)
-> Show PutNotificationChannel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutNotificationChannel] -> ShowS
$cshowList :: [PutNotificationChannel] -> ShowS
show :: PutNotificationChannel -> String
$cshow :: PutNotificationChannel -> String
showsPrec :: Int -> PutNotificationChannel -> ShowS
$cshowsPrec :: Int -> PutNotificationChannel -> ShowS
Prelude.Show, (forall x. PutNotificationChannel -> Rep PutNotificationChannel x)
-> (forall x.
Rep PutNotificationChannel x -> PutNotificationChannel)
-> Generic PutNotificationChannel
forall x. Rep PutNotificationChannel x -> PutNotificationChannel
forall x. PutNotificationChannel -> Rep PutNotificationChannel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutNotificationChannel x -> PutNotificationChannel
$cfrom :: forall x. PutNotificationChannel -> Rep PutNotificationChannel x
Prelude.Generic)
newPutNotificationChannel ::
Prelude.Text ->
Prelude.Text ->
PutNotificationChannel
newPutNotificationChannel :: Text -> Text -> PutNotificationChannel
newPutNotificationChannel Text
pSnsTopicArn_ Text
pSnsRoleName_ =
PutNotificationChannel' :: Text -> Text -> PutNotificationChannel
PutNotificationChannel'
{ $sel:snsTopicArn:PutNotificationChannel' :: Text
snsTopicArn =
Text
pSnsTopicArn_,
$sel:snsRoleName:PutNotificationChannel' :: Text
snsRoleName = Text
pSnsRoleName_
}
putNotificationChannel_snsTopicArn :: Lens.Lens' PutNotificationChannel Prelude.Text
putNotificationChannel_snsTopicArn :: (Text -> f Text)
-> PutNotificationChannel -> f PutNotificationChannel
putNotificationChannel_snsTopicArn = (PutNotificationChannel -> Text)
-> (PutNotificationChannel -> Text -> PutNotificationChannel)
-> Lens PutNotificationChannel PutNotificationChannel Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutNotificationChannel' {Text
snsTopicArn :: Text
$sel:snsTopicArn:PutNotificationChannel' :: PutNotificationChannel -> Text
snsTopicArn} -> Text
snsTopicArn) (\s :: PutNotificationChannel
s@PutNotificationChannel' {} Text
a -> PutNotificationChannel
s {$sel:snsTopicArn:PutNotificationChannel' :: Text
snsTopicArn = Text
a} :: PutNotificationChannel)
putNotificationChannel_snsRoleName :: Lens.Lens' PutNotificationChannel Prelude.Text
putNotificationChannel_snsRoleName :: (Text -> f Text)
-> PutNotificationChannel -> f PutNotificationChannel
putNotificationChannel_snsRoleName = (PutNotificationChannel -> Text)
-> (PutNotificationChannel -> Text -> PutNotificationChannel)
-> Lens PutNotificationChannel PutNotificationChannel Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutNotificationChannel' {Text
snsRoleName :: Text
$sel:snsRoleName:PutNotificationChannel' :: PutNotificationChannel -> Text
snsRoleName} -> Text
snsRoleName) (\s :: PutNotificationChannel
s@PutNotificationChannel' {} Text
a -> PutNotificationChannel
s {$sel:snsRoleName:PutNotificationChannel' :: Text
snsRoleName = Text
a} :: PutNotificationChannel)
instance Core.AWSRequest PutNotificationChannel where
type
AWSResponse PutNotificationChannel =
PutNotificationChannelResponse
request :: PutNotificationChannel -> Request PutNotificationChannel
request = Service -> PutNotificationChannel -> Request PutNotificationChannel
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy PutNotificationChannel
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutNotificationChannel)))
response =
AWSResponse PutNotificationChannel
-> Logger
-> Service
-> Proxy PutNotificationChannel
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutNotificationChannel)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
AWSResponse PutNotificationChannel
PutNotificationChannelResponse
PutNotificationChannelResponse'
instance Prelude.Hashable PutNotificationChannel
instance Prelude.NFData PutNotificationChannel
instance Core.ToHeaders PutNotificationChannel where
toHeaders :: PutNotificationChannel -> [Header]
toHeaders =
[Header] -> PutNotificationChannel -> [Header]
forall a b. a -> b -> a
Prelude.const
( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"AWSFMS_20180101.PutNotificationChannel" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON PutNotificationChannel where
toJSON :: PutNotificationChannel -> Value
toJSON PutNotificationChannel' {Text
snsRoleName :: Text
snsTopicArn :: Text
$sel:snsRoleName:PutNotificationChannel' :: PutNotificationChannel -> Text
$sel:snsTopicArn:PutNotificationChannel' :: PutNotificationChannel -> 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
"SnsTopicArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
snsTopicArn),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"SnsRoleName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
snsRoleName)
]
)
instance Core.ToPath PutNotificationChannel where
toPath :: PutNotificationChannel -> ByteString
toPath = ByteString -> PutNotificationChannel -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery PutNotificationChannel where
toQuery :: PutNotificationChannel -> QueryString
toQuery = QueryString -> PutNotificationChannel -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data PutNotificationChannelResponse = PutNotificationChannelResponse'
{
}
deriving (PutNotificationChannelResponse
-> PutNotificationChannelResponse -> Bool
(PutNotificationChannelResponse
-> PutNotificationChannelResponse -> Bool)
-> (PutNotificationChannelResponse
-> PutNotificationChannelResponse -> Bool)
-> Eq PutNotificationChannelResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutNotificationChannelResponse
-> PutNotificationChannelResponse -> Bool
$c/= :: PutNotificationChannelResponse
-> PutNotificationChannelResponse -> Bool
== :: PutNotificationChannelResponse
-> PutNotificationChannelResponse -> Bool
$c== :: PutNotificationChannelResponse
-> PutNotificationChannelResponse -> Bool
Prelude.Eq, ReadPrec [PutNotificationChannelResponse]
ReadPrec PutNotificationChannelResponse
Int -> ReadS PutNotificationChannelResponse
ReadS [PutNotificationChannelResponse]
(Int -> ReadS PutNotificationChannelResponse)
-> ReadS [PutNotificationChannelResponse]
-> ReadPrec PutNotificationChannelResponse
-> ReadPrec [PutNotificationChannelResponse]
-> Read PutNotificationChannelResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutNotificationChannelResponse]
$creadListPrec :: ReadPrec [PutNotificationChannelResponse]
readPrec :: ReadPrec PutNotificationChannelResponse
$creadPrec :: ReadPrec PutNotificationChannelResponse
readList :: ReadS [PutNotificationChannelResponse]
$creadList :: ReadS [PutNotificationChannelResponse]
readsPrec :: Int -> ReadS PutNotificationChannelResponse
$creadsPrec :: Int -> ReadS PutNotificationChannelResponse
Prelude.Read, Int -> PutNotificationChannelResponse -> ShowS
[PutNotificationChannelResponse] -> ShowS
PutNotificationChannelResponse -> String
(Int -> PutNotificationChannelResponse -> ShowS)
-> (PutNotificationChannelResponse -> String)
-> ([PutNotificationChannelResponse] -> ShowS)
-> Show PutNotificationChannelResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutNotificationChannelResponse] -> ShowS
$cshowList :: [PutNotificationChannelResponse] -> ShowS
show :: PutNotificationChannelResponse -> String
$cshow :: PutNotificationChannelResponse -> String
showsPrec :: Int -> PutNotificationChannelResponse -> ShowS
$cshowsPrec :: Int -> PutNotificationChannelResponse -> ShowS
Prelude.Show, (forall x.
PutNotificationChannelResponse
-> Rep PutNotificationChannelResponse x)
-> (forall x.
Rep PutNotificationChannelResponse x
-> PutNotificationChannelResponse)
-> Generic PutNotificationChannelResponse
forall x.
Rep PutNotificationChannelResponse x
-> PutNotificationChannelResponse
forall x.
PutNotificationChannelResponse
-> Rep PutNotificationChannelResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutNotificationChannelResponse x
-> PutNotificationChannelResponse
$cfrom :: forall x.
PutNotificationChannelResponse
-> Rep PutNotificationChannelResponse x
Prelude.Generic)
newPutNotificationChannelResponse ::
PutNotificationChannelResponse
newPutNotificationChannelResponse :: PutNotificationChannelResponse
newPutNotificationChannelResponse =
PutNotificationChannelResponse
PutNotificationChannelResponse'
instance
Prelude.NFData
PutNotificationChannelResponse