{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.IoTAnalytics.ListDatasetContents
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Lists information about dataset contents that have been created.
--
-- This operation returns paginated results.
module Amazonka.IoTAnalytics.ListDatasetContents
  ( -- * Creating a Request
    ListDatasetContents (..),
    newListDatasetContents,

    -- * Request Lenses
    listDatasetContents_nextToken,
    listDatasetContents_scheduledBefore,
    listDatasetContents_maxResults,
    listDatasetContents_scheduledOnOrAfter,
    listDatasetContents_datasetName,

    -- * Destructuring the Response
    ListDatasetContentsResponse (..),
    newListDatasetContentsResponse,

    -- * Response Lenses
    listDatasetContentsResponse_datasetContentSummaries,
    listDatasetContentsResponse_nextToken,
    listDatasetContentsResponse_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

-- | /See:/ 'newListDatasetContents' smart constructor.
data ListDatasetContents = ListDatasetContents'
  { -- | The token for the next set of results.
    ListDatasetContents -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | A filter to limit results to those dataset contents whose creation is
    -- scheduled before the given time. See the field @triggers.schedule@ in
    -- the @CreateDataset@ request. (timestamp)
    ListDatasetContents -> Maybe POSIX
scheduledBefore :: Prelude.Maybe Core.POSIX,
    -- | The maximum number of results to return in this request.
    ListDatasetContents -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | A filter to limit results to those dataset contents whose creation is
    -- scheduled on or after the given time. See the field @triggers.schedule@
    -- in the @CreateDataset@ request. (timestamp)
    ListDatasetContents -> Maybe POSIX
scheduledOnOrAfter :: Prelude.Maybe Core.POSIX,
    -- | The name of the dataset whose contents information you want to list.
    ListDatasetContents -> Text
datasetName :: Prelude.Text
  }
  deriving (ListDatasetContents -> ListDatasetContents -> Bool
(ListDatasetContents -> ListDatasetContents -> Bool)
-> (ListDatasetContents -> ListDatasetContents -> Bool)
-> Eq ListDatasetContents
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListDatasetContents -> ListDatasetContents -> Bool
$c/= :: ListDatasetContents -> ListDatasetContents -> Bool
== :: ListDatasetContents -> ListDatasetContents -> Bool
$c== :: ListDatasetContents -> ListDatasetContents -> Bool
Prelude.Eq, ReadPrec [ListDatasetContents]
ReadPrec ListDatasetContents
Int -> ReadS ListDatasetContents
ReadS [ListDatasetContents]
(Int -> ReadS ListDatasetContents)
-> ReadS [ListDatasetContents]
-> ReadPrec ListDatasetContents
-> ReadPrec [ListDatasetContents]
-> Read ListDatasetContents
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListDatasetContents]
$creadListPrec :: ReadPrec [ListDatasetContents]
readPrec :: ReadPrec ListDatasetContents
$creadPrec :: ReadPrec ListDatasetContents
readList :: ReadS [ListDatasetContents]
$creadList :: ReadS [ListDatasetContents]
readsPrec :: Int -> ReadS ListDatasetContents
$creadsPrec :: Int -> ReadS ListDatasetContents
Prelude.Read, Int -> ListDatasetContents -> ShowS
[ListDatasetContents] -> ShowS
ListDatasetContents -> String
(Int -> ListDatasetContents -> ShowS)
-> (ListDatasetContents -> String)
-> ([ListDatasetContents] -> ShowS)
-> Show ListDatasetContents
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListDatasetContents] -> ShowS
$cshowList :: [ListDatasetContents] -> ShowS
show :: ListDatasetContents -> String
$cshow :: ListDatasetContents -> String
showsPrec :: Int -> ListDatasetContents -> ShowS
$cshowsPrec :: Int -> ListDatasetContents -> ShowS
Prelude.Show, (forall x. ListDatasetContents -> Rep ListDatasetContents x)
-> (forall x. Rep ListDatasetContents x -> ListDatasetContents)
-> Generic ListDatasetContents
forall x. Rep ListDatasetContents x -> ListDatasetContents
forall x. ListDatasetContents -> Rep ListDatasetContents x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListDatasetContents x -> ListDatasetContents
$cfrom :: forall x. ListDatasetContents -> Rep ListDatasetContents x
Prelude.Generic)

