{-# 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.Kinesis.RegisterStreamConsumer
(
RegisterStreamConsumer (..),
newRegisterStreamConsumer,
registerStreamConsumer_streamARN,
registerStreamConsumer_consumerName,
RegisterStreamConsumerResponse (..),
newRegisterStreamConsumerResponse,
registerStreamConsumerResponse_httpStatus,
registerStreamConsumerResponse_consumer,
)
where
import qualified Amazonka.Core as Core
import Amazonka.Kinesis.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 RegisterStreamConsumer = RegisterStreamConsumer'
{
RegisterStreamConsumer -> Text
streamARN :: Prelude.Text,
RegisterStreamConsumer -> Text
consumerName :: Prelude.Text
}
deriving (RegisterStreamConsumer -> RegisterStreamConsumer -> Bool
(RegisterStreamConsumer -> RegisterStreamConsumer -> Bool)
-> (RegisterStreamConsumer -> RegisterStreamConsumer -> Bool)
-> Eq RegisterStreamConsumer
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegisterStreamConsumer -> RegisterStreamConsumer -> Bool
$c/= :: RegisterStreamConsumer -> RegisterStreamConsumer -> Bool
== :: RegisterStreamConsumer -> RegisterStreamConsumer -> Bool
$c== :: RegisterStreamConsumer -> RegisterStreamConsumer -> Bool
Prelude.Eq, ReadPrec [RegisterStreamConsumer]
ReadPrec RegisterStreamConsumer
Int -> ReadS RegisterStreamConsumer
ReadS [RegisterStreamConsumer]
(Int -> ReadS RegisterStreamConsumer)
-> ReadS [RegisterStreamConsumer]
-> ReadPrec RegisterStreamConsumer
-> ReadPrec [RegisterStreamConsumer]
-> Read RegisterStreamConsumer
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RegisterStreamConsumer]
$creadListPrec :: ReadPrec [RegisterStreamConsumer]
readPrec :: ReadPrec RegisterStreamConsumer
$creadPrec :: ReadPrec RegisterStreamConsumer
readList :: ReadS [RegisterStreamConsumer]
$creadList :: ReadS [RegisterStreamConsumer]
readsPrec :: Int -> ReadS RegisterStreamConsumer
$creadsPrec :: Int -> ReadS RegisterStreamConsumer
Prelude.Read, Int -> RegisterStreamConsumer -> ShowS
[RegisterStreamConsumer] -> ShowS
RegisterStreamConsumer -> String
(Int -> RegisterStreamConsumer -> ShowS)
-> (RegisterStreamConsumer -> String)
-> ([RegisterStreamConsumer] -> ShowS)
-> Show RegisterStreamConsumer
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RegisterStreamConsumer] -> ShowS
$cshowList :: [RegisterStreamConsumer] -> ShowS
show :: RegisterStreamConsumer -> String
$cshow :: RegisterStreamConsumer -> String
showsPrec :: Int -> RegisterStreamConsumer -> ShowS
$cshowsPrec :: Int -> RegisterStreamConsumer -> ShowS
Prelude.Show, (forall x. RegisterStreamConsumer -> Rep RegisterStreamConsumer x)
-> (forall x.
Rep RegisterStreamConsumer x -> RegisterStreamConsumer)
-> Generic RegisterStreamConsumer
forall x. Rep RegisterStreamConsumer x -> RegisterStreamConsumer
forall x. RegisterStreamConsumer -> Rep RegisterStreamConsumer x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RegisterStreamConsumer x -> RegisterStreamConsumer
$cfrom :: forall x. RegisterStreamConsumer -> Rep RegisterStreamConsumer x
Prelude.Generic)
newRegisterStreamConsumer ::
Prelude.Text ->
Prelude.Text ->
RegisterStreamConsumer
newRegisterStreamConsumer :: Text -> Text -> RegisterStreamConsumer
newRegisterStreamConsumer Text
pStreamARN_ Text
pConsumerName_ =
RegisterStreamConsumer' :: Text -> Text -> RegisterStreamConsumer
RegisterStreamConsumer'
{ $sel:streamARN:RegisterStreamConsumer' :: Text
streamARN = Text
pStreamARN_,
$sel:consumerName:RegisterStreamConsumer' :: Text
consumerName = Text
pConsumerName_
}
registerStreamConsumer_streamARN :: Lens.Lens' RegisterStreamConsumer Prelude.Text
registerStreamConsumer_streamARN :: (Text -> f Text)
-> RegisterStreamConsumer -> f RegisterStreamConsumer
registerStreamConsumer_streamARN = (RegisterStreamConsumer -> Text)
-> (RegisterStreamConsumer -> Text -> RegisterStreamConsumer)
-> Lens RegisterStreamConsumer RegisterStreamConsumer Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterStreamConsumer' {Text
streamARN :: Text
$sel:streamARN:RegisterStreamConsumer' :: RegisterStreamConsumer -> Text
streamARN} -> Text
streamARN) (\s :: RegisterStreamConsumer
s@RegisterStreamConsumer' {} Text
a -> RegisterStreamConsumer
s {$sel:streamARN:RegisterStreamConsumer' :: Text
streamARN = Text
a} :: RegisterStreamConsumer)
registerStreamConsumer_consumerName :: Lens.Lens' RegisterStreamConsumer Prelude.Text
registerStreamConsumer_consumerName :: (Text -> f Text)
-> RegisterStreamConsumer -> f RegisterStreamConsumer
registerStreamConsumer_consumerName = (RegisterStreamConsumer -> Text)
-> (RegisterStreamConsumer -> Text -> RegisterStreamConsumer)
-> Lens RegisterStreamConsumer RegisterStreamConsumer Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterStreamConsumer' {Text
consumerName :: Text
$sel:consumerName:RegisterStreamConsumer' :: RegisterStreamConsumer -> Text
consumerName} -> Text
consumerName) (\s :: RegisterStreamConsumer
s@RegisterStreamConsumer' {} Text
a -> RegisterStreamConsumer
s {$sel:consumerName:RegisterStreamConsumer' :: Text
consumerName = Text
a} :: RegisterStreamConsumer)
instance Core.AWSRequest RegisterStreamConsumer where
type
AWSResponse RegisterStreamConsumer =
RegisterStreamConsumerResponse
request :: RegisterStreamConsumer -> Request RegisterStreamConsumer
request = Service -> RegisterStreamConsumer -> Request RegisterStreamConsumer
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy RegisterStreamConsumer
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse RegisterStreamConsumer)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse RegisterStreamConsumer))
-> Logger
-> Service
-> Proxy RegisterStreamConsumer
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse RegisterStreamConsumer)))
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 -> Consumer -> RegisterStreamConsumerResponse
RegisterStreamConsumerResponse'
(Int -> Consumer -> RegisterStreamConsumerResponse)
-> Either String Int
-> Either String (Consumer -> RegisterStreamConsumerResponse)
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 (Consumer -> RegisterStreamConsumerResponse)
-> Either String Consumer
-> Either String RegisterStreamConsumerResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Consumer
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"Consumer")
)
instance Prelude.Hashable RegisterStreamConsumer
instance Prelude.NFData RegisterStreamConsumer
instance Core.ToHeaders RegisterStreamConsumer where
toHeaders :: RegisterStreamConsumer -> ResponseHeaders
toHeaders =
ResponseHeaders -> RegisterStreamConsumer -> 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
"Kinesis_20131202.RegisterStreamConsumer" ::
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 RegisterStreamConsumer where
toJSON :: RegisterStreamConsumer -> Value
toJSON RegisterStreamConsumer' {Text
consumerName :: Text
streamARN :: Text
$sel:consumerName:RegisterStreamConsumer' :: RegisterStreamConsumer -> Text
$sel:streamARN:RegisterStreamConsumer' :: RegisterStreamConsumer -> 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
"StreamARN" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
streamARN),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ConsumerName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
consumerName)
]
)
instance Core.ToPath RegisterStreamConsumer where
toPath :: RegisterStreamConsumer -> ByteString
toPath = ByteString -> RegisterStreamConsumer -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery RegisterStreamConsumer where
toQuery :: RegisterStreamConsumer -> QueryString
toQuery = QueryString -> RegisterStreamConsumer -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data RegisterStreamConsumerResponse = RegisterStreamConsumerResponse'
{
RegisterStreamConsumerResponse -> Int
httpStatus :: Prelude.Int,
RegisterStreamConsumerResponse -> Consumer
consumer :: Consumer
}
deriving (RegisterStreamConsumerResponse
-> RegisterStreamConsumerResponse -> Bool
(RegisterStreamConsumerResponse
-> RegisterStreamConsumerResponse -> Bool)
-> (RegisterStreamConsumerResponse
-> RegisterStreamConsumerResponse -> Bool)
-> Eq RegisterStreamConsumerResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegisterStreamConsumerResponse
-> RegisterStreamConsumerResponse -> Bool
$c/= :: RegisterStreamConsumerResponse
-> RegisterStreamConsumerResponse -> Bool
== :: RegisterStreamConsumerResponse
-> RegisterStreamConsumerResponse -> Bool
$c== :: RegisterStreamConsumerResponse
-> RegisterStreamConsumerResponse -> Bool
Prelude.Eq, ReadPrec [RegisterStreamConsumerResponse]
ReadPrec RegisterStreamConsumerResponse
Int -> ReadS RegisterStreamConsumerResponse
ReadS [RegisterStreamConsumerResponse]
(Int -> ReadS RegisterStreamConsumerResponse)
-> ReadS [RegisterStreamConsumerResponse]
-> ReadPrec RegisterStreamConsumerResponse
-> ReadPrec [RegisterStreamConsumerResponse]
-> Read RegisterStreamConsumerResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RegisterStreamConsumerResponse]
$creadListPrec :: ReadPrec [RegisterStreamConsumerResponse]
readPrec :: ReadPrec RegisterStreamConsumerResponse
$creadPrec :: ReadPrec RegisterStreamConsumerResponse
readList :: ReadS [RegisterStreamConsumerResponse]
$creadList :: ReadS [RegisterStreamConsumerResponse]
readsPrec :: Int -> ReadS RegisterStreamConsumerResponse
$creadsPrec :: Int -> ReadS RegisterStreamConsumerResponse
Prelude.Read, Int -> RegisterStreamConsumerResponse -> ShowS
[RegisterStreamConsumerResponse] -> ShowS
RegisterStreamConsumerResponse -> String
(Int -> RegisterStreamConsumerResponse -> ShowS)
-> (RegisterStreamConsumerResponse -> String)
-> ([RegisterStreamConsumerResponse] -> ShowS)
-> Show RegisterStreamConsumerResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RegisterStreamConsumerResponse] -> ShowS
$cshowList :: [RegisterStreamConsumerResponse] -> ShowS
show :: RegisterStreamConsumerResponse -> String
$cshow :: RegisterStreamConsumerResponse -> String
showsPrec :: Int -> RegisterStreamConsumerResponse -> ShowS
$cshowsPrec :: Int -> RegisterStreamConsumerResponse -> ShowS
Prelude.Show, (forall x.
RegisterStreamConsumerResponse
-> Rep RegisterStreamConsumerResponse x)
-> (forall x.
Rep RegisterStreamConsumerResponse x
-> RegisterStreamConsumerResponse)
-> Generic RegisterStreamConsumerResponse
forall x.
Rep RegisterStreamConsumerResponse x
-> RegisterStreamConsumerResponse
forall x.
RegisterStreamConsumerResponse
-> Rep RegisterStreamConsumerResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RegisterStreamConsumerResponse x
-> RegisterStreamConsumerResponse
$cfrom :: forall x.
RegisterStreamConsumerResponse
-> Rep RegisterStreamConsumerResponse x
Prelude.Generic)
newRegisterStreamConsumerResponse ::
Prelude.Int ->
Consumer ->
RegisterStreamConsumerResponse
newRegisterStreamConsumerResponse :: Int -> Consumer -> RegisterStreamConsumerResponse
newRegisterStreamConsumerResponse
Int
pHttpStatus_
Consumer
pConsumer_ =
RegisterStreamConsumerResponse' :: Int -> Consumer -> RegisterStreamConsumerResponse
RegisterStreamConsumerResponse'
{ $sel:httpStatus:RegisterStreamConsumerResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:consumer:RegisterStreamConsumerResponse' :: Consumer
consumer = Consumer
pConsumer_
}
registerStreamConsumerResponse_httpStatus :: Lens.Lens' RegisterStreamConsumerResponse Prelude.Int
registerStreamConsumerResponse_httpStatus :: (Int -> f Int)
-> RegisterStreamConsumerResponse
-> f RegisterStreamConsumerResponse
registerStreamConsumerResponse_httpStatus = (RegisterStreamConsumerResponse -> Int)
-> (RegisterStreamConsumerResponse
-> Int -> RegisterStreamConsumerResponse)
-> Lens
RegisterStreamConsumerResponse
RegisterStreamConsumerResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterStreamConsumerResponse' {Int
httpStatus :: Int
$sel:httpStatus:RegisterStreamConsumerResponse' :: RegisterStreamConsumerResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: RegisterStreamConsumerResponse
s@RegisterStreamConsumerResponse' {} Int
a -> RegisterStreamConsumerResponse
s {$sel:httpStatus:RegisterStreamConsumerResponse' :: Int
httpStatus = Int
a} :: RegisterStreamConsumerResponse)
registerStreamConsumerResponse_consumer :: Lens.Lens' RegisterStreamConsumerResponse Consumer
registerStreamConsumerResponse_consumer :: (Consumer -> f Consumer)
-> RegisterStreamConsumerResponse
-> f RegisterStreamConsumerResponse
registerStreamConsumerResponse_consumer = (RegisterStreamConsumerResponse -> Consumer)
-> (RegisterStreamConsumerResponse
-> Consumer -> RegisterStreamConsumerResponse)
-> Lens
RegisterStreamConsumerResponse
RegisterStreamConsumerResponse
Consumer
Consumer
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterStreamConsumerResponse' {Consumer
consumer :: Consumer
$sel:consumer:RegisterStreamConsumerResponse' :: RegisterStreamConsumerResponse -> Consumer
consumer} -> Consumer
consumer) (\s :: RegisterStreamConsumerResponse
s@RegisterStreamConsumerResponse' {} Consumer
a -> RegisterStreamConsumerResponse
s {$sel:consumer:RegisterStreamConsumerResponse' :: Consumer
consumer = Consumer
a} :: RegisterStreamConsumerResponse)
instance
Prelude.NFData
RegisterStreamConsumerResponse