{-# 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.CreateStream
(
CreateStream (..),
newCreateStream,
createStream_streamName,
createStream_shardCount,
CreateStreamResponse (..),
newCreateStreamResponse,
)
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 CreateStream = CreateStream'
{
CreateStream -> Text
streamName :: Prelude.Text,
CreateStream -> Natural
shardCount :: Prelude.Natural
}
deriving (CreateStream -> CreateStream -> Bool
(CreateStream -> CreateStream -> Bool)
-> (CreateStream -> CreateStream -> Bool) -> Eq CreateStream
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateStream -> CreateStream -> Bool
$c/= :: CreateStream -> CreateStream -> Bool
== :: CreateStream -> CreateStream -> Bool
$c== :: CreateStream -> CreateStream -> Bool
Prelude.Eq, ReadPrec [CreateStream]
ReadPrec CreateStream
Int -> ReadS CreateStream
ReadS [CreateStream]
(Int -> ReadS CreateStream)
-> ReadS [CreateStream]
-> ReadPrec CreateStream
-> ReadPrec [CreateStream]
-> Read CreateStream
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateStream]
$creadListPrec :: ReadPrec [CreateStream]
readPrec :: ReadPrec CreateStream
$creadPrec :: ReadPrec CreateStream
readList :: ReadS [CreateStream]
$creadList :: ReadS [CreateStream]
readsPrec :: Int -> ReadS CreateStream
$creadsPrec :: Int -> ReadS CreateStream
Prelude.Read, Int -> CreateStream -> ShowS
[CreateStream] -> ShowS
CreateStream -> String
(Int -> CreateStream -> ShowS)
-> (CreateStream -> String)
-> ([CreateStream] -> ShowS)
-> Show CreateStream
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateStream] -> ShowS
$cshowList :: [CreateStream] -> ShowS
show :: CreateStream -> String
$cshow :: CreateStream -> String
showsPrec :: Int -> CreateStream -> ShowS
$cshowsPrec :: Int -> CreateStream -> ShowS
Prelude.Show, (forall x. CreateStream -> Rep CreateStream x)
-> (forall x. Rep CreateStream x -> CreateStream)
-> Generic CreateStream
forall x. Rep CreateStream x -> CreateStream
forall x. CreateStream -> Rep CreateStream x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateStream x -> CreateStream
$cfrom :: forall x. CreateStream -> Rep CreateStream x
Prelude.Generic)
newCreateStream ::
Prelude.Text ->
Prelude.Natural ->
CreateStream
newCreateStream :: Text -> Natural -> CreateStream
newCreateStream Text
pStreamName_ Natural
pShardCount_ =
CreateStream' :: Text -> Natural -> CreateStream
CreateStream'
{ $sel:streamName:CreateStream' :: Text
streamName = Text
pStreamName_,
$sel:shardCount:CreateStream' :: Natural
shardCount = Natural
pShardCount_
}
createStream_streamName :: Lens.Lens' CreateStream Prelude.Text
createStream_streamName :: (Text -> f Text) -> CreateStream -> f CreateStream
createStream_streamName = (CreateStream -> Text)
-> (CreateStream -> Text -> CreateStream)
-> Lens CreateStream CreateStream Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStream' {Text
streamName :: Text
$sel:streamName:CreateStream' :: CreateStream -> Text
streamName} -> Text
streamName) (\s :: CreateStream
s@CreateStream' {} Text
a -> CreateStream
s {$sel:streamName:CreateStream' :: Text
streamName = Text
a} :: CreateStream)
createStream_shardCount :: Lens.Lens' CreateStream Prelude.Natural
createStream_shardCount :: (Natural -> f Natural) -> CreateStream -> f CreateStream
createStream_shardCount = (CreateStream -> Natural)
-> (CreateStream -> Natural -> CreateStream)
-> Lens CreateStream CreateStream Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStream' {Natural
shardCount :: Natural
$sel:shardCount:CreateStream' :: CreateStream -> Natural
shardCount} -> Natural
shardCount) (\s :: CreateStream
s@CreateStream' {} Natural
a -> CreateStream
s {$sel:shardCount:CreateStream' :: Natural
shardCount = Natural
a} :: CreateStream)
instance Core.AWSRequest CreateStream where
type AWSResponse CreateStream = CreateStreamResponse
request :: CreateStream -> Request CreateStream
request = Service -> CreateStream -> Request CreateStream
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateStream
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateStream)))
response = AWSResponse CreateStream
-> Logger
-> Service
-> Proxy CreateStream
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateStream)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse CreateStream
CreateStreamResponse
CreateStreamResponse'
instance Prelude.Hashable CreateStream
instance Prelude.NFData CreateStream
instance Core.ToHeaders CreateStream where
toHeaders :: CreateStream -> [Header]
toHeaders =
[Header] -> CreateStream -> [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
"Kinesis_20131202.CreateStream" ::
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 CreateStream where
toJSON :: CreateStream -> Value
toJSON CreateStream' {Natural
Text
shardCount :: Natural
streamName :: Text
$sel:shardCount:CreateStream' :: CreateStream -> Natural
$sel:streamName:CreateStream' :: CreateStream -> 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
"StreamName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
streamName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ShardCount" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
shardCount)
]
)
instance Core.ToPath CreateStream where
toPath :: CreateStream -> ByteString
toPath = ByteString -> CreateStream -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateStream where
toQuery :: CreateStream -> QueryString
toQuery = QueryString -> CreateStream -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateStreamResponse = CreateStreamResponse'
{
}
deriving (CreateStreamResponse -> CreateStreamResponse -> Bool
(CreateStreamResponse -> CreateStreamResponse -> Bool)
-> (CreateStreamResponse -> CreateStreamResponse -> Bool)
-> Eq CreateStreamResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateStreamResponse -> CreateStreamResponse -> Bool
$c/= :: CreateStreamResponse -> CreateStreamResponse -> Bool
== :: CreateStreamResponse -> CreateStreamResponse -> Bool
$c== :: CreateStreamResponse -> CreateStreamResponse -> Bool
Prelude.Eq, ReadPrec [CreateStreamResponse]
ReadPrec CreateStreamResponse
Int -> ReadS CreateStreamResponse
ReadS [CreateStreamResponse]
(Int -> ReadS CreateStreamResponse)
-> ReadS [CreateStreamResponse]
-> ReadPrec CreateStreamResponse
-> ReadPrec [CreateStreamResponse]
-> Read CreateStreamResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateStreamResponse]
$creadListPrec :: ReadPrec [CreateStreamResponse]
readPrec :: ReadPrec CreateStreamResponse
$creadPrec :: ReadPrec CreateStreamResponse
readList :: ReadS [CreateStreamResponse]
$creadList :: ReadS [CreateStreamResponse]
readsPrec :: Int -> ReadS CreateStreamResponse
$creadsPrec :: Int -> ReadS CreateStreamResponse
Prelude.Read, Int -> CreateStreamResponse -> ShowS
[CreateStreamResponse] -> ShowS
CreateStreamResponse -> String
(Int -> CreateStreamResponse -> ShowS)
-> (CreateStreamResponse -> String)
-> ([CreateStreamResponse] -> ShowS)
-> Show CreateStreamResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateStreamResponse] -> ShowS
$cshowList :: [CreateStreamResponse] -> ShowS
show :: CreateStreamResponse -> String
$cshow :: CreateStreamResponse -> String
showsPrec :: Int -> CreateStreamResponse -> ShowS
$cshowsPrec :: Int -> CreateStreamResponse -> ShowS
Prelude.Show, (forall x. CreateStreamResponse -> Rep CreateStreamResponse x)
-> (forall x. Rep CreateStreamResponse x -> CreateStreamResponse)
-> Generic CreateStreamResponse
forall x. Rep CreateStreamResponse x -> CreateStreamResponse
forall x. CreateStreamResponse -> Rep CreateStreamResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateStreamResponse x -> CreateStreamResponse
$cfrom :: forall x. CreateStreamResponse -> Rep CreateStreamResponse x
Prelude.Generic)
newCreateStreamResponse ::
CreateStreamResponse
newCreateStreamResponse :: CreateStreamResponse
newCreateStreamResponse = CreateStreamResponse
CreateStreamResponse'
instance Prelude.NFData CreateStreamResponse