{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.IoTEvents.Types.AlarmAction
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.IoTEvents.Types.AlarmAction where

import qualified Amazonka.Core as Core
import Amazonka.IoTEvents.Types.DynamoDBAction
import Amazonka.IoTEvents.Types.DynamoDBv2Action
import Amazonka.IoTEvents.Types.FirehoseAction
import Amazonka.IoTEvents.Types.IotEventsAction
import Amazonka.IoTEvents.Types.IotSiteWiseAction
import Amazonka.IoTEvents.Types.IotTopicPublishAction
import Amazonka.IoTEvents.Types.LambdaAction
import Amazonka.IoTEvents.Types.SNSTopicPublishAction
import Amazonka.IoTEvents.Types.SqsAction
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Specifies one of the following actions to receive notifications when the
-- alarm state changes.
--
-- /See:/ 'newAlarmAction' smart constructor.
data AlarmAction = AlarmAction'
  { AlarmAction -> Maybe IotTopicPublishAction
iotTopicPublish :: Prelude.Maybe IotTopicPublishAction,
    AlarmAction -> Maybe DynamoDBv2Action
dynamoDBv2 :: Prelude.Maybe DynamoDBv2Action,
    AlarmAction -> Maybe SNSTopicPublishAction
sns :: Prelude.Maybe SNSTopicPublishAction,
    AlarmAction -> Maybe DynamoDBAction
dynamoDB :: Prelude.Maybe DynamoDBAction,
    AlarmAction -> Maybe FirehoseAction
firehose :: Prelude.Maybe FirehoseAction,
    AlarmAction -> Maybe IotSiteWiseAction
iotSiteWise :: Prelude.Maybe IotSiteWiseAction,
    AlarmAction -> Maybe LambdaAction
lambda :: Prelude.Maybe LambdaAction,
    AlarmAction -> Maybe IotEventsAction
iotEvents :: Prelude.Maybe IotEventsAction,
    AlarmAction -> Maybe SqsAction
sqs :: Prelude.Maybe SqsAction
  }
  deriving (AlarmAction -> AlarmAction -> Bool
(AlarmAction -> AlarmAction -> Bool)
-> (AlarmAction -> AlarmAction -> Bool) -> Eq AlarmAction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AlarmAction -> AlarmAction -> Bool
$c/= :: AlarmAction -> AlarmAction -> Bool
== :: AlarmAction -> AlarmAction -> Bool
$c== :: AlarmAction -> AlarmAction -> Bool
Prelude.Eq, ReadPrec [AlarmAction]
ReadPrec AlarmAction
Int -> ReadS AlarmAction
ReadS [AlarmAction]
(Int -> ReadS AlarmAction)
-> ReadS [AlarmAction]
-> ReadPrec AlarmAction
-> ReadPrec [AlarmAction]
-> Read AlarmAction
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AlarmAction]
$creadListPrec :: ReadPrec [AlarmAction]
readPrec :: ReadPrec AlarmAction
$creadPrec :: ReadPrec AlarmAction
readList :: ReadS [AlarmAction]
$creadList :: ReadS [AlarmAction]
readsPrec :: Int -> ReadS AlarmAction
$creadsPrec :: Int -> ReadS AlarmAction
Prelude.Read, Int -> AlarmAction -> ShowS
[AlarmAction] -> ShowS
AlarmAction -> String
(Int -> AlarmAction -> ShowS)
-> (AlarmAction -> String)
-> ([AlarmAction] -> ShowS)
-> Show AlarmAction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AlarmAction] -> ShowS
$cshowList :: [AlarmAction] -> ShowS
show :: AlarmAction -> String
$cshow :: AlarmAction -> String
showsPrec :: Int -> AlarmAction -> ShowS
$cshowsPrec :: Int -> AlarmAction -> ShowS
Prelude.Show, (forall x. AlarmAction -> Rep AlarmAction x)
-> (forall x. Rep AlarmAction x -> AlarmAction)
-> Generic AlarmAction
forall x. Rep AlarmAction x -> AlarmAction
forall x. AlarmAction -> Rep AlarmAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AlarmAction x -> AlarmAction
$cfrom :: forall x. AlarmAction -> Rep AlarmAction x
Prelude.Generic)