-- |
-- Create a value of 'ListDatasetContents' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'nextToken', 'listDatasetContents_nextToken' - The token for the next set of results.
--
-- 'scheduledBefore', 'listDatasetContents_scheduledBefore' - A filter to limit results to those dataset contents whose creation is
-- scheduled before the given time. See the field @triggers.schedule@ in
-- the @CreateDataset@ request. (timestamp)
--
-- 'maxResults', 'listDatasetContents_maxResults' - The maximum number of results to return in this request.
--
-- 'scheduledOnOrAfter', 'listDatasetContents_scheduledOnOrAfter' - A filter to limit results to those dataset contents whose creation is
-- scheduled on or after the given time. See the field @triggers.schedule@
-- in the @CreateDataset@ request. (timestamp)
--
-- 'datasetName', 'listDatasetContents_datasetName' - The name of the dataset whose contents information you want to list.
newListDatasetContents ::
  -- | 'datasetName'
  Prelude.Text ->
  ListDatasetContents
newListDatasetContents :: Text -> ListDatasetContents
newListDatasetContents Text
pDatasetName_ =
  ListDatasetContents' :: Maybe Text
-> Maybe POSIX
-> Maybe Natural
-> Maybe POSIX
-> Text
-> ListDatasetContents
ListDatasetContents'
    { $sel:nextToken:ListDatasetContents' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:scheduledBefore:ListDatasetContents' :: Maybe POSIX
scheduledBefore = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListDatasetContents' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:scheduledOnOrAfter:ListDatasetContents' :: Maybe POSIX
scheduledOnOrAfter = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:datasetName:ListDatasetContents' :: Text
datasetName = Text
pDatasetName_
    }

-- | The token for the next set of results.
listDatasetContents_nextToken :: Lens.Lens' ListDatasetContents (Prelude.Maybe Prelude.Text)
listDatasetContents_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListDatasetContents -> f ListDatasetContents
listDatasetContents_nextToken = (ListDatasetContents -> Maybe Text)
-> (ListDatasetContents -> Maybe Text -> ListDatasetContents)
-> Lens
     ListDatasetContents ListDatasetContents (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDatasetContents' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListDatasetContents' :: ListDatasetContents -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListDatasetContents
s@ListDatasetContents' {} Maybe Text
a -> ListDatasetContents
s {$sel:nextToken:ListDatasetContents' :: Maybe Text
nextToken = Maybe Text
a} :: ListDatasetContents)

-- | A filter to limit results to those dataset contents whose creation is
-- scheduled before the given time. See the field @triggers.schedule@ in
-- the @CreateDataset@ request. (timestamp)
listDatasetContents_scheduledBefore :: Lens.Lens' ListDatasetContents (Prelude.Maybe Prelude.UTCTime)
listDatasetContents_scheduledBefore :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ListDatasetContents -> f ListDatasetContents
listDatasetContents_scheduledBefore = (ListDatasetContents -> Maybe POSIX)
-> (ListDatasetContents -> Maybe POSIX -> ListDatasetContents)
-> Lens
     ListDatasetContents ListDatasetContents (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDatasetContents' {Maybe POSIX
scheduledBefore :: Maybe POSIX
$sel:scheduledBefore:ListDatasetContents' :: ListDatasetContents -> Maybe POSIX
scheduledBefore} -> Maybe POSIX
scheduledBefore) (\s :: ListDatasetContents
s@ListDatasetContents' {} Maybe POSIX
a -> ListDatasetContents
s {$sel:scheduledBefore:ListDatasetContents' :: Maybe POSIX
scheduledBefore = Maybe POSIX
a} :: ListDatasetContents) ((Maybe POSIX -> f (Maybe POSIX))
 -> ListDatasetContents -> f ListDatasetContents)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ListDatasetContents
