{-# 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.LookoutMetrics.ListAlerts
(
ListAlerts (..),
newListAlerts,
listAlerts_anomalyDetectorArn,
listAlerts_nextToken,
listAlerts_maxResults,
ListAlertsResponse (..),
newListAlertsResponse,
listAlertsResponse_nextToken,
listAlertsResponse_alertSummaryList,
listAlertsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.LookoutMetrics.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListAlerts = ListAlerts'
{
ListAlerts -> Maybe Text
anomalyDetectorArn :: Prelude.Maybe Prelude.Text,
ListAlerts -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListAlerts -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
}
deriving (ListAlerts -> ListAlerts -> Bool
(ListAlerts -> ListAlerts -> Bool)
-> (ListAlerts -> ListAlerts -> Bool) -> Eq ListAlerts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAlerts -> ListAlerts -> Bool
$c/= :: ListAlerts -> ListAlerts -> Bool
== :: ListAlerts -> ListAlerts -> Bool
$c== :: ListAlerts -> ListAlerts -> Bool
Prelude.Eq, ReadPrec [ListAlerts]
ReadPrec ListAlerts
Int -> ReadS ListAlerts
ReadS [ListAlerts]
(Int -> ReadS ListAlerts)
-> ReadS [ListAlerts]
-> ReadPrec ListAlerts
-> ReadPrec [ListAlerts]
-> Read ListAlerts
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAlerts]
$creadListPrec :: ReadPrec [ListAlerts]
readPrec :: ReadPrec ListAlerts
$creadPrec :: ReadPrec ListAlerts
readList :: ReadS [ListAlerts]
$creadList :: ReadS [ListAlerts]
readsPrec :: Int -> ReadS ListAlerts
$creadsPrec :: Int -> ReadS ListAlerts
Prelude.Read, Int -> ListAlerts -> ShowS
[ListAlerts] -> ShowS
ListAlerts -> String
(Int -> ListAlerts -> ShowS)
-> (ListAlerts -> String)
-> ([ListAlerts] -> ShowS)
-> Show ListAlerts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAlerts] -> ShowS
$cshowList :: [ListAlerts] -> ShowS
show :: ListAlerts -> String
$cshow :: ListAlerts -> String
showsPrec :: Int -> ListAlerts -> ShowS
$cshowsPrec :: Int -> ListAlerts -> ShowS
Prelude.Show, (forall x. ListAlerts -> Rep ListAlerts x)
-> (forall x. Rep ListAlerts x -> ListAlerts) -> Generic ListAlerts
forall x. Rep ListAlerts x -> ListAlerts
forall x. ListAlerts -> Rep ListAlerts x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListAlerts x -> ListAlerts
$cfrom :: forall x. ListAlerts -> Rep ListAlerts x
Prelude.Generic)
newListAlerts ::
ListAlerts
newListAlerts :: ListAlerts
newListAlerts =
ListAlerts' :: Maybe Text -> Maybe Text -> Maybe Natural -> ListAlerts
ListAlerts'
{ $sel:anomalyDetectorArn:ListAlerts' :: Maybe Text
anomalyDetectorArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListAlerts' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListAlerts' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
listAlerts_anomalyDetectorArn :: Lens.Lens' ListAlerts (Prelude.Maybe Prelude.Text)
listAlerts_anomalyDetectorArn :: (Maybe Text -> f (Maybe Text)) -> ListAlerts -> f ListAlerts
listAlerts_anomalyDetectorArn = (ListAlerts -> Maybe Text)
-> (ListAlerts -> Maybe Text -> ListAlerts)
-> Lens ListAlerts ListAlerts (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAlerts' {Maybe Text
anomalyDetectorArn :: Maybe Text
$sel:anomalyDetectorArn:ListAlerts' :: ListAlerts -> Maybe Text
anomalyDetectorArn} -> Maybe Text
anomalyDetectorArn) (\s :: ListAlerts
s@ListAlerts' {} Maybe Text
a -> ListAlerts
s {$sel:anomalyDetectorArn:ListAlerts' :: Maybe Text
anomalyDetectorArn = Maybe Text
a} :: ListAlerts)
listAlerts_nextToken :: Lens.Lens' ListAlerts (Prelude.Maybe Prelude.Text)
listAlerts_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListAlerts -> f ListAlerts
listAlerts_nextToken = (ListAlerts -> Maybe Text)
-> (ListAlerts -> Maybe Text -> ListAlerts)
-> Lens ListAlerts ListAlerts (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAlerts' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAlerts' :: ListAlerts -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAlerts
s@ListAlerts' {} Maybe Text
a -> ListAlerts
s {$sel:nextToken:ListAlerts' :: Maybe Text
nextToken = Maybe Text
a} :: ListAlerts)
listAlerts_maxResults :: Lens.Lens' ListAlerts (Prelude.Maybe Prelude.Natural)
listAlerts_maxResults :: (Maybe Natural -> f (Maybe Natural)) -> ListAlerts -> f ListAlerts
listAlerts_maxResults = (ListAlerts -> Maybe Natural)
-> (ListAlerts -> Maybe Natural -> ListAlerts)
-> Lens ListAlerts ListAlerts (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAlerts' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListAlerts' :: ListAlerts -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListAlerts
s@ListAlerts' {} Maybe Natural
a -> ListAlerts
s {$sel:maxResults:ListAlerts' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListAlerts)
instance Core.AWSRequest ListAlerts where
type AWSResponse ListAlerts = ListAlertsResponse
request :: ListAlerts -> Request ListAlerts
request = Service -> ListAlerts -> Request ListAlerts
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ListAlerts
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListAlerts)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListAlerts))
-> Logger
-> Service
-> Proxy ListAlerts
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListAlerts)))
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 Text -> Maybe [AlertSummary] -> Int -> ListAlertsResponse
ListAlertsResponse'
(Maybe Text -> Maybe [AlertSummary] -> Int -> ListAlertsResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe [AlertSummary] -> Int -> ListAlertsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NextToken")
Either String (Maybe [AlertSummary] -> Int -> ListAlertsResponse)
-> Either String (Maybe [AlertSummary])
-> Either String (Int -> ListAlertsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Either String (Maybe (Maybe [AlertSummary]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"AlertSummaryList"
Either String (Maybe (Maybe [AlertSummary]))
-> Maybe [AlertSummary] -> Either String (Maybe [AlertSummary])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [AlertSummary]
forall a. Monoid a => a
Prelude.mempty
)
Either String (Int -> ListAlertsResponse)
-> Either String Int -> Either String ListAlertsResponse
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 ListAlerts
instance Prelude.NFData ListAlerts
instance Core.ToHeaders ListAlerts where
toHeaders :: ListAlerts -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListAlerts -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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 ListAlerts where
toJSON :: ListAlerts -> Value
toJSON ListAlerts' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
anomalyDetectorArn :: Maybe Text
$sel:maxResults:ListAlerts' :: ListAlerts -> Maybe Natural
$sel:nextToken:ListAlerts' :: ListAlerts -> Maybe Text
$sel:anomalyDetectorArn:ListAlerts' :: ListAlerts -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"AnomalyDetectorArn" 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
anomalyDetectorArn,
(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,
(Text
"MaxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults
]
)
instance Core.ToPath ListAlerts where
toPath :: ListAlerts -> ByteString
toPath = ByteString -> ListAlerts -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/ListAlerts"
instance Core.ToQuery ListAlerts where
toQuery :: ListAlerts -> QueryString
toQuery = QueryString -> ListAlerts -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ListAlertsResponse = ListAlertsResponse'
{
ListAlertsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListAlertsResponse -> Maybe [AlertSummary]
alertSummaryList :: Prelude.Maybe [AlertSummary],
ListAlertsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListAlertsResponse -> ListAlertsResponse -> Bool
(ListAlertsResponse -> ListAlertsResponse -> Bool)
-> (ListAlertsResponse -> ListAlertsResponse -> Bool)
-> Eq ListAlertsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAlertsResponse -> ListAlertsResponse -> Bool
$c/= :: ListAlertsResponse -> ListAlertsResponse -> Bool
== :: ListAlertsResponse -> ListAlertsResponse -> Bool
$c== :: ListAlertsResponse -> ListAlertsResponse -> Bool
Prelude.Eq, ReadPrec [ListAlertsResponse]
ReadPrec ListAlertsResponse
Int -> ReadS ListAlertsResponse
ReadS [ListAlertsResponse]
(Int -> ReadS ListAlertsResponse)
-> ReadS [ListAlertsResponse]
-> ReadPrec ListAlertsResponse
-> ReadPrec [ListAlertsResponse]
-> Read ListAlertsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAlertsResponse]
$creadListPrec :: ReadPrec [ListAlertsResponse]
readPrec :: ReadPrec ListAlertsResponse
$creadPrec :: ReadPrec ListAlertsResponse
readList :: ReadS [ListAlertsResponse]
$creadList :: ReadS [ListAlertsResponse]
readsPrec :: Int -> ReadS ListAlertsResponse
$creadsPrec :: Int -> ReadS ListAlertsResponse
Prelude.Read, Int -> ListAlertsResponse -> ShowS
[ListAlertsResponse] -> ShowS
ListAlertsResponse -> String
(Int -> ListAlertsResponse -> ShowS)
-> (ListAlertsResponse -> String)
-> ([ListAlertsResponse] -> ShowS)
-> Show ListAlertsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAlertsResponse] -> ShowS
$cshowList :: [ListAlertsResponse] -> ShowS
show :: ListAlertsResponse -> String
$cshow :: ListAlertsResponse -> String
showsPrec :: Int -> ListAlertsResponse -> ShowS
$cshowsPrec :: Int -> ListAlertsResponse -> ShowS
Prelude.Show, (forall x. ListAlertsResponse -> Rep ListAlertsResponse x)
-> (forall x. Rep ListAlertsResponse x -> ListAlertsResponse)
-> Generic ListAlertsResponse
forall x. Rep ListAlertsResponse x -> ListAlertsResponse
forall x. ListAlertsResponse -> Rep ListAlertsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListAlertsResponse x -> ListAlertsResponse
$cfrom :: forall x. ListAlertsResponse -> Rep ListAlertsResponse x
Prelude.Generic)
newListAlertsResponse ::
Prelude.Int ->
ListAlertsResponse
newListAlertsResponse :: Int -> ListAlertsResponse
newListAlertsResponse Int
pHttpStatus_ =
ListAlertsResponse' :: Maybe Text -> Maybe [AlertSummary] -> Int -> ListAlertsResponse
ListAlertsResponse'
{ $sel:nextToken:ListAlertsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:alertSummaryList:ListAlertsResponse' :: Maybe [AlertSummary]
alertSummaryList = Maybe [AlertSummary]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListAlertsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listAlertsResponse_nextToken :: Lens.Lens' ListAlertsResponse (Prelude.Maybe Prelude.Text)
listAlertsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListAlertsResponse -> f ListAlertsResponse
listAlertsResponse_nextToken = (ListAlertsResponse -> Maybe Text)
-> (ListAlertsResponse -> Maybe Text -> ListAlertsResponse)
-> Lens
ListAlertsResponse ListAlertsResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAlertsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAlertsResponse' :: ListAlertsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAlertsResponse
s@ListAlertsResponse' {} Maybe Text
a -> ListAlertsResponse
s {$sel:nextToken:ListAlertsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListAlertsResponse)
listAlertsResponse_alertSummaryList :: Lens.Lens' ListAlertsResponse (Prelude.Maybe [AlertSummary])
listAlertsResponse_alertSummaryList :: (Maybe [AlertSummary] -> f (Maybe [AlertSummary]))
-> ListAlertsResponse -> f ListAlertsResponse
listAlertsResponse_alertSummaryList = (ListAlertsResponse -> Maybe [AlertSummary])
-> (ListAlertsResponse
-> Maybe [AlertSummary] -> ListAlertsResponse)
-> Lens
ListAlertsResponse
ListAlertsResponse
(Maybe [AlertSummary])
(Maybe [AlertSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAlertsResponse' {Maybe [AlertSummary]
alertSummaryList :: Maybe [AlertSummary]
$sel:alertSummaryList:ListAlertsResponse' :: ListAlertsResponse -> Maybe [AlertSummary]
alertSummaryList} -> Maybe [AlertSummary]
alertSummaryList) (\s :: ListAlertsResponse
s@ListAlertsResponse' {} Maybe [AlertSummary]
a -> ListAlertsResponse
s {$sel:alertSummaryList:ListAlertsResponse' :: Maybe [AlertSummary]
alertSummaryList = Maybe [AlertSummary]
a} :: ListAlertsResponse) ((Maybe [AlertSummary] -> f (Maybe [AlertSummary]))
-> ListAlertsResponse -> f ListAlertsResponse)
-> ((Maybe [AlertSummary] -> f (Maybe [AlertSummary]))
-> Maybe [AlertSummary] -> f (Maybe [AlertSummary]))
-> (Maybe [AlertSummary] -> f (Maybe [AlertSummary]))
-> ListAlertsResponse
-> f ListAlertsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [AlertSummary] [AlertSummary] [AlertSummary] [AlertSummary]
-> Iso
(Maybe [AlertSummary])
(Maybe [AlertSummary])
(Maybe [AlertSummary])
(Maybe [AlertSummary])
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 AnIso [AlertSummary] [AlertSummary] [AlertSummary] [AlertSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listAlertsResponse_httpStatus :: Lens.Lens' ListAlertsResponse Prelude.Int
listAlertsResponse_httpStatus :: (Int -> f Int) -> ListAlertsResponse -> f ListAlertsResponse
listAlertsResponse_httpStatus = (ListAlertsResponse -> Int)
-> (ListAlertsResponse -> Int -> ListAlertsResponse)
-> Lens ListAlertsResponse ListAlertsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAlertsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListAlertsResponse' :: ListAlertsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListAlertsResponse
s@ListAlertsResponse' {} Int
a -> ListAlertsResponse
s {$sel:httpStatus:ListAlertsResponse' :: Int
httpStatus = Int
a} :: ListAlertsResponse)
instance Prelude.NFData ListAlertsResponse