{-# 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.ForecastQuery.QueryForecast
-- 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)
--
-- Retrieves a forecast for a single item, filtered by the supplied
-- criteria.
--
-- The criteria is a key-value pair. The key is either @item_id@ (or the
-- equivalent non-timestamp, non-target field) from the
-- @TARGET_TIME_SERIES@ dataset, or one of the forecast dimensions
-- specified as part of the @FeaturizationConfig@ object.
--
-- By default, @QueryForecast@ returns the complete date range for the
-- filtered forecast. You can request a specific date range.
--
-- To get the full forecast, use the
-- <https://docs.aws.amazon.com/en_us/forecast/latest/dg/API_CreateForecastExportJob.html CreateForecastExportJob>
-- operation.
--
-- The forecasts generated by Amazon Forecast are in the same timezone as
-- the dataset that was used to create the predictor.
module Amazonka.ForecastQuery.QueryForecast
  ( -- * Creating a Request
    QueryForecast (..),
    newQueryForecast,

    -- * Request Lenses
    queryForecast_endDate,
    queryForecast_startDate,
    queryForecast_nextToken,
    queryForecast_forecastArn,
    queryForecast_filters,

    -- * Destructuring the Response
    QueryForecastResponse (..),
    newQueryForecastResponse,

    -- * Response Lenses
    queryForecastResponse_forecast,
    queryForecastResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.ForecastQuery.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:/ 'newQueryForecast' smart constructor.
data QueryForecast = QueryForecast'
  { -- | The end date for the forecast. Specify the date using this format:
    -- yyyy-MM-dd\'T\'HH:mm:ss (ISO 8601 format). For example,
    -- 2015-01-01T20:00:00.
    QueryForecast -> Maybe Text
endDate :: Prelude.Maybe Prelude.Text,
    -- | The start date for the forecast. Specify the date using this format:
    -- yyyy-MM-dd\'T\'HH:mm:ss (ISO 8601 format). For example,
    -- 2015-01-01T08:00:00.
    QueryForecast -> Maybe Text
startDate :: Prelude.Maybe Prelude.Text,
    -- | 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.
    QueryForecast -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the forecast to query.
    QueryForecast -> Text
forecastArn :: Prelude.Text,
    -- | The filtering criteria to apply when retrieving the forecast. For
    -- example, to get the forecast for @client_21@ in the electricity usage
    -- dataset, specify the following:
    --
    -- @{\"item_id\" : \"client_21\"}@
    --
    -- To get the full forecast, use the
    -- <https://docs.aws.amazon.com/en_us/forecast/latest/dg/API_CreateForecastExportJob.html CreateForecastExportJob>
    -- operation.
    QueryForecast -> HashMap Text Text
filters :: Prelude.HashMap Prelude.Text Prelude.Text
  }
  deriving (QueryForecast -> QueryForecast -> Bool
(QueryForecast -> QueryForecast -> Bool)
-> (QueryForecast -> QueryForecast -> Bool) -> Eq QueryForecast
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: QueryForecast -> QueryForecast -> Bool
$c/= :: QueryForecast -> QueryForecast -> Bool
== :: QueryForecast -> QueryForecast -> Bool
$c== :: QueryForecast -> QueryForecast -> Bool
Prelude.Eq, ReadPrec [QueryForecast]
ReadPrec QueryForecast
Int -> ReadS QueryForecast
ReadS [QueryForecast]
(Int -> ReadS QueryForecast)
-> ReadS [QueryForecast]
-> ReadPrec QueryForecast
-> ReadPrec [QueryForecast]
-> Read QueryForecast
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [QueryForecast]
$creadListPrec :: ReadPrec [QueryForecast]
readPrec :: ReadPrec QueryForecast
$creadPrec :: ReadPrec QueryForecast
readList :: ReadS [QueryForecast]
$creadList :: ReadS [QueryForecast]
readsPrec :: Int -> ReadS QueryForecast
$creadsPrec :: Int -> ReadS QueryForecast
Prelude.Read, Int -> QueryForecast -> ShowS
[QueryForecast] -> ShowS
QueryForecast -> String
(Int -> QueryForecast -> ShowS)
-> (QueryForecast -> String)
-> ([QueryForecast] -> ShowS)
-> Show QueryForecast
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [QueryForecast] -> ShowS
$cshowList :: [QueryForecast] -> ShowS
show :: QueryForecast -> String
$cshow :: QueryForecast -> String
showsPrec :: Int -> QueryForecast -> ShowS
$cshowsPrec :: Int -> QueryForecast -> ShowS
Prelude.Show, (forall x. QueryForecast -> Rep QueryForecast x)
-> (forall x. Rep QueryForecast x -> QueryForecast)
-> Generic QueryForecast
forall x. Rep QueryForecast x -> QueryForecast
forall x. QueryForecast -> Rep QueryForecast x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep QueryForecast x -> QueryForecast
$cfrom :: forall x. QueryForecast -> Rep QueryForecast x
Prelude.Generic)

-- |
-- Create a value of 'QueryForecast' 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:
--
-- 'endDate', 'queryForecast_endDate' - The end date for the forecast. Specify the date using this format:
-- yyyy-MM-dd\'T\'HH:mm:ss (ISO 8601 format). For example,
-- 2015-01-01T20:00:00.
--
-- 'startDate', 'queryForecast_startDate' - The start date for the forecast. Specify the date using this format:
-- yyyy-MM-dd\'T\'HH:mm:ss (ISO 8601 format). For example,
-- 2015-01-01T08:00:00.
--
-- 'nextToken', 'queryForecast_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.
--
-- 'forecastArn', 'queryForecast_forecastArn' - The Amazon Resource Name (ARN) of the forecast to query.
--
-- 'filters', 'queryForecast_filters' - The filtering criteria to apply when retrieving the forecast. For
-- example, to get the forecast for @client_21@ in the electricity usage
-- dataset, specify the following:
--
-- @{\"item_id\" : \"client_21\"}@
--
-- To get the full forecast, use the
-- <https://docs.aws.amazon.com/en_us/forecast/latest/dg/API_CreateForecastExportJob.html CreateForecastExportJob>
-- operation.
newQueryForecast ::
  -- | 'forecastArn'
  Prelude.Text ->
  QueryForecast
newQueryForecast :: Text -> QueryForecast
newQueryForecast Text
pForecastArn_ =
  QueryForecast' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Text
-> HashMap Text Text
-> QueryForecast
QueryForecast'
    { $sel:endDate:QueryForecast' :: Maybe Text
endDate = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:startDate:QueryForecast' :: Maybe Text
startDate = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:QueryForecast' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:forecastArn:QueryForecast' :: Text
forecastArn = Text
pForecastArn_,
      $sel:filters:QueryForecast' :: HashMap Text Text
filters = HashMap Text Text
forall a. Monoid a => a
Prelude.mempty
    }

-- | The end date for the forecast. Specify the date using this format:
-- yyyy-MM-dd\'T\'HH:mm:ss (ISO 8601 format). For example,
-- 2015-01-01T20:00:00.
queryForecast_endDate :: Lens.Lens' QueryForecast (Prelude.Maybe Prelude.Text)
queryForecast_endDate :: (Maybe Text -> f (Maybe Text)) -> QueryForecast -> f QueryForecast
queryForecast_endDate = (QueryForecast -> Maybe Text)
-> (QueryForecast -> Maybe Text -> QueryForecast)
-> Lens QueryForecast QueryForecast (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryForecast' {Maybe Text
endDate :: Maybe Text
$sel:endDate:QueryForecast' :: QueryForecast -> Maybe Text
endDate} -> Maybe Text
endDate) (\s :: QueryForecast
s@QueryForecast' {} Maybe Text
a -> QueryForecast
s {$sel:endDate:QueryForecast' :: Maybe Text
endDate = Maybe Text
a} :: QueryForecast)

-- | The start date for the forecast. Specify the date using this format:
-- yyyy-MM-dd\'T\'HH:mm:ss (ISO 8601 format). For example,
-- 2015-01-01T08:00:00.
queryForecast_startDate :: Lens.Lens' QueryForecast (Prelude.Maybe Prelude.Text)
queryForecast_startDate :: (Maybe Text -> f (Maybe Text)) -> QueryForecast -> f QueryForecast
queryForecast_startDate = (QueryForecast -> Maybe Text)
-> (QueryForecast -> Maybe Text -> QueryForecast)
-> Lens QueryForecast QueryForecast (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryForecast' {Maybe Text
startDate :: Maybe Text
$sel:startDate:QueryForecast' :: QueryForecast -> Maybe Text
startDate} -> Maybe Text
startDate) (\s :: QueryForecast
s@QueryForecast' {} Maybe Text
a -> QueryForecast
s {$sel:startDate:QueryForecast' :: Maybe Text
startDate = Maybe Text
a} :: QueryForecast)

-- | 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.
queryForecast_nextToken :: Lens.Lens' QueryForecast (Prelude.Maybe Prelude.Text)
queryForecast_nextToken :: (Maybe Text -> f (Maybe Text)) -> QueryForecast -> f QueryForecast
queryForecast_nextToken = (QueryForecast -> Maybe Text)
-> (QueryForecast -> Maybe Text -> QueryForecast)
-> Lens QueryForecast QueryForecast (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryForecast' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:QueryForecast' :: QueryForecast -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: QueryForecast
s@QueryForecast' {} Maybe Text
a -> QueryForecast
s {$sel:nextToken:QueryForecast' :: Maybe Text
nextToken = Maybe Text
a} :: QueryForecast)

-- | The Amazon Resource Name (ARN) of the forecast to query.
queryForecast_forecastArn :: Lens.Lens' QueryForecast Prelude.Text
queryForecast_forecastArn :: (Text -> f Text) -> QueryForecast -> f QueryForecast
queryForecast_forecastArn = (QueryForecast -> Text)
-> (QueryForecast -> Text -> QueryForecast)
-> Lens QueryForecast QueryForecast Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryForecast' {Text
forecastArn :: Text
$sel:forecastArn:QueryForecast' :: QueryForecast -> Text
forecastArn} -> Text
forecastArn) (\s :: QueryForecast
s@QueryForecast' {} Text
a -> QueryForecast
s {$sel:forecastArn:QueryForecast' :: Text
forecastArn = Text
a} :: QueryForecast)