-> f ListDatasetContents
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

-- | The maximum number of results to return in this request.
listDatasetContents_maxResults :: Lens.Lens' ListDatasetContents (Prelude.Maybe Prelude.Natural)
listDatasetContents_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListDatasetContents -> f ListDatasetContents
listDatasetContents_maxResults = (ListDatasetContents -> Maybe Natural)
-> (ListDatasetContents -> Maybe Natural -> ListDatasetContents)
-> Lens
     ListDatasetContents
     ListDatasetContents
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDatasetContents' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListDatasetContents' :: ListDatasetContents -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListDatasetContents
s@ListDatasetContents' {} Maybe Natural
a -> ListDatasetContents
s {$sel:maxResults:ListDatasetContents' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListDatasetContents)

-- | A filter to limit results to those dataset contents whose creation is
-- scheduled on or after the given time. See the field @triggers.schedule@
-- in the @CreateDataset@ request. (timestamp)
listDatasetContents_scheduledOnOrAfter :: Lens.Lens' ListDatasetContents (Prelude.Maybe Prelude.UTCTime)
listDatasetContents_scheduledOnOrAfter :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ListDatasetContents -> f ListDatasetContents
listDatasetContents_scheduledOnOrAfter = (ListDatasetContents -> Maybe POSIX)
-> (ListDatasetContents -> Maybe POSIX -> ListDatasetContents)
-> Lens
     ListDatasetContents ListDatasetContents (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDatasetContents' {Maybe POSIX
scheduledOnOrAfter :: Maybe POSIX
$sel:scheduledOnOrAfter:ListDatasetContents' :: ListDatasetContents -> Maybe POSIX
scheduledOnOrAfter} -> Maybe POSIX
scheduledOnOrAfter) (\s :: ListDatasetContents
s@ListDatasetContents' {} Maybe POSIX
a -> ListDatasetContents
s {$sel:scheduledOnOrAfter:ListDatasetContents' :: Maybe POSIX
scheduledOnOrAfter = Maybe POSIX
a} :: ListDatasetContents) ((Maybe POSIX -> f (Maybe POSIX))
 -> ListDatasetContents -> f ListDatasetContents)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ListDatasetContents
-> f ListDatasetContents
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

-- | The name of the dataset whose contents information you want to list.
listDatasetContents_datasetName :: Lens.Lens' ListDatasetContents Prelude.Text
listDatasetContents_datasetName :: (Text -> f Text) -> ListDatasetContents -> f ListDatasetContents
listDatasetContents_datasetName = (ListDatasetContents -> Text)
-> (ListDatasetContents -> Text -> ListDatasetContents)
-> Lens ListDatasetContents ListDatasetContents Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDatasetContents' {Text
datasetName :: Text
$sel:datasetName:ListDatasetContents' :: ListDatasetContents -> Text
datasetName} -> Text
datasetName) (\s :: ListDatasetContents
s@ListDatasetContents' {} Text
a -> ListDatasetContents
s {$sel:datasetName:ListDatasetContents' :: Text
datasetName = Text
a} :: ListDatasetContents)

instance Core.AWSPager ListDatasetContents where
  page :: ListDatasetContents
-> AWSResponse ListDatasetContents -> Maybe ListDatasetContents
page ListDatasetContents
rq AWSResponse ListDatasetContents
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListDatasetContents
ListDatasetContentsResponse
rs
            ListDatasetContentsResponse
-> Getting (First Text) ListDatasetContentsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListDatasetContentsResponse
-> Const (First Text) ListDatasetContentsResponse
Lens' ListDatasetContentsResponse (Maybe Text)
listDatasetContentsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListDatasetContentsResponse
 -> Const (First Text) ListDatasetContentsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListDatasetContentsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListDatasetContents
