{-# 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.ListDatasetGroups
(
ListDatasetGroups (..),
newListDatasetGroups,
listDatasetGroups_maxResults,
listDatasetGroups_nextToken,
ListDatasetGroupsResponse (..),
newListDatasetGroupsResponse,
listDatasetGroupsResponse_datasetGroups,
listDatasetGroupsResponse_nextToken,
listDatasetGroupsResponse_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 ListDatasetGroups = ListDatasetGroups'
{
ListDatasetGroups -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListDatasetGroups -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (ListDatasetGroups -> ListDatasetGroups -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListDatasetGroups -> ListDatasetGroups -> Bool
$c/= :: ListDatasetGroups -> ListDatasetGroups -> Bool
== :: ListDatasetGroups -> ListDatasetGroups -> Bool
$c== :: ListDatasetGroups -> ListDatasetGroups -> Bool
Prelude.Eq, ReadPrec [ListDatasetGroups]
ReadPrec ListDatasetGroups
Int -> ReadS ListDatasetGroups
ReadS [ListDatasetGroups]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListDatasetGroups]
$creadListPrec :: ReadPrec [ListDatasetGroups]
readPrec :: ReadPrec ListDatasetGroups
$creadPrec :: ReadPrec ListDatasetGroups
readList :: ReadS [ListDatasetGroups]
$creadList :: ReadS [ListDatasetGroups]
readsPrec :: Int -> ReadS ListDatasetGroups
$creadsPrec :: Int -> ReadS ListDatasetGroups
Prelude.Read, Int -> ListDatasetGroups -> ShowS
[ListDatasetGroups] -> ShowS
ListDatasetGroups -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListDatasetGroups] -> ShowS
$cshowList :: [ListDatasetGroups] -> ShowS
show :: ListDatasetGroups -> String
$cshow :: ListDatasetGroups -> String
showsPrec :: Int -> ListDatasetGroups -> ShowS
$cshowsPrec :: Int -> ListDatasetGroups -> ShowS
Prelude.Show, forall x. Rep ListDatasetGroups x -> ListDatasetGroups
forall x. ListDatasetGroups -> Rep ListDatasetGroups x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListDatasetGroups x -> ListDatasetGroups
$cfrom :: forall x. ListDatasetGroups -> Rep ListDatasetGroups x
Prelude.Generic)
newListDatasetGroups ::
ListDatasetGroups
newListDatasetGroups :: ListDatasetGroups
newListDatasetGroups =
ListDatasetGroups'
{ $sel:maxResults:ListDatasetGroups' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListDatasetGroups' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
}
listDatasetGroups_maxResults :: Lens.Lens' ListDatasetGroups (Prelude.Maybe Prelude.Natural)
listDatasetGroups_maxResults :: Lens' ListDatasetGroups (Maybe Natural)
listDatasetGroups_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDatasetGroups' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListDatasetGroups' :: ListDatasetGroups -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListDatasetGroups
s@ListDatasetGroups' {} Maybe Natural
a -> ListDatasetGroups
s {$sel:maxResults:ListDatasetGroups' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListDatasetGroups)
listDatasetGroups_nextToken :: Lens.Lens' ListDatasetGroups (Prelude.Maybe Prelude.Text)
listDatasetGroups_nextToken :: Lens' ListDatasetGroups (Maybe Text)
listDatasetGroups_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDatasetGroups' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListDatasetGroups' :: ListDatasetGroups -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListDatasetGroups
s@ListDatasetGroups' {} Maybe Text
a -> ListDatasetGroups
s {$sel:nextToken:ListDatasetGroups' :: Maybe Text
nextToken = Maybe Text
a} :: ListDatasetGroups)
instance Core.AWSPager ListDatasetGroups where
page :: ListDatasetGroups
-> AWSResponse ListDatasetGroups -> Maybe ListDatasetGroups
page ListDatasetGroups
rq AWSResponse ListDatasetGroups
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListDatasetGroups
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListDatasetGroupsResponse (Maybe Text)
listDatasetGroupsResponse_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 ListDatasetGroups
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListDatasetGroupsResponse (Maybe [DatasetGroupSummary])
listDatasetGroupsResponse_datasetGroups
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.$ ListDatasetGroups
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListDatasetGroups (Maybe Text)
listDatasetGroups_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListDatasetGroups
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListDatasetGroupsResponse (Maybe Text)
listDatasetGroupsResponse_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 ListDatasetGroups where
type
AWSResponse ListDatasetGroups =
ListDatasetGroupsResponse
request :: (Service -> Service)
-> ListDatasetGroups -> Request ListDatasetGroups
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 ListDatasetGroups
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListDatasetGroups)))
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 [DatasetGroupSummary]
-> Maybe Text -> Int -> ListDatasetGroupsResponse
ListDatasetGroupsResponse'
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
"DatasetGroups" 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 ListDatasetGroups where
hashWithSalt :: Int -> ListDatasetGroups -> Int
hashWithSalt Int
_salt ListDatasetGroups' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListDatasetGroups' :: ListDatasetGroups -> Maybe Text
$sel:maxResults:ListDatasetGroups' :: ListDatasetGroups -> Maybe Natural
..} =
Int
_salt
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 ListDatasetGroups where
rnf :: ListDatasetGroups -> ()
rnf ListDatasetGroups' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListDatasetGroups' :: ListDatasetGroups -> Maybe Text
$sel:maxResults:ListDatasetGroups' :: ListDatasetGroups -> Maybe Natural
..} =
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 ListDatasetGroups where
toHeaders :: ListDatasetGroups -> 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.ListDatasetGroups" ::
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 ListDatasetGroups where
toJSON :: ListDatasetGroups -> Value
toJSON ListDatasetGroups' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListDatasetGroups' :: ListDatasetGroups -> Maybe Text
$sel:maxResults:ListDatasetGroups' :: ListDatasetGroups -> Maybe Natural
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (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 ListDatasetGroups where
toPath :: ListDatasetGroups -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ListDatasetGroups where
toQuery :: ListDatasetGroups -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListDatasetGroupsResponse = ListDatasetGroupsResponse'
{
ListDatasetGroupsResponse -> Maybe [DatasetGroupSummary]
datasetGroups :: Prelude.Maybe [DatasetGroupSummary],
ListDatasetGroupsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListDatasetGroupsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListDatasetGroupsResponse -> ListDatasetGroupsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListDatasetGroupsResponse -> ListDatasetGroupsResponse -> Bool
$c/= :: ListDatasetGroupsResponse -> ListDatasetGroupsResponse -> Bool
== :: ListDatasetGroupsResponse -> ListDatasetGroupsResponse -> Bool
$c== :: ListDatasetGroupsResponse -> ListDatasetGroupsResponse -> Bool
Prelude.Eq, ReadPrec [ListDatasetGroupsResponse]
ReadPrec ListDatasetGroupsResponse
Int -> ReadS ListDatasetGroupsResponse
ReadS [ListDatasetGroupsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListDatasetGroupsResponse]
$creadListPrec :: ReadPrec [ListDatasetGroupsResponse]
readPrec :: ReadPrec ListDatasetGroupsResponse
$creadPrec :: ReadPrec ListDatasetGroupsResponse
readList :: ReadS [ListDatasetGroupsResponse]
$creadList :: ReadS [ListDatasetGroupsResponse]
readsPrec :: Int -> ReadS ListDatasetGroupsResponse
$creadsPrec :: Int -> ReadS ListDatasetGroupsResponse
Prelude.Read, Int -> ListDatasetGroupsResponse -> ShowS
[ListDatasetGroupsResponse] -> ShowS
ListDatasetGroupsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListDatasetGroupsResponse] -> ShowS
$cshowList :: [ListDatasetGroupsResponse] -> ShowS
show :: ListDatasetGroupsResponse -> String
$cshow :: ListDatasetGroupsResponse -> String
showsPrec :: Int -> ListDatasetGroupsResponse -> ShowS
$cshowsPrec :: Int -> ListDatasetGroupsResponse -> ShowS
Prelude.Show, forall x.
Rep ListDatasetGroupsResponse x -> ListDatasetGroupsResponse
forall x.
ListDatasetGroupsResponse -> Rep ListDatasetGroupsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListDatasetGroupsResponse x -> ListDatasetGroupsResponse
$cfrom :: forall x.
ListDatasetGroupsResponse -> Rep ListDatasetGroupsResponse x
Prelude.Generic)
newListDatasetGroupsResponse ::
Prelude.Int ->
ListDatasetGroupsResponse
newListDatasetGroupsResponse :: Int -> ListDatasetGroupsResponse
newListDatasetGroupsResponse Int
pHttpStatus_ =
ListDatasetGroupsResponse'
{ $sel:datasetGroups:ListDatasetGroupsResponse' :: Maybe [DatasetGroupSummary]
datasetGroups =
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListDatasetGroupsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListDatasetGroupsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listDatasetGroupsResponse_datasetGroups :: Lens.Lens' ListDatasetGroupsResponse (Prelude.Maybe [DatasetGroupSummary])
listDatasetGroupsResponse_datasetGroups :: Lens' ListDatasetGroupsResponse (Maybe [DatasetGroupSummary])
listDatasetGroupsResponse_datasetGroups = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDatasetGroupsResponse' {Maybe [DatasetGroupSummary]
datasetGroups :: Maybe [DatasetGroupSummary]
$sel:datasetGroups:ListDatasetGroupsResponse' :: ListDatasetGroupsResponse -> Maybe [DatasetGroupSummary]
datasetGroups} -> Maybe [DatasetGroupSummary]
datasetGroups) (\s :: ListDatasetGroupsResponse
s@ListDatasetGroupsResponse' {} Maybe [DatasetGroupSummary]
a -> ListDatasetGroupsResponse
s {$sel:datasetGroups:ListDatasetGroupsResponse' :: Maybe [DatasetGroupSummary]
datasetGroups = Maybe [DatasetGroupSummary]
a} :: ListDatasetGroupsResponse) 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
listDatasetGroupsResponse_nextToken :: Lens.Lens' ListDatasetGroupsResponse (Prelude.Maybe Prelude.Text)
listDatasetGroupsResponse_nextToken :: Lens' ListDatasetGroupsResponse (Maybe Text)
listDatasetGroupsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDatasetGroupsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListDatasetGroupsResponse' :: ListDatasetGroupsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListDatasetGroupsResponse
s@ListDatasetGroupsResponse' {} Maybe Text
a -> ListDatasetGroupsResponse
s {$sel:nextToken:ListDatasetGroupsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListDatasetGroupsResponse)
listDatasetGroupsResponse_httpStatus :: Lens.Lens' ListDatasetGroupsResponse Prelude.Int
listDatasetGroupsResponse_httpStatus :: Lens' ListDatasetGroupsResponse Int
listDatasetGroupsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDatasetGroupsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListDatasetGroupsResponse' :: ListDatasetGroupsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListDatasetGroupsResponse
s@ListDatasetGroupsResponse' {} Int
a -> ListDatasetGroupsResponse
s {$sel:httpStatus:ListDatasetGroupsResponse' :: Int
httpStatus = Int
a} :: ListDatasetGroupsResponse)
instance Prelude.NFData ListDatasetGroupsResponse where
rnf :: ListDatasetGroupsResponse -> ()
rnf ListDatasetGroupsResponse' {Int
Maybe [DatasetGroupSummary]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
datasetGroups :: Maybe [DatasetGroupSummary]
$sel:httpStatus:ListDatasetGroupsResponse' :: ListDatasetGroupsResponse -> Int
$sel:nextToken:ListDatasetGroupsResponse' :: ListDatasetGroupsResponse -> Maybe Text
$sel:datasetGroups:ListDatasetGroupsResponse' :: ListDatasetGroupsResponse -> Maybe [DatasetGroupSummary]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [DatasetGroupSummary]
datasetGroups
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