{-# 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.IoTAnalytics.DescribeChannel
(
DescribeChannel (..),
newDescribeChannel,
describeChannel_includeStatistics,
describeChannel_channelName,
DescribeChannelResponse (..),
newDescribeChannelResponse,
describeChannelResponse_channel,
describeChannelResponse_statistics,
describeChannelResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.IoTAnalytics.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 DescribeChannel = DescribeChannel'
{
DescribeChannel -> Maybe Bool
includeStatistics :: Prelude.Maybe Prelude.Bool,
DescribeChannel -> Text
channelName :: Prelude.Text
}
deriving (DescribeChannel -> DescribeChannel -> Bool
(DescribeChannel -> DescribeChannel -> Bool)
-> (DescribeChannel -> DescribeChannel -> Bool)
-> Eq DescribeChannel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeChannel -> DescribeChannel -> Bool
$c/= :: DescribeChannel -> DescribeChannel -> Bool
== :: DescribeChannel -> DescribeChannel -> Bool
$c== :: DescribeChannel -> DescribeChannel -> Bool
Prelude.Eq, ReadPrec [DescribeChannel]
ReadPrec DescribeChannel
Int -> ReadS DescribeChannel
ReadS [DescribeChannel]
(Int -> ReadS DescribeChannel)
-> ReadS [DescribeChannel]
-> ReadPrec DescribeChannel
-> ReadPrec [DescribeChannel]
-> Read DescribeChannel
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeChannel]
$creadListPrec :: ReadPrec [DescribeChannel]
readPrec :: ReadPrec DescribeChannel
$creadPrec :: ReadPrec DescribeChannel
readList :: ReadS [DescribeChannel]
$creadList :: ReadS [DescribeChannel]
readsPrec :: Int -> ReadS DescribeChannel
$creadsPrec :: Int -> ReadS DescribeChannel
Prelude.Read, Int -> DescribeChannel -> ShowS
[DescribeChannel] -> ShowS
DescribeChannel -> String
(Int -> DescribeChannel -> ShowS)
-> (DescribeChannel -> String)
-> ([DescribeChannel] -> ShowS)
-> Show DescribeChannel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeChannel] -> ShowS
$cshowList :: [DescribeChannel] -> ShowS
show :: DescribeChannel -> String
$cshow :: DescribeChannel -> String
showsPrec :: Int -> DescribeChannel -> ShowS
$cshowsPrec :: Int -> DescribeChannel -> ShowS
Prelude.Show, (forall x. DescribeChannel -> Rep DescribeChannel x)
-> (forall x. Rep DescribeChannel x -> DescribeChannel)
-> Generic DescribeChannel
forall x. Rep DescribeChannel x -> DescribeChannel
forall x. DescribeChannel -> Rep DescribeChannel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeChannel x -> DescribeChannel
$cfrom :: forall x. DescribeChannel -> Rep DescribeChannel x
Prelude.Generic)
newDescribeChannel ::
Prelude.Text ->
DescribeChannel
newDescribeChannel :: Text -> DescribeChannel
newDescribeChannel Text
pChannelName_ =
DescribeChannel' :: Maybe Bool -> Text -> DescribeChannel
DescribeChannel'
{ $sel:includeStatistics:DescribeChannel' :: Maybe Bool
includeStatistics =
Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:channelName:DescribeChannel' :: Text
channelName = Text
pChannelName_
}
describeChannel_includeStatistics :: Lens.Lens' DescribeChannel (Prelude.Maybe Prelude.Bool)
describeChannel_includeStatistics :: (Maybe Bool -> f (Maybe Bool))
-> DescribeChannel -> f DescribeChannel
describeChannel_includeStatistics = (DescribeChannel -> Maybe Bool)
-> (DescribeChannel -> Maybe Bool -> DescribeChannel)
-> Lens DescribeChannel DescribeChannel (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeChannel' {Maybe Bool
includeStatistics :: Maybe Bool
$sel:includeStatistics:DescribeChannel' :: DescribeChannel -> Maybe Bool
includeStatistics} -> Maybe Bool
includeStatistics) (\s :: DescribeChannel
s@DescribeChannel' {} Maybe Bool
a -> DescribeChannel
s {$sel:includeStatistics:DescribeChannel' :: Maybe Bool
includeStatistics = Maybe Bool
a} :: DescribeChannel)
describeChannel_channelName :: Lens.Lens' DescribeChannel Prelude.Text
describeChannel_channelName :: (Text -> f Text) -> DescribeChannel -> f DescribeChannel
describeChannel_channelName = (DescribeChannel -> Text)
-> (DescribeChannel -> Text -> DescribeChannel)
-> Lens DescribeChannel DescribeChannel Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeChannel' {Text
channelName :: Text
$sel:channelName:DescribeChannel' :: DescribeChannel -> Text
channelName} -> Text
channelName) (\s :: DescribeChannel
s@DescribeChannel' {} Text
a -> DescribeChannel
s {$sel:channelName:DescribeChannel' :: Text
channelName = Text
a} :: DescribeChannel)
instance Core.AWSRequest DescribeChannel where
type
AWSResponse DescribeChannel =
DescribeChannelResponse
request :: DescribeChannel -> Request DescribeChannel
request = Service -> DescribeChannel -> Request DescribeChannel
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeChannel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeChannel)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeChannel))
-> Logger
-> Service
-> Proxy DescribeChannel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeChannel)))
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 Channel
-> Maybe ChannelStatistics -> Int -> DescribeChannelResponse
DescribeChannelResponse'
(Maybe Channel
-> Maybe ChannelStatistics -> Int -> DescribeChannelResponse)
-> Either String (Maybe Channel)
-> Either
String (Maybe ChannelStatistics -> Int -> DescribeChannelResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Channel)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"channel")
Either
String (Maybe ChannelStatistics -> Int -> DescribeChannelResponse)
-> Either String (Maybe ChannelStatistics)
-> Either String (Int -> DescribeChannelResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe ChannelStatistics)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"statistics")
Either String (Int -> DescribeChannelResponse)
-> Either String Int -> Either String DescribeChannelResponse
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 DescribeChannel
instance Prelude.NFData DescribeChannel
instance Core.ToHeaders DescribeChannel where
toHeaders :: DescribeChannel -> ResponseHeaders
toHeaders = ResponseHeaders -> DescribeChannel -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath DescribeChannel where
toPath :: DescribeChannel -> ByteString
toPath DescribeChannel' {Maybe Bool
Text
channelName :: Text
includeStatistics :: Maybe Bool
$sel:channelName:DescribeChannel' :: DescribeChannel -> Text
$sel:includeStatistics:DescribeChannel' :: DescribeChannel -> Maybe Bool
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/channels/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
channelName]
instance Core.ToQuery DescribeChannel where
toQuery :: DescribeChannel -> QueryString
toQuery DescribeChannel' {Maybe Bool
Text
channelName :: Text
includeStatistics :: Maybe Bool
$sel:channelName:DescribeChannel' :: DescribeChannel -> Text
$sel:includeStatistics:DescribeChannel' :: DescribeChannel -> Maybe Bool
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"includeStatistics" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
includeStatistics]
data DescribeChannelResponse = DescribeChannelResponse'
{
DescribeChannelResponse -> Maybe Channel
channel :: Prelude.Maybe Channel,
DescribeChannelResponse -> Maybe ChannelStatistics
statistics :: Prelude.Maybe ChannelStatistics,
DescribeChannelResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeChannelResponse -> DescribeChannelResponse -> Bool
(DescribeChannelResponse -> DescribeChannelResponse -> Bool)
-> (DescribeChannelResponse -> DescribeChannelResponse -> Bool)
-> Eq DescribeChannelResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeChannelResponse -> DescribeChannelResponse -> Bool
$c/= :: DescribeChannelResponse -> DescribeChannelResponse -> Bool
== :: DescribeChannelResponse -> DescribeChannelResponse -> Bool
$c== :: DescribeChannelResponse -> DescribeChannelResponse -> Bool
Prelude.Eq, ReadPrec [DescribeChannelResponse]
ReadPrec DescribeChannelResponse
Int -> ReadS DescribeChannelResponse
ReadS [DescribeChannelResponse]
(Int -> ReadS DescribeChannelResponse)
-> ReadS [DescribeChannelResponse]
-> ReadPrec DescribeChannelResponse
-> ReadPrec [DescribeChannelResponse]
-> Read DescribeChannelResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeChannelResponse]
$creadListPrec :: ReadPrec [DescribeChannelResponse]
readPrec :: ReadPrec DescribeChannelResponse
$creadPrec :: ReadPrec DescribeChannelResponse
readList :: ReadS [DescribeChannelResponse]
$creadList :: ReadS [DescribeChannelResponse]
readsPrec :: Int -> ReadS DescribeChannelResponse
$creadsPrec :: Int -> ReadS DescribeChannelResponse
Prelude.Read, Int -> DescribeChannelResponse -> ShowS
[DescribeChannelResponse] -> ShowS
DescribeChannelResponse -> String
(Int -> DescribeChannelResponse -> ShowS)
-> (DescribeChannelResponse -> String)
-> ([DescribeChannelResponse] -> ShowS)
-> Show DescribeChannelResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeChannelResponse] -> ShowS
$cshowList :: [DescribeChannelResponse] -> ShowS
show :: DescribeChannelResponse -> String
$cshow :: DescribeChannelResponse -> String
showsPrec :: Int -> DescribeChannelResponse -> ShowS
$cshowsPrec :: Int -> DescribeChannelResponse -> ShowS
Prelude.Show, (forall x.
DescribeChannelResponse -> Rep DescribeChannelResponse x)
-> (forall x.
Rep DescribeChannelResponse x -> DescribeChannelResponse)
-> Generic DescribeChannelResponse
forall x. Rep DescribeChannelResponse x -> DescribeChannelResponse
forall x. DescribeChannelResponse -> Rep DescribeChannelResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeChannelResponse x -> DescribeChannelResponse
$cfrom :: forall x. DescribeChannelResponse -> Rep DescribeChannelResponse x
Prelude.Generic)
newDescribeChannelResponse ::
Prelude.Int ->
DescribeChannelResponse
newDescribeChannelResponse :: Int -> DescribeChannelResponse
newDescribeChannelResponse Int
pHttpStatus_ =
DescribeChannelResponse' :: Maybe Channel
-> Maybe ChannelStatistics -> Int -> DescribeChannelResponse
DescribeChannelResponse'
{ $sel:channel:DescribeChannelResponse' :: Maybe Channel
channel = Maybe Channel
forall a. Maybe a
Prelude.Nothing,
$sel:statistics:DescribeChannelResponse' :: Maybe ChannelStatistics
statistics = Maybe ChannelStatistics
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeChannelResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeChannelResponse_channel :: Lens.Lens' DescribeChannelResponse (Prelude.Maybe Channel)
describeChannelResponse_channel :: (Maybe Channel -> f (Maybe Channel))
-> DescribeChannelResponse -> f DescribeChannelResponse
describeChannelResponse_channel = (DescribeChannelResponse -> Maybe Channel)
-> (DescribeChannelResponse
-> Maybe Channel -> DescribeChannelResponse)
-> Lens
DescribeChannelResponse
DescribeChannelResponse
(Maybe Channel)
(Maybe Channel)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeChannelResponse' {Maybe Channel
channel :: Maybe Channel
$sel:channel:DescribeChannelResponse' :: DescribeChannelResponse -> Maybe Channel
channel} -> Maybe Channel
channel) (\s :: DescribeChannelResponse
s@DescribeChannelResponse' {} Maybe Channel
a -> DescribeChannelResponse
s {$sel:channel:DescribeChannelResponse' :: Maybe Channel
channel = Maybe Channel
a} :: DescribeChannelResponse)
describeChannelResponse_statistics :: Lens.Lens' DescribeChannelResponse (Prelude.Maybe ChannelStatistics)
describeChannelResponse_statistics :: (Maybe ChannelStatistics -> f (Maybe ChannelStatistics))
-> DescribeChannelResponse -> f DescribeChannelResponse
describeChannelResponse_statistics = (DescribeChannelResponse -> Maybe ChannelStatistics)
-> (DescribeChannelResponse
-> Maybe ChannelStatistics -> DescribeChannelResponse)
-> Lens
DescribeChannelResponse
DescribeChannelResponse
(Maybe ChannelStatistics)
(Maybe ChannelStatistics)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeChannelResponse' {Maybe ChannelStatistics
statistics :: Maybe ChannelStatistics
$sel:statistics:DescribeChannelResponse' :: DescribeChannelResponse -> Maybe ChannelStatistics
statistics} -> Maybe ChannelStatistics
statistics) (\s :: DescribeChannelResponse
s@DescribeChannelResponse' {} Maybe ChannelStatistics
a -> DescribeChannelResponse
s {$sel:statistics:DescribeChannelResponse' :: Maybe ChannelStatistics
statistics = Maybe ChannelStatistics
a} :: DescribeChannelResponse)
describeChannelResponse_httpStatus :: Lens.Lens' DescribeChannelResponse Prelude.Int
describeChannelResponse_httpStatus :: (Int -> f Int)
-> DescribeChannelResponse -> f DescribeChannelResponse
describeChannelResponse_httpStatus = (DescribeChannelResponse -> Int)
-> (DescribeChannelResponse -> Int -> DescribeChannelResponse)
-> Lens DescribeChannelResponse DescribeChannelResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeChannelResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeChannelResponse' :: DescribeChannelResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeChannelResponse
s@DescribeChannelResponse' {} Int
a -> DescribeChannelResponse
s {$sel:httpStatus:DescribeChannelResponse' :: Int
httpStatus = Int
a} :: DescribeChannelResponse)
instance Prelude.NFData DescribeChannelResponse