-- |
-- Create a value of 'AlarmAction' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'iotTopicPublish', 'alarmAction_iotTopicPublish' - Undocumented member.
--
-- 'dynamoDBv2', 'alarmAction_dynamoDBv2' - Undocumented member.
--
-- 'sns', 'alarmAction_sns' - Undocumented member.
--
-- 'dynamoDB', 'alarmAction_dynamoDB' - Undocumented member.
--
-- 'firehose', 'alarmAction_firehose' - Undocumented member.
--
-- 'iotSiteWise', 'alarmAction_iotSiteWise' - Undocumented member.
--
-- 'lambda', 'alarmAction_lambda' - Undocumented member.
--
-- 'iotEvents', 'alarmAction_iotEvents' - Undocumented member.
--
-- 'sqs', 'alarmAction_sqs' - Undocumented member.
newAlarmAction ::
  AlarmAction
newAlarmAction :: AlarmAction
newAlarmAction =
  AlarmAction' :: Maybe IotTopicPublishAction
-> Maybe DynamoDBv2Action
-> Maybe SNSTopicPublishAction
-> Maybe DynamoDBAction
-> Maybe FirehoseAction
-> Maybe IotSiteWiseAction
-> Maybe LambdaAction
-> Maybe IotEventsAction
-> Maybe SqsAction
-> AlarmAction
AlarmAction'
    { $sel:iotTopicPublish:AlarmAction' :: Maybe IotTopicPublishAction
iotTopicPublish = Maybe IotTopicPublishAction
forall a. Maybe a
Prelude.Nothing,
      $sel:dynamoDBv2:AlarmAction' :: Maybe DynamoDBv2Action
dynamoDBv2 = Maybe DynamoDBv2Action
forall a. Maybe a
Prelude.Nothing,
      $sel:sns:AlarmAction' :: Maybe SNSTopicPublishAction
sns = Maybe SNSTopicPublishAction
forall a. Maybe a
Prelude.Nothing,
      $sel:dynamoDB:AlarmAction' :: Maybe DynamoDBAction
dynamoDB = Maybe DynamoDBAction
forall a. Maybe a
Prelude.Nothing,
      $sel:firehose:AlarmAction' :: Maybe FirehoseAction
firehose = Maybe FirehoseAction
forall a. Maybe a
Prelude.Nothing,
      $sel:iotSiteWise:AlarmAction' :: Maybe IotSiteWiseAction
iotSiteWise = Maybe IotSiteWiseAction
forall a. Maybe a
Prelude.Nothing,
      $sel:lambda:AlarmAction' :: Maybe LambdaAction
lambda = Maybe LambdaAction
forall a. Maybe a
Prelude.Nothing,
      $sel:iotEvents:AlarmAction' :: Maybe IotEventsAction
iotEvents = Maybe IotEventsAction
forall a. Maybe a
Prelude.Nothing,
      $sel:sqs:AlarmAction' :: Maybe SqsAction
sqs = Maybe SqsAction
forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
alarmAction_iotTopicPublish :: Lens.Lens' AlarmAction (Prelude.Maybe IotTopicPublishAction)
alarmAction_iotTopicPublish :: (Maybe IotTopicPublishAction -> f (Maybe IotTopicPublishAction))
-> AlarmAction -> f AlarmAction
alarmAction_iotTopicPublish = (AlarmAction -> Maybe IotTopicPublishAction)
-> (AlarmAction -> Maybe IotTopicPublishAction -> AlarmAction)
-> Lens
     AlarmAction
     AlarmAction
     (Maybe IotTopicPublishAction)
     (Maybe IotTopicPublishAction)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlarmAction' {Maybe IotTopicPublishAction
iotTopicPublish :: Maybe IotTopicPublishAction
$sel:iotTopicPublish:AlarmAction' :: AlarmAction -> Maybe IotTopicPublishAction
iotTopicPublish} -> Maybe IotTopicPublishAction
iotTopicPublish) (\s :: AlarmAction
s@AlarmAction' {} Maybe IotTopicPublishAction
a -> AlarmAction
s {$sel:iotTopicPublish:AlarmAction' :: Maybe IotTopicPublishAction
iotTopicPublish = Maybe IotTopicPublishAction
a} :: AlarmAction)

