{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Network.AWS.Kinesis.UpdateShardCount
(
updateShardCount
, UpdateShardCount
, uscStreamName
, uscTargetShardCount
, uscScalingType
, updateShardCountResponse
, UpdateShardCountResponse
, uscrsTargetShardCount
, uscrsStreamName
, uscrsCurrentShardCount
, uscrsResponseStatus
) where
import Network.AWS.Kinesis.Types
import Network.AWS.Kinesis.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data UpdateShardCount = UpdateShardCount'
{ _uscStreamName :: !Text
, _uscTargetShardCount :: !Nat
, _uscScalingType :: !ScalingType
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updateShardCount
:: Text
-> Natural
-> ScalingType
-> UpdateShardCount
updateShardCount pStreamName_ pTargetShardCount_ pScalingType_ =
UpdateShardCount'
{ _uscStreamName = pStreamName_
, _uscTargetShardCount = _Nat # pTargetShardCount_
, _uscScalingType = pScalingType_
}
uscStreamName :: Lens' UpdateShardCount Text
uscStreamName = lens _uscStreamName (\ s a -> s{_uscStreamName = a})
uscTargetShardCount :: Lens' UpdateShardCount Natural
uscTargetShardCount = lens _uscTargetShardCount (\ s a -> s{_uscTargetShardCount = a}) . _Nat
uscScalingType :: Lens' UpdateShardCount ScalingType
uscScalingType = lens _uscScalingType (\ s a -> s{_uscScalingType = a})
instance AWSRequest UpdateShardCount where
type Rs UpdateShardCount = UpdateShardCountResponse
request = postJSON kinesis
response
= receiveJSON
(\ s h x ->
UpdateShardCountResponse' <$>
(x .?> "TargetShardCount") <*> (x .?> "StreamName")
<*> (x .?> "CurrentShardCount")
<*> (pure (fromEnum s)))
instance Hashable UpdateShardCount where
instance NFData UpdateShardCount where
instance ToHeaders UpdateShardCount where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("Kinesis_20131202.UpdateShardCount" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON UpdateShardCount where
toJSON UpdateShardCount'{..}
= object
(catMaybes
[Just ("StreamName" .= _uscStreamName),
Just ("TargetShardCount" .= _uscTargetShardCount),
Just ("ScalingType" .= _uscScalingType)])
instance ToPath UpdateShardCount where
toPath = const "/"
instance ToQuery UpdateShardCount where
toQuery = const mempty
data UpdateShardCountResponse = UpdateShardCountResponse'
{ _uscrsTargetShardCount :: !(Maybe Nat)
, _uscrsStreamName :: !(Maybe Text)
, _uscrsCurrentShardCount :: !(Maybe Nat)
, _uscrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updateShardCountResponse
:: Int
-> UpdateShardCountResponse
updateShardCountResponse pResponseStatus_ =
UpdateShardCountResponse'
{ _uscrsTargetShardCount = Nothing
, _uscrsStreamName = Nothing
, _uscrsCurrentShardCount = Nothing
, _uscrsResponseStatus = pResponseStatus_
}
uscrsTargetShardCount :: Lens' UpdateShardCountResponse (Maybe Natural)
uscrsTargetShardCount = lens _uscrsTargetShardCount (\ s a -> s{_uscrsTargetShardCount = a}) . mapping _Nat
uscrsStreamName :: Lens' UpdateShardCountResponse (Maybe Text)
uscrsStreamName = lens _uscrsStreamName (\ s a -> s{_uscrsStreamName = a})
uscrsCurrentShardCount :: Lens' UpdateShardCountResponse (Maybe Natural)
uscrsCurrentShardCount = lens _uscrsCurrentShardCount (\ s a -> s{_uscrsCurrentShardCount = a}) . mapping _Nat
uscrsResponseStatus :: Lens' UpdateShardCountResponse Int
uscrsResponseStatus = lens _uscrsResponseStatus (\ s a -> s{_uscrsResponseStatus = a})
instance NFData UpdateShardCountResponse where