{-# 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.TestAlarm
(
TestAlarm (..),
newTestAlarm,
testAlarm_alarmName,
testAlarm_state,
TestAlarmResponse (..),
newTestAlarmResponse,
testAlarmResponse_operations,
testAlarmResponse_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 TestAlarm = TestAlarm'
{
TestAlarm -> Text
alarmName :: Prelude.Text,
TestAlarm -> AlarmState
state :: AlarmState
}
deriving (TestAlarm -> TestAlarm -> Bool
(TestAlarm -> TestAlarm -> Bool)
-> (TestAlarm -> TestAlarm -> Bool) -> Eq TestAlarm
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TestAlarm -> TestAlarm -> Bool
$c/= :: TestAlarm -> TestAlarm -> Bool
== :: TestAlarm -> TestAlarm -> Bool
$c== :: TestAlarm -> TestAlarm -> Bool
Prelude.Eq, ReadPrec [TestAlarm]
ReadPrec TestAlarm
Int -> ReadS TestAlarm
ReadS [TestAlarm]
(Int -> ReadS TestAlarm)
-> ReadS [TestAlarm]
-> ReadPrec TestAlarm
-> ReadPrec [TestAlarm]
-> Read TestAlarm
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TestAlarm]
$creadListPrec :: ReadPrec [TestAlarm]
readPrec :: ReadPrec TestAlarm
$creadPrec :: ReadPrec TestAlarm
readList :: ReadS [TestAlarm]
$creadList :: ReadS [TestAlarm]
readsPrec :: Int -> ReadS TestAlarm
$creadsPrec :: Int -> ReadS TestAlarm
Prelude.Read, Int -> TestAlarm -> ShowS
[TestAlarm] -> ShowS
TestAlarm -> String
(Int -> TestAlarm -> ShowS)
-> (TestAlarm -> String)
-> ([TestAlarm] -> ShowS)
-> Show TestAlarm
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TestAlarm] -> ShowS
$cshowList :: [TestAlarm] -> ShowS
show :: TestAlarm -> String
$cshow :: TestAlarm -> String
showsPrec :: Int -> TestAlarm -> ShowS
$cshowsPrec :: Int -> TestAlarm -> ShowS
Prelude.Show, (forall x. TestAlarm -> Rep TestAlarm x)
-> (forall x. Rep TestAlarm x -> TestAlarm) -> Generic TestAlarm
forall x. Rep TestAlarm x -> TestAlarm
forall x. TestAlarm -> Rep TestAlarm x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TestAlarm x -> TestAlarm
$cfrom :: forall x. TestAlarm -> Rep TestAlarm x
Prelude.Generic)
newTestAlarm ::
Prelude.Text ->
AlarmState ->
TestAlarm
newTestAlarm :: Text -> AlarmState -> TestAlarm
newTestAlarm Text
pAlarmName_ AlarmState
pState_ =
TestAlarm' :: Text -> AlarmState -> TestAlarm
TestAlarm'
{ $sel:alarmName:TestAlarm' :: Text
alarmName = Text
pAlarmName_,
$sel:state:TestAlarm' :: AlarmState
state = AlarmState
pState_
}
testAlarm_alarmName :: Lens.Lens' TestAlarm Prelude.Text
testAlarm_alarmName :: (Text -> f Text) -> TestAlarm -> f TestAlarm
testAlarm_alarmName = (TestAlarm -> Text)
-> (TestAlarm -> Text -> TestAlarm)
-> Lens TestAlarm TestAlarm Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TestAlarm' {Text
alarmName :: Text
$sel:alarmName:TestAlarm' :: TestAlarm -> Text
alarmName} -> Text
alarmName) (\s :: TestAlarm
s@TestAlarm' {} Text
a -> TestAlarm
s {$sel:alarmName:TestAlarm' :: Text
alarmName = Text
a} :: TestAlarm)
testAlarm_state :: Lens.Lens' TestAlarm AlarmState
testAlarm_state :: (AlarmState -> f AlarmState) -> TestAlarm -> f TestAlarm
testAlarm_state = (TestAlarm -> AlarmState)
-> (TestAlarm -> AlarmState -> TestAlarm)
-> Lens TestAlarm TestAlarm AlarmState AlarmState
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TestAlarm' {AlarmState
state :: AlarmState
$sel:state:TestAlarm' :: TestAlarm -> AlarmState
state} -> AlarmState
state) (\s :: TestAlarm
s@TestAlarm' {} AlarmState
a -> TestAlarm
s {$sel:state:TestAlarm' :: AlarmState
state = AlarmState
a} :: TestAlarm)
instance Core.AWSRequest TestAlarm where
type AWSResponse TestAlarm = TestAlarmResponse
request :: TestAlarm -> Request TestAlarm
request = Service -> TestAlarm -> Request TestAlarm
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy TestAlarm
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse TestAlarm)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse TestAlarm))
-> Logger
-> Service
-> Proxy TestAlarm
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse TestAlarm)))
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 [Operation] -> Int -> TestAlarmResponse
TestAlarmResponse'
(Maybe [Operation] -> Int -> TestAlarmResponse)
-> Either String (Maybe [Operation])
-> Either String (Int -> TestAlarmResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Operation]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"operations" Either String (Maybe (Maybe [Operation]))
-> Maybe [Operation] -> Either String (Maybe [Operation])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Operation]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> TestAlarmResponse)
-> Either String Int -> Either String TestAlarmResponse
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 TestAlarm
instance Prelude.NFData TestAlarm
instance Core.ToHeaders TestAlarm where
toHeaders :: TestAlarm -> ResponseHeaders
toHeaders =
ResponseHeaders -> TestAlarm -> 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.TestAlarm" ::
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 TestAlarm where
toJSON :: TestAlarm -> Value
toJSON TestAlarm' {Text
AlarmState
state :: AlarmState
alarmName :: Text
$sel:state:TestAlarm' :: TestAlarm -> AlarmState
$sel:alarmName:TestAlarm' :: TestAlarm -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"alarmName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
alarmName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"state" Text -> AlarmState -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= AlarmState
state)
]
)
instance Core.ToPath TestAlarm where
toPath :: TestAlarm -> ByteString
toPath = ByteString -> TestAlarm -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery TestAlarm where
toQuery :: TestAlarm -> QueryString
toQuery = QueryString -> TestAlarm -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data TestAlarmResponse = TestAlarmResponse'
{
TestAlarmResponse -> Maybe [Operation]
operations :: Prelude.Maybe [Operation],
TestAlarmResponse -> Int
httpStatus :: Prelude.Int
}
deriving (TestAlarmResponse -> TestAlarmResponse -> Bool
(TestAlarmResponse -> TestAlarmResponse -> Bool)
-> (TestAlarmResponse -> TestAlarmResponse -> Bool)
-> Eq TestAlarmResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TestAlarmResponse -> TestAlarmResponse -> Bool
$c/= :: TestAlarmResponse -> TestAlarmResponse -> Bool
== :: TestAlarmResponse -> TestAlarmResponse -> Bool
$c== :: TestAlarmResponse -> TestAlarmResponse -> Bool
Prelude.Eq, ReadPrec [TestAlarmResponse]
ReadPrec TestAlarmResponse
Int -> ReadS TestAlarmResponse
ReadS [TestAlarmResponse]
(Int -> ReadS TestAlarmResponse)
-> ReadS [TestAlarmResponse]
-> ReadPrec TestAlarmResponse
-> ReadPrec [TestAlarmResponse]
-> Read TestAlarmResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TestAlarmResponse]
$creadListPrec :: ReadPrec [TestAlarmResponse]
readPrec :: ReadPrec TestAlarmResponse
$creadPrec :: ReadPrec TestAlarmResponse
readList :: ReadS [TestAlarmResponse]
$creadList :: ReadS [TestAlarmResponse]
readsPrec :: Int -> ReadS TestAlarmResponse
$creadsPrec :: Int -> ReadS TestAlarmResponse
Prelude.Read, Int -> TestAlarmResponse -> ShowS
[TestAlarmResponse] -> ShowS
TestAlarmResponse -> String
(Int -> TestAlarmResponse -> ShowS)
-> (TestAlarmResponse -> String)
-> ([TestAlarmResponse] -> ShowS)
-> Show TestAlarmResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TestAlarmResponse] -> ShowS
$cshowList :: [TestAlarmResponse] -> ShowS
show :: TestAlarmResponse -> String
$cshow :: TestAlarmResponse -> String
showsPrec :: Int -> TestAlarmResponse -> ShowS
$cshowsPrec :: Int -> TestAlarmResponse -> ShowS
Prelude.Show, (forall x. TestAlarmResponse -> Rep TestAlarmResponse x)
-> (forall x. Rep TestAlarmResponse x -> TestAlarmResponse)
-> Generic TestAlarmResponse
forall x. Rep TestAlarmResponse x -> TestAlarmResponse
forall x. TestAlarmResponse -> Rep TestAlarmResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TestAlarmResponse x -> TestAlarmResponse
$cfrom :: forall x. TestAlarmResponse -> Rep TestAlarmResponse x
Prelude.Generic)
newTestAlarmResponse ::
Prelude.Int ->
TestAlarmResponse
newTestAlarmResponse :: Int -> TestAlarmResponse
newTestAlarmResponse Int
pHttpStatus_ =
TestAlarmResponse' :: Maybe [Operation] -> Int -> TestAlarmResponse
TestAlarmResponse'
{ $sel:operations:TestAlarmResponse' :: Maybe [Operation]
operations = Maybe [Operation]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:TestAlarmResponse' :: Int
httpStatus = Int
pHttpStatus_
}
testAlarmResponse_operations :: Lens.Lens' TestAlarmResponse (Prelude.Maybe [Operation])
testAlarmResponse_operations :: (Maybe [Operation] -> f (Maybe [Operation]))
-> TestAlarmResponse -> f TestAlarmResponse
testAlarmResponse_operations = (TestAlarmResponse -> Maybe [Operation])
-> (TestAlarmResponse -> Maybe [Operation] -> TestAlarmResponse)
-> Lens
TestAlarmResponse
TestAlarmResponse
(Maybe [Operation])
(Maybe [Operation])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TestAlarmResponse' {Maybe [Operation]
operations :: Maybe [Operation]
$sel:operations:TestAlarmResponse' :: TestAlarmResponse -> Maybe [Operation]
operations} -> Maybe [Operation]
operations) (\s :: TestAlarmResponse
s@TestAlarmResponse' {} Maybe [Operation]
a -> TestAlarmResponse
s {$sel:operations:TestAlarmResponse' :: Maybe [Operation]
operations = Maybe [Operation]
a} :: TestAlarmResponse) ((Maybe [Operation] -> f (Maybe [Operation]))
-> TestAlarmResponse -> f TestAlarmResponse)
-> ((Maybe [Operation] -> f (Maybe [Operation]))
-> Maybe [Operation] -> f (Maybe [Operation]))
-> (Maybe [Operation] -> f (Maybe [Operation]))
-> TestAlarmResponse
-> f TestAlarmResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Operation] [Operation] [Operation] [Operation]
-> Iso
(Maybe [Operation])
(Maybe [Operation])
(Maybe [Operation])
(Maybe [Operation])
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 [Operation] [Operation] [Operation] [Operation]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
testAlarmResponse_httpStatus :: Lens.Lens' TestAlarmResponse Prelude.Int
testAlarmResponse_httpStatus :: (Int -> f Int) -> TestAlarmResponse -> f TestAlarmResponse
testAlarmResponse_httpStatus = (TestAlarmResponse -> Int)
-> (TestAlarmResponse -> Int -> TestAlarmResponse)
-> Lens TestAlarmResponse TestAlarmResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TestAlarmResponse' {Int
httpStatus :: Int
$sel:httpStatus:TestAlarmResponse' :: TestAlarmResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: TestAlarmResponse
s@TestAlarmResponse' {} Int
a -> TestAlarmResponse
s {$sel:httpStatus:TestAlarmResponse' :: Int
httpStatus = Int
a} :: TestAlarmResponse)
instance Prelude.NFData TestAlarmResponse