forall a. Maybe a
Prelude.Nothing
    | Maybe [DatasetContentSummary] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListDatasetContents
ListDatasetContentsResponse
rs
            ListDatasetContentsResponse
-> Getting
     (First [DatasetContentSummary])
     ListDatasetContentsResponse
     [DatasetContentSummary]
-> Maybe [DatasetContentSummary]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [DatasetContentSummary]
 -> Const
      (First [DatasetContentSummary]) (Maybe [DatasetContentSummary]))
-> ListDatasetContentsResponse
-> Const
     (First [DatasetContentSummary]) ListDatasetContentsResponse
Lens' ListDatasetContentsResponse (Maybe [DatasetContentSummary])
listDatasetContentsResponse_datasetContentSummaries
              ((Maybe [DatasetContentSummary]
  -> Const
       (First [DatasetContentSummary]) (Maybe [DatasetContentSummary]))
 -> ListDatasetContentsResponse
 -> Const
      (First [DatasetContentSummary]) ListDatasetContentsResponse)
-> (([DatasetContentSummary]
     -> Const (First [DatasetContentSummary]) [DatasetContentSummary])
    -> Maybe [DatasetContentSummary]
    -> Const
         (First [DatasetContentSummary]) (Maybe [DatasetContentSummary]))
-> Getting
     (First [DatasetContentSummary])
     ListDatasetContentsResponse
     [DatasetContentSummary]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([DatasetContentSummary]
 -> Const (First [DatasetContentSummary]) [DatasetContentSummary])
-> Maybe [DatasetContentSummary]
-> Const
     (First [DatasetContentSummary]) (Maybe [DatasetContentSummary])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListDatasetContents
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListDatasetContents -> Maybe ListDatasetContents
forall a. a -> Maybe a
Prelude.Just (ListDatasetContents -> Maybe ListDatasetContents)
-> ListDatasetContents -> Maybe ListDatasetContents
forall a b. (a -> b) -> a -> b
Prelude.$
        ListDatasetContents
rq
          ListDatasetContents
-> (ListDatasetContents -> ListDatasetContents)
-> ListDatasetContents
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListDatasetContents -> Identity ListDatasetContents
Lens
  ListDatasetContents ListDatasetContents (Maybe Text) (Maybe Text)
listDatasetContents_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListDatasetContents -> Identity ListDatasetContents)
-> Maybe Text -> ListDatasetContents -> ListDatasetContents
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListDatasetContents
ListDatasetContentsResponse
rs
          ListDatasetContentsResponse
-> Getting (First Text) ListDatasetContentsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListDatasetContentsResponse
-> Const (First Text) ListDatasetContentsResponse
Lens' ListDatasetContentsResponse (Maybe Text)
listDatasetContentsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListDatasetContentsResponse
 -> Const (First Text) ListDatasetContentsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListDatasetContentsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest ListDatasetContents where
  type
    AWSResponse ListDatasetContents =
      ListDatasetContentsResponse
  request :: ListDatasetContents -> Request ListDatasetContents
request = Service -> ListDatasetContents -> Request ListDatasetContents
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy ListDatasetContents
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListDatasetContents)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListDatasetContents))
-> Logger
-> Service
-> Proxy ListDatasetContents
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListDatasetContents)))
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 [DatasetContentSummary]
-> Maybe Text -> Int -> ListDatasetContentsResponse
ListDatasetContentsResponse'
            (Maybe [DatasetContentSummary]
 -> Maybe Text -> Int -> ListDatasetContentsResponse)
