{-# 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.IoTEventsData.Types.EnableAlarmActionRequest
-- 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.IoTEventsData.Types.EnableAlarmActionRequest where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information needed to enable the alarm.
--
-- /See:/ 'newEnableAlarmActionRequest' smart constructor.
data EnableAlarmActionRequest = EnableAlarmActionRequest'
  { -- | The value of the key used as a filter to select only the alarms
    -- associated with the
    -- <https://docs.aws.amazon.com/iotevents/latest/apireference/API_CreateAlarmModel.html#iotevents-CreateAlarmModel-request-key key>.
    EnableAlarmActionRequest -> Maybe Text
keyValue :: Prelude.Maybe Prelude.Text,
    -- | The note that you can leave when you enable the alarm.
    EnableAlarmActionRequest -> Maybe Text
note :: Prelude.Maybe Prelude.Text,
    -- | The request ID. Each ID must be unique within each batch.
    EnableAlarmActionRequest -> Text
requestId :: Prelude.Text,
    -- | The name of the alarm model.
    EnableAlarmActionRequest -> Text
alarmModelName :: Prelude.Text
  }
  deriving (EnableAlarmActionRequest -> EnableAlarmActionRequest -> Bool
(EnableAlarmActionRequest -> EnableAlarmActionRequest -> Bool)
-> (EnableAlarmActionRequest -> EnableAlarmActionRequest -> Bool)
-> Eq EnableAlarmActionRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EnableAlarmActionRequest -> EnableAlarmActionRequest -> Bool
$c/= :: EnableAlarmActionRequest -> EnableAlarmActionRequest -> Bool
== :: EnableAlarmActionRequest -> EnableAlarmActionRequest -> Bool
$c== :: EnableAlarmActionRequest -> EnableAlarmActionRequest -> Bool
Prelude.Eq, ReadPrec [EnableAlarmActionRequest]
ReadPrec EnableAlarmActionRequest
Int -> ReadS EnableAlarmActionRequest
ReadS [EnableAlarmActionRequest]
(Int -> ReadS EnableAlarmActionRequest)
-> ReadS [EnableAlarmActionRequest]
-> ReadPrec EnableAlarmActionRequest
-> ReadPrec [EnableAlarmActionRequest]
-> Read EnableAlarmActionRequest
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EnableAlarmActionRequest]
$creadListPrec :: ReadPrec [EnableAlarmActionRequest]
readPrec :: ReadPrec EnableAlarmActionRequest
$creadPrec :: ReadPrec EnableAlarmActionRequest
readList :: ReadS [EnableAlarmActionRequest]
$creadList :: ReadS [EnableAlarmActionRequest]
readsPrec :: Int -> ReadS EnableAlarmActionRequest
$creadsPrec :: Int -> ReadS EnableAlarmActionRequest
Prelude.Read, Int -> EnableAlarmActionRequest -> ShowS
[EnableAlarmActionRequest] -> ShowS
EnableAlarmActionRequest -> String
(Int -> EnableAlarmActionRequest -> ShowS)
-> (EnableAlarmActionRequest -> String)
-> ([EnableAlarmActionRequest] -> ShowS)
-> Show EnableAlarmActionRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EnableAlarmActionRequest] -> ShowS
$cshowList :: [EnableAlarmActionRequest] -> ShowS
show :: EnableAlarmActionRequest -> String
$cshow :: EnableAlarmActionRequest -> String
showsPrec :: Int -> EnableAlarmActionRequest -> ShowS
$cshowsPrec :: Int -> EnableAlarmActionRequest -> ShowS
Prelude.Show, (forall x.
 EnableAlarmActionRequest -> Rep EnableAlarmActionRequest x)
-> (forall x.
    Rep EnableAlarmActionRequest x -> EnableAlarmActionRequest)
-> Generic EnableAlarmActionRequest
forall x.
Rep EnableAlarmActionRequest x -> EnableAlarmActionRequest
forall x.
EnableAlarmActionRequest -> Rep EnableAlarmActionRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep EnableAlarmActionRequest x -> EnableAlarmActionRequest
$cfrom :: forall x.
EnableAlarmActionRequest -> Rep EnableAlarmActionRequest x
Prelude.Generic)

-- |
-- Create a value of 'EnableAlarmActionRequest' 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:
--
-- 'keyValue', 'enableAlarmActionRequest_keyValue' - The value of the key used as a filter to select only the alarms
-- associated with the
-- <https://docs.aws.amazon.com/iotevents/latest/apireference/API_CreateAlarmModel.html#iotevents-CreateAlarmModel-request-key key>.
--
-- 'note', 'enableAlarmActionRequest_note' - The note that you can leave when you enable the alarm.
--
-- 'requestId', 'enableAlarmActionRequest_requestId' - The request ID. Each ID must be unique within each batch.
--
-- 'alarmModelName', 'enableAlarmActionRequest_alarmModelName' - The name of the alarm model.
newEnableAlarmActionRequest ::
  -- | 'requestId'
  Prelude.Text ->
  -- | 'alarmModelName'
  Prelude.Text ->
  EnableAlarmActionRequest
newEnableAlarmActionRequest :: Text -> Text -> EnableAlarmActionRequest
newEnableAlarmActionRequest
  Text
pRequestId_
  Text
pAlarmModelName_ =
    EnableAlarmActionRequest' :: Maybe Text
-> Maybe Text -> Text -> Text -> EnableAlarmActionRequest
EnableAlarmActionRequest'
      { $sel:keyValue:EnableAlarmActionRequest' :: Maybe Text
keyValue =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:note:EnableAlarmActionRequest' :: Maybe Text
note = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:requestId:EnableAlarmActionRequest' :: Text
requestId = Text
pRequestId_,
        $sel:alarmModelName:EnableAlarmActionRequest' :: Text
alarmModelName = Text
pAlarmModelName_
      }

