{-# 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.Forecast.ListDatasetImportJobs
-- 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)
--
-- Returns a list of dataset import jobs created using the
-- CreateDatasetImportJob operation. For each import job, this operation
-- returns a summary of its properties, including its Amazon Resource Name
-- (ARN). You can retrieve the complete set of properties by using the ARN
-- with the DescribeDatasetImportJob operation. You can filter the list by
-- providing an array of Filter objects.
--
-- This operation returns paginated results.
module Amazonka.Forecast.ListDatasetImportJobs
  ( -- * Creating a Request
    ListDatasetImportJobs (..),
    newListDatasetImportJobs,

    -- * Request Lenses
    listDatasetImportJobs_filters,
    listDatasetImportJobs_nextToken,
    listDatasetImportJobs_maxResults,

    -- * Destructuring the Response
    ListDatasetImportJobsResponse (..),
    newListDatasetImportJobsResponse,

    -- * Response Lenses
    listDatasetImportJobsResponse_datasetImportJobs,
    listDatasetImportJobsResponse_nextToken,
    listDatasetImportJobsResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.Forecast.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:/ 'newListDatasetImportJobs' smart constructor.
data ListDatasetImportJobs = ListDatasetImportJobs'
  { -- | An array of filters. For each filter, you provide a condition and a
    -- match statement. The condition is either @IS@ or @IS_NOT@, which
    -- specifies whether to include or exclude the datasets that match the
    -- statement from the list, respectively. The match statement consists of a
    -- key and a value.
    --
    -- __Filter properties__
    --
    -- -   @Condition@ - The condition to apply. Valid values are @IS@ and
    --     @IS_NOT@. To include the datasets that match the statement, specify
    --     @IS@. To exclude matching datasets, specify @IS_NOT@.
    --
    -- -   @Key@ - The name of the parameter to filter on. Valid values are
    --     @DatasetArn@ and @Status@.
    --
    -- -   @Value@ - The value to match.
    --
    -- For example, to list all dataset import jobs whose status is ACTIVE, you
    -- specify the following filter:
    --
    -- @\"Filters\": [ { \"Condition\": \"IS\", \"Key\": \"Status\", \"Value\": \"ACTIVE\" } ]@
    ListDatasetImportJobs -> Maybe [Filter]
filters :: Prelude.Maybe [Filter],
    -- | If the result of the previous request was truncated, the response
    -- includes a @NextToken@. To retrieve the next set of results, use the
    -- token in the next request. Tokens expire after 24 hours.
    ListDatasetImportJobs -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The number of items to return in the response.
    ListDatasetImportJobs -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListDatasetImportJobs -> ListDatasetImportJobs -> Bool
(ListDatasetImportJobs -> ListDatasetImportJobs -> Bool)
-> (ListDatasetImportJobs -> ListDatasetImportJobs -> Bool)
-> Eq ListDatasetImportJobs
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListDatasetImportJobs -> ListDatasetImportJobs -> Bool
$c/= :: ListDatasetImportJobs -> ListDatasetImportJobs -> Bool
== :: ListDatasetImportJobs -> ListDatasetImportJobs -> Bool
$c== :: ListDatasetImportJobs -> ListDatasetImportJobs -> Bool
Prelude.Eq, ReadPrec [ListDatasetImportJobs]
ReadPrec ListDatasetImportJobs
Int -> ReadS ListDatasetImportJobs
ReadS [ListDatasetImportJobs]
(Int -> ReadS ListDatasetImportJobs)
-> ReadS [ListDatasetImportJobs]
-> ReadPrec ListDatasetImportJobs
-> ReadPrec [ListDatasetImportJobs]
-> Read ListDatasetImportJobs
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListDatasetImportJobs]
$creadListPrec :: ReadPrec [ListDatasetImportJobs]
readPrec :: ReadPrec ListDatasetImportJobs
$creadPrec :: ReadPrec ListDatasetImportJobs
readList :: ReadS [ListDatasetImportJobs]
$creadList :: ReadS [ListDatasetImportJobs]
readsPrec :: Int -> ReadS ListDatasetImportJobs
$creadsPrec :: Int -> ReadS ListDatasetImportJobs
Prelude.Read, Int -> ListDatasetImportJobs -> ShowS
[ListDatasetImportJobs] -> ShowS
ListDatasetImportJobs -> String
(Int -> ListDatasetImportJobs -> ShowS)
-> (ListDatasetImportJobs -> String)
-> ([ListDatasetImportJobs] -> ShowS)
-> Show ListDatasetImportJobs
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListDatasetImportJobs] -> ShowS
$cshowList :: [ListDatasetImportJobs] -> ShowS
show :: ListDatasetImportJobs -> String
$cshow :: ListDatasetImportJobs -> String
showsPrec :: Int -> ListDatasetImportJobs -> ShowS
$cshowsPrec :: Int -> ListDatasetImportJobs -> ShowS
Prelude.Show, (forall x. ListDatasetImportJobs -> Rep ListDatasetImportJobs x)
-> (forall x. Rep ListDatasetImportJobs x -> ListDatasetImportJobs)
-> Generic ListDatasetImportJobs
forall x. Rep ListDatasetImportJobs x -> ListDatasetImportJobs
forall x. ListDatasetImportJobs -> Rep ListDatasetImportJobs x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListDatasetImportJobs x -> ListDatasetImportJobs
$cfrom :: forall x. ListDatasetImportJobs -> Rep ListDatasetImportJobs x
Prelude.Generic)

