{-# 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.ListMetricSets
(
ListMetricSets (..),
newListMetricSets,
listMetricSets_anomalyDetectorArn,
listMetricSets_nextToken,
listMetricSets_maxResults,
ListMetricSetsResponse (..),
newListMetricSetsResponse,
listMetricSetsResponse_nextToken,
listMetricSetsResponse_metricSetSummaryList,
listMetricSetsResponse_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 ListMetricSets = ListMetricSets'
{
ListMetricSets -> Maybe Text
anomalyDetectorArn :: Prelude.Maybe Prelude.Text,
ListMetricSets -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListMetricSets -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
}
deriving (ListMetricSets -> ListMetricSets -> Bool
(ListMetricSets -> ListMetricSets -> Bool)
-> (ListMetricSets -> ListMetricSets -> Bool) -> Eq ListMetricSets
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListMetricSets -> ListMetricSets -> Bool
$c/= :: ListMetricSets -> ListMetricSets -> Bool
== :: ListMetricSets -> ListMetricSets -> Bool
$c== :: ListMetricSets -> ListMetricSets -> Bool
Prelude.Eq, ReadPrec [ListMetricSets]
ReadPrec ListMetricSets
Int -> ReadS ListMetricSets
ReadS [ListMetricSets]
(Int -> ReadS ListMetricSets)
-> ReadS [ListMetricSets]
-> ReadPrec ListMetricSets
-> ReadPrec [ListMetricSets]
-> Read ListMetricSets
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListMetricSets]
$creadListPrec :: ReadPrec [ListMetricSets]
readPrec :: ReadPrec ListMetricSets
$creadPrec :: ReadPrec ListMetricSets
readList :: ReadS [ListMetricSets]
$creadList :: ReadS [ListMetricSets]
readsPrec :: Int -> ReadS ListMetricSets
$creadsPrec :: Int -> ReadS ListMetricSets
Prelude.Read, Int -> ListMetricSets -> ShowS
[ListMetricSets] -> ShowS
ListMetricSets -> String
(Int -> ListMetricSets -> ShowS)
-> (ListMetricSets -> String)
-> ([ListMetricSets] -> ShowS)
-> Show ListMetricSets
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListMetricSets] -> ShowS
$cshowList :: [ListMetricSets] -> ShowS
show :: ListMetricSets -> String
$cshow :: ListMetricSets -> String
showsPrec :: Int -> ListMetricSets -> ShowS
$cshowsPrec :: Int -> ListMetricSets -> ShowS
Prelude.Show, (forall x. ListMetricSets -> Rep ListMetricSets x)
-> (forall x. Rep ListMetricSets x -> ListMetricSets)
-> Generic ListMetricSets
forall x. Rep ListMetricSets x -> ListMetricSets
forall x. ListMetricSets -> Rep ListMetricSets x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListMetricSets x -> ListMetricSets
$cfrom :: forall x. ListMetricSets -> Rep ListMetricSets x
Prelude.Generic)
newListMetricSets ::
ListMetricSets
newListMetricSets :: ListMetricSets
newListMetricSets =
ListMetricSets' :: Maybe Text -> Maybe Text -> Maybe Natural -> ListMetricSets
ListMetricSets'
{ $sel:anomalyDetectorArn:ListMetricSets' :: Maybe Text
anomalyDetectorArn =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListMetricSets' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListMetricSets' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
listMetricSets_anomalyDetectorArn :: Lens.Lens' ListMetricSets (Prelude.Maybe Prelude.Text)
listMetricSets_anomalyDetectorArn :: (Maybe Text -> f (Maybe Text))
-> ListMetricSets -> f ListMetricSets
listMetricSets_anomalyDetectorArn = (ListMetricSets -> Maybe Text)
-> (ListMetricSets -> Maybe Text -> ListMetricSets)
-> Lens ListMetricSets ListMetricSets (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMetricSets' {Maybe Text
anomalyDetectorArn :: Maybe Text
$sel:anomalyDetectorArn:ListMetricSets' :: ListMetricSets -> Maybe Text
anomalyDetectorArn} -> Maybe Text
anomalyDetectorArn) (\s :: ListMetricSets
s@ListMetricSets' {} Maybe Text
a -> ListMetricSets
s {$sel:anomalyDetectorArn:ListMetricSets' :: Maybe Text
anomalyDetectorArn = Maybe Text
a} :: ListMetricSets)
listMetricSets_nextToken :: Lens.Lens' ListMetricSets (Prelude.Maybe Prelude.Text)
listMetricSets_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListMetricSets -> f ListMetricSets
listMetricSets_nextToken = (ListMetricSets -> Maybe Text)
-> (ListMetricSets -> Maybe Text -> ListMetricSets)
-> Lens ListMetricSets ListMetricSets (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMetricSets' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListMetricSets' :: ListMetricSets -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListMetricSets
s@ListMetricSets' {} Maybe Text
a -> ListMetricSets
s {$sel:nextToken:ListMetricSets' :: Maybe Text
nextToken = Maybe Text
a} :: ListMetricSets)
listMetricSets_maxResults :: Lens.Lens' ListMetricSets (Prelude.Maybe Prelude.Natural)
listMetricSets_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListMetricSets -> f ListMetricSets
listMetricSets_maxResults = (ListMetricSets -> Maybe Natural)
-> (ListMetricSets -> Maybe Natural -> ListMetricSets)
-> Lens
ListMetricSets ListMetricSets (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMetricSets' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListMetricSets' :: ListMetricSets -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListMetricSets
s@ListMetricSets' {} Maybe Natural
a -> ListMetricSets
s {$sel:maxResults:ListMetricSets' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListMetricSets)
instance Core.AWSRequest ListMetricSets where
type
AWSResponse ListMetricSets =
ListMetricSetsResponse
request :: ListMetricSets -> Request ListMetricSets
request = Service -> ListMetricSets -> Request ListMetricSets
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ListMetricSets
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListMetricSets)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListMetricSets))
-> Logger
-> Service
-> Proxy ListMetricSets
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListMetricSets)))
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 [MetricSetSummary] -> Int -> ListMetricSetsResponse
ListMetricSetsResponse'
(Maybe Text
-> Maybe [MetricSetSummary] -> Int -> ListMetricSetsResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe [MetricSetSummary] -> Int -> ListMetricSetsResponse)
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 [MetricSetSummary] -> Int -> ListMetricSetsResponse)
-> Either String (Maybe [MetricSetSummary])
-> Either String (Int -> ListMetricSetsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Either String (Maybe (Maybe [MetricSetSummary]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"MetricSetSummaryList"
Either String (Maybe (Maybe [MetricSetSummary]))
-> Maybe [MetricSetSummary]
-> Either String (Maybe [MetricSetSummary])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [MetricSetSummary]
forall a. Monoid a => a
Prelude.mempty
)
Either String (Int -> ListMetricSetsResponse)
-> Either String Int -> Either String ListMetricSetsResponse
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 ListMetricSets
instance Prelude.NFData ListMetricSets
instance Core.ToHeaders ListMetricSets where
toHeaders :: ListMetricSets -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListMetricSets -> 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 ListMetricSets where
toJSON :: ListMetricSets -> Value
toJSON ListMetricSets' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
anomalyDetectorArn :: Maybe Text
$sel:maxResults:ListMetricSets' :: ListMetricSets -> Maybe Natural
$sel:nextToken:ListMetricSets' :: ListMetricSets -> Maybe Text
$sel:anomalyDetectorArn:ListMetricSets' :: ListMetricSets -> 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 ListMetricSets where
toPath :: ListMetricSets -> ByteString
toPath = ByteString -> ListMetricSets -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/ListMetricSets"
instance Core.ToQuery ListMetricSets where
toQuery :: ListMetricSets -> QueryString
toQuery = QueryString -> ListMetricSets -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ListMetricSetsResponse = ListMetricSetsResponse'
{
ListMetricSetsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListMetricSetsResponse -> Maybe [MetricSetSummary]
metricSetSummaryList :: Prelude.Maybe [MetricSetSummary],
ListMetricSetsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListMetricSetsResponse -> ListMetricSetsResponse -> Bool
(ListMetricSetsResponse -> ListMetricSetsResponse -> Bool)
-> (ListMetricSetsResponse -> ListMetricSetsResponse -> Bool)
-> Eq ListMetricSetsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListMetricSetsResponse -> ListMetricSetsResponse -> Bool
$c/= :: ListMetricSetsResponse -> ListMetricSetsResponse -> Bool
== :: ListMetricSetsResponse -> ListMetricSetsResponse -> Bool
$c== :: ListMetricSetsResponse -> ListMetricSetsResponse -> Bool
Prelude.Eq, ReadPrec [ListMetricSetsResponse]
ReadPrec ListMetricSetsResponse
Int -> ReadS ListMetricSetsResponse
ReadS [ListMetricSetsResponse]
(Int -> ReadS ListMetricSetsResponse)
-> ReadS [ListMetricSetsResponse]
-> ReadPrec ListMetricSetsResponse
-> ReadPrec [ListMetricSetsResponse]
-> Read ListMetricSetsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListMetricSetsResponse]
$creadListPrec :: ReadPrec [ListMetricSetsResponse]
readPrec :: ReadPrec ListMetricSetsResponse
$creadPrec :: ReadPrec ListMetricSetsResponse
readList :: ReadS [ListMetricSetsResponse]
$creadList :: ReadS [ListMetricSetsResponse]
readsPrec :: Int -> ReadS ListMetricSetsResponse
$creadsPrec :: Int -> ReadS ListMetricSetsResponse
Prelude.Read, Int -> ListMetricSetsResponse -> ShowS
[ListMetricSetsResponse] -> ShowS
ListMetricSetsResponse -> String
(Int -> ListMetricSetsResponse -> ShowS)
-> (ListMetricSetsResponse -> String)
-> ([ListMetricSetsResponse] -> ShowS)
-> Show ListMetricSetsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListMetricSetsResponse] -> ShowS
$cshowList :: [ListMetricSetsResponse] -> ShowS
show :: ListMetricSetsResponse -> String
$cshow :: ListMetricSetsResponse -> String
showsPrec :: Int -> ListMetricSetsResponse -> ShowS
$cshowsPrec :: Int -> ListMetricSetsResponse -> ShowS
Prelude.Show, (forall x. ListMetricSetsResponse -> Rep ListMetricSetsResponse x)
-> (forall x.
Rep ListMetricSetsResponse x -> ListMetricSetsResponse)
-> Generic ListMetricSetsResponse
forall x. Rep ListMetricSetsResponse x -> ListMetricSetsResponse
forall x. ListMetricSetsResponse -> Rep ListMetricSetsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListMetricSetsResponse x -> ListMetricSetsResponse
$cfrom :: forall x. ListMetricSetsResponse -> Rep ListMetricSetsResponse x
Prelude.Generic)
newListMetricSetsResponse ::
Prelude.Int ->
ListMetricSetsResponse
newListMetricSetsResponse :: Int -> ListMetricSetsResponse
newListMetricSetsResponse Int
pHttpStatus_ =
ListMetricSetsResponse' :: Maybe Text
-> Maybe [MetricSetSummary] -> Int -> ListMetricSetsResponse
ListMetricSetsResponse'
{ $sel:nextToken:ListMetricSetsResponse' :: Maybe Text
nextToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:metricSetSummaryList:ListMetricSetsResponse' :: Maybe [MetricSetSummary]
metricSetSummaryList = Maybe [MetricSetSummary]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListMetricSetsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listMetricSetsResponse_nextToken :: Lens.Lens' ListMetricSetsResponse (Prelude.Maybe Prelude.Text)
listMetricSetsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListMetricSetsResponse -> f ListMetricSetsResponse
listMetricSetsResponse_nextToken = (ListMetricSetsResponse -> Maybe Text)
-> (ListMetricSetsResponse -> Maybe Text -> ListMetricSetsResponse)
-> Lens
ListMetricSetsResponse
ListMetricSetsResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMetricSetsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListMetricSetsResponse' :: ListMetricSetsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListMetricSetsResponse
s@ListMetricSetsResponse' {} Maybe Text
a -> ListMetricSetsResponse
s {$sel:nextToken:ListMetricSetsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListMetricSetsResponse)
listMetricSetsResponse_metricSetSummaryList :: Lens.Lens' ListMetricSetsResponse (Prelude.Maybe [MetricSetSummary])
listMetricSetsResponse_metricSetSummaryList :: (Maybe [MetricSetSummary] -> f (Maybe [MetricSetSummary]))
-> ListMetricSetsResponse -> f ListMetricSetsResponse
listMetricSetsResponse_metricSetSummaryList = (ListMetricSetsResponse -> Maybe [MetricSetSummary])
-> (ListMetricSetsResponse
-> Maybe [MetricSetSummary] -> ListMetricSetsResponse)
-> Lens
ListMetricSetsResponse
ListMetricSetsResponse
(Maybe [MetricSetSummary])
(Maybe [MetricSetSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMetricSetsResponse' {Maybe [MetricSetSummary]
metricSetSummaryList :: Maybe [MetricSetSummary]
$sel:metricSetSummaryList:ListMetricSetsResponse' :: ListMetricSetsResponse -> Maybe [MetricSetSummary]
metricSetSummaryList} -> Maybe [MetricSetSummary]
metricSetSummaryList) (\s :: ListMetricSetsResponse
s@ListMetricSetsResponse' {} Maybe [MetricSetSummary]
a -> ListMetricSetsResponse
s {$sel:metricSetSummaryList:ListMetricSetsResponse' :: Maybe [MetricSetSummary]
metricSetSummaryList = Maybe [MetricSetSummary]
a} :: ListMetricSetsResponse) ((Maybe [MetricSetSummary] -> f (Maybe [MetricSetSummary]))
-> ListMetricSetsResponse -> f ListMetricSetsResponse)
-> ((Maybe [MetricSetSummary] -> f (Maybe [MetricSetSummary]))
-> Maybe [MetricSetSummary] -> f (Maybe [MetricSetSummary]))
-> (Maybe [MetricSetSummary] -> f (Maybe [MetricSetSummary]))
-> ListMetricSetsResponse
-> f ListMetricSetsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[MetricSetSummary]
[MetricSetSummary]
[MetricSetSummary]
[MetricSetSummary]
-> Iso
(Maybe [MetricSetSummary])
(Maybe [MetricSetSummary])
(Maybe [MetricSetSummary])
(Maybe [MetricSetSummary])
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
[MetricSetSummary]
[MetricSetSummary]
[MetricSetSummary]
[MetricSetSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listMetricSetsResponse_httpStatus :: Lens.Lens' ListMetricSetsResponse Prelude.Int
listMetricSetsResponse_httpStatus :: (Int -> f Int)
-> ListMetricSetsResponse -> f ListMetricSetsResponse
listMetricSetsResponse_httpStatus = (ListMetricSetsResponse -> Int)
-> (ListMetricSetsResponse -> Int -> ListMetricSetsResponse)
-> Lens ListMetricSetsResponse ListMetricSetsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMetricSetsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListMetricSetsResponse' :: ListMetricSetsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListMetricSetsResponse
s@ListMetricSetsResponse' {} Int
a -> ListMetricSetsResponse
s {$sel:httpStatus:ListMetricSetsResponse' :: Int
httpStatus = Int
a} :: ListMetricSetsResponse)
instance Prelude.NFData ListMetricSetsResponse