-- | Undocumented member.
alarmAction_dynamoDBv2 :: Lens.Lens' AlarmAction (Prelude.Maybe DynamoDBv2Action)
alarmAction_dynamoDBv2 :: (Maybe DynamoDBv2Action -> f (Maybe DynamoDBv2Action))
-> AlarmAction -> f AlarmAction
alarmAction_dynamoDBv2 = (AlarmAction -> Maybe DynamoDBv2Action)
-> (AlarmAction -> Maybe DynamoDBv2Action -> AlarmAction)
-> Lens
     AlarmAction
     AlarmAction
     (Maybe DynamoDBv2Action)
     (Maybe DynamoDBv2Action)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlarmAction' {Maybe DynamoDBv2Action
dynamoDBv2 :: Maybe DynamoDBv2Action
$sel:dynamoDBv2:AlarmAction' :: AlarmAction -> Maybe DynamoDBv2Action
dynamoDBv2} -> Maybe DynamoDBv2Action
dynamoDBv2) (\s :: AlarmAction
s@AlarmAction' {} Maybe DynamoDBv2Action
a -> AlarmAction
s {$sel:dynamoDBv2:AlarmAction' :: Maybe DynamoDBv2Action
dynamoDBv2 = Maybe DynamoDBv2Action
a} :: AlarmAction)

-- | Undocumented member.
alarmAction_sns :: Lens.Lens' AlarmAction (Prelude.Maybe SNSTopicPublishAction)
alarmAction_sns :: (Maybe SNSTopicPublishAction -> f (Maybe SNSTopicPublishAction))
-> AlarmAction -> f AlarmAction
alarmAction_sns = (AlarmAction -> Maybe SNSTopicPublishAction)
-> (AlarmAction -> Maybe SNSTopicPublishAction -> AlarmAction)
-> Lens
     AlarmAction
     AlarmAction
     (Maybe SNSTopicPublishAction)
     (Maybe SNSTopicPublishAction)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlarmAction' {Maybe SNSTopicPublishAction
sns :: Maybe SNSTopicPublishAction
$sel:sns:AlarmAction' :: AlarmAction -> Maybe SNSTopicPublishAction
sns} -> Maybe SNSTopicPublishAction
sns) (\s :: AlarmAction
s@AlarmAction' {} Maybe SNSTopicPublishAction
a -> AlarmAction
s {$sel:sns:AlarmAction' :: Maybe SNSTopicPublishAction
sns = Maybe SNSTopicPublishAction
a} :: AlarmAction)

-- | Undocumented member.
alarmAction_dynamoDB :: Lens.Lens' AlarmAction (Prelude.Maybe DynamoDBAction)
alarmAction_dynamoDB :: (Maybe DynamoDBAction -> f (Maybe DynamoDBAction))
-> AlarmAction -> f AlarmAction
alarmAction_dynamoDB = (AlarmAction -> Maybe DynamoDBAction)
-> (AlarmAction -> Maybe DynamoDBAction -> AlarmAction)
-> Lens
     AlarmAction
     AlarmAction
     (Maybe DynamoDBAction)
     (Maybe DynamoDBAction)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlarmAction' {Maybe DynamoDBAction
dynamoDB :: Maybe DynamoDBAction
$sel:dynamoDB:AlarmAction' :: AlarmAction -> Maybe DynamoDBAction
dynamoDB} -> Maybe DynamoDBAction
dynamoDB) (\s :: AlarmAction
s@AlarmAction' {} Maybe DynamoDBAction
a -> AlarmAction
s {$sel:dynamoDB:AlarmAction' :: Maybe DynamoDBAction
dynamoDB = Maybe DynamoDBAction
a} :: AlarmAction)

-- | Undocumented member.
alarmAction_firehose :: Lens.Lens' AlarmAction (Prelude.Maybe FirehoseAction)
alarmAction_firehose :: (Maybe FirehoseAction -> f (Maybe FirehoseAction))
-> AlarmAction -> f AlarmAction
alarmAction_firehose = (AlarmAction -> Maybe FirehoseAction)
-> (AlarmAction -> Maybe FirehoseAction -> AlarmAction)
-> Lens
     AlarmAction
     AlarmAction
     (Maybe FirehoseAction)
     (Maybe FirehoseAction)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlarmAction' {Maybe FirehoseAction
firehose :: Maybe FirehoseAction
$sel:firehose:AlarmAction' :: AlarmAction -> Maybe FirehoseAction
firehose} -> Maybe FirehoseAction
firehose) (\s :: AlarmAction
s@AlarmAction' {} Maybe FirehoseAction
a -> AlarmAction
s {$sel:firehose:AlarmAction' :: Maybe FirehoseAction
firehose = Maybe FirehoseAction
a} :: AlarmAction)