-- | The filtering criteria to apply when retrieving the forecast. For
-- example, to get the forecast for @client_21@ in the electricity usage
-- dataset, specify the following:
--
-- @{\"item_id\" : \"client_21\"}@
--
-- To get the full forecast, use the
-- <https://docs.aws.amazon.com/en_us/forecast/latest/dg/API_CreateForecastExportJob.html CreateForecastExportJob>
-- operation.
queryForecast_filters :: Lens.Lens' QueryForecast (Prelude.HashMap Prelude.Text Prelude.Text)
queryForecast_filters :: (HashMap Text Text -> f (HashMap Text Text))
-> QueryForecast -> f QueryForecast
queryForecast_filters = (QueryForecast -> HashMap Text Text)
-> (QueryForecast -> HashMap Text Text -> QueryForecast)
-> Lens
     QueryForecast QueryForecast (HashMap Text Text) (HashMap Text Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryForecast' {HashMap Text Text
filters :: HashMap Text Text
$sel:filters:QueryForecast' :: QueryForecast -> HashMap Text Text
filters} -> HashMap Text Text
filters) (\s :: QueryForecast
s@QueryForecast' {} HashMap Text Text
a -> QueryForecast
s {$sel:filters:QueryForecast' :: HashMap Text Text
filters = HashMap Text Text
a} :: QueryForecast) ((HashMap Text Text -> f (HashMap Text Text))
 -> QueryForecast -> f QueryForecast)