-- | The value of the key used as a filter to select only the alarms
-- associated with the
-- <https://docs.aws.amazon.com/iotevents/latest/apireference/API_CreateAlarmModel.html#iotevents-CreateAlarmModel-request-key key>.
enableAlarmActionRequest_keyValue :: Lens.Lens' EnableAlarmActionRequest (Prelude.Maybe Prelude.Text)
enableAlarmActionRequest_keyValue :: (Maybe Text -> f (Maybe Text))
-> EnableAlarmActionRequest -> f EnableAlarmActionRequest
enableAlarmActionRequest_keyValue = (EnableAlarmActionRequest -> Maybe Text)
-> (EnableAlarmActionRequest
    -> Maybe Text -> EnableAlarmActionRequest)
-> Lens
     EnableAlarmActionRequest
     EnableAlarmActionRequest
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnableAlarmActionRequest' {Maybe Text
keyValue :: Maybe Text
$sel:keyValue:EnableAlarmActionRequest' :: EnableAlarmActionRequest -> Maybe Text
keyValue} -> Maybe Text
keyValue) (\s :: EnableAlarmActionRequest
s@EnableAlarmActionRequest' {} Maybe Text
a -> EnableAlarmActionRequest
s {$sel:keyValue:EnableAlarmActionRequest' :: Maybe Text
keyValue = Maybe Text
a} :: EnableAlarmActionRequest)

-- | The note that you can leave when you enable the alarm.
enableAlarmActionRequest_note :: Lens.Lens' EnableAlarmActionRequest (Prelude.Maybe Prelude.Text)
enableAlarmActionRequest_note :: (Maybe Text -> f (Maybe Text))
-> EnableAlarmActionRequest -> f EnableAlarmActionRequest
enableAlarmActionRequest_note = (EnableAlarmActionRequest -> Maybe Text)
-> (EnableAlarmActionRequest
    -> Maybe Text -> EnableAlarmActionRequest)
-> Lens
     EnableAlarmActionRequest
     EnableAlarmActionRequest
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnableAlarmActionRequest' {Maybe Text
note :: Maybe Text
$sel:note:EnableAlarmActionRequest' :: EnableAlarmActionRequest -> Maybe Text
note} -> Maybe Text
note) (\s :: EnableAlarmActionRequest
s@EnableAlarmActionRequest' {} Maybe Text
a -> EnableAlarmActionRequest
s {$sel:note:EnableAlarmActionRequest' :: Maybe Text
note = Maybe Text
a} :: EnableAlarmActionRequest)

-- | The request ID. Each ID must be unique within each batch.
enableAlarmActionRequest_requestId :: Lens.Lens' EnableAlarmActionRequest Prelude.Text
enableAlarmActionRequest_requestId :: (Text -> f Text)
-> EnableAlarmActionRequest -> f EnableAlarmActionRequest
enableAlarmActionRequest_requestId = (EnableAlarmActionRequest -> Text)
-> (EnableAlarmActionRequest -> Text -> EnableAlarmActionRequest)
-> Lens EnableAlarmActionRequest EnableAlarmActionRequest Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnableAlarmActionRequest' {Text
requestId :: Text
$sel:requestId:EnableAlarmActionRequest' :: EnableAlarmActionRequest -> Text
requestId} -> Text
requestId) (\s :: EnableAlarmActionRequest
s@EnableAlarmActionRequest' {} Text
a -> EnableAlarmActionRequest
s {$sel:requestId:EnableAlarmActionRequest' :: Text
requestId = Text
a} :: EnableAlarmActionRequest)

-- | The name of the alarm model.
enableAlarmActionRequest_alarmModelName :: Lens.Lens' EnableAlarmActionRequest Prelude.Text
enableAlarmActionRequest_alarmModelName :: (Text -> f Text)
-> EnableAlarmActionRequest -> f EnableAlarmActionRequest
enableAlarmActionRequest_alarmModelName = (EnableAlarmActionRequest -> Text)
-> (EnableAlarmActionRequest -> Text -> EnableAlarmActionRequest)
-> Lens EnableAlarmActionRequest EnableAlarmActionRequest Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnableAlarmActionRequest' {Text
alarmModelName :: Text
$sel:alarmModelName:EnableAlarmActionRequest' :: EnableAlarmActionRequest -> Text
alarmModelName} -> Text
alarmModelName) (\s :: EnableAlarmActionRequest
s@EnableAlarmActionRequest' {} Text
a -> EnableAlarmActionRequest
s {$sel:alarmModelName:EnableAlarmActionRequest' :: Text
alarmModelName = Text
a} :: EnableAlarmActionRequest)

instance Prelude.Hashable EnableAlarmActionRequest

instance Prelude.NFData EnableAlarmActionRequest

instance Core.ToJSON EnableAlarmActionRequest where
  toJSON :: EnableAlarmActionRequest -> Value
toJSON EnableAlarmActionRequest' {Maybe Text
Text
alarmModelName :: Text
requestId :: Text
note :: Maybe Text
keyValue :: Maybe Text
$sel:alarmModelName:EnableAlarmActionRequest' :: EnableAlarmActionRequest -> Text
$sel:requestId:EnableAlarmActionRequest' :: EnableAlarmActionRequest -> Text
$sel:note:EnableAlarmActionRequest' :: EnableAlarmActionRequest -> Maybe Text
$sel:keyValue:EnableAlarmActionRequest' :: EnableAlarmActionRequest -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"keyValue" 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
keyValue,
            (Text
"note" 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
note,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"requestId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
requestId),
            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)
          ]
      )