{-# 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.CloudWatch.ListMetricStreams
(
ListMetricStreams (..),
newListMetricStreams,
listMetricStreams_nextToken,
listMetricStreams_maxResults,
ListMetricStreamsResponse (..),
newListMetricStreamsResponse,
listMetricStreamsResponse_entries,
listMetricStreamsResponse_nextToken,
listMetricStreamsResponse_httpStatus,
)
where
import Amazonka.CloudWatch.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListMetricStreams = ListMetricStreams'
{
ListMetricStreams -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListMetricStreams -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
}
deriving (ListMetricStreams -> ListMetricStreams -> Bool
(ListMetricStreams -> ListMetricStreams -> Bool)
-> (ListMetricStreams -> ListMetricStreams -> Bool)
-> Eq ListMetricStreams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListMetricStreams -> ListMetricStreams -> Bool
$c/= :: ListMetricStreams -> ListMetricStreams -> Bool
== :: ListMetricStreams -> ListMetricStreams -> Bool
$c== :: ListMetricStreams -> ListMetricStreams -> Bool
Prelude.Eq, ReadPrec [ListMetricStreams]
ReadPrec ListMetricStreams
Int -> ReadS ListMetricStreams
ReadS [ListMetricStreams]
(Int -> ReadS ListMetricStreams)
-> ReadS [ListMetricStreams]
-> ReadPrec ListMetricStreams
-> ReadPrec [ListMetricStreams]
-> Read ListMetricStreams
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListMetricStreams]
$creadListPrec :: ReadPrec [ListMetricStreams]
readPrec :: ReadPrec ListMetricStreams
$creadPrec :: ReadPrec ListMetricStreams
readList :: ReadS [ListMetricStreams]
$creadList :: ReadS [ListMetricStreams]
readsPrec :: Int -> ReadS ListMetricStreams
$creadsPrec :: Int -> ReadS ListMetricStreams
Prelude.Read, Int -> ListMetricStreams -> ShowS
[ListMetricStreams] -> ShowS
ListMetricStreams -> String
(Int -> ListMetricStreams -> ShowS)
-> (ListMetricStreams -> String)
-> ([ListMetricStreams] -> ShowS)
-> Show ListMetricStreams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListMetricStreams] -> ShowS
$cshowList :: [ListMetricStreams] -> ShowS
show :: ListMetricStreams -> String
$cshow :: ListMetricStreams -> String
showsPrec :: Int -> ListMetricStreams -> ShowS
$cshowsPrec :: Int -> ListMetricStreams -> ShowS
Prelude.Show, (forall x. ListMetricStreams -> Rep ListMetricStreams x)
-> (forall x. Rep ListMetricStreams x -> ListMetricStreams)
-> Generic ListMetricStreams
forall x. Rep ListMetricStreams x -> ListMetricStreams
forall x. ListMetricStreams -> Rep ListMetricStreams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListMetricStreams x -> ListMetricStreams
$cfrom :: forall x. ListMetricStreams -> Rep ListMetricStreams x
Prelude.Generic)
newListMetricStreams ::
ListMetricStreams
newListMetricStreams :: ListMetricStreams
newListMetricStreams =
ListMetricStreams' :: Maybe Text -> Maybe Natural -> ListMetricStreams
ListMetricStreams'
{ $sel:nextToken:ListMetricStreams' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListMetricStreams' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
listMetricStreams_nextToken :: Lens.Lens' ListMetricStreams (Prelude.Maybe Prelude.Text)
listMetricStreams_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListMetricStreams -> f ListMetricStreams
listMetricStreams_nextToken = (ListMetricStreams -> Maybe Text)
-> (ListMetricStreams -> Maybe Text -> ListMetricStreams)
-> Lens
ListMetricStreams ListMetricStreams (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMetricStreams' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListMetricStreams' :: ListMetricStreams -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListMetricStreams
s@ListMetricStreams' {} Maybe Text
a -> ListMetricStreams
s {$sel:nextToken:ListMetricStreams' :: Maybe Text
nextToken = Maybe Text
a} :: ListMetricStreams)
listMetricStreams_maxResults :: Lens.Lens' ListMetricStreams (Prelude.Maybe Prelude.Natural)
listMetricStreams_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListMetricStreams -> f ListMetricStreams
listMetricStreams_maxResults = (ListMetricStreams -> Maybe Natural)
-> (ListMetricStreams -> Maybe Natural -> ListMetricStreams)
-> Lens
ListMetricStreams ListMetricStreams (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMetricStreams' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListMetricStreams' :: ListMetricStreams -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListMetricStreams
s@ListMetricStreams' {} Maybe Natural
a -> ListMetricStreams
s {$sel:maxResults:ListMetricStreams' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListMetricStreams)
instance Core.AWSRequest ListMetricStreams where
type
AWSResponse ListMetricStreams =
ListMetricStreamsResponse
request :: ListMetricStreams -> Request ListMetricStreams
request = Service -> ListMetricStreams -> Request ListMetricStreams
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy ListMetricStreams
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListMetricStreams)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse ListMetricStreams))
-> Logger
-> Service
-> Proxy ListMetricStreams
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListMetricStreams)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
-> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
Text
"ListMetricStreamsResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe [MetricStreamEntry]
-> Maybe Text -> Int -> ListMetricStreamsResponse
ListMetricStreamsResponse'
(Maybe [MetricStreamEntry]
-> Maybe Text -> Int -> ListMetricStreamsResponse)
-> Either String (Maybe [MetricStreamEntry])
-> Either String (Maybe Text -> Int -> ListMetricStreamsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Entries" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
Either String [Node]
-> ([Node] -> Either String (Maybe [MetricStreamEntry]))
-> Either String (Maybe [MetricStreamEntry])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [MetricStreamEntry])
-> [Node] -> Either String (Maybe [MetricStreamEntry])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [MetricStreamEntry]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
)
Either String (Maybe Text -> Int -> ListMetricStreamsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListMetricStreamsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"NextToken")
Either String (Int -> ListMetricStreamsResponse)
-> Either String Int -> Either String ListMetricStreamsResponse
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 ListMetricStreams
instance Prelude.NFData ListMetricStreams
instance Core.ToHeaders ListMetricStreams where
toHeaders :: ListMetricStreams -> ResponseHeaders
toHeaders = ResponseHeaders -> ListMetricStreams -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath ListMetricStreams where
toPath :: ListMetricStreams -> ByteString
toPath = ByteString -> ListMetricStreams -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ListMetricStreams where
toQuery :: ListMetricStreams -> QueryString
toQuery ListMetricStreams' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:maxResults:ListMetricStreams' :: ListMetricStreams -> Maybe Natural
$sel:nextToken:ListMetricStreams' :: ListMetricStreams -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"ListMetricStreams" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-08-01" :: Prelude.ByteString),
ByteString
"NextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
ByteString
"MaxResults" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults
]
data ListMetricStreamsResponse = ListMetricStreamsResponse'
{
ListMetricStreamsResponse -> Maybe [MetricStreamEntry]
entries :: Prelude.Maybe [MetricStreamEntry],
ListMetricStreamsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListMetricStreamsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListMetricStreamsResponse -> ListMetricStreamsResponse -> Bool
(ListMetricStreamsResponse -> ListMetricStreamsResponse -> Bool)
-> (ListMetricStreamsResponse -> ListMetricStreamsResponse -> Bool)
-> Eq ListMetricStreamsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListMetricStreamsResponse -> ListMetricStreamsResponse -> Bool
$c/= :: ListMetricStreamsResponse -> ListMetricStreamsResponse -> Bool
== :: ListMetricStreamsResponse -> ListMetricStreamsResponse -> Bool
$c== :: ListMetricStreamsResponse -> ListMetricStreamsResponse -> Bool
Prelude.Eq, ReadPrec [ListMetricStreamsResponse]
ReadPrec ListMetricStreamsResponse
Int -> ReadS ListMetricStreamsResponse
ReadS [ListMetricStreamsResponse]
(Int -> ReadS ListMetricStreamsResponse)
-> ReadS [ListMetricStreamsResponse]
-> ReadPrec ListMetricStreamsResponse
-> ReadPrec [ListMetricStreamsResponse]
-> Read ListMetricStreamsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListMetricStreamsResponse]
$creadListPrec :: ReadPrec [ListMetricStreamsResponse]
readPrec :: ReadPrec ListMetricStreamsResponse
$creadPrec :: ReadPrec ListMetricStreamsResponse
readList :: ReadS [ListMetricStreamsResponse]
$creadList :: ReadS [ListMetricStreamsResponse]
readsPrec :: Int -> ReadS ListMetricStreamsResponse
$creadsPrec :: Int -> ReadS ListMetricStreamsResponse
Prelude.Read, Int -> ListMetricStreamsResponse -> ShowS
[ListMetricStreamsResponse] -> ShowS
ListMetricStreamsResponse -> String
(Int -> ListMetricStreamsResponse -> ShowS)
-> (ListMetricStreamsResponse -> String)
-> ([ListMetricStreamsResponse] -> ShowS)
-> Show ListMetricStreamsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListMetricStreamsResponse] -> ShowS
$cshowList :: [ListMetricStreamsResponse] -> ShowS
show :: ListMetricStreamsResponse -> String
$cshow :: ListMetricStreamsResponse -> String
showsPrec :: Int -> ListMetricStreamsResponse -> ShowS
$cshowsPrec :: Int -> ListMetricStreamsResponse -> ShowS
Prelude.Show, (forall x.
ListMetricStreamsResponse -> Rep ListMetricStreamsResponse x)
-> (forall x.
Rep ListMetricStreamsResponse x -> ListMetricStreamsResponse)
-> Generic ListMetricStreamsResponse
forall x.
Rep ListMetricStreamsResponse x -> ListMetricStreamsResponse
forall x.
ListMetricStreamsResponse -> Rep ListMetricStreamsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListMetricStreamsResponse x -> ListMetricStreamsResponse
$cfrom :: forall x.
ListMetricStreamsResponse -> Rep ListMetricStreamsResponse x
Prelude.Generic)
newListMetricStreamsResponse ::
Prelude.Int ->
ListMetricStreamsResponse
newListMetricStreamsResponse :: Int -> ListMetricStreamsResponse
newListMetricStreamsResponse Int
pHttpStatus_ =
ListMetricStreamsResponse' :: Maybe [MetricStreamEntry]
-> Maybe Text -> Int -> ListMetricStreamsResponse
ListMetricStreamsResponse'
{ $sel:entries:ListMetricStreamsResponse' :: Maybe [MetricStreamEntry]
entries =
Maybe [MetricStreamEntry]
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListMetricStreamsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListMetricStreamsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listMetricStreamsResponse_entries :: Lens.Lens' ListMetricStreamsResponse (Prelude.Maybe [MetricStreamEntry])
listMetricStreamsResponse_entries :: (Maybe [MetricStreamEntry] -> f (Maybe [MetricStreamEntry]))
-> ListMetricStreamsResponse -> f ListMetricStreamsResponse
listMetricStreamsResponse_entries = (ListMetricStreamsResponse -> Maybe [MetricStreamEntry])
-> (ListMetricStreamsResponse
-> Maybe [MetricStreamEntry] -> ListMetricStreamsResponse)
-> Lens
ListMetricStreamsResponse
ListMetricStreamsResponse
(Maybe [MetricStreamEntry])
(Maybe [MetricStreamEntry])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMetricStreamsResponse' {Maybe [MetricStreamEntry]
entries :: Maybe [MetricStreamEntry]
$sel:entries:ListMetricStreamsResponse' :: ListMetricStreamsResponse -> Maybe [MetricStreamEntry]
entries} -> Maybe [MetricStreamEntry]
entries) (\s :: ListMetricStreamsResponse
s@ListMetricStreamsResponse' {} Maybe [MetricStreamEntry]
a -> ListMetricStreamsResponse
s {$sel:entries:ListMetricStreamsResponse' :: Maybe [MetricStreamEntry]
entries = Maybe [MetricStreamEntry]
a} :: ListMetricStreamsResponse) ((Maybe [MetricStreamEntry] -> f (Maybe [MetricStreamEntry]))
-> ListMetricStreamsResponse -> f ListMetricStreamsResponse)
-> ((Maybe [MetricStreamEntry] -> f (Maybe [MetricStreamEntry]))
-> Maybe [MetricStreamEntry] -> f (Maybe [MetricStreamEntry]))
-> (Maybe [MetricStreamEntry] -> f (Maybe [MetricStreamEntry]))
-> ListMetricStreamsResponse
-> f ListMetricStreamsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[MetricStreamEntry]
[MetricStreamEntry]
[MetricStreamEntry]
[MetricStreamEntry]
-> Iso
(Maybe [MetricStreamEntry])
(Maybe [MetricStreamEntry])
(Maybe [MetricStreamEntry])
(Maybe [MetricStreamEntry])
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
[MetricStreamEntry]
[MetricStreamEntry]
[MetricStreamEntry]
[MetricStreamEntry]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listMetricStreamsResponse_nextToken :: Lens.Lens' ListMetricStreamsResponse (Prelude.Maybe Prelude.Text)
listMetricStreamsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListMetricStreamsResponse -> f ListMetricStreamsResponse
listMetricStreamsResponse_nextToken = (ListMetricStreamsResponse -> Maybe Text)
-> (ListMetricStreamsResponse
-> Maybe Text -> ListMetricStreamsResponse)
-> Lens
ListMetricStreamsResponse
ListMetricStreamsResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMetricStreamsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListMetricStreamsResponse' :: ListMetricStreamsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListMetricStreamsResponse
s@ListMetricStreamsResponse' {} Maybe Text
a -> ListMetricStreamsResponse
s {$sel:nextToken:ListMetricStreamsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListMetricStreamsResponse)
listMetricStreamsResponse_httpStatus :: Lens.Lens' ListMetricStreamsResponse Prelude.Int
listMetricStreamsResponse_httpStatus :: (Int -> f Int)
-> ListMetricStreamsResponse -> f ListMetricStreamsResponse
listMetricStreamsResponse_httpStatus = (ListMetricStreamsResponse -> Int)
-> (ListMetricStreamsResponse -> Int -> ListMetricStreamsResponse)
-> Lens ListMetricStreamsResponse ListMetricStreamsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMetricStreamsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListMetricStreamsResponse' :: ListMetricStreamsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListMetricStreamsResponse
s@ListMetricStreamsResponse' {} Int
a -> ListMetricStreamsResponse
s {$sel:httpStatus:ListMetricStreamsResponse' :: Int
httpStatus = Int
a} :: ListMetricStreamsResponse)
instance Prelude.NFData ListMetricStreamsResponse