{-# 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.Chime.PutEventsConfiguration
(
PutEventsConfiguration (..),
newPutEventsConfiguration,
putEventsConfiguration_lambdaFunctionArn,
putEventsConfiguration_outboundEventsHTTPSEndpoint,
putEventsConfiguration_accountId,
putEventsConfiguration_botId,
PutEventsConfigurationResponse (..),
newPutEventsConfigurationResponse,
putEventsConfigurationResponse_eventsConfiguration,
putEventsConfigurationResponse_httpStatus,
)
where
import Amazonka.Chime.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 PutEventsConfiguration = PutEventsConfiguration'
{
PutEventsConfiguration -> Maybe (Sensitive Text)
lambdaFunctionArn :: Prelude.Maybe (Core.Sensitive Prelude.Text),
PutEventsConfiguration -> Maybe (Sensitive Text)
outboundEventsHTTPSEndpoint :: Prelude.Maybe (Core.Sensitive Prelude.Text),
PutEventsConfiguration -> Text
accountId :: Prelude.Text,
PutEventsConfiguration -> Text
botId :: Prelude.Text
}
deriving (PutEventsConfiguration -> PutEventsConfiguration -> Bool
(PutEventsConfiguration -> PutEventsConfiguration -> Bool)
-> (PutEventsConfiguration -> PutEventsConfiguration -> Bool)
-> Eq PutEventsConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutEventsConfiguration -> PutEventsConfiguration -> Bool
$c/= :: PutEventsConfiguration -> PutEventsConfiguration -> Bool
== :: PutEventsConfiguration -> PutEventsConfiguration -> Bool
$c== :: PutEventsConfiguration -> PutEventsConfiguration -> Bool
Prelude.Eq, Int -> PutEventsConfiguration -> ShowS
[PutEventsConfiguration] -> ShowS
PutEventsConfiguration -> String
(Int -> PutEventsConfiguration -> ShowS)
-> (PutEventsConfiguration -> String)
-> ([PutEventsConfiguration] -> ShowS)
-> Show PutEventsConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutEventsConfiguration] -> ShowS
$cshowList :: [PutEventsConfiguration] -> ShowS
show :: PutEventsConfiguration -> String
$cshow :: PutEventsConfiguration -> String
showsPrec :: Int -> PutEventsConfiguration -> ShowS
$cshowsPrec :: Int -> PutEventsConfiguration -> ShowS
Prelude.Show, (forall x. PutEventsConfiguration -> Rep PutEventsConfiguration x)
-> (forall x.
Rep PutEventsConfiguration x -> PutEventsConfiguration)
-> Generic PutEventsConfiguration
forall x. Rep PutEventsConfiguration x -> PutEventsConfiguration
forall x. PutEventsConfiguration -> Rep PutEventsConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutEventsConfiguration x -> PutEventsConfiguration
$cfrom :: forall x. PutEventsConfiguration -> Rep PutEventsConfiguration x
Prelude.Generic)
newPutEventsConfiguration ::
Prelude.Text ->
Prelude.Text ->
PutEventsConfiguration
newPutEventsConfiguration :: Text -> Text -> PutEventsConfiguration
newPutEventsConfiguration Text
pAccountId_ Text
pBotId_ =
PutEventsConfiguration' :: Maybe (Sensitive Text)
-> Maybe (Sensitive Text) -> Text -> Text -> PutEventsConfiguration
PutEventsConfiguration'
{ $sel:lambdaFunctionArn:PutEventsConfiguration' :: Maybe (Sensitive Text)
lambdaFunctionArn =
Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
$sel:outboundEventsHTTPSEndpoint:PutEventsConfiguration' :: Maybe (Sensitive Text)
outboundEventsHTTPSEndpoint = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
$sel:accountId:PutEventsConfiguration' :: Text
accountId = Text
pAccountId_,
$sel:botId:PutEventsConfiguration' :: Text
botId = Text
pBotId_
}
putEventsConfiguration_lambdaFunctionArn :: Lens.Lens' PutEventsConfiguration (Prelude.Maybe Prelude.Text)
putEventsConfiguration_lambdaFunctionArn :: (Maybe Text -> f (Maybe Text))
-> PutEventsConfiguration -> f PutEventsConfiguration
putEventsConfiguration_lambdaFunctionArn = (PutEventsConfiguration -> Maybe (Sensitive Text))
-> (PutEventsConfiguration
-> Maybe (Sensitive Text) -> PutEventsConfiguration)
-> Lens
PutEventsConfiguration
PutEventsConfiguration
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutEventsConfiguration' {Maybe (Sensitive Text)
lambdaFunctionArn :: Maybe (Sensitive Text)
$sel:lambdaFunctionArn:PutEventsConfiguration' :: PutEventsConfiguration -> Maybe (Sensitive Text)
lambdaFunctionArn} -> Maybe (Sensitive Text)
lambdaFunctionArn) (\s :: PutEventsConfiguration
s@PutEventsConfiguration' {} Maybe (Sensitive Text)
a -> PutEventsConfiguration
s {$sel:lambdaFunctionArn:PutEventsConfiguration' :: Maybe (Sensitive Text)
lambdaFunctionArn = Maybe (Sensitive Text)
a} :: PutEventsConfiguration) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> PutEventsConfiguration -> f PutEventsConfiguration)
-> ((Maybe Text -> f (Maybe Text))
-> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> PutEventsConfiguration
-> f PutEventsConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
(Maybe Text)
(Maybe Text)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive
putEventsConfiguration_outboundEventsHTTPSEndpoint :: Lens.Lens' PutEventsConfiguration (Prelude.Maybe Prelude.Text)
putEventsConfiguration_outboundEventsHTTPSEndpoint :: (Maybe Text -> f (Maybe Text))
-> PutEventsConfiguration -> f PutEventsConfiguration
putEventsConfiguration_outboundEventsHTTPSEndpoint = (PutEventsConfiguration -> Maybe (Sensitive Text))
-> (PutEventsConfiguration
-> Maybe (Sensitive Text) -> PutEventsConfiguration)
-> Lens
PutEventsConfiguration
PutEventsConfiguration
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutEventsConfiguration' {Maybe (Sensitive Text)
outboundEventsHTTPSEndpoint :: Maybe (Sensitive Text)
$sel:outboundEventsHTTPSEndpoint:PutEventsConfiguration' :: PutEventsConfiguration -> Maybe (Sensitive Text)
outboundEventsHTTPSEndpoint} -> Maybe (Sensitive Text)
outboundEventsHTTPSEndpoint) (\s :: PutEventsConfiguration
s@PutEventsConfiguration' {} Maybe (Sensitive Text)
a -> PutEventsConfiguration
s {$sel:outboundEventsHTTPSEndpoint:PutEventsConfiguration' :: Maybe (Sensitive Text)
outboundEventsHTTPSEndpoint = Maybe (Sensitive Text)
a} :: PutEventsConfiguration) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> PutEventsConfiguration -> f PutEventsConfiguration)
-> ((Maybe Text -> f (Maybe Text))
-> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> PutEventsConfiguration
-> f PutEventsConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
(Maybe Text)
(Maybe Text)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive
putEventsConfiguration_accountId :: Lens.Lens' PutEventsConfiguration Prelude.Text
putEventsConfiguration_accountId :: (Text -> f Text)
-> PutEventsConfiguration -> f PutEventsConfiguration
putEventsConfiguration_accountId = (PutEventsConfiguration -> Text)
-> (PutEventsConfiguration -> Text -> PutEventsConfiguration)
-> Lens PutEventsConfiguration PutEventsConfiguration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutEventsConfiguration' {Text
accountId :: Text
$sel:accountId:PutEventsConfiguration' :: PutEventsConfiguration -> Text
accountId} -> Text
accountId) (\s :: PutEventsConfiguration
s@PutEventsConfiguration' {} Text
a -> PutEventsConfiguration
s {$sel:accountId:PutEventsConfiguration' :: Text
accountId = Text
a} :: PutEventsConfiguration)
putEventsConfiguration_botId :: Lens.Lens' PutEventsConfiguration Prelude.Text
putEventsConfiguration_botId :: (Text -> f Text)
-> PutEventsConfiguration -> f PutEventsConfiguration
putEventsConfiguration_botId = (PutEventsConfiguration -> Text)
-> (PutEventsConfiguration -> Text -> PutEventsConfiguration)
-> Lens PutEventsConfiguration PutEventsConfiguration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutEventsConfiguration' {Text
botId :: Text
$sel:botId:PutEventsConfiguration' :: PutEventsConfiguration -> Text
botId} -> Text
botId) (\s :: PutEventsConfiguration
s@PutEventsConfiguration' {} Text
a -> PutEventsConfiguration
s {$sel:botId:PutEventsConfiguration' :: Text
botId = Text
a} :: PutEventsConfiguration)
instance Core.AWSRequest PutEventsConfiguration where
type
AWSResponse PutEventsConfiguration =
PutEventsConfigurationResponse
request :: PutEventsConfiguration -> Request PutEventsConfiguration
request = Service -> PutEventsConfiguration -> Request PutEventsConfiguration
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy PutEventsConfiguration
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutEventsConfiguration)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse PutEventsConfiguration))
-> Logger
-> Service
-> Proxy PutEventsConfiguration
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutEventsConfiguration)))
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 EventsConfiguration -> Int -> PutEventsConfigurationResponse
PutEventsConfigurationResponse'
(Maybe EventsConfiguration
-> Int -> PutEventsConfigurationResponse)
-> Either String (Maybe EventsConfiguration)
-> Either String (Int -> PutEventsConfigurationResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe EventsConfiguration)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"EventsConfiguration")
Either String (Int -> PutEventsConfigurationResponse)
-> Either String Int
-> Either String PutEventsConfigurationResponse
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 PutEventsConfiguration
instance Prelude.NFData PutEventsConfiguration
instance Core.ToHeaders PutEventsConfiguration where
toHeaders :: PutEventsConfiguration -> ResponseHeaders
toHeaders = ResponseHeaders -> PutEventsConfiguration -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON PutEventsConfiguration where
toJSON :: PutEventsConfiguration -> Value
toJSON PutEventsConfiguration' {Maybe (Sensitive Text)
Text
botId :: Text
accountId :: Text
outboundEventsHTTPSEndpoint :: Maybe (Sensitive Text)
lambdaFunctionArn :: Maybe (Sensitive Text)
$sel:botId:PutEventsConfiguration' :: PutEventsConfiguration -> Text
$sel:accountId:PutEventsConfiguration' :: PutEventsConfiguration -> Text
$sel:outboundEventsHTTPSEndpoint:PutEventsConfiguration' :: PutEventsConfiguration -> Maybe (Sensitive Text)
$sel:lambdaFunctionArn:PutEventsConfiguration' :: PutEventsConfiguration -> Maybe (Sensitive Text)
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"LambdaFunctionArn" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Sensitive Text -> Pair) -> Maybe (Sensitive Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
lambdaFunctionArn,
(Text
"OutboundEventsHTTPSEndpoint" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Sensitive Text -> Pair) -> Maybe (Sensitive Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
outboundEventsHTTPSEndpoint
]
)
instance Core.ToPath PutEventsConfiguration where
toPath :: PutEventsConfiguration -> ByteString
toPath PutEventsConfiguration' {Maybe (Sensitive Text)
Text
botId :: Text
accountId :: Text
outboundEventsHTTPSEndpoint :: Maybe (Sensitive Text)
lambdaFunctionArn :: Maybe (Sensitive Text)
$sel:botId:PutEventsConfiguration' :: PutEventsConfiguration -> Text
$sel:accountId:PutEventsConfiguration' :: PutEventsConfiguration -> Text
$sel:outboundEventsHTTPSEndpoint:PutEventsConfiguration' :: PutEventsConfiguration -> Maybe (Sensitive Text)
$sel:lambdaFunctionArn:PutEventsConfiguration' :: PutEventsConfiguration -> Maybe (Sensitive Text)
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/accounts/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
accountId,
ByteString
"/bots/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
botId,
ByteString
"/events-configuration"
]
instance Core.ToQuery PutEventsConfiguration where
toQuery :: PutEventsConfiguration -> QueryString
toQuery = QueryString -> PutEventsConfiguration -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data PutEventsConfigurationResponse = PutEventsConfigurationResponse'
{ PutEventsConfigurationResponse -> Maybe EventsConfiguration
eventsConfiguration :: Prelude.Maybe EventsConfiguration,
PutEventsConfigurationResponse -> Int
httpStatus :: Prelude.Int
}
deriving (PutEventsConfigurationResponse
-> PutEventsConfigurationResponse -> Bool
(PutEventsConfigurationResponse
-> PutEventsConfigurationResponse -> Bool)
-> (PutEventsConfigurationResponse
-> PutEventsConfigurationResponse -> Bool)
-> Eq PutEventsConfigurationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutEventsConfigurationResponse
-> PutEventsConfigurationResponse -> Bool
$c/= :: PutEventsConfigurationResponse
-> PutEventsConfigurationResponse -> Bool
== :: PutEventsConfigurationResponse
-> PutEventsConfigurationResponse -> Bool
$c== :: PutEventsConfigurationResponse
-> PutEventsConfigurationResponse -> Bool
Prelude.Eq, Int -> PutEventsConfigurationResponse -> ShowS
[PutEventsConfigurationResponse] -> ShowS
PutEventsConfigurationResponse -> String
(Int -> PutEventsConfigurationResponse -> ShowS)
-> (PutEventsConfigurationResponse -> String)
-> ([PutEventsConfigurationResponse] -> ShowS)
-> Show PutEventsConfigurationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutEventsConfigurationResponse] -> ShowS
$cshowList :: [PutEventsConfigurationResponse] -> ShowS
show :: PutEventsConfigurationResponse -> String
$cshow :: PutEventsConfigurationResponse -> String
showsPrec :: Int -> PutEventsConfigurationResponse -> ShowS
$cshowsPrec :: Int -> PutEventsConfigurationResponse -> ShowS
Prelude.Show, (forall x.
PutEventsConfigurationResponse
-> Rep PutEventsConfigurationResponse x)
-> (forall x.
Rep PutEventsConfigurationResponse x
-> PutEventsConfigurationResponse)
-> Generic PutEventsConfigurationResponse
forall x.
Rep PutEventsConfigurationResponse x
-> PutEventsConfigurationResponse
forall x.
PutEventsConfigurationResponse
-> Rep PutEventsConfigurationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutEventsConfigurationResponse x
-> PutEventsConfigurationResponse
$cfrom :: forall x.
PutEventsConfigurationResponse
-> Rep PutEventsConfigurationResponse x
Prelude.Generic)
newPutEventsConfigurationResponse ::
Prelude.Int ->
PutEventsConfigurationResponse
newPutEventsConfigurationResponse :: Int -> PutEventsConfigurationResponse
newPutEventsConfigurationResponse Int
pHttpStatus_ =
PutEventsConfigurationResponse' :: Maybe EventsConfiguration -> Int -> PutEventsConfigurationResponse
PutEventsConfigurationResponse'
{ $sel:eventsConfiguration:PutEventsConfigurationResponse' :: Maybe EventsConfiguration
eventsConfiguration =
Maybe EventsConfiguration
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:PutEventsConfigurationResponse' :: Int
httpStatus = Int
pHttpStatus_
}
putEventsConfigurationResponse_eventsConfiguration :: Lens.Lens' PutEventsConfigurationResponse (Prelude.Maybe EventsConfiguration)
putEventsConfigurationResponse_eventsConfiguration :: (Maybe EventsConfiguration -> f (Maybe EventsConfiguration))
-> PutEventsConfigurationResponse
-> f PutEventsConfigurationResponse
putEventsConfigurationResponse_eventsConfiguration = (PutEventsConfigurationResponse -> Maybe EventsConfiguration)
-> (PutEventsConfigurationResponse
-> Maybe EventsConfiguration -> PutEventsConfigurationResponse)
-> Lens
PutEventsConfigurationResponse
PutEventsConfigurationResponse
(Maybe EventsConfiguration)
(Maybe EventsConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutEventsConfigurationResponse' {Maybe EventsConfiguration
eventsConfiguration :: Maybe EventsConfiguration
$sel:eventsConfiguration:PutEventsConfigurationResponse' :: PutEventsConfigurationResponse -> Maybe EventsConfiguration
eventsConfiguration} -> Maybe EventsConfiguration
eventsConfiguration) (\s :: PutEventsConfigurationResponse
s@PutEventsConfigurationResponse' {} Maybe EventsConfiguration
a -> PutEventsConfigurationResponse
s {$sel:eventsConfiguration:PutEventsConfigurationResponse' :: Maybe EventsConfiguration
eventsConfiguration = Maybe EventsConfiguration
a} :: PutEventsConfigurationResponse)
putEventsConfigurationResponse_httpStatus :: Lens.Lens' PutEventsConfigurationResponse Prelude.Int
putEventsConfigurationResponse_httpStatus :: (Int -> f Int)
-> PutEventsConfigurationResponse
-> f PutEventsConfigurationResponse
putEventsConfigurationResponse_httpStatus = (PutEventsConfigurationResponse -> Int)
-> (PutEventsConfigurationResponse
-> Int -> PutEventsConfigurationResponse)
-> Lens
PutEventsConfigurationResponse
PutEventsConfigurationResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutEventsConfigurationResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutEventsConfigurationResponse' :: PutEventsConfigurationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutEventsConfigurationResponse
s@PutEventsConfigurationResponse' {} Int
a -> PutEventsConfigurationResponse
s {$sel:httpStatus:PutEventsConfigurationResponse' :: Int
httpStatus = Int
a} :: PutEventsConfigurationResponse)
instance
Prelude.NFData
PutEventsConfigurationResponse