{-# 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.UpdateShardCount
(
UpdateShardCount (..),
newUpdateShardCount,
updateShardCount_streamName,
updateShardCount_targetShardCount,
updateShardCount_scalingType,
UpdateShardCountResponse (..),
newUpdateShardCountResponse,
updateShardCountResponse_targetShardCount,
updateShardCountResponse_streamName,
updateShardCountResponse_currentShardCount,
updateShardCountResponse_httpStatus,
)
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 UpdateShardCount = UpdateShardCount'
{
UpdateShardCount -> Text
streamName :: Prelude.Text,
UpdateShardCount -> Natural
targetShardCount :: Prelude.Natural,
UpdateShardCount -> ScalingType
scalingType :: ScalingType
}
deriving (UpdateShardCount -> UpdateShardCount -> Bool
(UpdateShardCount -> UpdateShardCount -> Bool)
-> (UpdateShardCount -> UpdateShardCount -> Bool)
-> Eq UpdateShardCount
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateShardCount -> UpdateShardCount -> Bool
$c/= :: UpdateShardCount -> UpdateShardCount -> Bool
== :: UpdateShardCount -> UpdateShardCount -> Bool
$c== :: UpdateShardCount -> UpdateShardCount -> Bool
Prelude.Eq, ReadPrec [UpdateShardCount]
ReadPrec UpdateShardCount
Int -> ReadS UpdateShardCount
ReadS [UpdateShardCount]
(Int -> ReadS UpdateShardCount)
-> ReadS [UpdateShardCount]
-> ReadPrec UpdateShardCount
-> ReadPrec [UpdateShardCount]
-> Read UpdateShardCount
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateShardCount]
$creadListPrec :: ReadPrec [UpdateShardCount]
readPrec :: ReadPrec UpdateShardCount
$creadPrec :: ReadPrec UpdateShardCount
readList :: ReadS [UpdateShardCount]
$creadList :: ReadS [UpdateShardCount]
readsPrec :: Int -> ReadS UpdateShardCount
$creadsPrec :: Int -> ReadS UpdateShardCount
Prelude.Read, Int -> UpdateShardCount -> ShowS
[UpdateShardCount] -> ShowS
UpdateShardCount -> String
(Int -> UpdateShardCount -> ShowS)
-> (UpdateShardCount -> String)
-> ([UpdateShardCount] -> ShowS)
-> Show UpdateShardCount
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateShardCount] -> ShowS
$cshowList :: [UpdateShardCount] -> ShowS
show :: UpdateShardCount -> String
$cshow :: UpdateShardCount -> String
showsPrec :: Int -> UpdateShardCount -> ShowS
$cshowsPrec :: Int -> UpdateShardCount -> ShowS
Prelude.Show, (forall x. UpdateShardCount -> Rep UpdateShardCount x)
-> (forall x. Rep UpdateShardCount x -> UpdateShardCount)
-> Generic UpdateShardCount
forall x. Rep UpdateShardCount x -> UpdateShardCount
forall x. UpdateShardCount -> Rep UpdateShardCount x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateShardCount x -> UpdateShardCount
$cfrom :: forall x. UpdateShardCount -> Rep UpdateShardCount x
Prelude.Generic)
newUpdateShardCount ::
Prelude.Text ->
Prelude.Natural ->
ScalingType ->
UpdateShardCount
newUpdateShardCount :: Text -> Natural -> ScalingType -> UpdateShardCount
newUpdateShardCount
Text
pStreamName_
Natural
pTargetShardCount_
ScalingType
pScalingType_ =
UpdateShardCount' :: Text -> Natural -> ScalingType -> UpdateShardCount
UpdateShardCount'
{ $sel:streamName:UpdateShardCount' :: Text
streamName = Text
pStreamName_,
$sel:targetShardCount:UpdateShardCount' :: Natural
targetShardCount = Natural
pTargetShardCount_,
$sel:scalingType:UpdateShardCount' :: ScalingType
scalingType = ScalingType
pScalingType_
}
updateShardCount_streamName :: Lens.Lens' UpdateShardCount Prelude.Text
updateShardCount_streamName :: (Text -> f Text) -> UpdateShardCount -> f UpdateShardCount
updateShardCount_streamName = (UpdateShardCount -> Text)
-> (UpdateShardCount -> Text -> UpdateShardCount)
-> Lens UpdateShardCount UpdateShardCount Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateShardCount' {Text
streamName :: Text
$sel:streamName:UpdateShardCount' :: UpdateShardCount -> Text
streamName} -> Text
streamName) (\s :: UpdateShardCount
s@UpdateShardCount' {} Text
a -> UpdateShardCount
s {$sel:streamName:UpdateShardCount' :: Text
streamName = Text
a} :: UpdateShardCount)
updateShardCount_targetShardCount :: Lens.Lens' UpdateShardCount Prelude.Natural
updateShardCount_targetShardCount :: (Natural -> f Natural) -> UpdateShardCount -> f UpdateShardCount
updateShardCount_targetShardCount = (UpdateShardCount -> Natural)
-> (UpdateShardCount -> Natural -> UpdateShardCount)
-> Lens UpdateShardCount UpdateShardCount Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateShardCount' {Natural
targetShardCount :: Natural
$sel:targetShardCount:UpdateShardCount' :: UpdateShardCount -> Natural
targetShardCount} -> Natural
targetShardCount) (\s :: UpdateShardCount
s@UpdateShardCount' {} Natural
a -> UpdateShardCount
s {$sel:targetShardCount:UpdateShardCount' :: Natural
targetShardCount = Natural
a} :: UpdateShardCount)
updateShardCount_scalingType :: Lens.Lens' UpdateShardCount ScalingType
updateShardCount_scalingType :: (ScalingType -> f ScalingType)
-> UpdateShardCount -> f UpdateShardCount
updateShardCount_scalingType = (UpdateShardCount -> ScalingType)
-> (UpdateShardCount -> ScalingType -> UpdateShardCount)
-> Lens UpdateShardCount UpdateShardCount ScalingType ScalingType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateShardCount' {ScalingType
scalingType :: ScalingType
$sel:scalingType:UpdateShardCount' :: UpdateShardCount -> ScalingType
scalingType} -> ScalingType
scalingType) (\s :: UpdateShardCount
s@UpdateShardCount' {} ScalingType
a -> UpdateShardCount
s {$sel:scalingType:UpdateShardCount' :: ScalingType
scalingType = ScalingType
a} :: UpdateShardCount)
instance Core.AWSRequest UpdateShardCount where
type
AWSResponse UpdateShardCount =
UpdateShardCountResponse
request :: UpdateShardCount -> Request UpdateShardCount
request = Service -> UpdateShardCount -> Request UpdateShardCount
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateShardCount
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateShardCount)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateShardCount))
-> Logger
-> Service
-> Proxy UpdateShardCount
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateShardCount)))
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 Natural
-> Maybe Text -> Maybe Natural -> Int -> UpdateShardCountResponse
UpdateShardCountResponse'
(Maybe Natural
-> Maybe Text -> Maybe Natural -> Int -> UpdateShardCountResponse)
-> Either String (Maybe Natural)
-> Either
String
(Maybe Text -> Maybe Natural -> Int -> UpdateShardCountResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"TargetShardCount")
Either
String
(Maybe Text -> Maybe Natural -> Int -> UpdateShardCountResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Natural -> Int -> UpdateShardCountResponse)
forall (f :: * -> *) a b. Applicative f => 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
"StreamName")
Either String (Maybe Natural -> Int -> UpdateShardCountResponse)
-> Either String (Maybe Natural)
-> Either String (Int -> UpdateShardCountResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"CurrentShardCount")
Either String (Int -> UpdateShardCountResponse)
-> Either String Int -> Either String UpdateShardCountResponse
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 UpdateShardCount
instance Prelude.NFData UpdateShardCount
instance Core.ToHeaders UpdateShardCount where
toHeaders :: UpdateShardCount -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateShardCount -> 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.UpdateShardCount" ::
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 UpdateShardCount where
toJSON :: UpdateShardCount -> Value
toJSON UpdateShardCount' {Natural
Text
ScalingType
scalingType :: ScalingType
targetShardCount :: Natural
streamName :: Text
$sel:scalingType:UpdateShardCount' :: UpdateShardCount -> ScalingType
$sel:targetShardCount:UpdateShardCount' :: UpdateShardCount -> Natural
$sel:streamName:UpdateShardCount' :: UpdateShardCount -> 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
"TargetShardCount" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
targetShardCount),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ScalingType" Text -> ScalingType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ScalingType
scalingType)
]
)
instance Core.ToPath UpdateShardCount where
toPath :: UpdateShardCount -> ByteString
toPath = ByteString -> UpdateShardCount -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UpdateShardCount where
toQuery :: UpdateShardCount -> QueryString
toQuery = QueryString -> UpdateShardCount -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateShardCountResponse = UpdateShardCountResponse'
{
UpdateShardCountResponse -> Maybe Natural
targetShardCount :: Prelude.Maybe Prelude.Natural,
UpdateShardCountResponse -> Maybe Text
streamName :: Prelude.Maybe Prelude.Text,
UpdateShardCountResponse -> Maybe Natural
currentShardCount :: Prelude.Maybe Prelude.Natural,
UpdateShardCountResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateShardCountResponse -> UpdateShardCountResponse -> Bool
(UpdateShardCountResponse -> UpdateShardCountResponse -> Bool)
-> (UpdateShardCountResponse -> UpdateShardCountResponse -> Bool)
-> Eq UpdateShardCountResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateShardCountResponse -> UpdateShardCountResponse -> Bool
$c/= :: UpdateShardCountResponse -> UpdateShardCountResponse -> Bool
== :: UpdateShardCountResponse -> UpdateShardCountResponse -> Bool
$c== :: UpdateShardCountResponse -> UpdateShardCountResponse -> Bool
Prelude.Eq, ReadPrec [UpdateShardCountResponse]
ReadPrec UpdateShardCountResponse
Int -> ReadS UpdateShardCountResponse
ReadS [UpdateShardCountResponse]
(Int -> ReadS UpdateShardCountResponse)
-> ReadS [UpdateShardCountResponse]
-> ReadPrec UpdateShardCountResponse
-> ReadPrec [UpdateShardCountResponse]
-> Read UpdateShardCountResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateShardCountResponse]
$creadListPrec :: ReadPrec [UpdateShardCountResponse]
readPrec :: ReadPrec UpdateShardCountResponse
$creadPrec :: ReadPrec UpdateShardCountResponse
readList :: ReadS [UpdateShardCountResponse]
$creadList :: ReadS [UpdateShardCountResponse]
readsPrec :: Int -> ReadS UpdateShardCountResponse
$creadsPrec :: Int -> ReadS UpdateShardCountResponse
Prelude.Read, Int -> UpdateShardCountResponse -> ShowS
[UpdateShardCountResponse] -> ShowS
UpdateShardCountResponse -> String
(Int -> UpdateShardCountResponse -> ShowS)
-> (UpdateShardCountResponse -> String)
-> ([UpdateShardCountResponse] -> ShowS)
-> Show UpdateShardCountResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateShardCountResponse] -> ShowS
$cshowList :: [UpdateShardCountResponse] -> ShowS
show :: UpdateShardCountResponse -> String
$cshow :: UpdateShardCountResponse -> String
showsPrec :: Int -> UpdateShardCountResponse -> ShowS
$cshowsPrec :: Int -> UpdateShardCountResponse -> ShowS
Prelude.Show, (forall x.
UpdateShardCountResponse -> Rep UpdateShardCountResponse x)
-> (forall x.
Rep UpdateShardCountResponse x -> UpdateShardCountResponse)
-> Generic UpdateShardCountResponse
forall x.
Rep UpdateShardCountResponse x -> UpdateShardCountResponse
forall x.
UpdateShardCountResponse -> Rep UpdateShardCountResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateShardCountResponse x -> UpdateShardCountResponse
$cfrom :: forall x.
UpdateShardCountResponse -> Rep UpdateShardCountResponse x
Prelude.Generic)
newUpdateShardCountResponse ::
Prelude.Int ->
UpdateShardCountResponse
newUpdateShardCountResponse :: Int -> UpdateShardCountResponse
newUpdateShardCountResponse Int
pHttpStatus_ =
UpdateShardCountResponse' :: Maybe Natural
-> Maybe Text -> Maybe Natural -> Int -> UpdateShardCountResponse
UpdateShardCountResponse'
{ $sel:targetShardCount:UpdateShardCountResponse' :: Maybe Natural
targetShardCount =
Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:streamName:UpdateShardCountResponse' :: Maybe Text
streamName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:currentShardCount:UpdateShardCountResponse' :: Maybe Natural
currentShardCount = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateShardCountResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateShardCountResponse_targetShardCount :: Lens.Lens' UpdateShardCountResponse (Prelude.Maybe Prelude.Natural)
updateShardCountResponse_targetShardCount :: (Maybe Natural -> f (Maybe Natural))
-> UpdateShardCountResponse -> f UpdateShardCountResponse
updateShardCountResponse_targetShardCount = (UpdateShardCountResponse -> Maybe Natural)
-> (UpdateShardCountResponse
-> Maybe Natural -> UpdateShardCountResponse)
-> Lens
UpdateShardCountResponse
UpdateShardCountResponse
(Maybe Natural)
(Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateShardCountResponse' {Maybe Natural
targetShardCount :: Maybe Natural
$sel:targetShardCount:UpdateShardCountResponse' :: UpdateShardCountResponse -> Maybe Natural
targetShardCount} -> Maybe Natural
targetShardCount) (\s :: UpdateShardCountResponse
s@UpdateShardCountResponse' {} Maybe Natural
a -> UpdateShardCountResponse
s {$sel:targetShardCount:UpdateShardCountResponse' :: Maybe Natural
targetShardCount = Maybe Natural
a} :: UpdateShardCountResponse)
updateShardCountResponse_streamName :: Lens.Lens' UpdateShardCountResponse (Prelude.Maybe Prelude.Text)
updateShardCountResponse_streamName :: (Maybe Text -> f (Maybe Text))
-> UpdateShardCountResponse -> f UpdateShardCountResponse
updateShardCountResponse_streamName = (UpdateShardCountResponse -> Maybe Text)
-> (UpdateShardCountResponse
-> Maybe Text -> UpdateShardCountResponse)
-> Lens
UpdateShardCountResponse
UpdateShardCountResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateShardCountResponse' {Maybe Text
streamName :: Maybe Text
$sel:streamName:UpdateShardCountResponse' :: UpdateShardCountResponse -> Maybe Text
streamName} -> Maybe Text
streamName) (\s :: UpdateShardCountResponse
s@UpdateShardCountResponse' {} Maybe Text
a -> UpdateShardCountResponse
s {$sel:streamName:UpdateShardCountResponse' :: Maybe Text
streamName = Maybe Text
a} :: UpdateShardCountResponse)
updateShardCountResponse_currentShardCount :: Lens.Lens' UpdateShardCountResponse (Prelude.Maybe Prelude.Natural)
updateShardCountResponse_currentShardCount :: (Maybe Natural -> f (Maybe Natural))
-> UpdateShardCountResponse -> f UpdateShardCountResponse
updateShardCountResponse_currentShardCount = (UpdateShardCountResponse -> Maybe Natural)
-> (UpdateShardCountResponse
-> Maybe Natural -> UpdateShardCountResponse)
-> Lens
UpdateShardCountResponse
UpdateShardCountResponse
(Maybe Natural)
(Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateShardCountResponse' {Maybe Natural
currentShardCount :: Maybe Natural
$sel:currentShardCount:UpdateShardCountResponse' :: UpdateShardCountResponse -> Maybe Natural
currentShardCount} -> Maybe Natural
currentShardCount) (\s :: UpdateShardCountResponse
s@UpdateShardCountResponse' {} Maybe Natural
a -> UpdateShardCountResponse
s {$sel:currentShardCount:UpdateShardCountResponse' :: Maybe Natural
currentShardCount = Maybe Natural
a} :: UpdateShardCountResponse)
updateShardCountResponse_httpStatus :: Lens.Lens' UpdateShardCountResponse Prelude.Int
updateShardCountResponse_httpStatus :: (Int -> f Int)
-> UpdateShardCountResponse -> f UpdateShardCountResponse
updateShardCountResponse_httpStatus = (UpdateShardCountResponse -> Int)
-> (UpdateShardCountResponse -> Int -> UpdateShardCountResponse)
-> Lens UpdateShardCountResponse UpdateShardCountResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateShardCountResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateShardCountResponse' :: UpdateShardCountResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateShardCountResponse
s@UpdateShardCountResponse' {} Int
a -> UpdateShardCountResponse
s {$sel:httpStatus:UpdateShardCountResponse' :: Int
httpStatus = Int
a} :: UpdateShardCountResponse)
instance Prelude.NFData UpdateShardCountResponse