{-# 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.GetShardIterator
(
GetShardIterator (..),
newGetShardIterator,
getShardIterator_startingSequenceNumber,
getShardIterator_timestamp,
getShardIterator_streamName,
getShardIterator_shardId,
getShardIterator_shardIteratorType,
GetShardIteratorResponse (..),
newGetShardIteratorResponse,
getShardIteratorResponse_shardIterator,
getShardIteratorResponse_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 GetShardIterator = GetShardIterator'
{
GetShardIterator -> Maybe Text
startingSequenceNumber :: Prelude.Maybe Prelude.Text,
GetShardIterator -> Maybe POSIX
timestamp :: Prelude.Maybe Core.POSIX,
GetShardIterator -> Text
streamName :: Prelude.Text,
GetShardIterator -> Text
shardId :: Prelude.Text,
GetShardIterator -> ShardIteratorType
shardIteratorType :: ShardIteratorType
}
deriving (GetShardIterator -> GetShardIterator -> Bool
(GetShardIterator -> GetShardIterator -> Bool)
-> (GetShardIterator -> GetShardIterator -> Bool)
-> Eq GetShardIterator
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetShardIterator -> GetShardIterator -> Bool
$c/= :: GetShardIterator -> GetShardIterator -> Bool
== :: GetShardIterator -> GetShardIterator -> Bool
$c== :: GetShardIterator -> GetShardIterator -> Bool
Prelude.Eq, ReadPrec [GetShardIterator]
ReadPrec GetShardIterator
Int -> ReadS GetShardIterator
ReadS [GetShardIterator]
(Int -> ReadS GetShardIterator)
-> ReadS [GetShardIterator]
-> ReadPrec GetShardIterator
-> ReadPrec [GetShardIterator]
-> Read GetShardIterator
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetShardIterator]
$creadListPrec :: ReadPrec [GetShardIterator]
readPrec :: ReadPrec GetShardIterator
$creadPrec :: ReadPrec GetShardIterator
readList :: ReadS [GetShardIterator]
$creadList :: ReadS [GetShardIterator]
readsPrec :: Int -> ReadS GetShardIterator
$creadsPrec :: Int -> ReadS GetShardIterator
Prelude.Read, Int -> GetShardIterator -> ShowS
[GetShardIterator] -> ShowS
GetShardIterator -> String
(Int -> GetShardIterator -> ShowS)
-> (GetShardIterator -> String)
-> ([GetShardIterator] -> ShowS)
-> Show GetShardIterator
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetShardIterator] -> ShowS
$cshowList :: [GetShardIterator] -> ShowS
show :: GetShardIterator -> String
$cshow :: GetShardIterator -> String
showsPrec :: Int -> GetShardIterator -> ShowS
$cshowsPrec :: Int -> GetShardIterator -> ShowS
Prelude.Show, (forall x. GetShardIterator -> Rep GetShardIterator x)
-> (forall x. Rep GetShardIterator x -> GetShardIterator)
-> Generic GetShardIterator
forall x. Rep GetShardIterator x -> GetShardIterator
forall x. GetShardIterator -> Rep GetShardIterator x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetShardIterator x -> GetShardIterator
$cfrom :: forall x. GetShardIterator -> Rep GetShardIterator x
Prelude.Generic)
newGetShardIterator ::
Prelude.Text ->
Prelude.Text ->
ShardIteratorType ->
GetShardIterator
newGetShardIterator :: Text -> Text -> ShardIteratorType -> GetShardIterator
newGetShardIterator
Text
pStreamName_
Text
pShardId_
ShardIteratorType
pShardIteratorType_ =
GetShardIterator' :: Maybe Text
-> Maybe POSIX
-> Text
-> Text
-> ShardIteratorType
-> GetShardIterator
GetShardIterator'
{ $sel:startingSequenceNumber:GetShardIterator' :: Maybe Text
startingSequenceNumber =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:timestamp:GetShardIterator' :: Maybe POSIX
timestamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:streamName:GetShardIterator' :: Text
streamName = Text
pStreamName_,
$sel:shardId:GetShardIterator' :: Text
shardId = Text
pShardId_,
$sel:shardIteratorType:GetShardIterator' :: ShardIteratorType
shardIteratorType = ShardIteratorType
pShardIteratorType_
}
getShardIterator_startingSequenceNumber :: Lens.Lens' GetShardIterator (Prelude.Maybe Prelude.Text)
getShardIterator_startingSequenceNumber :: (Maybe Text -> f (Maybe Text))
-> GetShardIterator -> f GetShardIterator
getShardIterator_startingSequenceNumber = (GetShardIterator -> Maybe Text)
-> (GetShardIterator -> Maybe Text -> GetShardIterator)
-> Lens GetShardIterator GetShardIterator (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetShardIterator' {Maybe Text
startingSequenceNumber :: Maybe Text
$sel:startingSequenceNumber:GetShardIterator' :: GetShardIterator -> Maybe Text
startingSequenceNumber} -> Maybe Text
startingSequenceNumber) (\s :: GetShardIterator
s@GetShardIterator' {} Maybe Text
a -> GetShardIterator
s {$sel:startingSequenceNumber:GetShardIterator' :: Maybe Text
startingSequenceNumber = Maybe Text
a} :: GetShardIterator)
getShardIterator_timestamp :: Lens.Lens' GetShardIterator (Prelude.Maybe Prelude.UTCTime)
getShardIterator_timestamp :: (Maybe UTCTime -> f (Maybe UTCTime))
-> GetShardIterator -> f GetShardIterator
getShardIterator_timestamp = (GetShardIterator -> Maybe POSIX)
-> (GetShardIterator -> Maybe POSIX -> GetShardIterator)
-> Lens
GetShardIterator GetShardIterator (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetShardIterator' {Maybe POSIX
timestamp :: Maybe POSIX
$sel:timestamp:GetShardIterator' :: GetShardIterator -> Maybe POSIX
timestamp} -> Maybe POSIX
timestamp) (\s :: GetShardIterator
s@GetShardIterator' {} Maybe POSIX
a -> GetShardIterator
s {$sel:timestamp:GetShardIterator' :: Maybe POSIX
timestamp = Maybe POSIX
a} :: GetShardIterator) ((Maybe POSIX -> f (Maybe POSIX))
-> GetShardIterator -> f GetShardIterator)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> GetShardIterator
-> f GetShardIterator
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
getShardIterator_streamName :: Lens.Lens' GetShardIterator Prelude.Text
getShardIterator_streamName :: (Text -> f Text) -> GetShardIterator -> f GetShardIterator
getShardIterator_streamName = (GetShardIterator -> Text)
-> (GetShardIterator -> Text -> GetShardIterator)
-> Lens GetShardIterator GetShardIterator Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetShardIterator' {Text
streamName :: Text
$sel:streamName:GetShardIterator' :: GetShardIterator -> Text
streamName} -> Text
streamName) (\s :: GetShardIterator
s@GetShardIterator' {} Text
a -> GetShardIterator
s {$sel:streamName:GetShardIterator' :: Text
streamName = Text
a} :: GetShardIterator)
getShardIterator_shardId :: Lens.Lens' GetShardIterator Prelude.Text
getShardIterator_shardId :: (Text -> f Text) -> GetShardIterator -> f GetShardIterator
getShardIterator_shardId = (GetShardIterator -> Text)
-> (GetShardIterator -> Text -> GetShardIterator)
-> Lens GetShardIterator GetShardIterator Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetShardIterator' {Text
shardId :: Text
$sel:shardId:GetShardIterator' :: GetShardIterator -> Text
shardId} -> Text
shardId) (\s :: GetShardIterator
s@GetShardIterator' {} Text
a -> GetShardIterator
s {$sel:shardId:GetShardIterator' :: Text
shardId = Text
a} :: GetShardIterator)
getShardIterator_shardIteratorType :: Lens.Lens' GetShardIterator ShardIteratorType
getShardIterator_shardIteratorType :: (ShardIteratorType -> f ShardIteratorType)
-> GetShardIterator -> f GetShardIterator
getShardIterator_shardIteratorType = (GetShardIterator -> ShardIteratorType)
-> (GetShardIterator -> ShardIteratorType -> GetShardIterator)
-> Lens
GetShardIterator
GetShardIterator
ShardIteratorType
ShardIteratorType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetShardIterator' {ShardIteratorType
shardIteratorType :: ShardIteratorType
$sel:shardIteratorType:GetShardIterator' :: GetShardIterator -> ShardIteratorType
shardIteratorType} -> ShardIteratorType
shardIteratorType) (\s :: GetShardIterator
s@GetShardIterator' {} ShardIteratorType
a -> GetShardIterator
s {$sel:shardIteratorType:GetShardIterator' :: ShardIteratorType
shardIteratorType = ShardIteratorType
a} :: GetShardIterator)
instance Core.AWSRequest GetShardIterator where
type
AWSResponse GetShardIterator =
GetShardIteratorResponse
request :: GetShardIterator -> Request GetShardIterator
request = Service -> GetShardIterator -> Request GetShardIterator
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetShardIterator
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetShardIterator)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetShardIterator))
-> Logger
-> Service
-> Proxy GetShardIterator
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetShardIterator)))
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 Text -> Int -> GetShardIteratorResponse
GetShardIteratorResponse'
(Maybe Text -> Int -> GetShardIteratorResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetShardIteratorResponse)
forall (f :: * -> *) a b. Functor 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
"ShardIterator")
Either String (Int -> GetShardIteratorResponse)
-> Either String Int -> Either String GetShardIteratorResponse
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 GetShardIterator
instance Prelude.NFData GetShardIterator
instance Core.ToHeaders GetShardIterator where
toHeaders :: GetShardIterator -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetShardIterator -> 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.GetShardIterator" ::
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 GetShardIterator where
toJSON :: GetShardIterator -> Value
toJSON GetShardIterator' {Maybe Text
Maybe POSIX
Text
ShardIteratorType
shardIteratorType :: ShardIteratorType
shardId :: Text
streamName :: Text
timestamp :: Maybe POSIX
startingSequenceNumber :: Maybe Text
$sel:shardIteratorType:GetShardIterator' :: GetShardIterator -> ShardIteratorType
$sel:shardId:GetShardIterator' :: GetShardIterator -> Text
$sel:streamName:GetShardIterator' :: GetShardIterator -> Text
$sel:timestamp:GetShardIterator' :: GetShardIterator -> Maybe POSIX
$sel:startingSequenceNumber:GetShardIterator' :: GetShardIterator -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"StartingSequenceNumber" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
startingSequenceNumber,
(Text
"Timestamp" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (POSIX -> Pair) -> Maybe POSIX -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
timestamp,
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
"ShardId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
shardId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"ShardIteratorType" Text -> ShardIteratorType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ShardIteratorType
shardIteratorType)
]
)
instance Core.ToPath GetShardIterator where
toPath :: GetShardIterator -> ByteString
toPath = ByteString -> GetShardIterator -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetShardIterator where
toQuery :: GetShardIterator -> QueryString
toQuery = QueryString -> GetShardIterator -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetShardIteratorResponse = GetShardIteratorResponse'
{
GetShardIteratorResponse -> Maybe Text
shardIterator :: Prelude.Maybe Prelude.Text,
GetShardIteratorResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetShardIteratorResponse -> GetShardIteratorResponse -> Bool
(GetShardIteratorResponse -> GetShardIteratorResponse -> Bool)
-> (GetShardIteratorResponse -> GetShardIteratorResponse -> Bool)
-> Eq GetShardIteratorResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetShardIteratorResponse -> GetShardIteratorResponse -> Bool
$c/= :: GetShardIteratorResponse -> GetShardIteratorResponse -> Bool
== :: GetShardIteratorResponse -> GetShardIteratorResponse -> Bool
$c== :: GetShardIteratorResponse -> GetShardIteratorResponse -> Bool
Prelude.Eq, ReadPrec [GetShardIteratorResponse]
ReadPrec GetShardIteratorResponse
Int -> ReadS GetShardIteratorResponse
ReadS [GetShardIteratorResponse]
(Int -> ReadS GetShardIteratorResponse)
-> ReadS [GetShardIteratorResponse]
-> ReadPrec GetShardIteratorResponse
-> ReadPrec [GetShardIteratorResponse]
-> Read GetShardIteratorResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetShardIteratorResponse]
$creadListPrec :: ReadPrec [GetShardIteratorResponse]
readPrec :: ReadPrec GetShardIteratorResponse
$creadPrec :: ReadPrec GetShardIteratorResponse
readList :: ReadS [GetShardIteratorResponse]
$creadList :: ReadS [GetShardIteratorResponse]
readsPrec :: Int -> ReadS GetShardIteratorResponse
$creadsPrec :: Int -> ReadS GetShardIteratorResponse
Prelude.Read, Int -> GetShardIteratorResponse -> ShowS
[GetShardIteratorResponse] -> ShowS
GetShardIteratorResponse -> String
(Int -> GetShardIteratorResponse -> ShowS)
-> (GetShardIteratorResponse -> String)
-> ([GetShardIteratorResponse] -> ShowS)
-> Show GetShardIteratorResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetShardIteratorResponse] -> ShowS
$cshowList :: [GetShardIteratorResponse] -> ShowS
show :: GetShardIteratorResponse -> String
$cshow :: GetShardIteratorResponse -> String
showsPrec :: Int -> GetShardIteratorResponse -> ShowS
$cshowsPrec :: Int -> GetShardIteratorResponse -> ShowS
Prelude.Show, (forall x.
GetShardIteratorResponse -> Rep GetShardIteratorResponse x)
-> (forall x.
Rep GetShardIteratorResponse x -> GetShardIteratorResponse)
-> Generic GetShardIteratorResponse
forall x.
Rep GetShardIteratorResponse x -> GetShardIteratorResponse
forall x.
GetShardIteratorResponse -> Rep GetShardIteratorResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetShardIteratorResponse x -> GetShardIteratorResponse
$cfrom :: forall x.
GetShardIteratorResponse -> Rep GetShardIteratorResponse x
Prelude.Generic)
newGetShardIteratorResponse ::
Prelude.Int ->
GetShardIteratorResponse
newGetShardIteratorResponse :: Int -> GetShardIteratorResponse
newGetShardIteratorResponse Int
pHttpStatus_ =
GetShardIteratorResponse' :: Maybe Text -> Int -> GetShardIteratorResponse
GetShardIteratorResponse'
{ $sel:shardIterator:GetShardIteratorResponse' :: Maybe Text
shardIterator =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetShardIteratorResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getShardIteratorResponse_shardIterator :: Lens.Lens' GetShardIteratorResponse (Prelude.Maybe Prelude.Text)
getShardIteratorResponse_shardIterator :: (Maybe Text -> f (Maybe Text))
-> GetShardIteratorResponse -> f GetShardIteratorResponse
getShardIteratorResponse_shardIterator = (GetShardIteratorResponse -> Maybe Text)
-> (GetShardIteratorResponse
-> Maybe Text -> GetShardIteratorResponse)
-> Lens
GetShardIteratorResponse
GetShardIteratorResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetShardIteratorResponse' {Maybe Text
shardIterator :: Maybe Text
$sel:shardIterator:GetShardIteratorResponse' :: GetShardIteratorResponse -> Maybe Text
shardIterator} -> Maybe Text
shardIterator) (\s :: GetShardIteratorResponse
s@GetShardIteratorResponse' {} Maybe Text
a -> GetShardIteratorResponse
s {$sel:shardIterator:GetShardIteratorResponse' :: Maybe Text
shardIterator = Maybe Text
a} :: GetShardIteratorResponse)
getShardIteratorResponse_httpStatus :: Lens.Lens' GetShardIteratorResponse Prelude.Int
getShardIteratorResponse_httpStatus :: (Int -> f Int)
-> GetShardIteratorResponse -> f GetShardIteratorResponse
getShardIteratorResponse_httpStatus = (GetShardIteratorResponse -> Int)
-> (GetShardIteratorResponse -> Int -> GetShardIteratorResponse)
-> Lens GetShardIteratorResponse GetShardIteratorResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetShardIteratorResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetShardIteratorResponse' :: GetShardIteratorResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetShardIteratorResponse
s@GetShardIteratorResponse' {} Int
a -> GetShardIteratorResponse
s {$sel:httpStatus:GetShardIteratorResponse' :: Int
httpStatus = Int
a} :: GetShardIteratorResponse)
instance Prelude.NFData GetShardIteratorResponse