{-# 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.Forecast.ListForecasts
(
ListForecasts (..),
newListForecasts,
listForecasts_filters,
listForecasts_maxResults,
listForecasts_nextToken,
ListForecastsResponse (..),
newListForecastsResponse,
listForecastsResponse_forecasts,
listForecastsResponse_nextToken,
listForecastsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Forecast.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListForecasts = ListForecasts'
{
ListForecasts -> Maybe [Filter]
filters :: Prelude.Maybe [Filter],
ListForecasts -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListForecasts -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (ListForecasts -> ListForecasts -> Bool
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]
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
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. 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)
newListForecasts ::
ListForecasts
newListForecasts :: ListForecasts
newListForecasts =
ListForecasts'
{ $sel:filters:ListForecasts' :: Maybe [Filter]
filters = forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListForecasts' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListForecasts' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
}
listForecasts_filters :: Lens.Lens' ListForecasts (Prelude.Maybe [Filter])
listForecasts_filters :: Lens' ListForecasts (Maybe [Filter])
listForecasts_filters = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listForecasts_maxResults :: Lens.Lens' ListForecasts (Prelude.Maybe Prelude.Natural)
listForecasts_maxResults :: Lens' ListForecasts (Maybe Natural)
listForecasts_maxResults = 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)
listForecasts_nextToken :: Lens.Lens' ListForecasts (Prelude.Maybe Prelude.Text)
listForecasts_nextToken :: Lens' ListForecasts (Maybe Text)
listForecasts_nextToken = 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)
instance Core.AWSPager ListForecasts where
page :: ListForecasts -> AWSResponse ListForecasts -> Maybe ListForecasts
page ListForecasts
rq AWSResponse ListForecasts
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListForecasts
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListForecastsResponse (Maybe Text)
listForecastsResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListForecasts
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListForecastsResponse (Maybe [ForecastSummary])
listForecastsResponse_forecasts
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ ListForecasts
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListForecasts (Maybe Text)
listForecasts_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListForecasts
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListForecastsResponse (Maybe Text)
listForecastsResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest ListForecasts where
type
AWSResponse ListForecasts =
ListForecastsResponse
request :: (Service -> Service) -> ListForecasts -> Request ListForecasts
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 ListForecasts
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListForecasts)))
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 [ForecastSummary]
-> Maybe Text -> Int -> ListForecastsResponse
ListForecastsResponse'
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
"Forecasts" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"NextToken")
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 ListForecasts where
hashWithSalt :: Int -> ListForecasts -> Int
hashWithSalt Int
_salt ListForecasts' {Maybe Natural
Maybe [Filter]
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe [Filter]
$sel:nextToken:ListForecasts' :: ListForecasts -> Maybe Text
$sel:maxResults:ListForecasts' :: ListForecasts -> Maybe Natural
$sel:filters:ListForecasts' :: ListForecasts -> Maybe [Filter]
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Filter]
filters
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
instance Prelude.NFData ListForecasts where
rnf :: ListForecasts -> ()
rnf ListForecasts' {Maybe Natural
Maybe [Filter]
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe [Filter]
$sel:nextToken:ListForecasts' :: ListForecasts -> Maybe Text
$sel:maxResults:ListForecasts' :: ListForecasts -> Maybe Natural
$sel:filters:ListForecasts' :: ListForecasts -> Maybe [Filter]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Filter]
filters
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
instance Data.ToHeaders ListForecasts where
toHeaders :: ListForecasts -> 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
"AmazonForecast.ListForecasts" ::
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 ListForecasts where
toJSON :: ListForecasts -> Value
toJSON ListForecasts' {Maybe Natural
Maybe [Filter]
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe [Filter]
$sel:nextToken:ListForecasts' :: ListForecasts -> Maybe Text
$sel:maxResults:ListForecasts' :: ListForecasts -> Maybe Natural
$sel:filters:ListForecasts' :: ListForecasts -> Maybe [Filter]
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Filters" 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 [Filter]
filters,
(Key
"MaxResults" 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 Natural
maxResults,
(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
]
)
instance Data.ToPath ListForecasts where
toPath :: ListForecasts -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ListForecasts where
toQuery :: ListForecasts -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListForecastsResponse = ListForecastsResponse'
{
ListForecastsResponse -> Maybe [ForecastSummary]
forecasts :: Prelude.Maybe [ForecastSummary],
ListForecastsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListForecastsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListForecastsResponse -> ListForecastsResponse -> Bool
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]
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
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. 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)
newListForecastsResponse ::
Prelude.Int ->
ListForecastsResponse
newListForecastsResponse :: Int -> ListForecastsResponse
newListForecastsResponse Int
pHttpStatus_ =
ListForecastsResponse'
{ $sel:forecasts:ListForecastsResponse' :: Maybe [ForecastSummary]
forecasts = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListForecastsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListForecastsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listForecastsResponse_forecasts :: Lens.Lens' ListForecastsResponse (Prelude.Maybe [ForecastSummary])
listForecastsResponse_forecasts :: Lens' ListForecastsResponse (Maybe [ForecastSummary])
listForecastsResponse_forecasts = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listForecastsResponse_nextToken :: Lens.Lens' ListForecastsResponse (Prelude.Maybe Prelude.Text)
listForecastsResponse_nextToken :: Lens' ListForecastsResponse (Maybe Text)
listForecastsResponse_nextToken = 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)
listForecastsResponse_httpStatus :: Lens.Lens' ListForecastsResponse Prelude.Int
listForecastsResponse_httpStatus :: Lens' ListForecastsResponse Int
listForecastsResponse_httpStatus = 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 where
rnf :: ListForecastsResponse -> ()
rnf ListForecastsResponse' {Int
Maybe [ForecastSummary]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
forecasts :: Maybe [ForecastSummary]
$sel:httpStatus:ListForecastsResponse' :: ListForecastsResponse -> Int
$sel:nextToken:ListForecastsResponse' :: ListForecastsResponse -> Maybe Text
$sel:forecasts:ListForecastsResponse' :: ListForecastsResponse -> Maybe [ForecastSummary]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [ForecastSummary]
forecasts
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 Int
httpStatus