-> ((HashMap Text Text -> f (HashMap Text Text))
    -> HashMap Text Text -> f (HashMap Text Text))
-> (HashMap Text Text -> f (HashMap Text Text))
-> QueryForecast
-> f QueryForecast
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (HashMap Text Text -> f (HashMap Text Text))
-> HashMap Text Text -> f (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSRequest QueryForecast where
  type
    AWSResponse QueryForecast =
      QueryForecastResponse
  request :: QueryForecast -> Request QueryForecast
request = Service -> QueryForecast -> Request QueryForecast
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy QueryForecast
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse QueryForecast)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse QueryForecast))
-> Logger
-> Service
-> Proxy QueryForecast
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse QueryForecast)))
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 Forecast -> Int -> QueryForecastResponse
QueryForecastResponse'
            (Maybe Forecast -> Int -> QueryForecastResponse)
-> Either String (Maybe Forecast)
-> Either String (Int -> QueryForecastResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Forecast)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Forecast")
            Either String (Int -> QueryForecastResponse)
-> Either String Int -> Either String QueryForecastResponse
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 QueryForecast

instance Prelude.NFData QueryForecast

instance Core.ToHeaders QueryForecast where
  toHeaders :: QueryForecast -> ResponseHeaders
toHeaders =
    ResponseHeaders -> QueryForecast -> 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
"AmazonForecastRuntime.QueryForecast" ::
                          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 QueryForecast where
  toJSON :: QueryForecast -> Value
toJSON QueryForecast' {Maybe Text
Text
HashMap Text Text
filters :: HashMap Text Text
forecastArn :: Text
nextToken :: Maybe Text
startDate :: Maybe Text
endDate :: Maybe Text
$sel:filters:QueryForecast' :: QueryForecast -> HashMap Text Text
$sel:forecastArn:QueryForecast' :: QueryForecast -> Text
$sel:nextToken:QueryForecast' :: QueryForecast -> Maybe Text
$sel:startDate:QueryForecast' :: QueryForecast -> Maybe Text
$sel:endDate:QueryForecast' :: QueryForecast -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"EndDate" 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
endDate,
            (Text
"StartDate" 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
startDate,
            (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,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ForecastArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
forecastArn),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Filters" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= HashMap Text Text
filters)
          ]
      )

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

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