-- | Undocumented member.
alarmAction_iotSiteWise :: Lens.Lens' AlarmAction (Prelude.Maybe IotSiteWiseAction)
alarmAction_iotSiteWise :: (Maybe IotSiteWiseAction -> f (Maybe IotSiteWiseAction))
-> AlarmAction -> f AlarmAction
alarmAction_iotSiteWise = (AlarmAction -> Maybe IotSiteWiseAction)
-> (AlarmAction -> Maybe IotSiteWiseAction -> AlarmAction)
-> Lens
     AlarmAction
     AlarmAction
     (Maybe IotSiteWiseAction)
     (Maybe IotSiteWiseAction)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlarmAction' {Maybe IotSiteWiseAction
iotSiteWise :: Maybe IotSiteWiseAction
$sel:iotSiteWise:AlarmAction' :: AlarmAction -> Maybe IotSiteWiseAction
iotSiteWise} -> Maybe IotSiteWiseAction
iotSiteWise) (\s :: AlarmAction
s@AlarmAction' {} Maybe IotSiteWiseAction
a -> AlarmAction
s {$sel:iotSiteWise:AlarmAction' :: Maybe IotSiteWiseAction
iotSiteWise = Maybe IotSiteWiseAction
a} :: AlarmAction)

-- | Undocumented member.
alarmAction_lambda :: Lens.Lens' AlarmAction (Prelude.Maybe LambdaAction)
alarmAction_lambda :: (Maybe LambdaAction -> f (Maybe LambdaAction))
-> AlarmAction -> f AlarmAction
alarmAction_lambda = (AlarmAction -> Maybe LambdaAction)
-> (AlarmAction -> Maybe LambdaAction -> AlarmAction)
-> Lens
     AlarmAction AlarmAction (Maybe LambdaAction) (Maybe LambdaAction)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlarmAction' {Maybe LambdaAction
lambda :: Maybe LambdaAction
$sel:lambda:AlarmAction' :: AlarmAction -> Maybe LambdaAction
lambda} -> Maybe LambdaAction
lambda) (\s :: AlarmAction
s@AlarmAction' {} Maybe LambdaAction
a -> AlarmAction
s {$sel:lambda:AlarmAction' :: Maybe LambdaAction
lambda = Maybe LambdaAction
a} :: AlarmAction)

-- | Undocumented member.
alarmAction_iotEvents :: Lens.Lens' AlarmAction (Prelude.Maybe IotEventsAction)
alarmAction_iotEvents :: (Maybe IotEventsAction -> f (Maybe IotEventsAction))
-> AlarmAction -> f AlarmAction
alarmAction_iotEvents = (AlarmAction -> Maybe IotEventsAction)
-> (AlarmAction -> Maybe IotEventsAction -> AlarmAction)
-> Lens
     AlarmAction
     AlarmAction
     (Maybe IotEventsAction)
     (Maybe IotEventsAction)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlarmAction' {Maybe IotEventsAction
iotEvents :: Maybe IotEventsAction
$sel:iotEvents:AlarmAction' :: AlarmAction -> Maybe IotEventsAction
iotEvents} -> Maybe IotEventsAction
iotEvents) (\s :: AlarmAction
s@AlarmAction' {} Maybe IotEventsAction
a -> AlarmAction
s {$sel:iotEvents:AlarmAction' :: Maybe IotEventsAction
iotEvents = Maybe IotEventsAction
a} :: AlarmAction)

-- | Undocumented member.
alarmAction_sqs :: Lens.Lens' AlarmAction (Prelude.Maybe SqsAction)
alarmAction_sqs :: (Maybe SqsAction -> f (Maybe SqsAction))
-> AlarmAction -> f AlarmAction
alarmAction_sqs = (AlarmAction -> Maybe SqsAction)
-> (AlarmAction -> Maybe SqsAction -> AlarmAction)
-> Lens AlarmAction AlarmAction (Maybe SqsAction) (Maybe SqsAction)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlarmAction' {Maybe SqsAction
sqs :: Maybe SqsAction
$sel:sqs:AlarmAction' :: AlarmAction -> Maybe SqsAction
sqs} -> Maybe SqsAction
sqs) (\s :: AlarmAction
s@AlarmAction' {} Maybe SqsAction
a -> AlarmAction
s {$sel:sqs:AlarmAction' :: Maybe SqsAction
sqs = Maybe SqsAction
a} :: AlarmAction)

