{-# 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.IoT.DescribeStream
(
DescribeStream (..),
newDescribeStream,
describeStream_streamId,
DescribeStreamResponse (..),
newDescribeStreamResponse,
describeStreamResponse_streamInfo,
describeStreamResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.IoT.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 DescribeStream = DescribeStream'
{
DescribeStream -> Text
streamId :: Prelude.Text
}
deriving (DescribeStream -> DescribeStream -> Bool
(DescribeStream -> DescribeStream -> Bool)
-> (DescribeStream -> DescribeStream -> Bool) -> Eq DescribeStream
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeStream -> DescribeStream -> Bool
$c/= :: DescribeStream -> DescribeStream -> Bool
== :: DescribeStream -> DescribeStream -> Bool
$c== :: DescribeStream -> DescribeStream -> Bool
Prelude.Eq, ReadPrec [DescribeStream]
ReadPrec DescribeStream
Int -> ReadS DescribeStream
ReadS [DescribeStream]
(Int -> ReadS DescribeStream)
-> ReadS [DescribeStream]
-> ReadPrec DescribeStream
-> ReadPrec [DescribeStream]
-> Read DescribeStream
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeStream]
$creadListPrec :: ReadPrec [DescribeStream]
readPrec :: ReadPrec DescribeStream
$creadPrec :: ReadPrec DescribeStream
readList :: ReadS [DescribeStream]
$creadList :: ReadS [DescribeStream]
readsPrec :: Int -> ReadS DescribeStream
$creadsPrec :: Int -> ReadS DescribeStream
Prelude.Read, Int -> DescribeStream -> ShowS
[DescribeStream] -> ShowS
DescribeStream -> String
(Int -> DescribeStream -> ShowS)
-> (DescribeStream -> String)
-> ([DescribeStream] -> ShowS)
-> Show DescribeStream
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeStream] -> ShowS
$cshowList :: [DescribeStream] -> ShowS
show :: DescribeStream -> String
$cshow :: DescribeStream -> String
showsPrec :: Int -> DescribeStream -> ShowS
$cshowsPrec :: Int -> DescribeStream -> ShowS
Prelude.Show, (forall x. DescribeStream -> Rep DescribeStream x)
-> (forall x. Rep DescribeStream x -> DescribeStream)
-> Generic DescribeStream
forall x. Rep DescribeStream x -> DescribeStream
forall x. DescribeStream -> Rep DescribeStream x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeStream x -> DescribeStream
$cfrom :: forall x. DescribeStream -> Rep DescribeStream x
Prelude.Generic)
newDescribeStream ::
Prelude.Text ->
DescribeStream
newDescribeStream :: Text -> DescribeStream
newDescribeStream Text
pStreamId_ =
DescribeStream' :: Text -> DescribeStream
DescribeStream' {$sel:streamId:DescribeStream' :: Text
streamId = Text
pStreamId_}
describeStream_streamId :: Lens.Lens' DescribeStream Prelude.Text
describeStream_streamId :: (Text -> f Text) -> DescribeStream -> f DescribeStream
describeStream_streamId = (DescribeStream -> Text)
-> (DescribeStream -> Text -> DescribeStream)
-> Lens DescribeStream DescribeStream Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeStream' {Text
streamId :: Text
$sel:streamId:DescribeStream' :: DescribeStream -> Text
streamId} -> Text
streamId) (\s :: DescribeStream
s@DescribeStream' {} Text
a -> DescribeStream
s {$sel:streamId:DescribeStream' :: Text
streamId = Text
a} :: DescribeStream)
instance Core.AWSRequest DescribeStream where
type
AWSResponse DescribeStream =
DescribeStreamResponse
request :: DescribeStream -> Request DescribeStream
request = Service -> DescribeStream -> Request DescribeStream
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeStream
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeStream)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeStream))
-> Logger
-> Service
-> Proxy DescribeStream
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeStream)))
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 StreamInfo -> Int -> DescribeStreamResponse
DescribeStreamResponse'
(Maybe StreamInfo -> Int -> DescribeStreamResponse)
-> Either String (Maybe StreamInfo)
-> Either String (Int -> DescribeStreamResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe StreamInfo)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"streamInfo")
Either String (Int -> DescribeStreamResponse)
-> Either String Int -> Either String DescribeStreamResponse
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 DescribeStream
instance Prelude.NFData DescribeStream
instance Core.ToHeaders DescribeStream where
toHeaders :: DescribeStream -> ResponseHeaders
toHeaders = ResponseHeaders -> DescribeStream -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath DescribeStream where
toPath :: DescribeStream -> ByteString
toPath DescribeStream' {Text
streamId :: Text
$sel:streamId:DescribeStream' :: DescribeStream -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/streams/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
streamId]
instance Core.ToQuery DescribeStream where
toQuery :: DescribeStream -> QueryString
toQuery = QueryString -> DescribeStream -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeStreamResponse = DescribeStreamResponse'
{
DescribeStreamResponse -> Maybe StreamInfo
streamInfo :: Prelude.Maybe StreamInfo,
DescribeStreamResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeStreamResponse -> DescribeStreamResponse -> Bool
(DescribeStreamResponse -> DescribeStreamResponse -> Bool)
-> (DescribeStreamResponse -> DescribeStreamResponse -> Bool)
-> Eq DescribeStreamResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeStreamResponse -> DescribeStreamResponse -> Bool
$c/= :: DescribeStreamResponse -> DescribeStreamResponse -> Bool
== :: DescribeStreamResponse -> DescribeStreamResponse -> Bool
$c== :: DescribeStreamResponse -> DescribeStreamResponse -> Bool
Prelude.Eq, ReadPrec [DescribeStreamResponse]
ReadPrec DescribeStreamResponse
Int -> ReadS DescribeStreamResponse
ReadS [DescribeStreamResponse]
(Int -> ReadS DescribeStreamResponse)
-> ReadS [DescribeStreamResponse]
-> ReadPrec DescribeStreamResponse
-> ReadPrec [DescribeStreamResponse]
-> Read DescribeStreamResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeStreamResponse]
$creadListPrec :: ReadPrec [DescribeStreamResponse]
readPrec :: ReadPrec DescribeStreamResponse
$creadPrec :: ReadPrec DescribeStreamResponse
readList :: ReadS [DescribeStreamResponse]
$creadList :: ReadS [DescribeStreamResponse]
readsPrec :: Int -> ReadS DescribeStreamResponse
$creadsPrec :: Int -> ReadS DescribeStreamResponse
Prelude.Read, Int -> DescribeStreamResponse -> ShowS
[DescribeStreamResponse] -> ShowS
DescribeStreamResponse -> String
(Int -> DescribeStreamResponse -> ShowS)
-> (DescribeStreamResponse -> String)
-> ([DescribeStreamResponse] -> ShowS)
-> Show DescribeStreamResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeStreamResponse] -> ShowS
$cshowList :: [DescribeStreamResponse] -> ShowS
show :: DescribeStreamResponse -> String
$cshow :: DescribeStreamResponse -> String
showsPrec :: Int -> DescribeStreamResponse -> ShowS
$cshowsPrec :: Int -> DescribeStreamResponse -> ShowS
Prelude.Show, (forall x. DescribeStreamResponse -> Rep DescribeStreamResponse x)
-> (forall x.
Rep DescribeStreamResponse x -> DescribeStreamResponse)
-> Generic DescribeStreamResponse
forall x. Rep DescribeStreamResponse x -> DescribeStreamResponse
forall x. DescribeStreamResponse -> Rep DescribeStreamResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeStreamResponse x -> DescribeStreamResponse
$cfrom :: forall x. DescribeStreamResponse -> Rep DescribeStreamResponse x
Prelude.Generic)
newDescribeStreamResponse ::
Prelude.Int ->
DescribeStreamResponse
newDescribeStreamResponse :: Int -> DescribeStreamResponse
newDescribeStreamResponse Int
pHttpStatus_ =
DescribeStreamResponse' :: Maybe StreamInfo -> Int -> DescribeStreamResponse
DescribeStreamResponse'
{ $sel:streamInfo:DescribeStreamResponse' :: Maybe StreamInfo
streamInfo =
Maybe StreamInfo
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeStreamResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeStreamResponse_streamInfo :: Lens.Lens' DescribeStreamResponse (Prelude.Maybe StreamInfo)
describeStreamResponse_streamInfo :: (Maybe StreamInfo -> f (Maybe StreamInfo))
-> DescribeStreamResponse -> f DescribeStreamResponse
describeStreamResponse_streamInfo = (DescribeStreamResponse -> Maybe StreamInfo)
-> (DescribeStreamResponse
-> Maybe StreamInfo -> DescribeStreamResponse)
-> Lens
DescribeStreamResponse
DescribeStreamResponse
(Maybe StreamInfo)
(Maybe StreamInfo)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeStreamResponse' {Maybe StreamInfo
streamInfo :: Maybe StreamInfo
$sel:streamInfo:DescribeStreamResponse' :: DescribeStreamResponse -> Maybe StreamInfo
streamInfo} -> Maybe StreamInfo
streamInfo) (\s :: DescribeStreamResponse
s@DescribeStreamResponse' {} Maybe StreamInfo
a -> DescribeStreamResponse
s {$sel:streamInfo:DescribeStreamResponse' :: Maybe StreamInfo
streamInfo = Maybe StreamInfo
a} :: DescribeStreamResponse)
describeStreamResponse_httpStatus :: Lens.Lens' DescribeStreamResponse Prelude.Int
describeStreamResponse_httpStatus :: (Int -> f Int)
-> DescribeStreamResponse -> f DescribeStreamResponse
describeStreamResponse_httpStatus = (DescribeStreamResponse -> Int)
-> (DescribeStreamResponse -> Int -> DescribeStreamResponse)
-> Lens DescribeStreamResponse DescribeStreamResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeStreamResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeStreamResponse' :: DescribeStreamResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeStreamResponse
s@DescribeStreamResponse' {} Int
a -> DescribeStreamResponse
s {$sel:httpStatus:DescribeStreamResponse' :: Int
httpStatus = Int
a} :: DescribeStreamResponse)
instance Prelude.NFData DescribeStreamResponse