{-# 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.ClearTimerAction
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.IoTEvents.Types.ClearTimerAction where

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

-- | Information needed to clear the timer.
--
-- /See:/ 'newClearTimerAction' smart constructor.
data ClearTimerAction = ClearTimerAction'
  { -- | The name of the timer to clear.
    ClearTimerAction -> Text
timerName :: Prelude.Text
  }
  deriving (ClearTimerAction -> ClearTimerAction -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ClearTimerAction -> ClearTimerAction -> Bool
$c/= :: ClearTimerAction -> ClearTimerAction -> Bool
== :: ClearTimerAction -> ClearTimerAction -> Bool
$c== :: ClearTimerAction -> ClearTimerAction -> Bool
Prelude.Eq, ReadPrec [ClearTimerAction]
ReadPrec ClearTimerAction
Int -> ReadS ClearTimerAction
ReadS [ClearTimerAction]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ClearTimerAction]
$creadListPrec :: ReadPrec [ClearTimerAction]
readPrec :: ReadPrec ClearTimerAction
$creadPrec :: ReadPrec ClearTimerAction
readList :: ReadS [ClearTimerAction]
$creadList :: ReadS [ClearTimerAction]
readsPrec :: Int -> ReadS ClearTimerAction
$creadsPrec :: Int -> ReadS ClearTimerAction
Prelude.Read, Int -> ClearTimerAction -> ShowS
[ClearTimerAction] -> ShowS
ClearTimerAction -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ClearTimerAction] -> ShowS
$cshowList :: [ClearTimerAction] -> ShowS
show :: ClearTimerAction -> String
$cshow :: ClearTimerAction -> String
showsPrec :: Int -> ClearTimerAction -> ShowS
$cshowsPrec :: Int -> ClearTimerAction -> ShowS
Prelude.Show, forall x. Rep ClearTimerAction x -> ClearTimerAction
forall x. ClearTimerAction -> Rep ClearTimerAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ClearTimerAction x -> ClearTimerAction
$cfrom :: forall x. ClearTimerAction -> Rep ClearTimerAction x
Prelude.Generic)

-- |
-- Create a value of 'ClearTimerAction' 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:
--
-- 'timerName', 'clearTimerAction_timerName' - The name of the timer to clear.
newClearTimerAction ::
  -- | 'timerName'
  Prelude.Text ->
  ClearTimerAction
newClearTimerAction :: Text -> ClearTimerAction
newClearTimerAction Text
pTimerName_ =
  ClearTimerAction' {$sel:timerName:ClearTimerAction' :: Text
timerName = Text
pTimerName_}

-- | The name of the timer to clear.
clearTimerAction_timerName :: Lens.Lens' ClearTimerAction Prelude.Text
clearTimerAction_timerName :: Lens' ClearTimerAction Text
clearTimerAction_timerName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClearTimerAction' {Text
timerName :: Text
$sel:timerName:ClearTimerAction' :: ClearTimerAction -> Text
timerName} -> Text
timerName) (\s :: ClearTimerAction
s@ClearTimerAction' {} Text
a -> ClearTimerAction
s {$sel:timerName:ClearTimerAction' :: Text
timerName = Text
a} :: ClearTimerAction)

instance Data.FromJSON ClearTimerAction where
  parseJSON :: Value -> Parser ClearTimerAction
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ClearTimerAction"
      ( \Object
x ->
          Text -> ClearTimerAction
ClearTimerAction'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"timerName")
      )

instance Prelude.Hashable ClearTimerAction where
  hashWithSalt :: Int -> ClearTimerAction -> Int
hashWithSalt Int
_salt ClearTimerAction' {Text
timerName :: Text
$sel:timerName:ClearTimerAction' :: ClearTimerAction -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
timerName

instance Prelude.NFData ClearTimerAction where
  rnf :: ClearTimerAction -> ()
rnf ClearTimerAction' {Text
timerName :: Text
$sel:timerName:ClearTimerAction' :: ClearTimerAction -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
timerName

instance Data.ToJSON ClearTimerAction where
  toJSON :: ClearTimerAction -> Value
toJSON ClearTimerAction' {Text
timerName :: Text
$sel:timerName:ClearTimerAction' :: ClearTimerAction -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"timerName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
timerName)]
      )