-- |
-- Create a value of 'ListDatasetImportJobs' 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:
--
-- 'filters', 'listDatasetImportJobs_filters' - An array of filters. For each filter, you provide a condition and a
-- match statement. The condition is either @IS@ or @IS_NOT@, which
-- specifies whether to include or exclude the datasets that match the
-- statement from the list, respectively. The match statement consists of a
-- key and a value.
--
-- __Filter properties__
--
-- -   @Condition@ - The condition to apply. Valid values are @IS@ and
--     @IS_NOT@. To include the datasets that match the statement, specify
--     @IS@. To exclude matching datasets, specify @IS_NOT@.
--
-- -   @Key@ - The name of the parameter to filter on. Valid values are
--     @DatasetArn@ and @Status@.
--
-- -   @Value@ - The value to match.
--
-- For example, to list all dataset import jobs whose status is ACTIVE, you
-- specify the following filter:
--
-- @\"Filters\": [ { \"Condition\": \"IS\", \"Key\": \"Status\", \"Value\": \"ACTIVE\" } ]@
--
-- 'nextToken', 'listDatasetImportJobs_nextToken' - If the result of the previous request was truncated, the response
-- includes a @NextToken@. To retrieve the next set of results, use the
-- token in the next request. Tokens expire after 24 hours.
--
-- 'maxResults', 'listDatasetImportJobs_maxResults' - The number of items to return in the response.
newListDatasetImportJobs ::
  ListDatasetImportJobs
newListDatasetImportJobs :: ListDatasetImportJobs
newListDatasetImportJobs =
  ListDatasetImportJobs' :: Maybe [Filter]