-- | /See:/ 'newQueryForecastResponse' smart constructor.
data QueryForecastResponse = QueryForecastResponse'
  { -- | The forecast.
    QueryForecastResponse -> Maybe Forecast
forecast :: Prelude.Maybe Forecast,
    -- | The response's http status code.
    QueryForecastResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (QueryForecastResponse -> QueryForecastResponse -> Bool
(QueryForecastResponse -> QueryForecastResponse -> Bool)
-> (QueryForecastResponse -> QueryForecastResponse -> Bool)
-> Eq QueryForecastResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: QueryForecastResponse -> QueryForecastResponse -> Bool
$c/= :: QueryForecastResponse -> QueryForecastResponse -> Bool
== :: QueryForecastResponse -> QueryForecastResponse -> Bool
$c== :: QueryForecastResponse -> QueryForecastResponse -> Bool
Prelude.Eq, ReadPrec [QueryForecastResponse]
ReadPrec QueryForecastResponse
Int -> ReadS QueryForecastResponse
ReadS [QueryForecastResponse]
(Int -> ReadS QueryForecastResponse)
-> ReadS [QueryForecastResponse]
-> ReadPrec QueryForecastResponse
-> ReadPrec [QueryForecastResponse]
-> Read QueryForecastResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [QueryForecastResponse]
$creadListPrec :: ReadPrec [QueryForecastResponse]
readPrec :: ReadPrec QueryForecastResponse
$creadPrec :: ReadPrec QueryForecastResponse
readList :: ReadS [QueryForecastResponse]
$creadList :: ReadS [QueryForecastResponse]
readsPrec :: Int -> ReadS QueryForecastResponse
$creadsPrec :: Int -> ReadS QueryForecastResponse
Prelude.Read, Int -> QueryForecastResponse -> ShowS
[QueryForecastResponse] -> ShowS
QueryForecastResponse -> String
(Int -> QueryForecastResponse -> ShowS)
-> (QueryForecastResponse -> String)
-> ([QueryForecastResponse] -> ShowS)
-> Show QueryForecastResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [QueryForecastResponse] -> ShowS
$cshowList :: [QueryForecastResponse] -> ShowS
show :: QueryForecastResponse -> String
$cshow :: QueryForecastResponse -> String
showsPrec :: Int -> QueryForecastResponse -> ShowS
$cshowsPrec :: Int -> QueryForecastResponse -> ShowS
Prelude.Show, (forall x. QueryForecastResponse -> Rep QueryForecastResponse x)
-> (forall x. Rep QueryForecastResponse x -> QueryForecastResponse)
-> Generic QueryForecastResponse
forall x. Rep QueryForecastResponse x -> QueryForecastResponse
forall x. QueryForecastResponse -> Rep QueryForecastResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep QueryForecastResponse x -> QueryForecastResponse
$cfrom :: forall x. QueryForecastResponse -> Rep QueryForecastResponse x
Prelude.Generic)

-- |
-- Create a value of 'QueryForecastResponse' 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:
--
-- 'forecast', 'queryForecastResponse_forecast' - The forecast.
--
-- 'httpStatus', 'queryForecastResponse_httpStatus' - The response's http status code.
newQueryForecastResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  QueryForecastResponse
newQueryForecastResponse :: Int -> QueryForecastResponse
newQueryForecastResponse Int
pHttpStatus_ =
  QueryForecastResponse' :: Maybe Forecast -> Int -> QueryForecastResponse
QueryForecastResponse'
    { $sel:forecast:QueryForecastResponse' :: Maybe Forecast
forecast = Maybe Forecast
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:QueryForecastResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The forecast.
queryForecastResponse_forecast :: Lens.Lens' QueryForecastResponse (Prelude.Maybe Forecast)
queryForecastResponse_forecast :: (Maybe Forecast -> f (Maybe Forecast))
-> QueryForecastResponse -> f QueryForecastResponse
queryForecastResponse_forecast = (QueryForecastResponse -> Maybe Forecast)
-> (QueryForecastResponse
    -> Maybe Forecast -> QueryForecastResponse)
-> Lens
     QueryForecastResponse
     QueryForecastResponse
     (Maybe Forecast)
     (Maybe Forecast)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryForecastResponse' {Maybe Forecast
forecast :: Maybe Forecast
$sel:forecast:QueryForecastResponse' :: QueryForecastResponse -> Maybe Forecast
forecast} -> Maybe Forecast
forecast) (\s :: QueryForecastResponse
s@QueryForecastResponse' {} Maybe Forecast
a -> QueryForecastResponse
s {$sel:forecast:QueryForecastResponse' :: Maybe Forecast
forecast = Maybe Forecast
a} :: QueryForecastResponse)

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

instance Prelude.NFData QueryForecastResponse