{-# 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.AlexaBusiness.SendAnnouncement
(
SendAnnouncement (..),
newSendAnnouncement,
sendAnnouncement_timeToLiveInSeconds,
sendAnnouncement_roomFilters,
sendAnnouncement_content,
sendAnnouncement_clientRequestToken,
SendAnnouncementResponse (..),
newSendAnnouncementResponse,
sendAnnouncementResponse_announcementArn,
sendAnnouncementResponse_httpStatus,
)
where
import Amazonka.AlexaBusiness.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 SendAnnouncement = SendAnnouncement'
{
SendAnnouncement -> Maybe Natural
timeToLiveInSeconds :: Prelude.Maybe Prelude.Natural,
SendAnnouncement -> [Filter]
roomFilters :: [Filter],
SendAnnouncement -> Content
content :: Content,
SendAnnouncement -> Text
clientRequestToken :: Prelude.Text
}
deriving (SendAnnouncement -> SendAnnouncement -> Bool
(SendAnnouncement -> SendAnnouncement -> Bool)
-> (SendAnnouncement -> SendAnnouncement -> Bool)
-> Eq SendAnnouncement
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SendAnnouncement -> SendAnnouncement -> Bool
$c/= :: SendAnnouncement -> SendAnnouncement -> Bool
== :: SendAnnouncement -> SendAnnouncement -> Bool
$c== :: SendAnnouncement -> SendAnnouncement -> Bool
Prelude.Eq, ReadPrec [SendAnnouncement]
ReadPrec SendAnnouncement
Int -> ReadS SendAnnouncement
ReadS [SendAnnouncement]
(Int -> ReadS SendAnnouncement)
-> ReadS [SendAnnouncement]
-> ReadPrec SendAnnouncement
-> ReadPrec [SendAnnouncement]
-> Read SendAnnouncement
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SendAnnouncement]
$creadListPrec :: ReadPrec [SendAnnouncement]
readPrec :: ReadPrec SendAnnouncement
$creadPrec :: ReadPrec SendAnnouncement
readList :: ReadS [SendAnnouncement]
$creadList :: ReadS [SendAnnouncement]
readsPrec :: Int -> ReadS SendAnnouncement
$creadsPrec :: Int -> ReadS SendAnnouncement
Prelude.Read, Int -> SendAnnouncement -> ShowS
[SendAnnouncement] -> ShowS
SendAnnouncement -> String
(Int -> SendAnnouncement -> ShowS)
-> (SendAnnouncement -> String)
-> ([SendAnnouncement] -> ShowS)
-> Show SendAnnouncement
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SendAnnouncement] -> ShowS
$cshowList :: [SendAnnouncement] -> ShowS
show :: SendAnnouncement -> String
$cshow :: SendAnnouncement -> String
showsPrec :: Int -> SendAnnouncement -> ShowS
$cshowsPrec :: Int -> SendAnnouncement -> ShowS
Prelude.Show, (forall x. SendAnnouncement -> Rep SendAnnouncement x)
-> (forall x. Rep SendAnnouncement x -> SendAnnouncement)
-> Generic SendAnnouncement
forall x. Rep SendAnnouncement x -> SendAnnouncement
forall x. SendAnnouncement -> Rep SendAnnouncement x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SendAnnouncement x -> SendAnnouncement
$cfrom :: forall x. SendAnnouncement -> Rep SendAnnouncement x
Prelude.Generic)
newSendAnnouncement ::
Content ->
Prelude.Text ->
SendAnnouncement
newSendAnnouncement :: Content -> Text -> SendAnnouncement
newSendAnnouncement Content
pContent_ Text
pClientRequestToken_ =
SendAnnouncement' :: Maybe Natural -> [Filter] -> Content -> Text -> SendAnnouncement
SendAnnouncement'
{ $sel:timeToLiveInSeconds:SendAnnouncement' :: Maybe Natural
timeToLiveInSeconds =
Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:roomFilters:SendAnnouncement' :: [Filter]
roomFilters = [Filter]
forall a. Monoid a => a
Prelude.mempty,
$sel:content:SendAnnouncement' :: Content
content = Content
pContent_,
$sel:clientRequestToken:SendAnnouncement' :: Text
clientRequestToken = Text
pClientRequestToken_
}
sendAnnouncement_timeToLiveInSeconds :: Lens.Lens' SendAnnouncement (Prelude.Maybe Prelude.Natural)
sendAnnouncement_timeToLiveInSeconds :: (Maybe Natural -> f (Maybe Natural))
-> SendAnnouncement -> f SendAnnouncement
sendAnnouncement_timeToLiveInSeconds = (SendAnnouncement -> Maybe Natural)
-> (SendAnnouncement -> Maybe Natural -> SendAnnouncement)
-> Lens
SendAnnouncement SendAnnouncement (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendAnnouncement' {Maybe Natural
timeToLiveInSeconds :: Maybe Natural
$sel:timeToLiveInSeconds:SendAnnouncement' :: SendAnnouncement -> Maybe Natural
timeToLiveInSeconds} -> Maybe Natural
timeToLiveInSeconds) (\s :: SendAnnouncement
s@SendAnnouncement' {} Maybe Natural
a -> SendAnnouncement
s {$sel:timeToLiveInSeconds:SendAnnouncement' :: Maybe Natural
timeToLiveInSeconds = Maybe Natural
a} :: SendAnnouncement)
sendAnnouncement_roomFilters :: Lens.Lens' SendAnnouncement [Filter]
sendAnnouncement_roomFilters :: ([Filter] -> f [Filter]) -> SendAnnouncement -> f SendAnnouncement
sendAnnouncement_roomFilters = (SendAnnouncement -> [Filter])
-> (SendAnnouncement -> [Filter] -> SendAnnouncement)
-> Lens SendAnnouncement SendAnnouncement [Filter] [Filter]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendAnnouncement' {[Filter]
roomFilters :: [Filter]
$sel:roomFilters:SendAnnouncement' :: SendAnnouncement -> [Filter]
roomFilters} -> [Filter]
roomFilters) (\s :: SendAnnouncement
s@SendAnnouncement' {} [Filter]
a -> SendAnnouncement
s {$sel:roomFilters:SendAnnouncement' :: [Filter]
roomFilters = [Filter]
a} :: SendAnnouncement) (([Filter] -> f [Filter])
-> SendAnnouncement -> f SendAnnouncement)
-> (([Filter] -> f [Filter]) -> [Filter] -> f [Filter])
-> ([Filter] -> f [Filter])
-> SendAnnouncement
-> f SendAnnouncement
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Filter] -> f [Filter]) -> [Filter] -> f [Filter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
sendAnnouncement_content :: Lens.Lens' SendAnnouncement Content
sendAnnouncement_content :: (Content -> f Content) -> SendAnnouncement -> f SendAnnouncement
sendAnnouncement_content = (SendAnnouncement -> Content)
-> (SendAnnouncement -> Content -> SendAnnouncement)
-> Lens SendAnnouncement SendAnnouncement Content Content
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendAnnouncement' {Content
content :: Content
$sel:content:SendAnnouncement' :: SendAnnouncement -> Content
content} -> Content
content) (\s :: SendAnnouncement
s@SendAnnouncement' {} Content
a -> SendAnnouncement
s {$sel:content:SendAnnouncement' :: Content
content = Content
a} :: SendAnnouncement)
sendAnnouncement_clientRequestToken :: Lens.Lens' SendAnnouncement Prelude.Text
sendAnnouncement_clientRequestToken :: (Text -> f Text) -> SendAnnouncement -> f SendAnnouncement
sendAnnouncement_clientRequestToken = (SendAnnouncement -> Text)
-> (SendAnnouncement -> Text -> SendAnnouncement)
-> Lens SendAnnouncement SendAnnouncement Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendAnnouncement' {Text
clientRequestToken :: Text
$sel:clientRequestToken:SendAnnouncement' :: SendAnnouncement -> Text
clientRequestToken} -> Text
clientRequestToken) (\s :: SendAnnouncement
s@SendAnnouncement' {} Text
a -> SendAnnouncement
s {$sel:clientRequestToken:SendAnnouncement' :: Text
clientRequestToken = Text
a} :: SendAnnouncement)
instance Core.AWSRequest SendAnnouncement where
type
AWSResponse SendAnnouncement =
SendAnnouncementResponse
request :: SendAnnouncement -> Request SendAnnouncement
request = Service -> SendAnnouncement -> Request SendAnnouncement
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy SendAnnouncement
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse SendAnnouncement)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse SendAnnouncement))
-> Logger
-> Service
-> Proxy SendAnnouncement
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse SendAnnouncement)))
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 Text -> Int -> SendAnnouncementResponse
SendAnnouncementResponse'
(Maybe Text -> Int -> SendAnnouncementResponse)
-> Either String (Maybe Text)
-> Either String (Int -> SendAnnouncementResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"AnnouncementArn")
Either String (Int -> SendAnnouncementResponse)
-> Either String Int -> Either String SendAnnouncementResponse
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 SendAnnouncement
instance Prelude.NFData SendAnnouncement
instance Core.ToHeaders SendAnnouncement where
toHeaders :: SendAnnouncement -> ResponseHeaders
toHeaders =
ResponseHeaders -> SendAnnouncement -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AlexaForBusiness.SendAnnouncement" ::
Prelude.ByteString
),
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 SendAnnouncement where
toJSON :: SendAnnouncement -> Value
toJSON SendAnnouncement' {[Filter]
Maybe Natural
Text
Content
clientRequestToken :: Text
content :: Content
roomFilters :: [Filter]
timeToLiveInSeconds :: Maybe Natural
$sel:clientRequestToken:SendAnnouncement' :: SendAnnouncement -> Text
$sel:content:SendAnnouncement' :: SendAnnouncement -> Content
$sel:roomFilters:SendAnnouncement' :: SendAnnouncement -> [Filter]
$sel:timeToLiveInSeconds:SendAnnouncement' :: SendAnnouncement -> Maybe Natural
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"TimeToLiveInSeconds" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
timeToLiveInSeconds,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"RoomFilters" Text -> [Filter] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Filter]
roomFilters),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Content" Text -> Content -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Content
content),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"ClientRequestToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
clientRequestToken)
]
)
instance Core.ToPath SendAnnouncement where
toPath :: SendAnnouncement -> ByteString
toPath = ByteString -> SendAnnouncement -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery SendAnnouncement where
toQuery :: SendAnnouncement -> QueryString
toQuery = QueryString -> SendAnnouncement -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data SendAnnouncementResponse = SendAnnouncementResponse'
{
SendAnnouncementResponse -> Maybe Text
announcementArn :: Prelude.Maybe Prelude.Text,
SendAnnouncementResponse -> Int
httpStatus :: Prelude.Int
}
deriving (SendAnnouncementResponse -> SendAnnouncementResponse -> Bool
(SendAnnouncementResponse -> SendAnnouncementResponse -> Bool)
-> (SendAnnouncementResponse -> SendAnnouncementResponse -> Bool)
-> Eq SendAnnouncementResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SendAnnouncementResponse -> SendAnnouncementResponse -> Bool
$c/= :: SendAnnouncementResponse -> SendAnnouncementResponse -> Bool
== :: SendAnnouncementResponse -> SendAnnouncementResponse -> Bool
$c== :: SendAnnouncementResponse -> SendAnnouncementResponse -> Bool
Prelude.Eq, ReadPrec [SendAnnouncementResponse]
ReadPrec SendAnnouncementResponse
Int -> ReadS SendAnnouncementResponse
ReadS [SendAnnouncementResponse]
(Int -> ReadS SendAnnouncementResponse)
-> ReadS [SendAnnouncementResponse]
-> ReadPrec SendAnnouncementResponse
-> ReadPrec [SendAnnouncementResponse]
-> Read SendAnnouncementResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SendAnnouncementResponse]
$creadListPrec :: ReadPrec [SendAnnouncementResponse]
readPrec :: ReadPrec SendAnnouncementResponse
$creadPrec :: ReadPrec SendAnnouncementResponse
readList :: ReadS [SendAnnouncementResponse]
$creadList :: ReadS [SendAnnouncementResponse]
readsPrec :: Int -> ReadS SendAnnouncementResponse
$creadsPrec :: Int -> ReadS SendAnnouncementResponse
Prelude.Read, Int -> SendAnnouncementResponse -> ShowS
[SendAnnouncementResponse] -> ShowS
SendAnnouncementResponse -> String
(Int -> SendAnnouncementResponse -> ShowS)
-> (SendAnnouncementResponse -> String)
-> ([SendAnnouncementResponse] -> ShowS)
-> Show SendAnnouncementResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SendAnnouncementResponse] -> ShowS
$cshowList :: [SendAnnouncementResponse] -> ShowS
show :: SendAnnouncementResponse -> String
$cshow :: SendAnnouncementResponse -> String
showsPrec :: Int -> SendAnnouncementResponse -> ShowS
$cshowsPrec :: Int -> SendAnnouncementResponse -> ShowS
Prelude.Show, (forall x.
SendAnnouncementResponse -> Rep SendAnnouncementResponse x)
-> (forall x.
Rep SendAnnouncementResponse x -> SendAnnouncementResponse)
-> Generic SendAnnouncementResponse
forall x.
Rep SendAnnouncementResponse x -> SendAnnouncementResponse
forall x.
SendAnnouncementResponse -> Rep SendAnnouncementResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SendAnnouncementResponse x -> SendAnnouncementResponse
$cfrom :: forall x.
SendAnnouncementResponse -> Rep SendAnnouncementResponse x
Prelude.Generic)
newSendAnnouncementResponse ::
Prelude.Int ->
SendAnnouncementResponse
newSendAnnouncementResponse :: Int -> SendAnnouncementResponse
newSendAnnouncementResponse Int
pHttpStatus_ =
SendAnnouncementResponse' :: Maybe Text -> Int -> SendAnnouncementResponse
SendAnnouncementResponse'
{ $sel:announcementArn:SendAnnouncementResponse' :: Maybe Text
announcementArn =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:SendAnnouncementResponse' :: Int
httpStatus = Int
pHttpStatus_
}
sendAnnouncementResponse_announcementArn :: Lens.Lens' SendAnnouncementResponse (Prelude.Maybe Prelude.Text)
sendAnnouncementResponse_announcementArn :: (Maybe Text -> f (Maybe Text))
-> SendAnnouncementResponse -> f SendAnnouncementResponse
sendAnnouncementResponse_announcementArn = (SendAnnouncementResponse -> Maybe Text)
-> (SendAnnouncementResponse
-> Maybe Text -> SendAnnouncementResponse)
-> Lens
SendAnnouncementResponse
SendAnnouncementResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendAnnouncementResponse' {Maybe Text
announcementArn :: Maybe Text
$sel:announcementArn:SendAnnouncementResponse' :: SendAnnouncementResponse -> Maybe Text
announcementArn} -> Maybe Text
announcementArn) (\s :: SendAnnouncementResponse
s@SendAnnouncementResponse' {} Maybe Text
a -> SendAnnouncementResponse
s {$sel:announcementArn:SendAnnouncementResponse' :: Maybe Text
announcementArn = Maybe Text
a} :: SendAnnouncementResponse)
sendAnnouncementResponse_httpStatus :: Lens.Lens' SendAnnouncementResponse Prelude.Int
sendAnnouncementResponse_httpStatus :: (Int -> f Int)
-> SendAnnouncementResponse -> f SendAnnouncementResponse
sendAnnouncementResponse_httpStatus = (SendAnnouncementResponse -> Int)
-> (SendAnnouncementResponse -> Int -> SendAnnouncementResponse)
-> Lens SendAnnouncementResponse SendAnnouncementResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendAnnouncementResponse' {Int
httpStatus :: Int
$sel:httpStatus:SendAnnouncementResponse' :: SendAnnouncementResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: SendAnnouncementResponse
s@SendAnnouncementResponse' {} Int
a -> SendAnnouncementResponse
s {$sel:httpStatus:SendAnnouncementResponse' :: Int
httpStatus = Int
a} :: SendAnnouncementResponse)
instance Prelude.NFData SendAnnouncementResponse