-> Maybe Text -> Maybe Natural -> ListDatasetImportJobs
ListDatasetImportJobs'
    { $sel:filters:ListDatasetImportJobs' :: Maybe [Filter]
filters = Maybe [Filter]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListDatasetImportJobs' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListDatasetImportJobs' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | An array of filters. For each filter, you provide a condition and a
-- match statement. The condition is either @IS@ or @IS_NOT@, which
-- specifies whether to include or exclude the datasets that match the
-- statement from the list, respectively. The match statement consists of a
-- key and a value.
--
-- __Filter properties__
--
-- -   @Condition@ - The condition to apply. Valid values are @IS@ and
--     @IS_NOT@. To include the datasets that match the statement, specify
--     @IS@. To exclude matching datasets, specify @IS_NOT@.
--
-- -   @Key@ - The name of the parameter to filter on. Valid values are
--     @DatasetArn@ and @Status@.
--
-- -   @Value@ - The value to match.
--
-- For example, to list all dataset import jobs whose status is ACTIVE, you
-- specify the following filter:
--
-- @\"Filters\": [ { \"Condition\": \"IS\", \"Key\": \"Status\", \"Value\": \"ACTIVE\" } ]@
listDatasetImportJobs_filters :: Lens.Lens' ListDatasetImportJobs (Prelude.Maybe [Filter])
listDatasetImportJobs_filters :: (Maybe [Filter] -> f (Maybe [Filter]))
-> ListDatasetImportJobs -> f ListDatasetImportJobs
listDatasetImportJobs_filters = (ListDatasetImportJobs -> Maybe [Filter])
-> (ListDatasetImportJobs
    -> Maybe [Filter] -> ListDatasetImportJobs)
-> Lens
     ListDatasetImportJobs
     ListDatasetImportJobs
     (Maybe [Filter])
     (Maybe [Filter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDatasetImportJobs' {Maybe [Filter]
filters :: Maybe [Filter]
$sel:filters:ListDatasetImportJobs' :: ListDatasetImportJobs -> Maybe [Filter]
filters} -> Maybe [Filter]
filters) (\s :: ListDatasetImportJobs
s@ListDatasetImportJobs' {} Maybe [Filter]
a -> ListDatasetImportJobs
s {$sel:filters:ListDatasetImportJobs' :: Maybe [Filter]
filters = Maybe [Filter]
a} :: ListDatasetImportJobs) ((Maybe [Filter] -> f (Maybe [Filter]))
 -> ListDatasetImportJobs -> f ListDatasetImportJobs)
-> ((Maybe [Filter] -> f (Maybe [Filter]))
    -> Maybe [Filter] -> f (Maybe [Filter]))
-> (Maybe [Filter] -> f (Maybe [Filter]))
-> ListDatasetImportJobs
-> f ListDatasetImportJobs
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Filter] [Filter] [Filter] [Filter]
-> Iso
     (Maybe [Filter]) (Maybe [Filter]) (Maybe [Filter]) (Maybe [Filter])
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 [Filter] [Filter] [Filter] [Filter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | If the result of the previous request was truncated, the response
-- includes a @NextToken@. To retrieve the next set of results, use the
-- token in the next request. Tokens expire after 24 hours.
listDatasetImportJobs_nextToken :: Lens.Lens' ListDatasetImportJobs (Prelude.Maybe Prelude.Text)
listDatasetImportJobs_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListDatasetImportJobs -> f ListDatasetImportJobs
listDatasetImportJobs_nextToken = (ListDatasetImportJobs -> Maybe Text)
-> (ListDatasetImportJobs -> Maybe Text -> ListDatasetImportJobs)
-> Lens
     ListDatasetImportJobs
     ListDatasetImportJobs
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDatasetImportJobs' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListDatasetImportJobs' :: ListDatasetImportJobs -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListDatasetImportJobs
s@ListDatasetImportJobs' {} Maybe Text
a -> ListDatasetImportJobs
s {$sel:nextToken:ListDatasetImportJobs' :: Maybe Text
nextToken = Maybe Text
a} :: ListDatasetImportJobs)

-- | The number of items to return in the response.
listDatasetImportJobs_maxResults :: Lens.Lens' ListDatasetImportJobs (Prelude.Maybe Prelude.Natural)
listDatasetImportJobs_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListDatasetImportJobs -> f ListDatasetImportJobs
listDatasetImportJobs_maxResults = (ListDatasetImportJobs -> Maybe Natural)
-> (ListDatasetImportJobs
    -> Maybe Natural -> ListDatasetImportJobs)
