{-# 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.IoTEvents.CreateAlarmModel
(
CreateAlarmModel (..),
newCreateAlarmModel,
createAlarmModel_severity,
createAlarmModel_alarmNotification,
createAlarmModel_key,
createAlarmModel_alarmModelDescription,
createAlarmModel_alarmEventActions,
createAlarmModel_alarmCapabilities,
createAlarmModel_tags,
createAlarmModel_alarmModelName,
createAlarmModel_roleArn,
createAlarmModel_alarmRule,
CreateAlarmModelResponse (..),
newCreateAlarmModelResponse,
createAlarmModelResponse_creationTime,
createAlarmModelResponse_status,
createAlarmModelResponse_lastUpdateTime,
createAlarmModelResponse_alarmModelVersion,
createAlarmModelResponse_alarmModelArn,
createAlarmModelResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.IoTEvents.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 CreateAlarmModel = CreateAlarmModel'
{
CreateAlarmModel -> Maybe Natural
severity :: Prelude.Maybe Prelude.Natural,
CreateAlarmModel -> Maybe AlarmNotification
alarmNotification :: Prelude.Maybe AlarmNotification,
CreateAlarmModel -> Maybe Text
key :: Prelude.Maybe Prelude.Text,
CreateAlarmModel -> Maybe Text
alarmModelDescription :: Prelude.Maybe Prelude.Text,
CreateAlarmModel -> Maybe AlarmEventActions
alarmEventActions :: Prelude.Maybe AlarmEventActions,
CreateAlarmModel -> Maybe AlarmCapabilities
alarmCapabilities :: Prelude.Maybe AlarmCapabilities,
CreateAlarmModel -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreateAlarmModel -> Text
alarmModelName :: Prelude.Text,
CreateAlarmModel -> Text
roleArn :: Prelude.Text,
CreateAlarmModel -> AlarmRule
alarmRule :: AlarmRule
}
deriving (CreateAlarmModel -> CreateAlarmModel -> Bool
(CreateAlarmModel -> CreateAlarmModel -> Bool)
-> (CreateAlarmModel -> CreateAlarmModel -> Bool)
-> Eq CreateAlarmModel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateAlarmModel -> CreateAlarmModel -> Bool
$c/= :: CreateAlarmModel -> CreateAlarmModel -> Bool
== :: CreateAlarmModel -> CreateAlarmModel -> Bool
$c== :: CreateAlarmModel -> CreateAlarmModel -> Bool
Prelude.Eq, ReadPrec [CreateAlarmModel]
ReadPrec CreateAlarmModel
Int -> ReadS CreateAlarmModel
ReadS [CreateAlarmModel]
(Int -> ReadS CreateAlarmModel)
-> ReadS [CreateAlarmModel]
-> ReadPrec CreateAlarmModel
-> ReadPrec [CreateAlarmModel]
-> Read CreateAlarmModel
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateAlarmModel]
$creadListPrec :: ReadPrec [CreateAlarmModel]
readPrec :: ReadPrec CreateAlarmModel
$creadPrec :: ReadPrec CreateAlarmModel
readList :: ReadS [CreateAlarmModel]
$creadList :: ReadS [CreateAlarmModel]
readsPrec :: Int -> ReadS CreateAlarmModel
$creadsPrec :: Int -> ReadS CreateAlarmModel
Prelude.Read, Int -> CreateAlarmModel -> ShowS
[CreateAlarmModel] -> ShowS
CreateAlarmModel -> String
(Int -> CreateAlarmModel -> ShowS)
-> (CreateAlarmModel -> String)
-> ([CreateAlarmModel] -> ShowS)
-> Show CreateAlarmModel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateAlarmModel] -> ShowS
$cshowList :: [CreateAlarmModel] -> ShowS
show :: CreateAlarmModel -> String
$cshow :: CreateAlarmModel -> String
showsPrec :: Int -> CreateAlarmModel -> ShowS
$cshowsPrec :: Int -> CreateAlarmModel -> ShowS
Prelude.Show, (forall x. CreateAlarmModel -> Rep CreateAlarmModel x)
-> (forall x. Rep CreateAlarmModel x -> CreateAlarmModel)
-> Generic CreateAlarmModel
forall x. Rep CreateAlarmModel x -> CreateAlarmModel
forall x. CreateAlarmModel -> Rep CreateAlarmModel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateAlarmModel x -> CreateAlarmModel
$cfrom :: forall x. CreateAlarmModel -> Rep CreateAlarmModel x
Prelude.Generic)
newCreateAlarmModel ::
Prelude.Text ->
Prelude.Text ->
AlarmRule ->
CreateAlarmModel
newCreateAlarmModel :: Text -> Text -> AlarmRule -> CreateAlarmModel
newCreateAlarmModel
Text
pAlarmModelName_
Text
pRoleArn_
AlarmRule
pAlarmRule_ =
CreateAlarmModel' :: Maybe Natural
-> Maybe AlarmNotification
-> Maybe Text
-> Maybe Text
-> Maybe AlarmEventActions
-> Maybe AlarmCapabilities
-> Maybe [Tag]
-> Text
-> Text
-> AlarmRule
-> CreateAlarmModel
CreateAlarmModel'
{ $sel:severity:CreateAlarmModel' :: Maybe Natural
severity = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:alarmNotification:CreateAlarmModel' :: Maybe AlarmNotification
alarmNotification = Maybe AlarmNotification
forall a. Maybe a
Prelude.Nothing,
$sel:key:CreateAlarmModel' :: Maybe Text
key = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:alarmModelDescription:CreateAlarmModel' :: Maybe Text
alarmModelDescription = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:alarmEventActions:CreateAlarmModel' :: Maybe AlarmEventActions
alarmEventActions = Maybe AlarmEventActions
forall a. Maybe a
Prelude.Nothing,
$sel:alarmCapabilities:CreateAlarmModel' :: Maybe AlarmCapabilities
alarmCapabilities = Maybe AlarmCapabilities
forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateAlarmModel' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
$sel:alarmModelName:CreateAlarmModel' :: Text
alarmModelName = Text
pAlarmModelName_,
$sel:roleArn:CreateAlarmModel' :: Text
roleArn = Text
pRoleArn_,
$sel:alarmRule:CreateAlarmModel' :: AlarmRule
alarmRule = AlarmRule
pAlarmRule_
}
createAlarmModel_severity :: Lens.Lens' CreateAlarmModel (Prelude.Maybe Prelude.Natural)
createAlarmModel_severity :: (Maybe Natural -> f (Maybe Natural))
-> CreateAlarmModel -> f CreateAlarmModel
createAlarmModel_severity = (CreateAlarmModel -> Maybe Natural)
-> (CreateAlarmModel -> Maybe Natural -> CreateAlarmModel)
-> Lens
CreateAlarmModel CreateAlarmModel (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAlarmModel' {Maybe Natural
severity :: Maybe Natural
$sel:severity:CreateAlarmModel' :: CreateAlarmModel -> Maybe Natural
severity} -> Maybe Natural
severity) (\s :: CreateAlarmModel
s@CreateAlarmModel' {} Maybe Natural
a -> CreateAlarmModel
s {$sel:severity:CreateAlarmModel' :: Maybe Natural
severity = Maybe Natural
a} :: CreateAlarmModel)
createAlarmModel_alarmNotification :: Lens.Lens' CreateAlarmModel (Prelude.Maybe AlarmNotification)
createAlarmModel_alarmNotification :: (Maybe AlarmNotification -> f (Maybe AlarmNotification))
-> CreateAlarmModel -> f CreateAlarmModel
createAlarmModel_alarmNotification = (CreateAlarmModel -> Maybe AlarmNotification)
-> (CreateAlarmModel
-> Maybe AlarmNotification -> CreateAlarmModel)
-> Lens
CreateAlarmModel
CreateAlarmModel
(Maybe AlarmNotification)
(Maybe AlarmNotification)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAlarmModel' {Maybe AlarmNotification
alarmNotification :: Maybe AlarmNotification
$sel:alarmNotification:CreateAlarmModel' :: CreateAlarmModel -> Maybe AlarmNotification
alarmNotification} -> Maybe AlarmNotification
alarmNotification) (\s :: CreateAlarmModel
s@CreateAlarmModel' {} Maybe AlarmNotification
a -> CreateAlarmModel
s {$sel:alarmNotification:CreateAlarmModel' :: Maybe AlarmNotification
alarmNotification = Maybe AlarmNotification
a} :: CreateAlarmModel)
createAlarmModel_key :: Lens.Lens' CreateAlarmModel (Prelude.Maybe Prelude.Text)
createAlarmModel_key :: (Maybe Text -> f (Maybe Text))
-> CreateAlarmModel -> f CreateAlarmModel
createAlarmModel_key = (CreateAlarmModel -> Maybe Text)
-> (CreateAlarmModel -> Maybe Text -> CreateAlarmModel)
-> Lens CreateAlarmModel CreateAlarmModel (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAlarmModel' {Maybe Text
key :: Maybe Text
$sel:key:CreateAlarmModel' :: CreateAlarmModel -> Maybe Text
key} -> Maybe Text
key) (\s :: CreateAlarmModel
s@CreateAlarmModel' {} Maybe Text
a -> CreateAlarmModel
s {$sel:key:CreateAlarmModel' :: Maybe Text
key = Maybe Text
a} :: CreateAlarmModel)
createAlarmModel_alarmModelDescription :: Lens.Lens' CreateAlarmModel (Prelude.Maybe Prelude.Text)
createAlarmModel_alarmModelDescription :: (Maybe Text -> f (Maybe Text))
-> CreateAlarmModel -> f CreateAlarmModel
createAlarmModel_alarmModelDescription = (CreateAlarmModel -> Maybe Text)
-> (CreateAlarmModel -> Maybe Text -> CreateAlarmModel)
-> Lens CreateAlarmModel CreateAlarmModel (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAlarmModel' {Maybe Text
alarmModelDescription :: Maybe Text
$sel:alarmModelDescription:CreateAlarmModel' :: CreateAlarmModel -> Maybe Text
alarmModelDescription} -> Maybe Text
alarmModelDescription) (\s :: CreateAlarmModel
s@CreateAlarmModel' {} Maybe Text
a -> CreateAlarmModel
s {$sel:alarmModelDescription:CreateAlarmModel' :: Maybe Text
alarmModelDescription = Maybe Text
a} :: CreateAlarmModel)
createAlarmModel_alarmEventActions :: Lens.Lens' CreateAlarmModel (Prelude.Maybe AlarmEventActions)
createAlarmModel_alarmEventActions :: (Maybe AlarmEventActions -> f (Maybe AlarmEventActions))
-> CreateAlarmModel -> f CreateAlarmModel
createAlarmModel_alarmEventActions = (CreateAlarmModel -> Maybe AlarmEventActions)
-> (CreateAlarmModel
-> Maybe AlarmEventActions -> CreateAlarmModel)
-> Lens
CreateAlarmModel
CreateAlarmModel
(Maybe AlarmEventActions)
(Maybe AlarmEventActions)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAlarmModel' {Maybe AlarmEventActions
alarmEventActions :: Maybe AlarmEventActions
$sel:alarmEventActions:CreateAlarmModel' :: CreateAlarmModel -> Maybe AlarmEventActions
alarmEventActions} -> Maybe AlarmEventActions
alarmEventActions) (\s :: CreateAlarmModel
s@CreateAlarmModel' {} Maybe AlarmEventActions
a -> CreateAlarmModel
s {$sel:alarmEventActions:CreateAlarmModel' :: Maybe AlarmEventActions
alarmEventActions = Maybe AlarmEventActions
a} :: CreateAlarmModel)
createAlarmModel_alarmCapabilities :: Lens.Lens' CreateAlarmModel (Prelude.Maybe AlarmCapabilities)
createAlarmModel_alarmCapabilities :: (Maybe AlarmCapabilities -> f (Maybe AlarmCapabilities))
-> CreateAlarmModel -> f CreateAlarmModel
createAlarmModel_alarmCapabilities = (CreateAlarmModel -> Maybe AlarmCapabilities)
-> (CreateAlarmModel
-> Maybe AlarmCapabilities -> CreateAlarmModel)
-> Lens
CreateAlarmModel
CreateAlarmModel
(Maybe AlarmCapabilities)
(Maybe AlarmCapabilities)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAlarmModel' {Maybe AlarmCapabilities
alarmCapabilities :: Maybe AlarmCapabilities
$sel:alarmCapabilities:CreateAlarmModel' :: CreateAlarmModel -> Maybe AlarmCapabilities
alarmCapabilities} -> Maybe AlarmCapabilities
alarmCapabilities) (\s :: CreateAlarmModel
s@CreateAlarmModel' {} Maybe AlarmCapabilities
a -> CreateAlarmModel
s {$sel:alarmCapabilities:CreateAlarmModel' :: Maybe AlarmCapabilities
alarmCapabilities = Maybe AlarmCapabilities
a} :: CreateAlarmModel)
createAlarmModel_tags :: Lens.Lens' CreateAlarmModel (Prelude.Maybe [Tag])
createAlarmModel_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateAlarmModel -> f CreateAlarmModel
createAlarmModel_tags = (CreateAlarmModel -> Maybe [Tag])
-> (CreateAlarmModel -> Maybe [Tag] -> CreateAlarmModel)
-> Lens
CreateAlarmModel CreateAlarmModel (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAlarmModel' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateAlarmModel' :: CreateAlarmModel -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateAlarmModel
s@CreateAlarmModel' {} Maybe [Tag]
a -> CreateAlarmModel
s {$sel:tags:CreateAlarmModel' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateAlarmModel) ((Maybe [Tag] -> f (Maybe [Tag]))
-> CreateAlarmModel -> f CreateAlarmModel)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateAlarmModel
-> f CreateAlarmModel
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createAlarmModel_alarmModelName :: Lens.Lens' CreateAlarmModel Prelude.Text
createAlarmModel_alarmModelName :: (Text -> f Text) -> CreateAlarmModel -> f CreateAlarmModel
createAlarmModel_alarmModelName = (CreateAlarmModel -> Text)
-> (CreateAlarmModel -> Text -> CreateAlarmModel)
-> Lens CreateAlarmModel CreateAlarmModel Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAlarmModel' {Text
alarmModelName :: Text
$sel:alarmModelName:CreateAlarmModel' :: CreateAlarmModel -> Text
alarmModelName} -> Text
alarmModelName) (\s :: CreateAlarmModel
s@CreateAlarmModel' {} Text
a -> CreateAlarmModel
s {$sel:alarmModelName:CreateAlarmModel' :: Text
alarmModelName = Text
a} :: CreateAlarmModel)
createAlarmModel_roleArn :: Lens.Lens' CreateAlarmModel Prelude.Text
createAlarmModel_roleArn :: (Text -> f Text) -> CreateAlarmModel -> f CreateAlarmModel
createAlarmModel_roleArn = (CreateAlarmModel -> Text)
-> (CreateAlarmModel -> Text -> CreateAlarmModel)
-> Lens CreateAlarmModel CreateAlarmModel Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAlarmModel' {Text
roleArn :: Text
$sel:roleArn:CreateAlarmModel' :: CreateAlarmModel -> Text
roleArn} -> Text
roleArn) (\s :: CreateAlarmModel
s@CreateAlarmModel' {} Text
a -> CreateAlarmModel
s {$sel:roleArn:CreateAlarmModel' :: Text
roleArn = Text
a} :: CreateAlarmModel)
createAlarmModel_alarmRule :: Lens.Lens' CreateAlarmModel AlarmRule
createAlarmModel_alarmRule :: (AlarmRule -> f AlarmRule)
-> CreateAlarmModel -> f CreateAlarmModel
createAlarmModel_alarmRule = (CreateAlarmModel -> AlarmRule)
-> (CreateAlarmModel -> AlarmRule -> CreateAlarmModel)
-> Lens CreateAlarmModel CreateAlarmModel AlarmRule AlarmRule
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAlarmModel' {AlarmRule
alarmRule :: AlarmRule
$sel:alarmRule:CreateAlarmModel' :: CreateAlarmModel -> AlarmRule
alarmRule} -> AlarmRule
alarmRule) (\s :: CreateAlarmModel
s@CreateAlarmModel' {} AlarmRule
a -> CreateAlarmModel
s {$sel:alarmRule:CreateAlarmModel' :: AlarmRule
alarmRule = AlarmRule
a} :: CreateAlarmModel)
instance Core.AWSRequest CreateAlarmModel where
type
AWSResponse CreateAlarmModel =
CreateAlarmModelResponse
request :: CreateAlarmModel -> Request CreateAlarmModel
request = Service -> CreateAlarmModel -> Request CreateAlarmModel
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateAlarmModel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateAlarmModel)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateAlarmModel))
-> Logger
-> Service
-> Proxy CreateAlarmModel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateAlarmModel)))
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 POSIX
-> Maybe AlarmModelVersionStatus
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Int
-> CreateAlarmModelResponse
CreateAlarmModelResponse'
(Maybe POSIX
-> Maybe AlarmModelVersionStatus
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Int
-> CreateAlarmModelResponse)
-> Either String (Maybe POSIX)
-> Either
String
(Maybe AlarmModelVersionStatus
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Int
-> CreateAlarmModelResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"creationTime")
Either
String
(Maybe AlarmModelVersionStatus
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Int
-> CreateAlarmModelResponse)
-> Either String (Maybe AlarmModelVersionStatus)
-> Either
String
(Maybe POSIX
-> Maybe Text -> Maybe Text -> Int -> CreateAlarmModelResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe AlarmModelVersionStatus)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"status")
Either
String
(Maybe POSIX
-> Maybe Text -> Maybe Text -> Int -> CreateAlarmModelResponse)
-> Either String (Maybe POSIX)
-> Either
String
(Maybe Text -> Maybe Text -> Int -> CreateAlarmModelResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"lastUpdateTime")
Either
String
(Maybe Text -> Maybe Text -> Int -> CreateAlarmModelResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> CreateAlarmModelResponse)
forall (f :: * -> *) a b. Applicative f => 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
"alarmModelVersion")
Either String (Maybe Text -> Int -> CreateAlarmModelResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateAlarmModelResponse)
forall (f :: * -> *) a b. Applicative f => 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
"alarmModelArn")
Either String (Int -> CreateAlarmModelResponse)
-> Either String Int -> Either String CreateAlarmModelResponse
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 CreateAlarmModel
instance Prelude.NFData CreateAlarmModel
instance Core.ToHeaders CreateAlarmModel where
toHeaders :: CreateAlarmModel -> ResponseHeaders
toHeaders = ResponseHeaders -> CreateAlarmModel -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON CreateAlarmModel where
toJSON :: CreateAlarmModel -> Value
toJSON CreateAlarmModel' {Maybe Natural
Maybe [Tag]
Maybe Text
Maybe AlarmCapabilities
Maybe AlarmNotification
Maybe AlarmEventActions
Text
AlarmRule
alarmRule :: AlarmRule
roleArn :: Text
alarmModelName :: Text
tags :: Maybe [Tag]
alarmCapabilities :: Maybe AlarmCapabilities
alarmEventActions :: Maybe AlarmEventActions
alarmModelDescription :: Maybe Text
key :: Maybe Text
alarmNotification :: Maybe AlarmNotification
severity :: Maybe Natural
$sel:alarmRule:CreateAlarmModel' :: CreateAlarmModel -> AlarmRule
$sel:roleArn:CreateAlarmModel' :: CreateAlarmModel -> Text
$sel:alarmModelName:CreateAlarmModel' :: CreateAlarmModel -> Text
$sel:tags:CreateAlarmModel' :: CreateAlarmModel -> Maybe [Tag]
$sel:alarmCapabilities:CreateAlarmModel' :: CreateAlarmModel -> Maybe AlarmCapabilities
$sel:alarmEventActions:CreateAlarmModel' :: CreateAlarmModel -> Maybe AlarmEventActions
$sel:alarmModelDescription:CreateAlarmModel' :: CreateAlarmModel -> Maybe Text
$sel:key:CreateAlarmModel' :: CreateAlarmModel -> Maybe Text
$sel:alarmNotification:CreateAlarmModel' :: CreateAlarmModel -> Maybe AlarmNotification
$sel:severity:CreateAlarmModel' :: CreateAlarmModel -> Maybe Natural
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"severity" 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
severity,
(Text
"alarmNotification" Text -> AlarmNotification -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(AlarmNotification -> Pair)
-> Maybe AlarmNotification -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AlarmNotification
alarmNotification,
(Text
"key" 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
key,
(Text
"alarmModelDescription" 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
alarmModelDescription,
(Text
"alarmEventActions" Text -> AlarmEventActions -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(AlarmEventActions -> Pair)
-> Maybe AlarmEventActions -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AlarmEventActions
alarmEventActions,
(Text
"alarmCapabilities" Text -> AlarmCapabilities -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(AlarmCapabilities -> Pair)
-> Maybe AlarmCapabilities -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AlarmCapabilities
alarmCapabilities,
(Text
"tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"alarmModelName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
alarmModelName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"roleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
roleArn),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"alarmRule" Text -> AlarmRule -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= AlarmRule
alarmRule)
]
)
instance Core.ToPath CreateAlarmModel where
toPath :: CreateAlarmModel -> ByteString
toPath = ByteString -> CreateAlarmModel -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/alarm-models"
instance Core.ToQuery CreateAlarmModel where
toQuery :: CreateAlarmModel -> QueryString
toQuery = QueryString -> CreateAlarmModel -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateAlarmModelResponse = CreateAlarmModelResponse'
{
CreateAlarmModelResponse -> Maybe POSIX
creationTime :: Prelude.Maybe Core.POSIX,
CreateAlarmModelResponse -> Maybe AlarmModelVersionStatus
status :: Prelude.Maybe AlarmModelVersionStatus,
CreateAlarmModelResponse -> Maybe POSIX
lastUpdateTime :: Prelude.Maybe Core.POSIX,
CreateAlarmModelResponse -> Maybe Text
alarmModelVersion :: Prelude.Maybe Prelude.Text,
CreateAlarmModelResponse -> Maybe Text
alarmModelArn :: Prelude.Maybe Prelude.Text,
CreateAlarmModelResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateAlarmModelResponse -> CreateAlarmModelResponse -> Bool
(CreateAlarmModelResponse -> CreateAlarmModelResponse -> Bool)
-> (CreateAlarmModelResponse -> CreateAlarmModelResponse -> Bool)
-> Eq CreateAlarmModelResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateAlarmModelResponse -> CreateAlarmModelResponse -> Bool
$c/= :: CreateAlarmModelResponse -> CreateAlarmModelResponse -> Bool
== :: CreateAlarmModelResponse -> CreateAlarmModelResponse -> Bool
$c== :: CreateAlarmModelResponse -> CreateAlarmModelResponse -> Bool
Prelude.Eq, ReadPrec [CreateAlarmModelResponse]
ReadPrec CreateAlarmModelResponse
Int -> ReadS CreateAlarmModelResponse
ReadS [CreateAlarmModelResponse]
(Int -> ReadS CreateAlarmModelResponse)
-> ReadS [CreateAlarmModelResponse]
-> ReadPrec CreateAlarmModelResponse
-> ReadPrec [CreateAlarmModelResponse]
-> Read CreateAlarmModelResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateAlarmModelResponse]
$creadListPrec :: ReadPrec [CreateAlarmModelResponse]
readPrec :: ReadPrec CreateAlarmModelResponse
$creadPrec :: ReadPrec CreateAlarmModelResponse
readList :: ReadS [CreateAlarmModelResponse]
$creadList :: ReadS [CreateAlarmModelResponse]
readsPrec :: Int -> ReadS CreateAlarmModelResponse
$creadsPrec :: Int -> ReadS CreateAlarmModelResponse
Prelude.Read, Int -> CreateAlarmModelResponse -> ShowS
[CreateAlarmModelResponse] -> ShowS
CreateAlarmModelResponse -> String
(Int -> CreateAlarmModelResponse -> ShowS)
-> (CreateAlarmModelResponse -> String)
-> ([CreateAlarmModelResponse] -> ShowS)
-> Show CreateAlarmModelResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateAlarmModelResponse] -> ShowS
$cshowList :: [CreateAlarmModelResponse] -> ShowS
show :: CreateAlarmModelResponse -> String
$cshow :: CreateAlarmModelResponse -> String
showsPrec :: Int -> CreateAlarmModelResponse -> ShowS
$cshowsPrec :: Int -> CreateAlarmModelResponse -> ShowS
Prelude.Show, (forall x.
CreateAlarmModelResponse -> Rep CreateAlarmModelResponse x)
-> (forall x.
Rep CreateAlarmModelResponse x -> CreateAlarmModelResponse)
-> Generic CreateAlarmModelResponse
forall x.
Rep CreateAlarmModelResponse x -> CreateAlarmModelResponse
forall x.
CreateAlarmModelResponse -> Rep CreateAlarmModelResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateAlarmModelResponse x -> CreateAlarmModelResponse
$cfrom :: forall x.
CreateAlarmModelResponse -> Rep CreateAlarmModelResponse x
Prelude.Generic)
newCreateAlarmModelResponse ::
Prelude.Int ->
CreateAlarmModelResponse
newCreateAlarmModelResponse :: Int -> CreateAlarmModelResponse
newCreateAlarmModelResponse Int
pHttpStatus_ =
CreateAlarmModelResponse' :: Maybe POSIX
-> Maybe AlarmModelVersionStatus
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Int
-> CreateAlarmModelResponse
CreateAlarmModelResponse'
{ $sel:creationTime:CreateAlarmModelResponse' :: Maybe POSIX
creationTime =
Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:status:CreateAlarmModelResponse' :: Maybe AlarmModelVersionStatus
status = Maybe AlarmModelVersionStatus
forall a. Maybe a
Prelude.Nothing,
$sel:lastUpdateTime:CreateAlarmModelResponse' :: Maybe POSIX
lastUpdateTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:alarmModelVersion:CreateAlarmModelResponse' :: Maybe Text
alarmModelVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:alarmModelArn:CreateAlarmModelResponse' :: Maybe Text
alarmModelArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateAlarmModelResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createAlarmModelResponse_creationTime :: Lens.Lens' CreateAlarmModelResponse (Prelude.Maybe Prelude.UTCTime)
createAlarmModelResponse_creationTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateAlarmModelResponse -> f CreateAlarmModelResponse
createAlarmModelResponse_creationTime = (CreateAlarmModelResponse -> Maybe POSIX)
-> (CreateAlarmModelResponse
-> Maybe POSIX -> CreateAlarmModelResponse)
-> Lens
CreateAlarmModelResponse
CreateAlarmModelResponse
(Maybe POSIX)
(Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAlarmModelResponse' {Maybe POSIX
creationTime :: Maybe POSIX
$sel:creationTime:CreateAlarmModelResponse' :: CreateAlarmModelResponse -> Maybe POSIX
creationTime} -> Maybe POSIX
creationTime) (\s :: CreateAlarmModelResponse
s@CreateAlarmModelResponse' {} Maybe POSIX
a -> CreateAlarmModelResponse
s {$sel:creationTime:CreateAlarmModelResponse' :: Maybe POSIX
creationTime = Maybe POSIX
a} :: CreateAlarmModelResponse) ((Maybe POSIX -> f (Maybe POSIX))
-> CreateAlarmModelResponse -> f CreateAlarmModelResponse)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateAlarmModelResponse
-> f CreateAlarmModelResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
createAlarmModelResponse_status :: Lens.Lens' CreateAlarmModelResponse (Prelude.Maybe AlarmModelVersionStatus)
createAlarmModelResponse_status :: (Maybe AlarmModelVersionStatus
-> f (Maybe AlarmModelVersionStatus))
-> CreateAlarmModelResponse -> f CreateAlarmModelResponse
createAlarmModelResponse_status = (CreateAlarmModelResponse -> Maybe AlarmModelVersionStatus)
-> (CreateAlarmModelResponse
-> Maybe AlarmModelVersionStatus -> CreateAlarmModelResponse)
-> Lens
CreateAlarmModelResponse
CreateAlarmModelResponse
(Maybe AlarmModelVersionStatus)
(Maybe AlarmModelVersionStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAlarmModelResponse' {Maybe AlarmModelVersionStatus
status :: Maybe AlarmModelVersionStatus
$sel:status:CreateAlarmModelResponse' :: CreateAlarmModelResponse -> Maybe AlarmModelVersionStatus
status} -> Maybe AlarmModelVersionStatus
status) (\s :: CreateAlarmModelResponse
s@CreateAlarmModelResponse' {} Maybe AlarmModelVersionStatus
a -> CreateAlarmModelResponse
s {$sel:status:CreateAlarmModelResponse' :: Maybe AlarmModelVersionStatus
status = Maybe AlarmModelVersionStatus
a} :: CreateAlarmModelResponse)
createAlarmModelResponse_lastUpdateTime :: Lens.Lens' CreateAlarmModelResponse (Prelude.Maybe Prelude.UTCTime)
createAlarmModelResponse_lastUpdateTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateAlarmModelResponse -> f CreateAlarmModelResponse
createAlarmModelResponse_lastUpdateTime = (CreateAlarmModelResponse -> Maybe POSIX)
-> (CreateAlarmModelResponse
-> Maybe POSIX -> CreateAlarmModelResponse)
-> Lens
CreateAlarmModelResponse
CreateAlarmModelResponse
(Maybe POSIX)
(Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAlarmModelResponse' {Maybe POSIX
lastUpdateTime :: Maybe POSIX
$sel:lastUpdateTime:CreateAlarmModelResponse' :: CreateAlarmModelResponse -> Maybe POSIX
lastUpdateTime} -> Maybe POSIX
lastUpdateTime) (\s :: CreateAlarmModelResponse
s@CreateAlarmModelResponse' {} Maybe POSIX
a -> CreateAlarmModelResponse
s {$sel:lastUpdateTime:CreateAlarmModelResponse' :: Maybe POSIX
lastUpdateTime = Maybe POSIX
a} :: CreateAlarmModelResponse) ((Maybe POSIX -> f (Maybe POSIX))
-> CreateAlarmModelResponse -> f CreateAlarmModelResponse)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateAlarmModelResponse
-> f CreateAlarmModelResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
createAlarmModelResponse_alarmModelVersion :: Lens.Lens' CreateAlarmModelResponse (Prelude.Maybe Prelude.Text)
createAlarmModelResponse_alarmModelVersion :: (Maybe Text -> f (Maybe Text))
-> CreateAlarmModelResponse -> f CreateAlarmModelResponse
createAlarmModelResponse_alarmModelVersion = (CreateAlarmModelResponse -> Maybe Text)
-> (CreateAlarmModelResponse
-> Maybe Text -> CreateAlarmModelResponse)
-> Lens
CreateAlarmModelResponse
CreateAlarmModelResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAlarmModelResponse' {Maybe Text
alarmModelVersion :: Maybe Text
$sel:alarmModelVersion:CreateAlarmModelResponse' :: CreateAlarmModelResponse -> Maybe Text
alarmModelVersion} -> Maybe Text
alarmModelVersion) (\s :: CreateAlarmModelResponse
s@CreateAlarmModelResponse' {} Maybe Text
a -> CreateAlarmModelResponse
s {$sel:alarmModelVersion:CreateAlarmModelResponse' :: Maybe Text
alarmModelVersion = Maybe Text
a} :: CreateAlarmModelResponse)
createAlarmModelResponse_alarmModelArn :: Lens.Lens' CreateAlarmModelResponse (Prelude.Maybe Prelude.Text)
createAlarmModelResponse_alarmModelArn :: (Maybe Text -> f (Maybe Text))
-> CreateAlarmModelResponse -> f CreateAlarmModelResponse
createAlarmModelResponse_alarmModelArn = (CreateAlarmModelResponse -> Maybe Text)
-> (CreateAlarmModelResponse
-> Maybe Text -> CreateAlarmModelResponse)
-> Lens
CreateAlarmModelResponse
CreateAlarmModelResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAlarmModelResponse' {Maybe Text
alarmModelArn :: Maybe Text
$sel:alarmModelArn:CreateAlarmModelResponse' :: CreateAlarmModelResponse -> Maybe Text
alarmModelArn} -> Maybe Text
alarmModelArn) (\s :: CreateAlarmModelResponse
s@CreateAlarmModelResponse' {} Maybe Text
a -> CreateAlarmModelResponse
s {$sel:alarmModelArn:CreateAlarmModelResponse' :: Maybe Text
alarmModelArn = Maybe Text
a} :: CreateAlarmModelResponse)
createAlarmModelResponse_httpStatus :: Lens.Lens' CreateAlarmModelResponse Prelude.Int
createAlarmModelResponse_httpStatus :: (Int -> f Int)
-> CreateAlarmModelResponse -> f CreateAlarmModelResponse
createAlarmModelResponse_httpStatus = (CreateAlarmModelResponse -> Int)
-> (CreateAlarmModelResponse -> Int -> CreateAlarmModelResponse)
-> Lens CreateAlarmModelResponse CreateAlarmModelResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAlarmModelResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateAlarmModelResponse' :: CreateAlarmModelResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateAlarmModelResponse
s@CreateAlarmModelResponse' {} Int
a -> CreateAlarmModelResponse
s {$sel:httpStatus:CreateAlarmModelResponse' :: Int
httpStatus = Int
a} :: CreateAlarmModelResponse)
instance Prelude.NFData CreateAlarmModelResponse