-> Either String (Maybe [DatasetContentSummary])
-> Either String (Maybe Text -> Int -> ListDatasetContentsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object
-> Text -> Either String (Maybe (Maybe [DatasetContentSummary]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"datasetContentSummaries"
                            Either String (Maybe (Maybe [DatasetContentSummary]))
-> Maybe [DatasetContentSummary]
-> Either String (Maybe [DatasetContentSummary])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [DatasetContentSummary]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either String (Maybe Text -> Int -> ListDatasetContentsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListDatasetContentsResponse)
forall (f :: * -> *) a b. Applicative f => 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
"nextToken")
            Either String (Int -> ListDatasetContentsResponse)
-> Either String Int -> Either String ListDatasetContentsResponse
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 ListDatasetContents

instance Prelude.NFData ListDatasetContents

instance Core.ToHeaders ListDatasetContents where
  toHeaders :: ListDatasetContents -> ResponseHeaders
toHeaders = ResponseHeaders -> ListDatasetContents -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance Core.ToPath ListDatasetContents where
  toPath :: ListDatasetContents -> ByteString
toPath ListDatasetContents' {Maybe Natural
Maybe Text
Maybe POSIX
Text
datasetName :: Text
scheduledOnOrAfter :: Maybe POSIX
maxResults :: Maybe Natural
scheduledBefore :: Maybe POSIX
nextToken :: Maybe Text
$sel:datasetName:ListDatasetContents' :: ListDatasetContents -> Text
$sel:scheduledOnOrAfter:ListDatasetContents' :: ListDatasetContents -> Maybe POSIX
$sel:maxResults:ListDatasetContents' :: ListDatasetContents -> Maybe Natural
$sel:scheduledBefore:ListDatasetContents' :: ListDatasetContents -> Maybe POSIX
$sel:nextToken:ListDatasetContents' :: ListDatasetContents -> 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
"/contents"]

instance Core.ToQuery ListDatasetContents where
  toQuery :: ListDatasetContents -> QueryString
toQuery ListDatasetContents' {Maybe Natural
Maybe Text
Maybe POSIX
Text
datasetName :: Text
scheduledOnOrAfter :: Maybe POSIX
maxResults :: Maybe Natural
scheduledBefore :: Maybe POSIX
nextToken :: Maybe Text
$sel:datasetName:ListDatasetContents' :: ListDatasetContents -> Text
$sel:scheduledOnOrAfter:ListDatasetContents' :: ListDatasetContents -> Maybe POSIX
$sel:maxResults:ListDatasetContents' :: ListDatasetContents -> Maybe Natural
$sel:scheduledBefore:ListDatasetContents' :: ListDatasetContents -> Maybe POSIX
$sel:nextToken:ListDatasetContents' :: ListDatasetContents -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"nextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
        ByteString
"scheduledBefore" ByteString -> Maybe POSIX -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe POSIX
scheduledBefore,
        ByteString
"maxResults" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults,
        ByteString
"scheduledOnOrAfter" ByteString -> Maybe POSIX -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe POSIX
scheduledOnOrAfter
      ]

