{-# 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-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.ClearTimerAction where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(ClearTimerAction -> ClearTimerAction -> Bool)
-> (ClearTimerAction -> ClearTimerAction -> Bool)
-> Eq ClearTimerAction
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]
(Int -> ReadS ClearTimerAction)
-> ReadS [ClearTimerAction]
-> ReadPrec ClearTimerAction
-> ReadPrec [ClearTimerAction]
-> Read 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
(Int -> ClearTimerAction -> ShowS)
-> (ClearTimerAction -> String)
-> ([ClearTimerAction] -> ShowS)
-> Show ClearTimerAction
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. ClearTimerAction -> Rep ClearTimerAction x)
-> (forall x. Rep ClearTimerAction x -> ClearTimerAction)
-> Generic ClearTimerAction
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' :: Text -> ClearTimerAction
ClearTimerAction' {$sel:timerName:ClearTimerAction' :: Text
timerName = Text
pTimerName_}

-- | The name of the timer to clear.
clearTimerAction_timerName :: Lens.Lens' ClearTimerAction Prelude.Text
clearTimerAction_timerName :: (Text -> f Text) -> ClearTimerAction -> f ClearTimerAction
clearTimerAction_timerName = (ClearTimerAction -> Text)
-> (ClearTimerAction -> Text -> ClearTimerAction)
-> Lens ClearTimerAction ClearTimerAction Text Text
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 Core.FromJSON ClearTimerAction where
  parseJSON :: Value -> Parser ClearTimerAction
parseJSON =
    String
-> (Object -> Parser ClearTimerAction)
-> Value
-> Parser ClearTimerAction
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ClearTimerAction"
      ( \Object
x ->
          Text -> ClearTimerAction
ClearTimerAction'
            (Text -> ClearTimerAction)
-> Parser Text -> Parser ClearTimerAction
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"timerName")
      )

instance Prelude.Hashable ClearTimerAction

instance Prelude.NFData ClearTimerAction

instance Core.ToJSON ClearTimerAction where
  toJSON :: ClearTimerAction -> Value
toJSON ClearTimerAction' {Text
timerName :: Text
$sel:timerName:ClearTimerAction' :: ClearTimerAction -> 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
"timerName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
timerName)]
      )