-> Lens
     ListDatasetImportJobs
     ListDatasetImportJobs
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDatasetImportJobs' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListDatasetImportJobs' :: ListDatasetImportJobs -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListDatasetImportJobs
s@ListDatasetImportJobs' {} Maybe Natural
a -> ListDatasetImportJobs
s {$sel:maxResults:ListDatasetImportJobs' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListDatasetImportJobs)

instance Core.AWSPager ListDatasetImportJobs where
  page :: ListDatasetImportJobs
-> AWSResponse ListDatasetImportJobs -> Maybe ListDatasetImportJobs
page ListDatasetImportJobs
rq AWSResponse ListDatasetImportJobs
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListDatasetImportJobs
ListDatasetImportJobsResponse
rs
            ListDatasetImportJobsResponse
-> Getting (First Text) ListDatasetImportJobsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListDatasetImportJobsResponse
-> Const (First Text) ListDatasetImportJobsResponse
Lens' ListDatasetImportJobsResponse (Maybe Text)
listDatasetImportJobsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListDatasetImportJobsResponse
 -> Const (First Text) ListDatasetImportJobsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListDatasetImportJobsResponse 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 ListDatasetImportJobs
forall a. Maybe a
Prelude.Nothing
    | Maybe [DatasetImportJobSummary] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListDatasetImportJobs
ListDatasetImportJobsResponse
rs
            ListDatasetImportJobsResponse
-> Getting
     (First [DatasetImportJobSummary])
     ListDatasetImportJobsResponse
     [DatasetImportJobSummary]
-> Maybe [DatasetImportJobSummary]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [DatasetImportJobSummary]
 -> Const
      (First [DatasetImportJobSummary])
      (Maybe [DatasetImportJobSummary]))
-> ListDatasetImportJobsResponse
-> Const
     (First [DatasetImportJobSummary]) ListDatasetImportJobsResponse
Lens'
  ListDatasetImportJobsResponse (Maybe [DatasetImportJobSummary])
listDatasetImportJobsResponse_datasetImportJobs
              ((Maybe [DatasetImportJobSummary]
  -> Const
       (First [DatasetImportJobSummary])
       (Maybe [DatasetImportJobSummary]))
 -> ListDatasetImportJobsResponse
 -> Const
      (First [DatasetImportJobSummary]) ListDatasetImportJobsResponse)
-> (([DatasetImportJobSummary]
     -> Const
          (First [DatasetImportJobSummary]) [DatasetImportJobSummary])
    -> Maybe [DatasetImportJobSummary]
    -> Const
         (First [DatasetImportJobSummary])
         (Maybe [DatasetImportJobSummary]))
-> Getting
     (First [DatasetImportJobSummary])
     ListDatasetImportJobsResponse
     [DatasetImportJobSummary]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([DatasetImportJobSummary]
 -> Const
      (First [DatasetImportJobSummary]) [DatasetImportJobSummary])
-> Maybe [DatasetImportJobSummary]
-> Const
     (First [DatasetImportJobSummary]) (Maybe [DatasetImportJobSummary])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListDatasetImportJobs
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListDatasetImportJobs -> Maybe ListDatasetImportJobs
forall a. a -> Maybe a
Prelude.Just (ListDatasetImportJobs -> Maybe ListDatasetImportJobs)
-> ListDatasetImportJobs -> Maybe ListDatasetImportJobs
forall a b. (a -> b) -> a -> b
Prelude.$
        ListDatasetImportJobs
rq
          ListDatasetImportJobs
-> (ListDatasetImportJobs -> ListDatasetImportJobs)
-> ListDatasetImportJobs
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListDatasetImportJobs -> Identity ListDatasetImportJobs
Lens
  ListDatasetImportJobs
  ListDatasetImportJobs
  (Maybe Text)
  (Maybe Text)
listDatasetImportJobs_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListDatasetImportJobs -> Identity ListDatasetImportJobs)
-> Maybe Text -> ListDatasetImportJobs -> ListDatasetImportJobs
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListDatasetImportJobs
ListDatasetImportJobsResponse
rs
          ListDatasetImportJobsResponse