-- | /See:/ 'newListDatasetContentsResponse' smart constructor.
data ListDatasetContentsResponse = ListDatasetContentsResponse'
  { -- | Summary information about dataset contents that have been created.
    ListDatasetContentsResponse -> Maybe [DatasetContentSummary]
datasetContentSummaries :: Prelude.Maybe [DatasetContentSummary],
    -- | The token to retrieve the next set of results, or @null@ if there are no
    -- more results.
    ListDatasetContentsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListDatasetContentsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListDatasetContentsResponse -> ListDatasetContentsResponse -> Bool
(ListDatasetContentsResponse
 -> ListDatasetContentsResponse -> Bool)
-> (ListDatasetContentsResponse
    -> ListDatasetContentsResponse -> Bool)
-> Eq ListDatasetContentsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListDatasetContentsResponse -> ListDatasetContentsResponse -> Bool
$c/= :: ListDatasetContentsResponse -> ListDatasetContentsResponse -> Bool
== :: ListDatasetContentsResponse -> ListDatasetContentsResponse -> Bool
$c== :: ListDatasetContentsResponse -> ListDatasetContentsResponse -> Bool
Prelude.Eq, ReadPrec [ListDatasetContentsResponse]
ReadPrec ListDatasetContentsResponse
Int -> ReadS ListDatasetContentsResponse
ReadS [ListDatasetContentsResponse]
(Int -> ReadS ListDatasetContentsResponse)
-> ReadS [ListDatasetContentsResponse]
-> ReadPrec ListDatasetContentsResponse
-> ReadPrec [ListDatasetContentsResponse]
-> Read ListDatasetContentsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListDatasetContentsResponse]
$creadListPrec :: ReadPrec [ListDatasetContentsResponse]
readPrec :: ReadPrec ListDatasetContentsResponse
$creadPrec :: ReadPrec ListDatasetContentsResponse
readList :: ReadS [ListDatasetContentsResponse]
$creadList :: ReadS [ListDatasetContentsResponse]
readsPrec :: Int -> ReadS ListDatasetContentsResponse
$creadsPrec :: Int -> ReadS ListDatasetContentsResponse
Prelude.Read, Int -> ListDatasetContentsResponse -> ShowS
[ListDatasetContentsResponse] -> ShowS
ListDatasetContentsResponse -> String
(Int -> ListDatasetContentsResponse -> ShowS)
-> (ListDatasetContentsResponse -> String)
-> ([ListDatasetContentsResponse] -> ShowS)
-> Show ListDatasetContentsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListDatasetContentsResponse] -> ShowS
$cshowList :: [ListDatasetContentsResponse] -> ShowS
show :: ListDatasetContentsResponse -> String
$cshow :: ListDatasetContentsResponse -> String
showsPrec :: Int -> ListDatasetContentsResponse -> ShowS
$cshowsPrec :: Int -> ListDatasetContentsResponse -> ShowS
Prelude.Show, (forall x.
 ListDatasetContentsResponse -> Rep ListDatasetContentsResponse x)
-> (forall x.
    Rep ListDatasetContentsResponse x -> ListDatasetContentsResponse)
-> Generic ListDatasetContentsResponse
forall x.
Rep ListDatasetContentsResponse x -> ListDatasetContentsResponse
forall x.
ListDatasetContentsResponse -> Rep ListDatasetContentsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListDatasetContentsResponse x -> ListDatasetContentsResponse
$cfrom :: forall x.
ListDatasetContentsResponse -> Rep ListDatasetContentsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListDatasetContentsResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'datasetContentSummaries', 'listDatasetContentsResponse_datasetContentSummaries' - Summary information about dataset contents that have been created.
--
-- 'nextToken', 'listDatasetContentsResponse_nextToken' - The token to retrieve the next set of results, or @null@ if there are no
-- more results.
--
-- 'httpStatus', 'listDatasetContentsResponse_httpStatus' - The response's http status code.
newListDatasetContentsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListDatasetContentsResponse
newListDatasetContentsResponse :: Int -> ListDatasetContentsResponse
newListDatasetContentsResponse Int
pHttpStatus_ =
  ListDatasetContentsResponse' :: Maybe [DatasetContentSummary]
