{-# 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.ListMonitors
(
ListMonitors (..),
newListMonitors,
listMonitors_filters,
listMonitors_maxResults,
listMonitors_nextToken,
ListMonitorsResponse (..),
newListMonitorsResponse,
listMonitorsResponse_monitors,
listMonitorsResponse_nextToken,
listMonitorsResponse_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 ListMonitors = ListMonitors'
{
ListMonitors -> Maybe [Filter]
filters :: Prelude.Maybe [Filter],
ListMonitors -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListMonitors -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (ListMonitors -> ListMonitors -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListMonitors -> ListMonitors -> Bool
$c/= :: ListMonitors -> ListMonitors -> Bool
== :: ListMonitors -> ListMonitors -> Bool
$c== :: ListMonitors -> ListMonitors -> Bool
Prelude.Eq, ReadPrec [ListMonitors]
ReadPrec ListMonitors
Int -> ReadS ListMonitors
ReadS [ListMonitors]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListMonitors]
$creadListPrec :: ReadPrec [ListMonitors]
readPrec :: ReadPrec ListMonitors
$creadPrec :: ReadPrec ListMonitors
readList :: ReadS [ListMonitors]
$creadList :: ReadS [ListMonitors]
readsPrec :: Int -> ReadS ListMonitors
$creadsPrec :: Int -> ReadS ListMonitors
Prelude.Read, Int -> ListMonitors -> ShowS
[ListMonitors] -> ShowS
ListMonitors -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListMonitors] -> ShowS
$cshowList :: [ListMonitors] -> ShowS
show :: ListMonitors -> String
$cshow :: ListMonitors -> String
showsPrec :: Int -> ListMonitors -> ShowS
$cshowsPrec :: Int -> ListMonitors -> ShowS
Prelude.Show, forall x. Rep ListMonitors x -> ListMonitors
forall x. ListMonitors -> Rep ListMonitors x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListMonitors x -> ListMonitors
$cfrom :: forall x. ListMonitors -> Rep ListMonitors x
Prelude.Generic)
newListMonitors ::
ListMonitors
newListMonitors :: ListMonitors
newListMonitors =
ListMonitors'
{ $sel:filters:ListMonitors' :: Maybe [Filter]
filters = forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListMonitors' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListMonitors' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
}
listMonitors_filters :: Lens.Lens' ListMonitors (Prelude.Maybe [Filter])
listMonitors_filters :: Lens' ListMonitors (Maybe [Filter])
listMonitors_filters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMonitors' {Maybe [Filter]
filters :: Maybe [Filter]
$sel:filters:ListMonitors' :: ListMonitors -> Maybe [Filter]
filters} -> Maybe [Filter]
filters) (\s :: ListMonitors
s@ListMonitors' {} Maybe [Filter]
a -> ListMonitors
s {$sel:filters:ListMonitors' :: Maybe [Filter]
filters = Maybe [Filter]
a} :: ListMonitors) 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
listMonitors_maxResults :: Lens.Lens' ListMonitors (Prelude.Maybe Prelude.Natural)
listMonitors_maxResults :: Lens' ListMonitors (Maybe Natural)
listMonitors_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMonitors' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListMonitors' :: ListMonitors -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListMonitors
s@ListMonitors' {} Maybe Natural
a -> ListMonitors
s {$sel:maxResults:ListMonitors' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListMonitors)
listMonitors_nextToken :: Lens.Lens' ListMonitors (Prelude.Maybe Prelude.Text)
listMonitors_nextToken :: Lens' ListMonitors (Maybe Text)
listMonitors_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMonitors' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListMonitors' :: ListMonitors -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListMonitors
s@ListMonitors' {} Maybe Text
a -> ListMonitors
s {$sel:nextToken:ListMonitors' :: Maybe Text
nextToken = Maybe Text
a} :: ListMonitors)
instance Core.AWSPager ListMonitors where
page :: ListMonitors -> AWSResponse ListMonitors -> Maybe ListMonitors
page ListMonitors
rq AWSResponse ListMonitors
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListMonitors
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListMonitorsResponse (Maybe Text)
listMonitorsResponse_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 ListMonitors
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListMonitorsResponse (Maybe [MonitorSummary])
listMonitorsResponse_monitors
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.$ ListMonitors
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListMonitors (Maybe Text)
listMonitors_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListMonitors
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListMonitorsResponse (Maybe Text)
listMonitorsResponse_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 ListMonitors where
type AWSResponse ListMonitors = ListMonitorsResponse
request :: (Service -> Service) -> ListMonitors -> Request ListMonitors
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 ListMonitors
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListMonitors)))
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 [MonitorSummary] -> Maybe Text -> Int -> ListMonitorsResponse
ListMonitorsResponse'
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
"Monitors" 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 ListMonitors where
hashWithSalt :: Int -> ListMonitors -> Int
hashWithSalt Int
_salt ListMonitors' {Maybe Natural
Maybe [Filter]
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe [Filter]
$sel:nextToken:ListMonitors' :: ListMonitors -> Maybe Text
$sel:maxResults:ListMonitors' :: ListMonitors -> Maybe Natural
$sel:filters:ListMonitors' :: ListMonitors -> 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 ListMonitors where
rnf :: ListMonitors -> ()
rnf ListMonitors' {Maybe Natural
Maybe [Filter]
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe [Filter]
$sel:nextToken:ListMonitors' :: ListMonitors -> Maybe Text
$sel:maxResults:ListMonitors' :: ListMonitors -> Maybe Natural
$sel:filters:ListMonitors' :: ListMonitors -> 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 ListMonitors where
toHeaders :: ListMonitors -> 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.ListMonitors" ::
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 ListMonitors where
toJSON :: ListMonitors -> Value
toJSON ListMonitors' {Maybe Natural
Maybe [Filter]
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe [Filter]
$sel:nextToken:ListMonitors' :: ListMonitors -> Maybe Text
$sel:maxResults:ListMonitors' :: ListMonitors -> Maybe Natural
$sel:filters:ListMonitors' :: ListMonitors -> 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 ListMonitors where
toPath :: ListMonitors -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ListMonitors where
toQuery :: ListMonitors -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListMonitorsResponse = ListMonitorsResponse'
{
ListMonitorsResponse -> Maybe [MonitorSummary]
monitors :: Prelude.Maybe [MonitorSummary],
ListMonitorsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListMonitorsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListMonitorsResponse -> ListMonitorsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListMonitorsResponse -> ListMonitorsResponse -> Bool
$c/= :: ListMonitorsResponse -> ListMonitorsResponse -> Bool
== :: ListMonitorsResponse -> ListMonitorsResponse -> Bool
$c== :: ListMonitorsResponse -> ListMonitorsResponse -> Bool
Prelude.Eq, ReadPrec [ListMonitorsResponse]
ReadPrec ListMonitorsResponse
Int -> ReadS ListMonitorsResponse
ReadS [ListMonitorsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListMonitorsResponse]
$creadListPrec :: ReadPrec [ListMonitorsResponse]
readPrec :: ReadPrec ListMonitorsResponse
$creadPrec :: ReadPrec ListMonitorsResponse
readList :: ReadS [ListMonitorsResponse]
$creadList :: ReadS [ListMonitorsResponse]
readsPrec :: Int -> ReadS ListMonitorsResponse
$creadsPrec :: Int -> ReadS ListMonitorsResponse
Prelude.Read, Int -> ListMonitorsResponse -> ShowS
[ListMonitorsResponse] -> ShowS
ListMonitorsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListMonitorsResponse] -> ShowS
$cshowList :: [ListMonitorsResponse] -> ShowS
show :: ListMonitorsResponse -> String
$cshow :: ListMonitorsResponse -> String
showsPrec :: Int -> ListMonitorsResponse -> ShowS
$cshowsPrec :: Int -> ListMonitorsResponse -> ShowS
Prelude.Show, forall x. Rep ListMonitorsResponse x -> ListMonitorsResponse
forall x. ListMonitorsResponse -> Rep ListMonitorsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListMonitorsResponse x -> ListMonitorsResponse
$cfrom :: forall x. ListMonitorsResponse -> Rep ListMonitorsResponse x
Prelude.Generic)
newListMonitorsResponse ::
Prelude.Int ->
ListMonitorsResponse
newListMonitorsResponse :: Int -> ListMonitorsResponse
newListMonitorsResponse Int
pHttpStatus_ =
ListMonitorsResponse'
{ $sel:monitors:ListMonitorsResponse' :: Maybe [MonitorSummary]
monitors = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListMonitorsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListMonitorsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listMonitorsResponse_monitors :: Lens.Lens' ListMonitorsResponse (Prelude.Maybe [MonitorSummary])
listMonitorsResponse_monitors :: Lens' ListMonitorsResponse (Maybe [MonitorSummary])
listMonitorsResponse_monitors = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMonitorsResponse' {Maybe [MonitorSummary]
monitors :: Maybe [MonitorSummary]
$sel:monitors:ListMonitorsResponse' :: ListMonitorsResponse -> Maybe [MonitorSummary]
monitors} -> Maybe [MonitorSummary]
monitors) (\s :: ListMonitorsResponse
s@ListMonitorsResponse' {} Maybe [MonitorSummary]
a -> ListMonitorsResponse
s {$sel:monitors:ListMonitorsResponse' :: Maybe [MonitorSummary]
monitors = Maybe [MonitorSummary]
a} :: ListMonitorsResponse) 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
listMonitorsResponse_nextToken :: Lens.Lens' ListMonitorsResponse (Prelude.Maybe Prelude.Text)
listMonitorsResponse_nextToken :: Lens' ListMonitorsResponse (Maybe Text)
listMonitorsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMonitorsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListMonitorsResponse' :: ListMonitorsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListMonitorsResponse
s@ListMonitorsResponse' {} Maybe Text
a -> ListMonitorsResponse
s {$sel:nextToken:ListMonitorsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListMonitorsResponse)
listMonitorsResponse_httpStatus :: Lens.Lens' ListMonitorsResponse Prelude.Int
listMonitorsResponse_httpStatus :: Lens' ListMonitorsResponse Int
listMonitorsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMonitorsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListMonitorsResponse' :: ListMonitorsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListMonitorsResponse
s@ListMonitorsResponse' {} Int
a -> ListMonitorsResponse
s {$sel:httpStatus:ListMonitorsResponse' :: Int
httpStatus = Int
a} :: ListMonitorsResponse)
instance Prelude.NFData ListMonitorsResponse where
rnf :: ListMonitorsResponse -> ()
rnf ListMonitorsResponse' {Int
Maybe [MonitorSummary]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
monitors :: Maybe [MonitorSummary]
$sel:httpStatus:ListMonitorsResponse' :: ListMonitorsResponse -> Int
$sel:nextToken:ListMonitorsResponse' :: ListMonitorsResponse -> Maybe Text
$sel:monitors:ListMonitorsResponse' :: ListMonitorsResponse -> Maybe [MonitorSummary]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [MonitorSummary]
monitors
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