-> Getting (First Text) ListDatasetImportJobsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListDatasetImportJobsResponse
-> Const (First Text) ListDatasetImportJobsResponse
Lens' ListDatasetImportJobsResponse (Maybe Text)
listDatasetImportJobsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListDatasetImportJobsResponse
 -> Const (First Text) ListDatasetImportJobsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListDatasetImportJobsResponse 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 ListDatasetImportJobs where
  type
    AWSResponse ListDatasetImportJobs =
      ListDatasetImportJobsResponse
  request :: ListDatasetImportJobs -> Request ListDatasetImportJobs
request = Service -> ListDatasetImportJobs -> Request ListDatasetImportJobs
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListDatasetImportJobs
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListDatasetImportJobs)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListDatasetImportJobs))
-> Logger
-> Service
-> Proxy ListDatasetImportJobs
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListDatasetImportJobs)))
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 [DatasetImportJobSummary]
-> Maybe Text -> Int -> ListDatasetImportJobsResponse
ListDatasetImportJobsResponse'
            (Maybe [DatasetImportJobSummary]
 -> Maybe Text -> Int -> ListDatasetImportJobsResponse)
-> Either String (Maybe [DatasetImportJobSummary])
-> Either
     String (Maybe Text -> Int -> ListDatasetImportJobsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object
-> Text -> Either String (Maybe (Maybe [DatasetImportJobSummary]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"DatasetImportJobs"
                            Either String (Maybe (Maybe [DatasetImportJobSummary]))
-> Maybe [DatasetImportJobSummary]
-> Either String (Maybe [DatasetImportJobSummary])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [DatasetImportJobSummary]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either String (Maybe Text -> Int -> ListDatasetImportJobsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListDatasetImportJobsResponse)
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 -> ListDatasetImportJobsResponse)
-> Either String Int -> Either String ListDatasetImportJobsResponse
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 ListDatasetImportJobs

instance Prelude.NFData ListDatasetImportJobs

instance Core.ToHeaders ListDatasetImportJobs where
  toHeaders :: ListDatasetImportJobs -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListDatasetImportJobs -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AmazonForecast.ListDatasetImportJobs" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON ListDatasetImportJobs where
  toJSON :: ListDatasetImportJobs -> Value
toJSON ListDatasetImportJobs' {Maybe Natural
Maybe [Filter]
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
filters :: Maybe [Filter]
$sel:maxResults:ListDatasetImportJobs' :: ListDatasetImportJobs -> Maybe Natural
$sel:nextToken:ListDatasetImportJobs' :: ListDatasetImportJobs -> Maybe Text
$sel:filters:ListDatasetImportJobs' :: ListDatasetImportJobs -> Maybe [Filter]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Filters" Text -> [Filter] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Filter] -> Pair) -> Maybe [Filter] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Filter]
filters,
            (Text
"NextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Text
"MaxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults
          ]
      )

instance Core.ToPath ListDatasetImportJobs where
  toPath :: ListDatasetImportJobs -> ByteString
toPath = ByteString -> ListDatasetImportJobs -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery ListDatasetImportJobs where
  toQuery :: ListDatasetImportJobs -> QueryString
toQuery = QueryString -> ListDatasetImportJobs -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newListDatasetImportJobsResponse' smart constructor.
data ListDatasetImportJobsResponse = ListDatasetImportJobsResponse'
  { -- | An array of objects that summarize each dataset import job\'s
    -- properties.
    ListDatasetImportJobsResponse -> Maybe [DatasetImportJobSummary]
datasetImportJobs :: Prelude.Maybe [DatasetImportJobSummary],
    -- | If the response is truncated, Amazon Forecast returns this token. To
    -- retrieve the next set of results, use the token in the next request.
    ListDatasetImportJobsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListDatasetImportJobsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListDatasetImportJobsResponse
-> ListDatasetImportJobsResponse -> Bool
(ListDatasetImportJobsResponse
 -> ListDatasetImportJobsResponse -> Bool)
-> (ListDatasetImportJobsResponse
    -> ListDatasetImportJobsResponse -> Bool)
-> Eq ListDatasetImportJobsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListDatasetImportJobsResponse
-> ListDatasetImportJobsResponse -> Bool
$c/= :: ListDatasetImportJobsResponse
-> ListDatasetImportJobsResponse -> Bool
== :: ListDatasetImportJobsResponse
-> ListDatasetImportJobsResponse -> Bool
$c== :: ListDatasetImportJobsResponse
-> ListDatasetImportJobsResponse -> Bool
Prelude.Eq, ReadPrec [ListDatasetImportJobsResponse]
ReadPrec ListDatasetImportJobsResponse
Int -> ReadS ListDatasetImportJobsResponse
ReadS [ListDatasetImportJobsResponse]
(Int -> ReadS ListDatasetImportJobsResponse)
-> ReadS [ListDatasetImportJobsResponse]
-> ReadPrec ListDatasetImportJobsResponse
-> ReadPrec [ListDatasetImportJobsResponse]
-> Read ListDatasetImportJobsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListDatasetImportJobsResponse]
$creadListPrec :: ReadPrec [ListDatasetImportJobsResponse]
readPrec :: ReadPrec ListDatasetImportJobsResponse
$creadPrec :: ReadPrec ListDatasetImportJobsResponse
readList :: ReadS [ListDatasetImportJobsResponse]
$creadList :: ReadS [ListDatasetImportJobsResponse]
readsPrec :: Int -> ReadS ListDatasetImportJobsResponse
$creadsPrec :: Int -> ReadS ListDatasetImportJobsResponse
Prelude.Read, Int -> ListDatasetImportJobsResponse -> ShowS
[ListDatasetImportJobsResponse] -> ShowS
ListDatasetImportJobsResponse -> String
(Int -> ListDatasetImportJobsResponse -> ShowS)
-> (ListDatasetImportJobsResponse -> String)
-> ([ListDatasetImportJobsResponse] -> ShowS)
-> Show ListDatasetImportJobsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListDatasetImportJobsResponse] -> ShowS
$cshowList :: [ListDatasetImportJobsResponse] -> ShowS
show :: ListDatasetImportJobsResponse -> String
$cshow :: ListDatasetImportJobsResponse -> String
showsPrec :: Int -> ListDatasetImportJobsResponse -> ShowS
$cshowsPrec :: Int -> ListDatasetImportJobsResponse -> ShowS
Prelude.Show, (forall x.
 ListDatasetImportJobsResponse
 -> Rep ListDatasetImportJobsResponse x)
