{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.ForecastQuery.QueryWhatIfForecast
(
QueryWhatIfForecast (..),
newQueryWhatIfForecast,
queryWhatIfForecast_endDate,
queryWhatIfForecast_nextToken,
queryWhatIfForecast_startDate,
queryWhatIfForecast_whatIfForecastArn,
queryWhatIfForecast_filters,
QueryWhatIfForecastResponse (..),
newQueryWhatIfForecastResponse,
queryWhatIfForecastResponse_forecast,
queryWhatIfForecastResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ForecastQuery.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data QueryWhatIfForecast = QueryWhatIfForecast'
{
QueryWhatIfForecast -> Maybe Text
endDate :: Prelude.Maybe Prelude.Text,
QueryWhatIfForecast -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
QueryWhatIfForecast -> Maybe Text
startDate :: Prelude.Maybe Prelude.Text,
QueryWhatIfForecast -> Text
whatIfForecastArn :: Prelude.Text,
QueryWhatIfForecast -> HashMap Text Text
filters :: Prelude.HashMap Prelude.Text Prelude.Text
}
deriving (QueryWhatIfForecast -> QueryWhatIfForecast -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: QueryWhatIfForecast -> QueryWhatIfForecast -> Bool
$c/= :: QueryWhatIfForecast -> QueryWhatIfForecast -> Bool
== :: QueryWhatIfForecast -> QueryWhatIfForecast -> Bool
$c== :: QueryWhatIfForecast -> QueryWhatIfForecast -> Bool
Prelude.Eq, ReadPrec [QueryWhatIfForecast]
ReadPrec QueryWhatIfForecast
Int -> ReadS QueryWhatIfForecast
ReadS [QueryWhatIfForecast]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [QueryWhatIfForecast]
$creadListPrec :: ReadPrec [QueryWhatIfForecast]
readPrec :: ReadPrec QueryWhatIfForecast
$creadPrec :: ReadPrec QueryWhatIfForecast
readList :: ReadS [QueryWhatIfForecast]
$creadList :: ReadS [QueryWhatIfForecast]
readsPrec :: Int -> ReadS QueryWhatIfForecast
$creadsPrec :: Int -> ReadS QueryWhatIfForecast
Prelude.Read, Int -> QueryWhatIfForecast -> ShowS
[QueryWhatIfForecast] -> ShowS
QueryWhatIfForecast -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [QueryWhatIfForecast] -> ShowS
$cshowList :: [QueryWhatIfForecast] -> ShowS
show :: QueryWhatIfForecast -> String
$cshow :: QueryWhatIfForecast -> String
showsPrec :: Int -> QueryWhatIfForecast -> ShowS
$cshowsPrec :: Int -> QueryWhatIfForecast -> ShowS
Prelude.Show, forall x. Rep QueryWhatIfForecast x -> QueryWhatIfForecast
forall x. QueryWhatIfForecast -> Rep QueryWhatIfForecast x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep QueryWhatIfForecast x -> QueryWhatIfForecast
$cfrom :: forall x. QueryWhatIfForecast -> Rep QueryWhatIfForecast x
Prelude.Generic)
newQueryWhatIfForecast ::
Prelude.Text ->
QueryWhatIfForecast
newQueryWhatIfForecast :: Text -> QueryWhatIfForecast
newQueryWhatIfForecast Text
pWhatIfForecastArn_ =
QueryWhatIfForecast'
{ $sel:endDate:QueryWhatIfForecast' :: Maybe Text
endDate = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:QueryWhatIfForecast' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:startDate:QueryWhatIfForecast' :: Maybe Text
startDate = forall a. Maybe a
Prelude.Nothing,
$sel:whatIfForecastArn:QueryWhatIfForecast' :: Text
whatIfForecastArn = Text
pWhatIfForecastArn_,
$sel:filters:QueryWhatIfForecast' :: HashMap Text Text
filters = forall a. Monoid a => a
Prelude.mempty
}
queryWhatIfForecast_endDate :: Lens.Lens' QueryWhatIfForecast (Prelude.Maybe Prelude.Text)
queryWhatIfForecast_endDate :: Lens' QueryWhatIfForecast (Maybe Text)
queryWhatIfForecast_endDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryWhatIfForecast' {Maybe Text
endDate :: Maybe Text
$sel:endDate:QueryWhatIfForecast' :: QueryWhatIfForecast -> Maybe Text
endDate} -> Maybe Text
endDate) (\s :: QueryWhatIfForecast
s@QueryWhatIfForecast' {} Maybe Text
a -> QueryWhatIfForecast
s {$sel:endDate:QueryWhatIfForecast' :: Maybe Text
endDate = Maybe Text
a} :: QueryWhatIfForecast)
queryWhatIfForecast_nextToken :: Lens.Lens' QueryWhatIfForecast (Prelude.Maybe Prelude.Text)
queryWhatIfForecast_nextToken :: Lens' QueryWhatIfForecast (Maybe Text)
queryWhatIfForecast_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryWhatIfForecast' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:QueryWhatIfForecast' :: QueryWhatIfForecast -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: QueryWhatIfForecast
s@QueryWhatIfForecast' {} Maybe Text
a -> QueryWhatIfForecast
s {$sel:nextToken:QueryWhatIfForecast' :: Maybe Text
nextToken = Maybe Text
a} :: QueryWhatIfForecast)
queryWhatIfForecast_startDate :: Lens.Lens' QueryWhatIfForecast (Prelude.Maybe Prelude.Text)
queryWhatIfForecast_startDate :: Lens' QueryWhatIfForecast (Maybe Text)
queryWhatIfForecast_startDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryWhatIfForecast' {Maybe Text
startDate :: Maybe Text
$sel:startDate:QueryWhatIfForecast' :: QueryWhatIfForecast -> Maybe Text
startDate} -> Maybe Text
startDate) (\s :: QueryWhatIfForecast
s@QueryWhatIfForecast' {} Maybe Text
a -> QueryWhatIfForecast
s {$sel:startDate:QueryWhatIfForecast' :: Maybe Text
startDate = Maybe Text
a} :: QueryWhatIfForecast)
queryWhatIfForecast_whatIfForecastArn :: Lens.Lens' QueryWhatIfForecast Prelude.Text
queryWhatIfForecast_whatIfForecastArn :: Lens' QueryWhatIfForecast Text
queryWhatIfForecast_whatIfForecastArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryWhatIfForecast' {Text
whatIfForecastArn :: Text
$sel:whatIfForecastArn:QueryWhatIfForecast' :: QueryWhatIfForecast -> Text
whatIfForecastArn} -> Text
whatIfForecastArn) (\s :: QueryWhatIfForecast
s@QueryWhatIfForecast' {} Text
a -> QueryWhatIfForecast
s {$sel:whatIfForecastArn:QueryWhatIfForecast' :: Text
whatIfForecastArn = Text
a} :: QueryWhatIfForecast)
queryWhatIfForecast_filters :: Lens.Lens' QueryWhatIfForecast (Prelude.HashMap Prelude.Text Prelude.Text)
queryWhatIfForecast_filters :: Lens' QueryWhatIfForecast (HashMap Text Text)
queryWhatIfForecast_filters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryWhatIfForecast' {HashMap Text Text
filters :: HashMap Text Text
$sel:filters:QueryWhatIfForecast' :: QueryWhatIfForecast -> HashMap Text Text
filters} -> HashMap Text Text
filters) (\s :: QueryWhatIfForecast
s@QueryWhatIfForecast' {} HashMap Text Text
a -> QueryWhatIfForecast
s {$sel:filters:QueryWhatIfForecast' :: HashMap Text Text
filters = HashMap Text Text
a} :: QueryWhatIfForecast) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest QueryWhatIfForecast where
type
AWSResponse QueryWhatIfForecast =
QueryWhatIfForecastResponse
request :: (Service -> Service)
-> QueryWhatIfForecast -> Request QueryWhatIfForecast
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy QueryWhatIfForecast
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse QueryWhatIfForecast)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Forecast -> Int -> QueryWhatIfForecastResponse
QueryWhatIfForecastResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Forecast")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable QueryWhatIfForecast where
hashWithSalt :: Int -> QueryWhatIfForecast -> Int
hashWithSalt Int
_salt QueryWhatIfForecast' {Maybe Text
Text
HashMap Text Text
filters :: HashMap Text Text
whatIfForecastArn :: Text
startDate :: Maybe Text
nextToken :: Maybe Text
endDate :: Maybe Text
$sel:filters:QueryWhatIfForecast' :: QueryWhatIfForecast -> HashMap Text Text
$sel:whatIfForecastArn:QueryWhatIfForecast' :: QueryWhatIfForecast -> Text
$sel:startDate:QueryWhatIfForecast' :: QueryWhatIfForecast -> Maybe Text
$sel:nextToken:QueryWhatIfForecast' :: QueryWhatIfForecast -> Maybe Text
$sel:endDate:QueryWhatIfForecast' :: QueryWhatIfForecast -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
endDate
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
startDate
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
whatIfForecastArn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` HashMap Text Text
filters
instance Prelude.NFData QueryWhatIfForecast where
rnf :: QueryWhatIfForecast -> ()
rnf QueryWhatIfForecast' {Maybe Text
Text
HashMap Text Text
filters :: HashMap Text Text
whatIfForecastArn :: Text
startDate :: Maybe Text
nextToken :: Maybe Text
endDate :: Maybe Text
$sel:filters:QueryWhatIfForecast' :: QueryWhatIfForecast -> HashMap Text Text
$sel:whatIfForecastArn:QueryWhatIfForecast' :: QueryWhatIfForecast -> Text
$sel:startDate:QueryWhatIfForecast' :: QueryWhatIfForecast -> Maybe Text
$sel:nextToken:QueryWhatIfForecast' :: QueryWhatIfForecast -> Maybe Text
$sel:endDate:QueryWhatIfForecast' :: QueryWhatIfForecast -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
endDate
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
startDate
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
whatIfForecastArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf HashMap Text Text
filters
instance Data.ToHeaders QueryWhatIfForecast where
toHeaders :: QueryWhatIfForecast -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AmazonForecastRuntime.QueryWhatIfForecast" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON QueryWhatIfForecast where
toJSON :: QueryWhatIfForecast -> Value
toJSON QueryWhatIfForecast' {Maybe Text
Text
HashMap Text Text
filters :: HashMap Text Text
whatIfForecastArn :: Text
startDate :: Maybe Text
nextToken :: Maybe Text
endDate :: Maybe Text
$sel:filters:QueryWhatIfForecast' :: QueryWhatIfForecast -> HashMap Text Text
$sel:whatIfForecastArn:QueryWhatIfForecast' :: QueryWhatIfForecast -> Text
$sel:startDate:QueryWhatIfForecast' :: QueryWhatIfForecast -> Maybe Text
$sel:nextToken:QueryWhatIfForecast' :: QueryWhatIfForecast -> Maybe Text
$sel:endDate:QueryWhatIfForecast' :: QueryWhatIfForecast -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"EndDate" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
endDate,
(Key
"NextToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
(Key
"StartDate" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
startDate,
forall a. a -> Maybe a
Prelude.Just
(Key
"WhatIfForecastArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
whatIfForecastArn),
forall a. a -> Maybe a
Prelude.Just (Key
"Filters" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= HashMap Text Text
filters)
]
)
instance Data.ToPath QueryWhatIfForecast where
toPath :: QueryWhatIfForecast -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery QueryWhatIfForecast where
toQuery :: QueryWhatIfForecast -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data QueryWhatIfForecastResponse = QueryWhatIfForecastResponse'
{ QueryWhatIfForecastResponse -> Maybe Forecast
forecast :: Prelude.Maybe Forecast,
QueryWhatIfForecastResponse -> Int
httpStatus :: Prelude.Int
}
deriving (QueryWhatIfForecastResponse -> QueryWhatIfForecastResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: QueryWhatIfForecastResponse -> QueryWhatIfForecastResponse -> Bool
$c/= :: QueryWhatIfForecastResponse -> QueryWhatIfForecastResponse -> Bool
== :: QueryWhatIfForecastResponse -> QueryWhatIfForecastResponse -> Bool
$c== :: QueryWhatIfForecastResponse -> QueryWhatIfForecastResponse -> Bool
Prelude.Eq, ReadPrec [QueryWhatIfForecastResponse]
ReadPrec QueryWhatIfForecastResponse
Int -> ReadS QueryWhatIfForecastResponse
ReadS [QueryWhatIfForecastResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [QueryWhatIfForecastResponse]
$creadListPrec :: ReadPrec [QueryWhatIfForecastResponse]
readPrec :: ReadPrec QueryWhatIfForecastResponse
$creadPrec :: ReadPrec QueryWhatIfForecastResponse
readList :: ReadS [QueryWhatIfForecastResponse]
$creadList :: ReadS [QueryWhatIfForecastResponse]
readsPrec :: Int -> ReadS QueryWhatIfForecastResponse
$creadsPrec :: Int -> ReadS QueryWhatIfForecastResponse
Prelude.Read, Int -> QueryWhatIfForecastResponse -> ShowS
[QueryWhatIfForecastResponse] -> ShowS
QueryWhatIfForecastResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [QueryWhatIfForecastResponse] -> ShowS
$cshowList :: [QueryWhatIfForecastResponse] -> ShowS
show :: QueryWhatIfForecastResponse -> String
$cshow :: QueryWhatIfForecastResponse -> String
showsPrec :: Int -> QueryWhatIfForecastResponse -> ShowS
$cshowsPrec :: Int -> QueryWhatIfForecastResponse -> ShowS
Prelude.Show, forall x.
Rep QueryWhatIfForecastResponse x -> QueryWhatIfForecastResponse
forall x.
QueryWhatIfForecastResponse -> Rep QueryWhatIfForecastResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep QueryWhatIfForecastResponse x -> QueryWhatIfForecastResponse
$cfrom :: forall x.
QueryWhatIfForecastResponse -> Rep QueryWhatIfForecastResponse x
Prelude.Generic)
newQueryWhatIfForecastResponse ::
Prelude.Int ->
QueryWhatIfForecastResponse
newQueryWhatIfForecastResponse :: Int -> QueryWhatIfForecastResponse
newQueryWhatIfForecastResponse Int
pHttpStatus_ =
QueryWhatIfForecastResponse'
{ $sel:forecast:QueryWhatIfForecastResponse' :: Maybe Forecast
forecast =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:QueryWhatIfForecastResponse' :: Int
httpStatus = Int
pHttpStatus_
}
queryWhatIfForecastResponse_forecast :: Lens.Lens' QueryWhatIfForecastResponse (Prelude.Maybe Forecast)
queryWhatIfForecastResponse_forecast :: Lens' QueryWhatIfForecastResponse (Maybe Forecast)
queryWhatIfForecastResponse_forecast = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryWhatIfForecastResponse' {Maybe Forecast
forecast :: Maybe Forecast
$sel:forecast:QueryWhatIfForecastResponse' :: QueryWhatIfForecastResponse -> Maybe Forecast
forecast} -> Maybe Forecast
forecast) (\s :: QueryWhatIfForecastResponse
s@QueryWhatIfForecastResponse' {} Maybe Forecast
a -> QueryWhatIfForecastResponse
s {$sel:forecast:QueryWhatIfForecastResponse' :: Maybe Forecast
forecast = Maybe Forecast
a} :: QueryWhatIfForecastResponse)
queryWhatIfForecastResponse_httpStatus :: Lens.Lens' QueryWhatIfForecastResponse Prelude.Int
queryWhatIfForecastResponse_httpStatus :: Lens' QueryWhatIfForecastResponse Int
queryWhatIfForecastResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryWhatIfForecastResponse' {Int
httpStatus :: Int
$sel:httpStatus:QueryWhatIfForecastResponse' :: QueryWhatIfForecastResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: QueryWhatIfForecastResponse
s@QueryWhatIfForecastResponse' {} Int
a -> QueryWhatIfForecastResponse
s {$sel:httpStatus:QueryWhatIfForecastResponse' :: Int
httpStatus = Int
a} :: QueryWhatIfForecastResponse)
instance Prelude.NFData QueryWhatIfForecastResponse where
rnf :: QueryWhatIfForecastResponse -> ()
rnf QueryWhatIfForecastResponse' {Int
Maybe Forecast
httpStatus :: Int
forecast :: Maybe Forecast
$sel:httpStatus:QueryWhatIfForecastResponse' :: QueryWhatIfForecastResponse -> Int
$sel:forecast:QueryWhatIfForecastResponse' :: QueryWhatIfForecastResponse -> Maybe Forecast
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Forecast
forecast
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus