{-# 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.Lightsail.GetAlarms
(
GetAlarms (..),
newGetAlarms,
getAlarms_alarmName,
getAlarms_monitoredResourceName,
getAlarms_pageToken,
GetAlarmsResponse (..),
newGetAlarmsResponse,
getAlarmsResponse_nextPageToken,
getAlarmsResponse_alarms,
getAlarmsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Lightsail.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetAlarms = GetAlarms'
{
GetAlarms -> Maybe Text
alarmName :: Prelude.Maybe Prelude.Text,
GetAlarms -> Maybe Text
monitoredResourceName :: Prelude.Maybe Prelude.Text,
GetAlarms -> Maybe Text
pageToken :: Prelude.Maybe Prelude.Text
}
deriving (GetAlarms -> GetAlarms -> Bool
(GetAlarms -> GetAlarms -> Bool)
-> (GetAlarms -> GetAlarms -> Bool) -> Eq GetAlarms
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAlarms -> GetAlarms -> Bool
$c/= :: GetAlarms -> GetAlarms -> Bool
== :: GetAlarms -> GetAlarms -> Bool
$c== :: GetAlarms -> GetAlarms -> Bool
Prelude.Eq, ReadPrec [GetAlarms]
ReadPrec GetAlarms
Int -> ReadS GetAlarms
ReadS [GetAlarms]
(Int -> ReadS GetAlarms)
-> ReadS [GetAlarms]
-> ReadPrec GetAlarms
-> ReadPrec [GetAlarms]
-> Read GetAlarms
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetAlarms]
$creadListPrec :: ReadPrec [GetAlarms]
readPrec :: ReadPrec GetAlarms
$creadPrec :: ReadPrec GetAlarms
readList :: ReadS [GetAlarms]
$creadList :: ReadS [GetAlarms]
readsPrec :: Int -> ReadS GetAlarms
$creadsPrec :: Int -> ReadS GetAlarms
Prelude.Read, Int -> GetAlarms -> ShowS
[GetAlarms] -> ShowS
GetAlarms -> String
(Int -> GetAlarms -> ShowS)
-> (GetAlarms -> String)
-> ([GetAlarms] -> ShowS)
-> Show GetAlarms
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetAlarms] -> ShowS
$cshowList :: [GetAlarms] -> ShowS
show :: GetAlarms -> String
$cshow :: GetAlarms -> String
showsPrec :: Int -> GetAlarms -> ShowS
$cshowsPrec :: Int -> GetAlarms -> ShowS
Prelude.Show, (forall x. GetAlarms -> Rep GetAlarms x)
-> (forall x. Rep GetAlarms x -> GetAlarms) -> Generic GetAlarms
forall x. Rep GetAlarms x -> GetAlarms
forall x. GetAlarms -> Rep GetAlarms x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetAlarms x -> GetAlarms
$cfrom :: forall x. GetAlarms -> Rep GetAlarms x
Prelude.Generic)
newGetAlarms ::
GetAlarms
newGetAlarms :: GetAlarms
newGetAlarms =
GetAlarms' :: Maybe Text -> Maybe Text -> Maybe Text -> GetAlarms
GetAlarms'
{ $sel:alarmName:GetAlarms' :: Maybe Text
alarmName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:monitoredResourceName:GetAlarms' :: Maybe Text
monitoredResourceName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:pageToken:GetAlarms' :: Maybe Text
pageToken = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
getAlarms_alarmName :: Lens.Lens' GetAlarms (Prelude.Maybe Prelude.Text)
getAlarms_alarmName :: (Maybe Text -> f (Maybe Text)) -> GetAlarms -> f GetAlarms
getAlarms_alarmName = (GetAlarms -> Maybe Text)
-> (GetAlarms -> Maybe Text -> GetAlarms)
-> Lens GetAlarms GetAlarms (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAlarms' {Maybe Text
alarmName :: Maybe Text
$sel:alarmName:GetAlarms' :: GetAlarms -> Maybe Text
alarmName} -> Maybe Text
alarmName) (\s :: GetAlarms
s@GetAlarms' {} Maybe Text
a -> GetAlarms
s {$sel:alarmName:GetAlarms' :: Maybe Text
alarmName = Maybe Text
a} :: GetAlarms)
getAlarms_monitoredResourceName :: Lens.Lens' GetAlarms (Prelude.Maybe Prelude.Text)
getAlarms_monitoredResourceName :: (Maybe Text -> f (Maybe Text)) -> GetAlarms -> f GetAlarms
getAlarms_monitoredResourceName = (GetAlarms -> Maybe Text)
-> (GetAlarms -> Maybe Text -> GetAlarms)
-> Lens GetAlarms GetAlarms (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAlarms' {Maybe Text
monitoredResourceName :: Maybe Text
$sel:monitoredResourceName:GetAlarms' :: GetAlarms -> Maybe Text
monitoredResourceName} -> Maybe Text
monitoredResourceName) (\s :: GetAlarms
s@GetAlarms' {} Maybe Text
a -> GetAlarms
s {$sel:monitoredResourceName:GetAlarms' :: Maybe Text
monitoredResourceName = Maybe Text
a} :: GetAlarms)
getAlarms_pageToken :: Lens.Lens' GetAlarms (Prelude.Maybe Prelude.Text)
getAlarms_pageToken :: (Maybe Text -> f (Maybe Text)) -> GetAlarms -> f GetAlarms
getAlarms_pageToken = (GetAlarms -> Maybe Text)
-> (GetAlarms -> Maybe Text -> GetAlarms)
-> Lens GetAlarms GetAlarms (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAlarms' {Maybe Text
pageToken :: Maybe Text
$sel:pageToken:GetAlarms' :: GetAlarms -> Maybe Text
pageToken} -> Maybe Text
pageToken) (\s :: GetAlarms
s@GetAlarms' {} Maybe Text
a -> GetAlarms
s {$sel:pageToken:GetAlarms' :: Maybe Text
pageToken = Maybe Text
a} :: GetAlarms)
instance Core.AWSRequest GetAlarms where
type AWSResponse GetAlarms = GetAlarmsResponse
request :: GetAlarms -> Request GetAlarms
request = Service -> GetAlarms -> Request GetAlarms
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetAlarms
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetAlarms)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetAlarms))
-> Logger
-> Service
-> Proxy GetAlarms
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetAlarms)))
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 [Alarm] -> Int -> GetAlarmsResponse
GetAlarmsResponse'
(Maybe Text -> Maybe [Alarm] -> Int -> GetAlarmsResponse)
-> Either String (Maybe Text)
-> Either String (Maybe [Alarm] -> Int -> GetAlarmsResponse)
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
"nextPageToken")
Either String (Maybe [Alarm] -> Int -> GetAlarmsResponse)
-> Either String (Maybe [Alarm])
-> Either String (Int -> GetAlarmsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [Alarm]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"alarms" Either String (Maybe (Maybe [Alarm]))
-> Maybe [Alarm] -> Either String (Maybe [Alarm])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Alarm]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> GetAlarmsResponse)
-> Either String Int -> Either String GetAlarmsResponse
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 GetAlarms
instance Prelude.NFData GetAlarms
instance Core.ToHeaders GetAlarms where
toHeaders :: GetAlarms -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetAlarms -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"Lightsail_20161128.GetAlarms" ::
Prelude.ByteString
),
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 GetAlarms where
toJSON :: GetAlarms -> Value
toJSON GetAlarms' {Maybe Text
pageToken :: Maybe Text
monitoredResourceName :: Maybe Text
alarmName :: Maybe Text
$sel:pageToken:GetAlarms' :: GetAlarms -> Maybe Text
$sel:monitoredResourceName:GetAlarms' :: GetAlarms -> Maybe Text
$sel:alarmName:GetAlarms' :: GetAlarms -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"alarmName" 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
alarmName,
(Text
"monitoredResourceName" 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
monitoredResourceName,
(Text
"pageToken" 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
pageToken
]
)
instance Core.ToPath GetAlarms where
toPath :: GetAlarms -> ByteString
toPath = ByteString -> GetAlarms -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetAlarms where
toQuery :: GetAlarms -> QueryString
toQuery = QueryString -> GetAlarms -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetAlarmsResponse = GetAlarmsResponse'
{
GetAlarmsResponse -> Maybe Text
nextPageToken :: Prelude.Maybe Prelude.Text,
GetAlarmsResponse -> Maybe [Alarm]
alarms :: Prelude.Maybe [Alarm],
GetAlarmsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetAlarmsResponse -> GetAlarmsResponse -> Bool
(GetAlarmsResponse -> GetAlarmsResponse -> Bool)
-> (GetAlarmsResponse -> GetAlarmsResponse -> Bool)
-> Eq GetAlarmsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAlarmsResponse -> GetAlarmsResponse -> Bool
$c/= :: GetAlarmsResponse -> GetAlarmsResponse -> Bool
== :: GetAlarmsResponse -> GetAlarmsResponse -> Bool
$c== :: GetAlarmsResponse -> GetAlarmsResponse -> Bool
Prelude.Eq, ReadPrec [GetAlarmsResponse]
ReadPrec GetAlarmsResponse
Int -> ReadS GetAlarmsResponse
ReadS [GetAlarmsResponse]
(Int -> ReadS GetAlarmsResponse)
-> ReadS [GetAlarmsResponse]
-> ReadPrec GetAlarmsResponse
-> ReadPrec [GetAlarmsResponse]
-> Read GetAlarmsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetAlarmsResponse]
$creadListPrec :: ReadPrec [GetAlarmsResponse]
readPrec :: ReadPrec GetAlarmsResponse
$creadPrec :: ReadPrec GetAlarmsResponse
readList :: ReadS [GetAlarmsResponse]
$creadList :: ReadS [GetAlarmsResponse]
readsPrec :: Int -> ReadS GetAlarmsResponse
$creadsPrec :: Int -> ReadS GetAlarmsResponse
Prelude.Read, Int -> GetAlarmsResponse -> ShowS
[GetAlarmsResponse] -> ShowS
GetAlarmsResponse -> String
(Int -> GetAlarmsResponse -> ShowS)
-> (GetAlarmsResponse -> String)
-> ([GetAlarmsResponse] -> ShowS)
-> Show GetAlarmsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetAlarmsResponse] -> ShowS
$cshowList :: [GetAlarmsResponse] -> ShowS
show :: GetAlarmsResponse -> String
$cshow :: GetAlarmsResponse -> String
showsPrec :: Int -> GetAlarmsResponse -> ShowS
$cshowsPrec :: Int -> GetAlarmsResponse -> ShowS
Prelude.Show, (forall x. GetAlarmsResponse -> Rep GetAlarmsResponse x)
-> (forall x. Rep GetAlarmsResponse x -> GetAlarmsResponse)
-> Generic GetAlarmsResponse
forall x. Rep GetAlarmsResponse x -> GetAlarmsResponse
forall x. GetAlarmsResponse -> Rep GetAlarmsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetAlarmsResponse x -> GetAlarmsResponse
$cfrom :: forall x. GetAlarmsResponse -> Rep GetAlarmsResponse x
Prelude.Generic)
newGetAlarmsResponse ::
Prelude.Int ->
GetAlarmsResponse
newGetAlarmsResponse :: Int -> GetAlarmsResponse
newGetAlarmsResponse Int
pHttpStatus_ =
GetAlarmsResponse' :: Maybe Text -> Maybe [Alarm] -> Int -> GetAlarmsResponse
GetAlarmsResponse'
{ $sel:nextPageToken:GetAlarmsResponse' :: Maybe Text
nextPageToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:alarms:GetAlarmsResponse' :: Maybe [Alarm]
alarms = Maybe [Alarm]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetAlarmsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getAlarmsResponse_nextPageToken :: Lens.Lens' GetAlarmsResponse (Prelude.Maybe Prelude.Text)
getAlarmsResponse_nextPageToken :: (Maybe Text -> f (Maybe Text))
-> GetAlarmsResponse -> f GetAlarmsResponse
getAlarmsResponse_nextPageToken = (GetAlarmsResponse -> Maybe Text)
-> (GetAlarmsResponse -> Maybe Text -> GetAlarmsResponse)
-> Lens
GetAlarmsResponse GetAlarmsResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAlarmsResponse' {Maybe Text
nextPageToken :: Maybe Text
$sel:nextPageToken:GetAlarmsResponse' :: GetAlarmsResponse -> Maybe Text
nextPageToken} -> Maybe Text
nextPageToken) (\s :: GetAlarmsResponse
s@GetAlarmsResponse' {} Maybe Text
a -> GetAlarmsResponse
s {$sel:nextPageToken:GetAlarmsResponse' :: Maybe Text
nextPageToken = Maybe Text
a} :: GetAlarmsResponse)
getAlarmsResponse_alarms :: Lens.Lens' GetAlarmsResponse (Prelude.Maybe [Alarm])
getAlarmsResponse_alarms :: (Maybe [Alarm] -> f (Maybe [Alarm]))
-> GetAlarmsResponse -> f GetAlarmsResponse
getAlarmsResponse_alarms = (GetAlarmsResponse -> Maybe [Alarm])
-> (GetAlarmsResponse -> Maybe [Alarm] -> GetAlarmsResponse)
-> Lens
GetAlarmsResponse GetAlarmsResponse (Maybe [Alarm]) (Maybe [Alarm])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAlarmsResponse' {Maybe [Alarm]
alarms :: Maybe [Alarm]
$sel:alarms:GetAlarmsResponse' :: GetAlarmsResponse -> Maybe [Alarm]
alarms} -> Maybe [Alarm]
alarms) (\s :: GetAlarmsResponse
s@GetAlarmsResponse' {} Maybe [Alarm]
a -> GetAlarmsResponse
s {$sel:alarms:GetAlarmsResponse' :: Maybe [Alarm]
alarms = Maybe [Alarm]
a} :: GetAlarmsResponse) ((Maybe [Alarm] -> f (Maybe [Alarm]))
-> GetAlarmsResponse -> f GetAlarmsResponse)
-> ((Maybe [Alarm] -> f (Maybe [Alarm]))
-> Maybe [Alarm] -> f (Maybe [Alarm]))
-> (Maybe [Alarm] -> f (Maybe [Alarm]))
-> GetAlarmsResponse
-> f GetAlarmsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Alarm] [Alarm] [Alarm] [Alarm]
-> Iso
(Maybe [Alarm]) (Maybe [Alarm]) (Maybe [Alarm]) (Maybe [Alarm])
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 [Alarm] [Alarm] [Alarm] [Alarm]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getAlarmsResponse_httpStatus :: Lens.Lens' GetAlarmsResponse Prelude.Int
getAlarmsResponse_httpStatus :: (Int -> f Int) -> GetAlarmsResponse -> f GetAlarmsResponse
getAlarmsResponse_httpStatus = (GetAlarmsResponse -> Int)
-> (GetAlarmsResponse -> Int -> GetAlarmsResponse)
-> Lens GetAlarmsResponse GetAlarmsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAlarmsResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetAlarmsResponse' :: GetAlarmsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetAlarmsResponse
s@GetAlarmsResponse' {} Int
a -> GetAlarmsResponse
s {$sel:httpStatus:GetAlarmsResponse' :: Int
httpStatus = Int
a} :: GetAlarmsResponse)
instance Prelude.NFData GetAlarmsResponse