-> (forall x.
    Rep ListDatasetImportJobsResponse x
    -> ListDatasetImportJobsResponse)
-> Generic ListDatasetImportJobsResponse
forall x.
Rep ListDatasetImportJobsResponse x
-> ListDatasetImportJobsResponse
forall x.
ListDatasetImportJobsResponse
-> Rep ListDatasetImportJobsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListDatasetImportJobsResponse x
-> ListDatasetImportJobsResponse
$cfrom :: forall x.
ListDatasetImportJobsResponse
-> Rep ListDatasetImportJobsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListDatasetImportJobsResponse' 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:
--
-- 'datasetImportJobs', 'listDatasetImportJobsResponse_datasetImportJobs' - An array of objects that summarize each dataset import job\'s
-- properties.
--
-- 'nextToken', 'listDatasetImportJobsResponse_nextToken' - If the response is truncated, Amazon Forecast returns this token. To
-- retrieve the next set of results, use the token in the next request.
--
-- 'httpStatus', 'listDatasetImportJobsResponse_httpStatus' - The response's http status code.
newListDatasetImportJobsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListDatasetImportJobsResponse
newListDatasetImportJobsResponse :: Int -> ListDatasetImportJobsResponse
newListDatasetImportJobsResponse Int
pHttpStatus_ =
  ListDatasetImportJobsResponse' :: Maybe [DatasetImportJobSummary]