instance Core.FromJSON AlarmAction where
  parseJSON :: Value -> Parser AlarmAction
parseJSON =
    String
-> (Object -> Parser AlarmAction) -> Value -> Parser AlarmAction
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AlarmAction"
      ( \Object
x ->
          Maybe IotTopicPublishAction
-> Maybe DynamoDBv2Action
-> Maybe SNSTopicPublishAction
-> Maybe DynamoDBAction
-> Maybe FirehoseAction
-> Maybe IotSiteWiseAction
-> Maybe LambdaAction
-> Maybe IotEventsAction
-> Maybe SqsAction
-> AlarmAction
AlarmAction'
            (Maybe IotTopicPublishAction
 -> Maybe DynamoDBv2Action
 -> Maybe SNSTopicPublishAction
 -> Maybe DynamoDBAction
 -> Maybe FirehoseAction
 -> Maybe IotSiteWiseAction
 -> Maybe LambdaAction
 -> Maybe IotEventsAction
 -> Maybe SqsAction
 -> AlarmAction)
-> Parser (Maybe IotTopicPublishAction)
-> Parser
     (Maybe DynamoDBv2Action
      -> Maybe SNSTopicPublishAction
      -> Maybe DynamoDBAction
      -> Maybe FirehoseAction
      -> Maybe IotSiteWiseAction
      -> Maybe LambdaAction
      -> Maybe IotEventsAction
      -> Maybe SqsAction
      -> AlarmAction)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe IotTopicPublishAction)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"iotTopicPublish")
            Parser
  (Maybe DynamoDBv2Action
   -> Maybe SNSTopicPublishAction
   -> Maybe DynamoDBAction
   -> Maybe FirehoseAction
   -> Maybe IotSiteWiseAction
   -> Maybe LambdaAction
   -> Maybe IotEventsAction
   -> Maybe SqsAction
   -> AlarmAction)
-> Parser (Maybe DynamoDBv2Action)
-> Parser
     (Maybe SNSTopicPublishAction
      -> Maybe DynamoDBAction
      -> Maybe FirehoseAction
      -> Maybe IotSiteWiseAction
      -> Maybe LambdaAction
      -> Maybe IotEventsAction
      -> Maybe SqsAction
      -> AlarmAction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe DynamoDBv2Action)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"dynamoDBv2")
            Parser
  (Maybe SNSTopicPublishAction
   -> Maybe DynamoDBAction
   -> Maybe FirehoseAction
   -> Maybe IotSiteWiseAction
   -> Maybe LambdaAction
   -> Maybe IotEventsAction
   -> Maybe SqsAction
   -> AlarmAction)
-> Parser (Maybe SNSTopicPublishAction)
-> Parser
     (Maybe DynamoDBAction
      -> Maybe FirehoseAction
      -> Maybe IotSiteWiseAction
      -> Maybe LambdaAction
      -> Maybe IotEventsAction
      -> Maybe SqsAction
      -> AlarmAction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SNSTopicPublishAction)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"sns")
            Parser
  (Maybe DynamoDBAction
   -> Maybe FirehoseAction
   -> Maybe IotSiteWiseAction
   -> Maybe LambdaAction
   -> Maybe IotEventsAction
   -> Maybe SqsAction
   -> AlarmAction)
-> Parser (Maybe DynamoDBAction)
-> Parser
     (Maybe FirehoseAction
      -> Maybe IotSiteWiseAction
      -> Maybe LambdaAction
      -> Maybe IotEventsAction
      -> Maybe SqsAction
      -> AlarmAction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe DynamoDBAction)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"dynamoDB")
            Parser
  (Maybe FirehoseAction
   -> Maybe IotSiteWiseAction
   -> Maybe LambdaAction
   -> Maybe IotEventsAction
   -> Maybe SqsAction
   -> AlarmAction)
-> Parser (Maybe FirehoseAction)
-> Parser
     (Maybe IotSiteWiseAction
      -> Maybe LambdaAction
      -> Maybe IotEventsAction
      -> Maybe SqsAction
      -> AlarmAction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe FirehoseAction)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"firehose")
            Parser
  (Maybe IotSiteWiseAction
   -> Maybe LambdaAction
   -> Maybe IotEventsAction
   -> Maybe SqsAction
   -> AlarmAction)
