{-# 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.GetDatasetContent
(
GetDatasetContent (..),
newGetDatasetContent,
getDatasetContent_versionId,
getDatasetContent_datasetName,
GetDatasetContentResponse (..),
newGetDatasetContentResponse,
getDatasetContentResponse_status,
getDatasetContentResponse_entries,
getDatasetContentResponse_timestamp,
getDatasetContentResponse_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 GetDatasetContent = GetDatasetContent'
{
GetDatasetContent -> Maybe Text
versionId :: Prelude.Maybe Prelude.Text,
GetDatasetContent -> Text
datasetName :: Prelude.Text
}
deriving (GetDatasetContent -> GetDatasetContent -> Bool
(GetDatasetContent -> GetDatasetContent -> Bool)
-> (GetDatasetContent -> GetDatasetContent -> Bool)
-> Eq GetDatasetContent
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDatasetContent -> GetDatasetContent -> Bool
$c/= :: GetDatasetContent -> GetDatasetContent -> Bool
== :: GetDatasetContent -> GetDatasetContent -> Bool
$c== :: GetDatasetContent -> GetDatasetContent -> Bool
Prelude.Eq, ReadPrec [GetDatasetContent]
ReadPrec GetDatasetContent
Int -> ReadS GetDatasetContent
ReadS [GetDatasetContent]
(Int -> ReadS GetDatasetContent)
-> ReadS [GetDatasetContent]
-> ReadPrec GetDatasetContent
-> ReadPrec [GetDatasetContent]
-> Read GetDatasetContent
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDatasetContent]
$creadListPrec :: ReadPrec [GetDatasetContent]
readPrec :: ReadPrec GetDatasetContent
$creadPrec :: ReadPrec GetDatasetContent
readList :: ReadS [GetDatasetContent]
$creadList :: ReadS [GetDatasetContent]
readsPrec :: Int -> ReadS GetDatasetContent
$creadsPrec :: Int -> ReadS GetDatasetContent
Prelude.Read, Int -> GetDatasetContent -> ShowS
[GetDatasetContent] -> ShowS
GetDatasetContent -> String
(Int -> GetDatasetContent -> ShowS)
-> (GetDatasetContent -> String)
-> ([GetDatasetContent] -> ShowS)
-> Show GetDatasetContent
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDatasetContent] -> ShowS
$cshowList :: [GetDatasetContent] -> ShowS
show :: GetDatasetContent -> String
$cshow :: GetDatasetContent -> String
showsPrec :: Int -> GetDatasetContent -> ShowS
$cshowsPrec :: Int -> GetDatasetContent -> ShowS
Prelude.Show, (forall x. GetDatasetContent -> Rep GetDatasetContent x)
-> (forall x. Rep GetDatasetContent x -> GetDatasetContent)
-> Generic GetDatasetContent
forall x. Rep GetDatasetContent x -> GetDatasetContent
forall x. GetDatasetContent -> Rep GetDatasetContent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetDatasetContent x -> GetDatasetContent
$cfrom :: forall x. GetDatasetContent -> Rep GetDatasetContent x
Prelude.Generic)
newGetDatasetContent ::
Prelude.Text ->
GetDatasetContent
newGetDatasetContent :: Text -> GetDatasetContent
newGetDatasetContent Text
pDatasetName_ =
GetDatasetContent' :: Maybe Text -> Text -> GetDatasetContent
GetDatasetContent'
{ $sel:versionId:GetDatasetContent' :: Maybe Text
versionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:datasetName:GetDatasetContent' :: Text
datasetName = Text
pDatasetName_
}
getDatasetContent_versionId :: Lens.Lens' GetDatasetContent (Prelude.Maybe Prelude.Text)
getDatasetContent_versionId :: (Maybe Text -> f (Maybe Text))
-> GetDatasetContent -> f GetDatasetContent
getDatasetContent_versionId = (GetDatasetContent -> Maybe Text)
-> (GetDatasetContent -> Maybe Text -> GetDatasetContent)
-> Lens
GetDatasetContent GetDatasetContent (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDatasetContent' {Maybe Text
versionId :: Maybe Text
$sel:versionId:GetDatasetContent' :: GetDatasetContent -> Maybe Text
versionId} -> Maybe Text
versionId) (\s :: GetDatasetContent
s@GetDatasetContent' {} Maybe Text
a -> GetDatasetContent
s {$sel:versionId:GetDatasetContent' :: Maybe Text
versionId = Maybe Text
a} :: GetDatasetContent)
getDatasetContent_datasetName :: Lens.Lens' GetDatasetContent Prelude.Text
getDatasetContent_datasetName :: (Text -> f Text) -> GetDatasetContent -> f GetDatasetContent
getDatasetContent_datasetName = (GetDatasetContent -> Text)
-> (GetDatasetContent -> Text -> GetDatasetContent)
-> Lens GetDatasetContent GetDatasetContent Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDatasetContent' {Text
datasetName :: Text
$sel:datasetName:GetDatasetContent' :: GetDatasetContent -> Text
datasetName} -> Text
datasetName) (\s :: GetDatasetContent
s@GetDatasetContent' {} Text
a -> GetDatasetContent
s {$sel:datasetName:GetDatasetContent' :: Text
datasetName = Text
a} :: GetDatasetContent)
instance Core.AWSRequest GetDatasetContent where
type
AWSResponse GetDatasetContent =
GetDatasetContentResponse
request :: GetDatasetContent -> Request GetDatasetContent
request = Service -> GetDatasetContent -> Request GetDatasetContent
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetDatasetContent
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetDatasetContent)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetDatasetContent))
-> Logger
-> Service
-> Proxy GetDatasetContent
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetDatasetContent)))
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 DatasetContentStatus
-> Maybe [DatasetEntry]
-> Maybe POSIX
-> Int
-> GetDatasetContentResponse
GetDatasetContentResponse'
(Maybe DatasetContentStatus
-> Maybe [DatasetEntry]
-> Maybe POSIX
-> Int
-> GetDatasetContentResponse)
-> Either String (Maybe DatasetContentStatus)
-> Either
String
(Maybe [DatasetEntry]
-> Maybe POSIX -> Int -> GetDatasetContentResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe DatasetContentStatus)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"status")
Either
String
(Maybe [DatasetEntry]
-> Maybe POSIX -> Int -> GetDatasetContentResponse)
-> Either String (Maybe [DatasetEntry])
-> Either String (Maybe POSIX -> Int -> GetDatasetContentResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [DatasetEntry]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"entries" Either String (Maybe (Maybe [DatasetEntry]))
-> Maybe [DatasetEntry] -> Either String (Maybe [DatasetEntry])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [DatasetEntry]
forall a. Monoid a => a
Prelude.mempty)
Either String (Maybe POSIX -> Int -> GetDatasetContentResponse)
-> Either String (Maybe POSIX)
-> Either String (Int -> GetDatasetContentResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"timestamp")
Either String (Int -> GetDatasetContentResponse)
-> Either String Int -> Either String GetDatasetContentResponse
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 GetDatasetContent
instance Prelude.NFData GetDatasetContent
instance Core.ToHeaders GetDatasetContent where
toHeaders :: GetDatasetContent -> ResponseHeaders
toHeaders = ResponseHeaders -> GetDatasetContent -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath GetDatasetContent where
toPath :: GetDatasetContent -> ByteString
toPath GetDatasetContent' {Maybe Text
Text
datasetName :: Text
versionId :: Maybe Text
$sel:datasetName:GetDatasetContent' :: GetDatasetContent -> Text
$sel:versionId:GetDatasetContent' :: GetDatasetContent -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/datasets/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
datasetName, ByteString
"/content"]
instance Core.ToQuery GetDatasetContent where
toQuery :: GetDatasetContent -> QueryString
toQuery GetDatasetContent' {Maybe Text
Text
datasetName :: Text
versionId :: Maybe Text
$sel:datasetName:GetDatasetContent' :: GetDatasetContent -> Text
$sel:versionId:GetDatasetContent' :: GetDatasetContent -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"versionId" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
versionId]
data GetDatasetContentResponse = GetDatasetContentResponse'
{
GetDatasetContentResponse -> Maybe DatasetContentStatus
status :: Prelude.Maybe DatasetContentStatus,
GetDatasetContentResponse -> Maybe [DatasetEntry]
entries :: Prelude.Maybe [DatasetEntry],
GetDatasetContentResponse -> Maybe POSIX
timestamp :: Prelude.Maybe Core.POSIX,
GetDatasetContentResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetDatasetContentResponse -> GetDatasetContentResponse -> Bool
(GetDatasetContentResponse -> GetDatasetContentResponse -> Bool)
-> (GetDatasetContentResponse -> GetDatasetContentResponse -> Bool)
-> Eq GetDatasetContentResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDatasetContentResponse -> GetDatasetContentResponse -> Bool
$c/= :: GetDatasetContentResponse -> GetDatasetContentResponse -> Bool
== :: GetDatasetContentResponse -> GetDatasetContentResponse -> Bool
$c== :: GetDatasetContentResponse -> GetDatasetContentResponse -> Bool
Prelude.Eq, ReadPrec [GetDatasetContentResponse]
ReadPrec GetDatasetContentResponse
Int -> ReadS GetDatasetContentResponse
ReadS [GetDatasetContentResponse]
(Int -> ReadS GetDatasetContentResponse)
-> ReadS [GetDatasetContentResponse]
-> ReadPrec GetDatasetContentResponse
-> ReadPrec [GetDatasetContentResponse]
-> Read GetDatasetContentResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDatasetContentResponse]
$creadListPrec :: ReadPrec [GetDatasetContentResponse]
readPrec :: ReadPrec GetDatasetContentResponse
$creadPrec :: ReadPrec GetDatasetContentResponse
readList :: ReadS [GetDatasetContentResponse]
$creadList :: ReadS [GetDatasetContentResponse]
readsPrec :: Int -> ReadS GetDatasetContentResponse
$creadsPrec :: Int -> ReadS GetDatasetContentResponse
Prelude.Read, Int -> GetDatasetContentResponse -> ShowS
[GetDatasetContentResponse] -> ShowS
GetDatasetContentResponse -> String
(Int -> GetDatasetContentResponse -> ShowS)
-> (GetDatasetContentResponse -> String)
-> ([GetDatasetContentResponse] -> ShowS)
-> Show GetDatasetContentResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDatasetContentResponse] -> ShowS
$cshowList :: [GetDatasetContentResponse] -> ShowS
show :: GetDatasetContentResponse -> String
$cshow :: GetDatasetContentResponse -> String
showsPrec :: Int -> GetDatasetContentResponse -> ShowS
$cshowsPrec :: Int -> GetDatasetContentResponse -> ShowS
Prelude.Show, (forall x.
GetDatasetContentResponse -> Rep GetDatasetContentResponse x)
-> (forall x.
Rep GetDatasetContentResponse x -> GetDatasetContentResponse)
-> Generic GetDatasetContentResponse
forall x.
Rep GetDatasetContentResponse x -> GetDatasetContentResponse
forall x.
GetDatasetContentResponse -> Rep GetDatasetContentResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetDatasetContentResponse x -> GetDatasetContentResponse
$cfrom :: forall x.
GetDatasetContentResponse -> Rep GetDatasetContentResponse x
Prelude.Generic)
newGetDatasetContentResponse ::
Prelude.Int ->
GetDatasetContentResponse
newGetDatasetContentResponse :: Int -> GetDatasetContentResponse
newGetDatasetContentResponse Int
pHttpStatus_ =
GetDatasetContentResponse' :: Maybe DatasetContentStatus
-> Maybe [DatasetEntry]
-> Maybe POSIX
-> Int
-> GetDatasetContentResponse
GetDatasetContentResponse'
{ $sel:status:GetDatasetContentResponse' :: Maybe DatasetContentStatus
status =
Maybe DatasetContentStatus
forall a. Maybe a
Prelude.Nothing,
$sel:entries:GetDatasetContentResponse' :: Maybe [DatasetEntry]
entries = Maybe [DatasetEntry]
forall a. Maybe a
Prelude.Nothing,
$sel:timestamp:GetDatasetContentResponse' :: Maybe POSIX
timestamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetDatasetContentResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getDatasetContentResponse_status :: Lens.Lens' GetDatasetContentResponse (Prelude.Maybe DatasetContentStatus)
getDatasetContentResponse_status :: (Maybe DatasetContentStatus -> f (Maybe DatasetContentStatus))
-> GetDatasetContentResponse -> f GetDatasetContentResponse
getDatasetContentResponse_status = (GetDatasetContentResponse -> Maybe DatasetContentStatus)
-> (GetDatasetContentResponse
-> Maybe DatasetContentStatus -> GetDatasetContentResponse)
-> Lens
GetDatasetContentResponse
GetDatasetContentResponse
(Maybe DatasetContentStatus)
(Maybe DatasetContentStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDatasetContentResponse' {Maybe DatasetContentStatus
status :: Maybe DatasetContentStatus
$sel:status:GetDatasetContentResponse' :: GetDatasetContentResponse -> Maybe DatasetContentStatus
status} -> Maybe DatasetContentStatus
status) (\s :: GetDatasetContentResponse
s@GetDatasetContentResponse' {} Maybe DatasetContentStatus
a -> GetDatasetContentResponse
s {$sel:status:GetDatasetContentResponse' :: Maybe DatasetContentStatus
status = Maybe DatasetContentStatus
a} :: GetDatasetContentResponse)
getDatasetContentResponse_entries :: Lens.Lens' GetDatasetContentResponse (Prelude.Maybe [DatasetEntry])
getDatasetContentResponse_entries :: (Maybe [DatasetEntry] -> f (Maybe [DatasetEntry]))
-> GetDatasetContentResponse -> f GetDatasetContentResponse
getDatasetContentResponse_entries = (GetDatasetContentResponse -> Maybe [DatasetEntry])
-> (GetDatasetContentResponse
-> Maybe [DatasetEntry] -> GetDatasetContentResponse)
-> Lens
GetDatasetContentResponse
GetDatasetContentResponse
(Maybe [DatasetEntry])
(Maybe [DatasetEntry])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDatasetContentResponse' {Maybe [DatasetEntry]
entries :: Maybe [DatasetEntry]
$sel:entries:GetDatasetContentResponse' :: GetDatasetContentResponse -> Maybe [DatasetEntry]
entries} -> Maybe [DatasetEntry]
entries) (\s :: GetDatasetContentResponse
s@GetDatasetContentResponse' {} Maybe [DatasetEntry]
a -> GetDatasetContentResponse
s {$sel:entries:GetDatasetContentResponse' :: Maybe [DatasetEntry]
entries = Maybe [DatasetEntry]
a} :: GetDatasetContentResponse) ((Maybe [DatasetEntry] -> f (Maybe [DatasetEntry]))
-> GetDatasetContentResponse -> f GetDatasetContentResponse)
-> ((Maybe [DatasetEntry] -> f (Maybe [DatasetEntry]))
-> Maybe [DatasetEntry] -> f (Maybe [DatasetEntry]))
-> (Maybe [DatasetEntry] -> f (Maybe [DatasetEntry]))
-> GetDatasetContentResponse
-> f GetDatasetContentResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [DatasetEntry] [DatasetEntry] [DatasetEntry] [DatasetEntry]
-> Iso
(Maybe [DatasetEntry])
(Maybe [DatasetEntry])
(Maybe [DatasetEntry])
(Maybe [DatasetEntry])
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 [DatasetEntry] [DatasetEntry] [DatasetEntry] [DatasetEntry]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getDatasetContentResponse_timestamp :: Lens.Lens' GetDatasetContentResponse (Prelude.Maybe Prelude.UTCTime)
getDatasetContentResponse_timestamp :: (Maybe UTCTime -> f (Maybe UTCTime))
-> GetDatasetContentResponse -> f GetDatasetContentResponse
getDatasetContentResponse_timestamp = (GetDatasetContentResponse -> Maybe POSIX)
-> (GetDatasetContentResponse
-> Maybe POSIX -> GetDatasetContentResponse)
-> Lens
GetDatasetContentResponse
GetDatasetContentResponse
(Maybe POSIX)
(Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDatasetContentResponse' {Maybe POSIX
timestamp :: Maybe POSIX
$sel:timestamp:GetDatasetContentResponse' :: GetDatasetContentResponse -> Maybe POSIX
timestamp} -> Maybe POSIX
timestamp) (\s :: GetDatasetContentResponse
s@GetDatasetContentResponse' {} Maybe POSIX
a -> GetDatasetContentResponse
s {$sel:timestamp:GetDatasetContentResponse' :: Maybe POSIX
timestamp = Maybe POSIX
a} :: GetDatasetContentResponse) ((Maybe POSIX -> f (Maybe POSIX))
-> GetDatasetContentResponse -> f GetDatasetContentResponse)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> GetDatasetContentResponse
-> f GetDatasetContentResponse
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
getDatasetContentResponse_httpStatus :: Lens.Lens' GetDatasetContentResponse Prelude.Int
getDatasetContentResponse_httpStatus :: (Int -> f Int)
-> GetDatasetContentResponse -> f GetDatasetContentResponse
getDatasetContentResponse_httpStatus = (GetDatasetContentResponse -> Int)
-> (GetDatasetContentResponse -> Int -> GetDatasetContentResponse)
-> Lens GetDatasetContentResponse GetDatasetContentResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDatasetContentResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetDatasetContentResponse' :: GetDatasetContentResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetDatasetContentResponse
s@GetDatasetContentResponse' {} Int
a -> GetDatasetContentResponse
s {$sel:httpStatus:GetDatasetContentResponse' :: Int
httpStatus = Int
a} :: GetDatasetContentResponse)
instance Prelude.NFData GetDatasetContentResponse