-> Maybe Text -> Int -> ListDatasetImportJobsResponse
ListDatasetImportJobsResponse'
    { $sel:datasetImportJobs:ListDatasetImportJobsResponse' :: Maybe [DatasetImportJobSummary]
datasetImportJobs =
        Maybe [DatasetImportJobSummary]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListDatasetImportJobsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListDatasetImportJobsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | An array of objects that summarize each dataset import job\'s
-- properties.
listDatasetImportJobsResponse_datasetImportJobs :: Lens.Lens' ListDatasetImportJobsResponse (Prelude.Maybe [DatasetImportJobSummary])
listDatasetImportJobsResponse_datasetImportJobs :: (Maybe [DatasetImportJobSummary]
 -> f (Maybe [DatasetImportJobSummary]))
-> ListDatasetImportJobsResponse -> f ListDatasetImportJobsResponse
listDatasetImportJobsResponse_datasetImportJobs = (ListDatasetImportJobsResponse -> Maybe [DatasetImportJobSummary])
-> (ListDatasetImportJobsResponse
    -> Maybe [DatasetImportJobSummary]
    -> ListDatasetImportJobsResponse)
-> Lens'
     ListDatasetImportJobsResponse (Maybe [DatasetImportJobSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDatasetImportJobsResponse' {Maybe [DatasetImportJobSummary]
datasetImportJobs :: Maybe [DatasetImportJobSummary]
$sel:datasetImportJobs:ListDatasetImportJobsResponse' :: ListDatasetImportJobsResponse -> Maybe [DatasetImportJobSummary]
datasetImportJobs} -> Maybe [DatasetImportJobSummary]
datasetImportJobs) (\s :: ListDatasetImportJobsResponse
s@ListDatasetImportJobsResponse' {} Maybe [DatasetImportJobSummary]
a -> ListDatasetImportJobsResponse
s {$sel:datasetImportJobs:ListDatasetImportJobsResponse' :: Maybe [DatasetImportJobSummary]
datasetImportJobs = Maybe [DatasetImportJobSummary]
a} :: ListDatasetImportJobsResponse) ((Maybe [DatasetImportJobSummary]
  -> f (Maybe [DatasetImportJobSummary]))
 -> ListDatasetImportJobsResponse
 -> f ListDatasetImportJobsResponse)
-> ((Maybe [DatasetImportJobSummary]
     -> f (Maybe [DatasetImportJobSummary]))
    -> Maybe [DatasetImportJobSummary]
    -> f (Maybe [DatasetImportJobSummary]))
-> (Maybe [DatasetImportJobSummary]
    -> f (Maybe [DatasetImportJobSummary]))
-> ListDatasetImportJobsResponse
-> f ListDatasetImportJobsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [DatasetImportJobSummary]
  [DatasetImportJobSummary]
  [DatasetImportJobSummary]
  [DatasetImportJobSummary]
-> Iso
     (Maybe [DatasetImportJobSummary])
     (Maybe [DatasetImportJobSummary])
     (Maybe [DatasetImportJobSummary])
     (Maybe [DatasetImportJobSummary])
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
  [DatasetImportJobSummary]
  [DatasetImportJobSummary]
  [DatasetImportJobSummary]
  [DatasetImportJobSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | If the response is truncated, Amazon Forecast returns this token. To
-- retrieve the next set of results, use the token in the next request.
listDatasetImportJobsResponse_nextToken :: Lens.Lens' ListDatasetImportJobsResponse (Prelude.Maybe Prelude.Text)
listDatasetImportJobsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListDatasetImportJobsResponse -> f ListDatasetImportJobsResponse
listDatasetImportJobsResponse_nextToken = (ListDatasetImportJobsResponse -> Maybe Text)
-> (ListDatasetImportJobsResponse
    -> Maybe Text -> ListDatasetImportJobsResponse)
-> Lens' ListDatasetImportJobsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDatasetImportJobsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListDatasetImportJobsResponse' :: ListDatasetImportJobsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListDatasetImportJobsResponse
s@ListDatasetImportJobsResponse' {} Maybe Text
a -> ListDatasetImportJobsResponse
s {$sel:nextToken:ListDatasetImportJobsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListDatasetImportJobsResponse)

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

instance Prelude.NFData ListDatasetImportJobsResponse