{-# 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.IoTEventsData.ListAlarms
(
ListAlarms (..),
newListAlarms,
listAlarms_nextToken,
listAlarms_maxResults,
listAlarms_alarmModelName,
ListAlarmsResponse (..),
newListAlarmsResponse,
listAlarmsResponse_nextToken,
listAlarmsResponse_alarmSummaries,
listAlarmsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.IoTEventsData.Types
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 ListAlarms = ListAlarms'
{
ListAlarms -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListAlarms -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListAlarms -> Text
alarmModelName :: Prelude.Text
}
deriving (ListAlarms -> ListAlarms -> Bool
(ListAlarms -> ListAlarms -> Bool)
-> (ListAlarms -> ListAlarms -> Bool) -> Eq ListAlarms
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAlarms -> ListAlarms -> Bool
$c/= :: ListAlarms -> ListAlarms -> Bool
== :: ListAlarms -> ListAlarms -> Bool
$c== :: ListAlarms -> ListAlarms -> Bool
Prelude.Eq, ReadPrec [ListAlarms]
ReadPrec ListAlarms
Int -> ReadS ListAlarms
ReadS [ListAlarms]
(Int -> ReadS ListAlarms)
-> ReadS [ListAlarms]
-> ReadPrec ListAlarms
-> ReadPrec [ListAlarms]
-> Read ListAlarms
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAlarms]
$creadListPrec :: ReadPrec [ListAlarms]
readPrec :: ReadPrec ListAlarms
$creadPrec :: ReadPrec ListAlarms
readList :: ReadS [ListAlarms]
$creadList :: ReadS [ListAlarms]
readsPrec :: Int -> ReadS ListAlarms
$creadsPrec :: Int -> ReadS ListAlarms
Prelude.Read, Int -> ListAlarms -> ShowS
[ListAlarms] -> ShowS
ListAlarms -> String
(Int -> ListAlarms -> ShowS)
-> (ListAlarms -> String)
-> ([ListAlarms] -> ShowS)
-> Show ListAlarms
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAlarms] -> ShowS
$cshowList :: [ListAlarms] -> ShowS
show :: ListAlarms -> String
$cshow :: ListAlarms -> String
showsPrec :: Int -> ListAlarms -> ShowS
$cshowsPrec :: Int -> ListAlarms -> ShowS
Prelude.Show, (forall x. ListAlarms -> Rep ListAlarms x)
-> (forall x. Rep ListAlarms x -> ListAlarms) -> Generic ListAlarms
forall x. Rep ListAlarms x -> ListAlarms
forall x. ListAlarms -> Rep ListAlarms x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListAlarms x -> ListAlarms
$cfrom :: forall x. ListAlarms -> Rep ListAlarms x
Prelude.Generic)
newListAlarms ::
Prelude.Text ->
ListAlarms
newListAlarms :: Text -> ListAlarms
newListAlarms Text
pAlarmModelName_ =
ListAlarms' :: Maybe Text -> Maybe Natural -> Text -> ListAlarms
ListAlarms'
{ $sel:nextToken:ListAlarms' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListAlarms' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:alarmModelName:ListAlarms' :: Text
alarmModelName = Text
pAlarmModelName_
}
listAlarms_nextToken :: Lens.Lens' ListAlarms (Prelude.Maybe Prelude.Text)
listAlarms_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListAlarms -> f ListAlarms
listAlarms_nextToken = (ListAlarms -> Maybe Text)
-> (ListAlarms -> Maybe Text -> ListAlarms)
-> Lens ListAlarms ListAlarms (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAlarms' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAlarms' :: ListAlarms -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAlarms
s@ListAlarms' {} Maybe Text
a -> ListAlarms
s {$sel:nextToken:ListAlarms' :: Maybe Text
nextToken = Maybe Text
a} :: ListAlarms)
listAlarms_maxResults :: Lens.Lens' ListAlarms (Prelude.Maybe Prelude.Natural)
listAlarms_maxResults :: (Maybe Natural -> f (Maybe Natural)) -> ListAlarms -> f ListAlarms
listAlarms_maxResults = (ListAlarms -> Maybe Natural)
-> (ListAlarms -> Maybe Natural -> ListAlarms)
-> Lens ListAlarms ListAlarms (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAlarms' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListAlarms' :: ListAlarms -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListAlarms
s@ListAlarms' {} Maybe Natural
a -> ListAlarms
s {$sel:maxResults:ListAlarms' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListAlarms)
listAlarms_alarmModelName :: Lens.Lens' ListAlarms Prelude.Text
listAlarms_alarmModelName :: (Text -> f Text) -> ListAlarms -> f ListAlarms
listAlarms_alarmModelName = (ListAlarms -> Text)
-> (ListAlarms -> Text -> ListAlarms)
-> Lens ListAlarms ListAlarms Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAlarms' {Text
alarmModelName :: Text
$sel:alarmModelName:ListAlarms' :: ListAlarms -> Text
alarmModelName} -> Text
alarmModelName) (\s :: ListAlarms
s@ListAlarms' {} Text
a -> ListAlarms
s {$sel:alarmModelName:ListAlarms' :: Text
alarmModelName = Text
a} :: ListAlarms)
instance Core.AWSRequest ListAlarms where
type AWSResponse ListAlarms = ListAlarmsResponse
request :: ListAlarms -> Request ListAlarms
request = Service -> ListAlarms -> Request ListAlarms
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy ListAlarms
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListAlarms)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListAlarms))
-> Logger
-> Service
-> Proxy ListAlarms
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListAlarms)))
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 [AlarmSummary] -> Int -> ListAlarmsResponse
ListAlarmsResponse'
(Maybe Text -> Maybe [AlarmSummary] -> Int -> ListAlarmsResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe [AlarmSummary] -> Int -> ListAlarmsResponse)
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 [AlarmSummary] -> Int -> ListAlarmsResponse)
-> Either String (Maybe [AlarmSummary])
-> Either String (Int -> ListAlarmsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [AlarmSummary]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"alarmSummaries" Either String (Maybe (Maybe [AlarmSummary]))
-> Maybe [AlarmSummary] -> Either String (Maybe [AlarmSummary])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [AlarmSummary]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> ListAlarmsResponse)
-> Either String Int -> Either String ListAlarmsResponse
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 ListAlarms
instance Prelude.NFData ListAlarms
instance Core.ToHeaders ListAlarms where
toHeaders :: ListAlarms -> ResponseHeaders
toHeaders = ResponseHeaders -> ListAlarms -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath ListAlarms where
toPath :: ListAlarms -> ByteString
toPath ListAlarms' {Maybe Natural
Maybe Text
Text
alarmModelName :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:alarmModelName:ListAlarms' :: ListAlarms -> Text
$sel:maxResults:ListAlarms' :: ListAlarms -> Maybe Natural
$sel:nextToken:ListAlarms' :: ListAlarms -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/alarms/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
alarmModelName]
instance Core.ToQuery ListAlarms where
toQuery :: ListAlarms -> QueryString
toQuery ListAlarms' {Maybe Natural
Maybe Text
Text
alarmModelName :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:alarmModelName:ListAlarms' :: ListAlarms -> Text
$sel:maxResults:ListAlarms' :: ListAlarms -> Maybe Natural
$sel:nextToken:ListAlarms' :: ListAlarms -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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 ListAlarmsResponse = ListAlarmsResponse'
{
ListAlarmsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListAlarmsResponse -> Maybe [AlarmSummary]
alarmSummaries :: Prelude.Maybe [AlarmSummary],
ListAlarmsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListAlarmsResponse -> ListAlarmsResponse -> Bool
(ListAlarmsResponse -> ListAlarmsResponse -> Bool)
-> (ListAlarmsResponse -> ListAlarmsResponse -> Bool)
-> Eq ListAlarmsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAlarmsResponse -> ListAlarmsResponse -> Bool
$c/= :: ListAlarmsResponse -> ListAlarmsResponse -> Bool
== :: ListAlarmsResponse -> ListAlarmsResponse -> Bool
$c== :: ListAlarmsResponse -> ListAlarmsResponse -> Bool
Prelude.Eq, ReadPrec [ListAlarmsResponse]
ReadPrec ListAlarmsResponse
Int -> ReadS ListAlarmsResponse
ReadS [ListAlarmsResponse]
(Int -> ReadS ListAlarmsResponse)
-> ReadS [ListAlarmsResponse]
-> ReadPrec ListAlarmsResponse
-> ReadPrec [ListAlarmsResponse]
-> Read ListAlarmsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAlarmsResponse]
$creadListPrec :: ReadPrec [ListAlarmsResponse]
readPrec :: ReadPrec ListAlarmsResponse
$creadPrec :: ReadPrec ListAlarmsResponse
readList :: ReadS [ListAlarmsResponse]
$creadList :: ReadS [ListAlarmsResponse]
readsPrec :: Int -> ReadS ListAlarmsResponse
$creadsPrec :: Int -> ReadS ListAlarmsResponse
Prelude.Read, Int -> ListAlarmsResponse -> ShowS
[ListAlarmsResponse] -> ShowS
ListAlarmsResponse -> String
(Int -> ListAlarmsResponse -> ShowS)
-> (ListAlarmsResponse -> String)
-> ([ListAlarmsResponse] -> ShowS)
-> Show ListAlarmsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAlarmsResponse] -> ShowS
$cshowList :: [ListAlarmsResponse] -> ShowS
show :: ListAlarmsResponse -> String
$cshow :: ListAlarmsResponse -> String
showsPrec :: Int -> ListAlarmsResponse -> ShowS
$cshowsPrec :: Int -> ListAlarmsResponse -> ShowS
Prelude.Show, (forall x. ListAlarmsResponse -> Rep ListAlarmsResponse x)
-> (forall x. Rep ListAlarmsResponse x -> ListAlarmsResponse)
-> Generic ListAlarmsResponse
forall x. Rep ListAlarmsResponse x -> ListAlarmsResponse
forall x. ListAlarmsResponse -> Rep ListAlarmsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListAlarmsResponse x -> ListAlarmsResponse
$cfrom :: forall x. ListAlarmsResponse -> Rep ListAlarmsResponse x
Prelude.Generic)
newListAlarmsResponse ::
Prelude.Int ->
ListAlarmsResponse
newListAlarmsResponse :: Int -> ListAlarmsResponse
newListAlarmsResponse Int
pHttpStatus_ =
ListAlarmsResponse' :: Maybe Text -> Maybe [AlarmSummary] -> Int -> ListAlarmsResponse
ListAlarmsResponse'
{ $sel:nextToken:ListAlarmsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:alarmSummaries:ListAlarmsResponse' :: Maybe [AlarmSummary]
alarmSummaries = Maybe [AlarmSummary]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListAlarmsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listAlarmsResponse_nextToken :: Lens.Lens' ListAlarmsResponse (Prelude.Maybe Prelude.Text)
listAlarmsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListAlarmsResponse -> f ListAlarmsResponse
listAlarmsResponse_nextToken = (ListAlarmsResponse -> Maybe Text)
-> (ListAlarmsResponse -> Maybe Text -> ListAlarmsResponse)
-> Lens
ListAlarmsResponse ListAlarmsResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAlarmsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAlarmsResponse' :: ListAlarmsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAlarmsResponse
s@ListAlarmsResponse' {} Maybe Text
a -> ListAlarmsResponse
s {$sel:nextToken:ListAlarmsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListAlarmsResponse)
listAlarmsResponse_alarmSummaries :: Lens.Lens' ListAlarmsResponse (Prelude.Maybe [AlarmSummary])
listAlarmsResponse_alarmSummaries :: (Maybe [AlarmSummary] -> f (Maybe [AlarmSummary]))
-> ListAlarmsResponse -> f ListAlarmsResponse
listAlarmsResponse_alarmSummaries = (ListAlarmsResponse -> Maybe [AlarmSummary])
-> (ListAlarmsResponse
-> Maybe [AlarmSummary] -> ListAlarmsResponse)
-> Lens
ListAlarmsResponse
ListAlarmsResponse
(Maybe [AlarmSummary])
(Maybe [AlarmSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAlarmsResponse' {Maybe [AlarmSummary]
alarmSummaries :: Maybe [AlarmSummary]
$sel:alarmSummaries:ListAlarmsResponse' :: ListAlarmsResponse -> Maybe [AlarmSummary]
alarmSummaries} -> Maybe [AlarmSummary]
alarmSummaries) (\s :: ListAlarmsResponse
s@ListAlarmsResponse' {} Maybe [AlarmSummary]
a -> ListAlarmsResponse
s {$sel:alarmSummaries:ListAlarmsResponse' :: Maybe [AlarmSummary]
alarmSummaries = Maybe [AlarmSummary]
a} :: ListAlarmsResponse) ((Maybe [AlarmSummary] -> f (Maybe [AlarmSummary]))
-> ListAlarmsResponse -> f ListAlarmsResponse)
-> ((Maybe [AlarmSummary] -> f (Maybe [AlarmSummary]))
-> Maybe [AlarmSummary] -> f (Maybe [AlarmSummary]))
-> (Maybe [AlarmSummary] -> f (Maybe [AlarmSummary]))
-> ListAlarmsResponse
-> f ListAlarmsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [AlarmSummary] [AlarmSummary] [AlarmSummary] [AlarmSummary]
-> Iso
(Maybe [AlarmSummary])
(Maybe [AlarmSummary])
(Maybe [AlarmSummary])
(Maybe [AlarmSummary])
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 [AlarmSummary] [AlarmSummary] [AlarmSummary] [AlarmSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listAlarmsResponse_httpStatus :: Lens.Lens' ListAlarmsResponse Prelude.Int
listAlarmsResponse_httpStatus :: (Int -> f Int) -> ListAlarmsResponse -> f ListAlarmsResponse
listAlarmsResponse_httpStatus = (ListAlarmsResponse -> Int)
-> (ListAlarmsResponse -> Int -> ListAlarmsResponse)
-> Lens ListAlarmsResponse ListAlarmsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAlarmsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListAlarmsResponse' :: ListAlarmsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListAlarmsResponse
s@ListAlarmsResponse' {} Int
a -> ListAlarmsResponse
s {$sel:httpStatus:ListAlarmsResponse' :: Int
httpStatus = Int
a} :: ListAlarmsResponse)
instance Prelude.NFData ListAlarmsResponse