-> Parser (Maybe IotSiteWiseAction)
-> Parser
     (Maybe LambdaAction
      -> Maybe IotEventsAction -> Maybe SqsAction -> AlarmAction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe IotSiteWiseAction)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"iotSiteWise")
            Parser
  (Maybe LambdaAction
   -> Maybe IotEventsAction -> Maybe SqsAction -> AlarmAction)
-> Parser (Maybe LambdaAction)
-> Parser (Maybe IotEventsAction -> Maybe SqsAction -> AlarmAction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe LambdaAction)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"lambda")
            Parser (Maybe IotEventsAction -> Maybe SqsAction -> AlarmAction)
-> Parser (Maybe IotEventsAction)
-> Parser (Maybe SqsAction -> AlarmAction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe IotEventsAction)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"iotEvents")
            Parser (Maybe SqsAction -> AlarmAction)
-> Parser (Maybe SqsAction) -> Parser AlarmAction
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SqsAction)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"sqs")
      )

instance Prelude.Hashable AlarmAction

instance Prelude.NFData AlarmAction

instance Core.ToJSON AlarmAction where
  toJSON :: AlarmAction -> Value
toJSON AlarmAction' {Maybe IotSiteWiseAction
Maybe LambdaAction
Maybe IotTopicPublishAction
Maybe IotEventsAction
Maybe FirehoseAction
Maybe DynamoDBv2Action
Maybe DynamoDBAction
Maybe SNSTopicPublishAction
Maybe SqsAction
sqs :: Maybe SqsAction
iotEvents :: Maybe IotEventsAction
lambda :: Maybe LambdaAction
iotSiteWise :: Maybe IotSiteWiseAction
firehose :: Maybe FirehoseAction
dynamoDB :: Maybe DynamoDBAction
sns :: Maybe SNSTopicPublishAction
dynamoDBv2 :: Maybe DynamoDBv2Action
iotTopicPublish :: Maybe IotTopicPublishAction
$sel:sqs:AlarmAction' :: AlarmAction -> Maybe SqsAction
$sel:iotEvents:AlarmAction' :: AlarmAction -> Maybe IotEventsAction
$sel:lambda:AlarmAction' :: AlarmAction -> Maybe LambdaAction
$sel:iotSiteWise:AlarmAction' :: AlarmAction -> Maybe IotSiteWiseAction
$sel:firehose:AlarmAction' :: AlarmAction -> Maybe FirehoseAction
$sel:dynamoDB:AlarmAction' :: AlarmAction -> Maybe DynamoDBAction
$sel:sns:AlarmAction' :: AlarmAction -> Maybe SNSTopicPublishAction
$sel:dynamoDBv2:AlarmAction' :: AlarmAction -> Maybe DynamoDBv2Action
$sel:iotTopicPublish:AlarmAction' :: AlarmAction -> Maybe IotTopicPublishAction
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"iotTopicPublish" Text -> IotTopicPublishAction -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (IotTopicPublishAction -> Pair)
-> Maybe IotTopicPublishAction -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe IotTopicPublishAction
iotTopicPublish,
            (Text
"dynamoDBv2" Text -> DynamoDBv2Action -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (DynamoDBv2Action -> Pair) -> Maybe DynamoDBv2Action -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DynamoDBv2Action
dynamoDBv2,
            (Text
"sns" Text -> SNSTopicPublishAction -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SNSTopicPublishAction -> Pair)
-> Maybe SNSTopicPublishAction -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SNSTopicPublishAction
sns,
            (Text
"dynamoDB" Text -> DynamoDBAction -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (DynamoDBAction -> Pair) -> Maybe DynamoDBAction -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DynamoDBAction
dynamoDB,
            (Text
"firehose" Text -> FirehoseAction -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (FirehoseAction -> Pair) -> Maybe FirehoseAction -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe FirehoseAction
firehose,
            (Text
"iotSiteWise" Text -> IotSiteWiseAction -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (IotSiteWiseAction -> Pair)
-> Maybe IotSiteWiseAction -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe IotSiteWiseAction
iotSiteWise,
            (Text
"lambda" Text -> LambdaAction -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (LambdaAction -> Pair) -> Maybe LambdaAction -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe LambdaAction
lambda,
            (Text
"iotEvents" Text -> IotEventsAction -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (IotEventsAction -> Pair) -> Maybe IotEventsAction -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe IotEventsAction
iotEvents,
            (Text
"sqs" Text -> SqsAction -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SqsAction -> Pair) -> Maybe SqsAction -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SqsAction
sqs
          ]
      )