{-# 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.SampleChannelData
(
SampleChannelData (..),
newSampleChannelData,
sampleChannelData_startTime,
sampleChannelData_maxMessages,
sampleChannelData_endTime,
sampleChannelData_channelName,
SampleChannelDataResponse (..),
newSampleChannelDataResponse,
sampleChannelDataResponse_payloads,
sampleChannelDataResponse_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 SampleChannelData = SampleChannelData'
{
SampleChannelData -> Maybe POSIX
startTime :: Prelude.Maybe Core.POSIX,
SampleChannelData -> Maybe Natural
maxMessages :: Prelude.Maybe Prelude.Natural,
SampleChannelData -> Maybe POSIX
endTime :: Prelude.Maybe Core.POSIX,
SampleChannelData -> Text
channelName :: Prelude.Text
}
deriving (SampleChannelData -> SampleChannelData -> Bool
(SampleChannelData -> SampleChannelData -> Bool)
-> (SampleChannelData -> SampleChannelData -> Bool)
-> Eq SampleChannelData
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SampleChannelData -> SampleChannelData -> Bool
$c/= :: SampleChannelData -> SampleChannelData -> Bool
== :: SampleChannelData -> SampleChannelData -> Bool
$c== :: SampleChannelData -> SampleChannelData -> Bool
Prelude.Eq, ReadPrec [SampleChannelData]
ReadPrec SampleChannelData
Int -> ReadS SampleChannelData
ReadS [SampleChannelData]
(Int -> ReadS SampleChannelData)
-> ReadS [SampleChannelData]
-> ReadPrec SampleChannelData
-> ReadPrec [SampleChannelData]
-> Read SampleChannelData
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SampleChannelData]
$creadListPrec :: ReadPrec [SampleChannelData]
readPrec :: ReadPrec SampleChannelData
$creadPrec :: ReadPrec SampleChannelData
readList :: ReadS [SampleChannelData]
$creadList :: ReadS [SampleChannelData]
readsPrec :: Int -> ReadS SampleChannelData
$creadsPrec :: Int -> ReadS SampleChannelData
Prelude.Read, Int -> SampleChannelData -> ShowS
[SampleChannelData] -> ShowS
SampleChannelData -> String
(Int -> SampleChannelData -> ShowS)
-> (SampleChannelData -> String)
-> ([SampleChannelData] -> ShowS)
-> Show SampleChannelData
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SampleChannelData] -> ShowS
$cshowList :: [SampleChannelData] -> ShowS
show :: SampleChannelData -> String
$cshow :: SampleChannelData -> String
showsPrec :: Int -> SampleChannelData -> ShowS
$cshowsPrec :: Int -> SampleChannelData -> ShowS
Prelude.Show, (forall x. SampleChannelData -> Rep SampleChannelData x)
-> (forall x. Rep SampleChannelData x -> SampleChannelData)
-> Generic SampleChannelData
forall x. Rep SampleChannelData x -> SampleChannelData
forall x. SampleChannelData -> Rep SampleChannelData x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SampleChannelData x -> SampleChannelData
$cfrom :: forall x. SampleChannelData -> Rep SampleChannelData x
Prelude.Generic)
newSampleChannelData ::
Prelude.Text ->
SampleChannelData
newSampleChannelData :: Text -> SampleChannelData
newSampleChannelData Text
pChannelName_ =
SampleChannelData' :: Maybe POSIX
-> Maybe Natural -> Maybe POSIX -> Text -> SampleChannelData
SampleChannelData'
{ $sel:startTime:SampleChannelData' :: Maybe POSIX
startTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:maxMessages:SampleChannelData' :: Maybe Natural
maxMessages = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:endTime:SampleChannelData' :: Maybe POSIX
endTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:channelName:SampleChannelData' :: Text
channelName = Text
pChannelName_
}
sampleChannelData_startTime :: Lens.Lens' SampleChannelData (Prelude.Maybe Prelude.UTCTime)
sampleChannelData_startTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> SampleChannelData -> f SampleChannelData
sampleChannelData_startTime = (SampleChannelData -> Maybe POSIX)
-> (SampleChannelData -> Maybe POSIX -> SampleChannelData)
-> Lens
SampleChannelData SampleChannelData (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SampleChannelData' {Maybe POSIX
startTime :: Maybe POSIX
$sel:startTime:SampleChannelData' :: SampleChannelData -> Maybe POSIX
startTime} -> Maybe POSIX
startTime) (\s :: SampleChannelData
s@SampleChannelData' {} Maybe POSIX
a -> SampleChannelData
s {$sel:startTime:SampleChannelData' :: Maybe POSIX
startTime = Maybe POSIX
a} :: SampleChannelData) ((Maybe POSIX -> f (Maybe POSIX))
-> SampleChannelData -> f SampleChannelData)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> SampleChannelData
-> f SampleChannelData
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
sampleChannelData_maxMessages :: Lens.Lens' SampleChannelData (Prelude.Maybe Prelude.Natural)
sampleChannelData_maxMessages :: (Maybe Natural -> f (Maybe Natural))
-> SampleChannelData -> f SampleChannelData
sampleChannelData_maxMessages = (SampleChannelData -> Maybe Natural)
-> (SampleChannelData -> Maybe Natural -> SampleChannelData)
-> Lens
SampleChannelData SampleChannelData (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SampleChannelData' {Maybe Natural
maxMessages :: Maybe Natural
$sel:maxMessages:SampleChannelData' :: SampleChannelData -> Maybe Natural
maxMessages} -> Maybe Natural
maxMessages) (\s :: SampleChannelData
s@SampleChannelData' {} Maybe Natural
a -> SampleChannelData
s {$sel:maxMessages:SampleChannelData' :: Maybe Natural
maxMessages = Maybe Natural
a} :: SampleChannelData)
sampleChannelData_endTime :: Lens.Lens' SampleChannelData (Prelude.Maybe Prelude.UTCTime)
sampleChannelData_endTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> SampleChannelData -> f SampleChannelData
sampleChannelData_endTime = (SampleChannelData -> Maybe POSIX)
-> (SampleChannelData -> Maybe POSIX -> SampleChannelData)
-> Lens
SampleChannelData SampleChannelData (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SampleChannelData' {Maybe POSIX
endTime :: Maybe POSIX
$sel:endTime:SampleChannelData' :: SampleChannelData -> Maybe POSIX
endTime} -> Maybe POSIX
endTime) (\s :: SampleChannelData
s@SampleChannelData' {} Maybe POSIX
a -> SampleChannelData
s {$sel:endTime:SampleChannelData' :: Maybe POSIX
endTime = Maybe POSIX
a} :: SampleChannelData) ((Maybe POSIX -> f (Maybe POSIX))
-> SampleChannelData -> f SampleChannelData)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> SampleChannelData
-> f SampleChannelData
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
sampleChannelData_channelName :: Lens.Lens' SampleChannelData Prelude.Text
sampleChannelData_channelName :: (Text -> f Text) -> SampleChannelData -> f SampleChannelData
sampleChannelData_channelName = (SampleChannelData -> Text)
-> (SampleChannelData -> Text -> SampleChannelData)
-> Lens SampleChannelData SampleChannelData Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SampleChannelData' {Text
channelName :: Text
$sel:channelName:SampleChannelData' :: SampleChannelData -> Text
channelName} -> Text
channelName) (\s :: SampleChannelData
s@SampleChannelData' {} Text
a -> SampleChannelData
s {$sel:channelName:SampleChannelData' :: Text
channelName = Text
a} :: SampleChannelData)
instance Core.AWSRequest SampleChannelData where
type
AWSResponse SampleChannelData =
SampleChannelDataResponse
request :: SampleChannelData -> Request SampleChannelData
request = Service -> SampleChannelData -> Request SampleChannelData
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy SampleChannelData
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse SampleChannelData)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse SampleChannelData))
-> Logger
-> Service
-> Proxy SampleChannelData
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse SampleChannelData)))
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 (NonEmpty Base64) -> Int -> SampleChannelDataResponse
SampleChannelDataResponse'
(Maybe (NonEmpty Base64) -> Int -> SampleChannelDataResponse)
-> Either String (Maybe (NonEmpty Base64))
-> Either String (Int -> SampleChannelDataResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (NonEmpty Base64))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"payloads")
Either String (Int -> SampleChannelDataResponse)
-> Either String Int -> Either String SampleChannelDataResponse
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 SampleChannelData
instance Prelude.NFData SampleChannelData
instance Core.ToHeaders SampleChannelData where
toHeaders :: SampleChannelData -> ResponseHeaders
toHeaders = ResponseHeaders -> SampleChannelData -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath SampleChannelData where
toPath :: SampleChannelData -> ByteString
toPath SampleChannelData' {Maybe Natural
Maybe POSIX
Text
channelName :: Text
endTime :: Maybe POSIX
maxMessages :: Maybe Natural
startTime :: Maybe POSIX
$sel:channelName:SampleChannelData' :: SampleChannelData -> Text
$sel:endTime:SampleChannelData' :: SampleChannelData -> Maybe POSIX
$sel:maxMessages:SampleChannelData' :: SampleChannelData -> Maybe Natural
$sel:startTime:SampleChannelData' :: SampleChannelData -> Maybe POSIX
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/channels/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
channelName, ByteString
"/sample"]
instance Core.ToQuery SampleChannelData where
toQuery :: SampleChannelData -> QueryString
toQuery SampleChannelData' {Maybe Natural
Maybe POSIX
Text
channelName :: Text
endTime :: Maybe POSIX
maxMessages :: Maybe Natural
startTime :: Maybe POSIX
$sel:channelName:SampleChannelData' :: SampleChannelData -> Text
$sel:endTime:SampleChannelData' :: SampleChannelData -> Maybe POSIX
$sel:maxMessages:SampleChannelData' :: SampleChannelData -> Maybe Natural
$sel:startTime:SampleChannelData' :: SampleChannelData -> Maybe POSIX
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"startTime" ByteString -> Maybe POSIX -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe POSIX
startTime,
ByteString
"maxMessages" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxMessages,
ByteString
"endTime" ByteString -> Maybe POSIX -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe POSIX
endTime
]
data SampleChannelDataResponse = SampleChannelDataResponse'
{
SampleChannelDataResponse -> Maybe (NonEmpty Base64)
payloads :: Prelude.Maybe (Prelude.NonEmpty Core.Base64),
SampleChannelDataResponse -> Int
httpStatus :: Prelude.Int
}
deriving (SampleChannelDataResponse -> SampleChannelDataResponse -> Bool
(SampleChannelDataResponse -> SampleChannelDataResponse -> Bool)
-> (SampleChannelDataResponse -> SampleChannelDataResponse -> Bool)
-> Eq SampleChannelDataResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SampleChannelDataResponse -> SampleChannelDataResponse -> Bool
$c/= :: SampleChannelDataResponse -> SampleChannelDataResponse -> Bool
== :: SampleChannelDataResponse -> SampleChannelDataResponse -> Bool
$c== :: SampleChannelDataResponse -> SampleChannelDataResponse -> Bool
Prelude.Eq, ReadPrec [SampleChannelDataResponse]
ReadPrec SampleChannelDataResponse
Int -> ReadS SampleChannelDataResponse
ReadS [SampleChannelDataResponse]
(Int -> ReadS SampleChannelDataResponse)
-> ReadS [SampleChannelDataResponse]
-> ReadPrec SampleChannelDataResponse
-> ReadPrec [SampleChannelDataResponse]
-> Read SampleChannelDataResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SampleChannelDataResponse]
$creadListPrec :: ReadPrec [SampleChannelDataResponse]
readPrec :: ReadPrec SampleChannelDataResponse
$creadPrec :: ReadPrec SampleChannelDataResponse
readList :: ReadS [SampleChannelDataResponse]
$creadList :: ReadS [SampleChannelDataResponse]
readsPrec :: Int -> ReadS SampleChannelDataResponse
$creadsPrec :: Int -> ReadS SampleChannelDataResponse
Prelude.Read, Int -> SampleChannelDataResponse -> ShowS
[SampleChannelDataResponse] -> ShowS
SampleChannelDataResponse -> String
(Int -> SampleChannelDataResponse -> ShowS)
-> (SampleChannelDataResponse -> String)
-> ([SampleChannelDataResponse] -> ShowS)
-> Show SampleChannelDataResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SampleChannelDataResponse] -> ShowS
$cshowList :: [SampleChannelDataResponse] -> ShowS
show :: SampleChannelDataResponse -> String
$cshow :: SampleChannelDataResponse -> String
showsPrec :: Int -> SampleChannelDataResponse -> ShowS
$cshowsPrec :: Int -> SampleChannelDataResponse -> ShowS
Prelude.Show, (forall x.
SampleChannelDataResponse -> Rep SampleChannelDataResponse x)
-> (forall x.
Rep SampleChannelDataResponse x -> SampleChannelDataResponse)
-> Generic SampleChannelDataResponse
forall x.
Rep SampleChannelDataResponse x -> SampleChannelDataResponse
forall x.
SampleChannelDataResponse -> Rep SampleChannelDataResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SampleChannelDataResponse x -> SampleChannelDataResponse
$cfrom :: forall x.
SampleChannelDataResponse -> Rep SampleChannelDataResponse x
Prelude.Generic)
newSampleChannelDataResponse ::
Prelude.Int ->
SampleChannelDataResponse
newSampleChannelDataResponse :: Int -> SampleChannelDataResponse
newSampleChannelDataResponse Int
pHttpStatus_ =
SampleChannelDataResponse' :: Maybe (NonEmpty Base64) -> Int -> SampleChannelDataResponse
SampleChannelDataResponse'
{ $sel:payloads:SampleChannelDataResponse' :: Maybe (NonEmpty Base64)
payloads =
Maybe (NonEmpty Base64)
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:SampleChannelDataResponse' :: Int
httpStatus = Int
pHttpStatus_
}
sampleChannelDataResponse_payloads :: Lens.Lens' SampleChannelDataResponse (Prelude.Maybe (Prelude.NonEmpty Prelude.ByteString))
sampleChannelDataResponse_payloads :: (Maybe (NonEmpty ByteString) -> f (Maybe (NonEmpty ByteString)))
-> SampleChannelDataResponse -> f SampleChannelDataResponse
sampleChannelDataResponse_payloads = (SampleChannelDataResponse -> Maybe (NonEmpty Base64))
-> (SampleChannelDataResponse
-> Maybe (NonEmpty Base64) -> SampleChannelDataResponse)
-> Lens
SampleChannelDataResponse
SampleChannelDataResponse
(Maybe (NonEmpty Base64))
(Maybe (NonEmpty Base64))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SampleChannelDataResponse' {Maybe (NonEmpty Base64)
payloads :: Maybe (NonEmpty Base64)
$sel:payloads:SampleChannelDataResponse' :: SampleChannelDataResponse -> Maybe (NonEmpty Base64)
payloads} -> Maybe (NonEmpty Base64)
payloads) (\s :: SampleChannelDataResponse
s@SampleChannelDataResponse' {} Maybe (NonEmpty Base64)
a -> SampleChannelDataResponse
s {$sel:payloads:SampleChannelDataResponse' :: Maybe (NonEmpty Base64)
payloads = Maybe (NonEmpty Base64)
a} :: SampleChannelDataResponse) ((Maybe (NonEmpty Base64) -> f (Maybe (NonEmpty Base64)))
-> SampleChannelDataResponse -> f SampleChannelDataResponse)
-> ((Maybe (NonEmpty ByteString)
-> f (Maybe (NonEmpty ByteString)))
-> Maybe (NonEmpty Base64) -> f (Maybe (NonEmpty Base64)))
-> (Maybe (NonEmpty ByteString) -> f (Maybe (NonEmpty ByteString)))
-> SampleChannelDataResponse
-> f SampleChannelDataResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(NonEmpty Base64)
(NonEmpty Base64)
(NonEmpty ByteString)
(NonEmpty ByteString)
-> Iso
(Maybe (NonEmpty Base64))
(Maybe (NonEmpty Base64))
(Maybe (NonEmpty ByteString))
(Maybe (NonEmpty ByteString))
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
(NonEmpty Base64)
(NonEmpty Base64)
(NonEmpty ByteString)
(NonEmpty ByteString)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
sampleChannelDataResponse_httpStatus :: Lens.Lens' SampleChannelDataResponse Prelude.Int
sampleChannelDataResponse_httpStatus :: (Int -> f Int)
-> SampleChannelDataResponse -> f SampleChannelDataResponse
sampleChannelDataResponse_httpStatus = (SampleChannelDataResponse -> Int)
-> (SampleChannelDataResponse -> Int -> SampleChannelDataResponse)
-> Lens SampleChannelDataResponse SampleChannelDataResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SampleChannelDataResponse' {Int
httpStatus :: Int
$sel:httpStatus:SampleChannelDataResponse' :: SampleChannelDataResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: SampleChannelDataResponse
s@SampleChannelDataResponse' {} Int
a -> SampleChannelDataResponse
s {$sel:httpStatus:SampleChannelDataResponse' :: Int
httpStatus = Int
a} :: SampleChannelDataResponse)
instance Prelude.NFData SampleChannelDataResponse