{-# 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.ListForecasts
-- 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 forecasts created using the CreateForecast operation.
-- For each forecast, this operation returns a summary of its properties,
-- including its Amazon Resource Name (ARN). To retrieve the complete set
-- of properties, specify the ARN with the DescribeForecast operation. You
-- can filter the list using an array of Filter objects.
--
-- This operation returns paginated results.
module Amazonka.Forecast.ListForecasts
  ( -- * Creating a Request
    ListForecasts (..),
    newListForecasts,

    -- * Request Lenses
    listForecasts_filters,
    listForecasts_nextToken,
    listForecasts_maxResults,

    -- * Destructuring the Response
    ListForecastsResponse (..),
    newListForecastsResponse,

    -- * Response Lenses
    listForecastsResponse_forecasts,
    listForecastsResponse_nextToken,
    listForecastsResponse_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:/ 'newListForecasts' smart constructor.
data ListForecasts = ListForecasts'
  { -- | 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 forecasts 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 forecasts that match the statement, specify
    --     @IS@. To exclude matching forecasts, specify @IS_NOT@.
    --
    -- -   @Key@ - The name of the parameter to filter on. Valid values are
    --     @DatasetGroupArn@, @PredictorArn@, and @Status@.
    --
    -- -   @Value@ - The value to match.
    --
    -- For example, to list all forecasts whose status is not ACTIVE, you would
    -- specify:
    --
    -- @\"Filters\": [ { \"Condition\": \"IS_NOT\", \"Key\": \"Status\", \"Value\": \"ACTIVE\" } ]@
    ListForecasts -> 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.
    ListForecasts -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The number of items to return in the response.
    ListForecasts -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListForecasts -> ListForecasts -> Bool
(ListForecasts -> ListForecasts -> Bool)
-> (ListForecasts -> ListForecasts -> Bool) -> Eq ListForecasts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListForecasts -> ListForecasts -> Bool
$c/= :: ListForecasts -> ListForecasts -> Bool
== :: ListForecasts -> ListForecasts -> Bool
$c== :: ListForecasts -> ListForecasts -> Bool
Prelude.Eq, ReadPrec [ListForecasts]
ReadPrec ListForecasts
Int -> ReadS ListForecasts
ReadS [ListForecasts]
(Int -> ReadS ListForecasts)
-> ReadS [ListForecasts]
-> ReadPrec ListForecasts
-> ReadPrec [ListForecasts]
-> Read ListForecasts
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListForecasts]
$creadListPrec :: ReadPrec [ListForecasts]
readPrec :: ReadPrec ListForecasts
$creadPrec :: ReadPrec ListForecasts
readList :: ReadS [ListForecasts]
$creadList :: ReadS [ListForecasts]
readsPrec :: Int -> ReadS ListForecasts
$creadsPrec :: Int -> ReadS ListForecasts
Prelude.Read, Int -> ListForecasts -> ShowS
[ListForecasts] -> ShowS
ListForecasts -> String
(Int -> ListForecasts -> ShowS)
-> (ListForecasts -> String)
-> ([ListForecasts] -> ShowS)
-> Show ListForecasts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListForecasts] -> ShowS
$cshowList :: [ListForecasts] -> ShowS
show :: ListForecasts -> String
$cshow :: ListForecasts -> String
showsPrec :: Int -> ListForecasts -> ShowS
$cshowsPrec :: Int -> ListForecasts -> ShowS
Prelude.Show, (forall x. ListForecasts -> Rep ListForecasts x)
-> (forall x. Rep ListForecasts x -> ListForecasts)
-> Generic ListForecasts
forall x. Rep ListForecasts x -> ListForecasts
forall x. ListForecasts -> Rep ListForecasts x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListForecasts x -> ListForecasts
$cfrom :: forall x. ListForecasts -> Rep ListForecasts x
Prelude.Generic)