-> Maybe Text -> Int -> ListDatasetContentsResponse
ListDatasetContentsResponse'
    { $sel:datasetContentSummaries:ListDatasetContentsResponse' :: Maybe [DatasetContentSummary]
datasetContentSummaries =
        Maybe [DatasetContentSummary]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListDatasetContentsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListDatasetContentsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Summary information about dataset contents that have been created.
listDatasetContentsResponse_datasetContentSummaries :: Lens.Lens' ListDatasetContentsResponse (Prelude.Maybe [DatasetContentSummary])
listDatasetContentsResponse_datasetContentSummaries :: (Maybe [DatasetContentSummary]
 -> f (Maybe [DatasetContentSummary]))
-> ListDatasetContentsResponse -> f ListDatasetContentsResponse
listDatasetContentsResponse_datasetContentSummaries = (ListDatasetContentsResponse -> Maybe [DatasetContentSummary])
-> (ListDatasetContentsResponse
    -> Maybe [DatasetContentSummary] -> ListDatasetContentsResponse)
-> Lens'
     ListDatasetContentsResponse (Maybe [DatasetContentSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDatasetContentsResponse' {Maybe [DatasetContentSummary]
datasetContentSummaries :: Maybe [DatasetContentSummary]
$sel:datasetContentSummaries:ListDatasetContentsResponse' :: ListDatasetContentsResponse -> Maybe [DatasetContentSummary]
datasetContentSummaries} -> Maybe [DatasetContentSummary]
datasetContentSummaries) (\s :: ListDatasetContentsResponse
s@ListDatasetContentsResponse' {} Maybe [DatasetContentSummary]
a -> ListDatasetContentsResponse
s {$sel:datasetContentSummaries:ListDatasetContentsResponse' :: Maybe [DatasetContentSummary]
datasetContentSummaries = Maybe [DatasetContentSummary]
a} :: ListDatasetContentsResponse) ((Maybe [DatasetContentSummary]
  -> f (Maybe [DatasetContentSummary]))
 -> ListDatasetContentsResponse -> f ListDatasetContentsResponse)
-> ((Maybe [DatasetContentSummary]
     -> f (Maybe [DatasetContentSummary]))
    -> Maybe [DatasetContentSummary]
    -> f (Maybe [DatasetContentSummary]))
-> (Maybe [DatasetContentSummary]
    -> f (Maybe [DatasetContentSummary]))
-> ListDatasetContentsResponse
-> f ListDatasetContentsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [DatasetContentSummary]
  [DatasetContentSummary]
  [DatasetContentSummary]
  [DatasetContentSummary]
-> Iso
     (Maybe [DatasetContentSummary])
     (Maybe [DatasetContentSummary])
     (Maybe [DatasetContentSummary])
     (Maybe [DatasetContentSummary])
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
  [DatasetContentSummary]
  [DatasetContentSummary]
  [DatasetContentSummary]
  [DatasetContentSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The token to retrieve the next set of results, or @null@ if there are no
-- more results.
listDatasetContentsResponse_nextToken :: Lens.Lens' ListDatasetContentsResponse (Prelude.Maybe Prelude.Text)
listDatasetContentsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListDatasetContentsResponse -> f ListDatasetContentsResponse
listDatasetContentsResponse_nextToken = (ListDatasetContentsResponse -> Maybe Text)
-> (ListDatasetContentsResponse
    -> Maybe Text -> ListDatasetContentsResponse)
-> Lens' ListDatasetContentsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDatasetContentsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListDatasetContentsResponse' :: ListDatasetContentsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListDatasetContentsResponse
s@ListDatasetContentsResponse' {} Maybe Text
a -> ListDatasetContentsResponse
s {$sel:nextToken:ListDatasetContentsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListDatasetContentsResponse)

-- | The response's http status code.
listDatasetContentsResponse_httpStatus :: Lens.Lens' ListDatasetContentsResponse Prelude.Int
listDatasetContentsResponse_httpStatus :: (Int -> f Int)
-> ListDatasetContentsResponse -> f ListDatasetContentsResponse
listDatasetContentsResponse_httpStatus = (ListDatasetContentsResponse -> Int)
-> (ListDatasetContentsResponse
    -> Int -> ListDatasetContentsResponse)
-> Lens
     ListDatasetContentsResponse ListDatasetContentsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDatasetContentsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListDatasetContentsResponse' :: ListDatasetContentsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListDatasetContentsResponse
s@ListDatasetContentsResponse' {} Int
a -> ListDatasetContentsResponse
s {$sel:httpStatus:ListDatasetContentsResponse' :: Int
httpStatus = Int
a} :: ListDatasetContentsResponse)

instance Prelude.NFData ListDatasetContentsResponse