-- |
-- Create a value of 'ListForecasts' 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', 'listForecasts_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 forecasts 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 forecasts that match the statement, specify
--     @IS@. To exclude matching forecasts, specify @IS_NOT@.
--
-- -   @Key@ - The name of the parameter to filter on. Valid values are
--     @DatasetGroupArn@, @PredictorArn@, and @Status@.
--
-- -   @Value@ - The value to match.
--
-- For example, to list all forecasts whose status is not ACTIVE, you would
-- specify:
--
-- @\"Filters\": [ { \"Condition\": \"IS_NOT\", \"Key\": \"Status\", \"Value\": \"ACTIVE\" } ]@
--
-- 'nextToken', 'listForecasts_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', 'listForecasts_maxResults' - The number of items to return in the response.
newListForecasts ::
  ListForecasts
newListForecasts :: ListForecasts
newListForecasts =
  ListForecasts' :: Maybe [Filter] -> Maybe Text -> Maybe Natural -> ListForecasts
ListForecasts'
    { $sel:filters:ListForecasts' :: Maybe [Filter]
filters = Maybe [Filter]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListForecasts' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListForecasts' :: 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 forecasts 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 forecasts that match the statement, specify
--     @IS@. To exclude matching forecasts, specify @IS_NOT@.
--
-- -   @Key@ - The name of the parameter to filter on. Valid values are
--     @DatasetGroupArn@, @PredictorArn@, and @Status@.
--
-- -   @Value@ - The value to match.
--
-- For example, to list all forecasts whose status is not ACTIVE, you would
-- specify:
--
-- @\"Filters\": [ { \"Condition\": \"IS_NOT\", \"Key\": \"Status\", \"Value\": \"ACTIVE\" } ]@
listForecasts_filters :: Lens.Lens' ListForecasts (Prelude.Maybe [Filter])
listForecasts_filters :: (Maybe [Filter] -> f (Maybe [Filter]))
-> ListForecasts -> f ListForecasts
listForecasts_filters = (ListForecasts -> Maybe [Filter])
-> (ListForecasts -> Maybe [Filter] -> ListForecasts)
-> Lens
     ListForecasts ListForecasts (Maybe [Filter]) (Maybe [Filter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListForecasts' {Maybe [Filter]
filters :: Maybe [Filter]
$sel:filters:ListForecasts' :: ListForecasts -> Maybe [Filter]
filters} -> Maybe [Filter]
filters) (\s :: ListForecasts
s@ListForecasts' {} Maybe [Filter]
a -> ListForecasts
s {$sel:filters:ListForecasts' :: Maybe [Filter]
filters = Maybe [Filter]
a} :: ListForecasts) ((Maybe [Filter] -> f (Maybe [Filter]))
 -> ListForecasts -> f ListForecasts)
-> ((Maybe [Filter] -> f (Maybe [Filter]))
    -> Maybe [Filter] -> f (Maybe [Filter]))
-> (Maybe [Filter] -> f (Maybe [Filter]))
-> ListForecasts
-> f ListForecasts
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.
listForecasts_nextToken :: Lens.Lens' ListForecasts (Prelude.Maybe Prelude.Text)
listForecasts_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListForecasts -> f ListForecasts
listForecasts_nextToken = (ListForecasts -> Maybe Text)
-> (ListForecasts -> Maybe Text -> ListForecasts)
-> Lens ListForecasts ListForecasts (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListForecasts' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListForecasts' :: ListForecasts -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListForecasts
s@ListForecasts' {} Maybe Text
a -> ListForecasts
s {$sel:nextToken:ListForecasts' :: Maybe Text
nextToken = Maybe Text
a} :: ListForecasts)

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

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

instance Prelude.NFData ListForecasts

instance Core.ToHeaders ListForecasts where
  toHeaders :: ListForecasts -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListForecasts -> 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.ListForecasts" ::
                          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 ListForecasts where
  toJSON :: ListForecasts -> Value
toJSON ListForecasts' {Maybe Natural
Maybe [Filter]
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
filters :: Maybe [Filter]
$sel:maxResults:ListForecasts' :: ListForecasts -> Maybe Natural
$sel:nextToken:ListForecasts' :: ListForecasts -> Maybe Text
$sel:filters:ListForecasts' :: ListForecasts -> 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 ListForecasts where
  toPath :: ListForecasts -> ByteString
toPath = ByteString -> ListForecasts -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

-- |
-- Create a value of 'ListForecastsResponse' 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:
--
-- 'forecasts', 'listForecastsResponse_forecasts' - An array of objects that summarize each forecast\'s properties.
--
-- 'nextToken', 'listForecastsResponse_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', 'listForecastsResponse_httpStatus' - The response's http status code.
newListForecastsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListForecastsResponse
newListForecastsResponse :: Int -> ListForecastsResponse
newListForecastsResponse Int
pHttpStatus_ =
  ListForecastsResponse' :: Maybe [ForecastSummary]
-> Maybe Text -> Int -> ListForecastsResponse
ListForecastsResponse'
    { $sel:forecasts:ListForecastsResponse' :: Maybe [ForecastSummary]
forecasts = Maybe [ForecastSummary]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListForecastsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListForecastsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | An array of objects that summarize each forecast\'s properties.
listForecastsResponse_forecasts :: Lens.Lens' ListForecastsResponse (Prelude.Maybe [ForecastSummary])
listForecastsResponse_forecasts :: (Maybe [ForecastSummary] -> f (Maybe [ForecastSummary]))
-> ListForecastsResponse -> f ListForecastsResponse
listForecastsResponse_forecasts = (ListForecastsResponse -> Maybe [ForecastSummary])
-> (ListForecastsResponse
    -> Maybe [ForecastSummary] -> ListForecastsResponse)
-> Lens' ListForecastsResponse (Maybe [ForecastSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListForecastsResponse' {Maybe [ForecastSummary]
forecasts :: Maybe [ForecastSummary]
$sel:forecasts:ListForecastsResponse' :: ListForecastsResponse -> Maybe [ForecastSummary]
forecasts} -> Maybe [ForecastSummary]
forecasts) (\s :: ListForecastsResponse
s@ListForecastsResponse' {} Maybe [ForecastSummary]
a -> ListForecastsResponse
s {$sel:forecasts:ListForecastsResponse' :: Maybe [ForecastSummary]
forecasts = Maybe [ForecastSummary]
a} :: ListForecastsResponse) ((Maybe [ForecastSummary] -> f (Maybe [ForecastSummary]))
 -> ListForecastsResponse -> f ListForecastsResponse)
-> ((Maybe [ForecastSummary] -> f (Maybe [ForecastSummary]))
    -> Maybe [ForecastSummary] -> f (Maybe [ForecastSummary]))
-> (Maybe [ForecastSummary] -> f (Maybe [ForecastSummary]))
-> ListForecastsResponse
-> f ListForecastsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ForecastSummary]
  [ForecastSummary]
  [ForecastSummary]
  [ForecastSummary]
-> Iso
     (Maybe [ForecastSummary])
     (Maybe [ForecastSummary])
     (Maybe [ForecastSummary])
     (Maybe [ForecastSummary])
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
  [ForecastSummary]
  [ForecastSummary]
  [ForecastSummary]
  [ForecastSummary]
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.
listForecastsResponse_nextToken :: Lens.Lens' ListForecastsResponse (Prelude.Maybe Prelude.Text)
listForecastsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListForecastsResponse -> f ListForecastsResponse
listForecastsResponse_nextToken = (ListForecastsResponse -> Maybe Text)
-> (ListForecastsResponse -> Maybe Text -> ListForecastsResponse)
-> Lens' ListForecastsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListForecastsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListForecastsResponse' :: ListForecastsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListForecastsResponse
s@ListForecastsResponse' {} Maybe Text
a -> ListForecastsResponse
s {$sel:nextToken:ListForecastsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListForecastsResponse)

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

instance Prelude.NFData ListForecastsResponse