{-# 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.GreengrassV2.Types.IoTJobTimeoutConfig
-- 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.GreengrassV2.Types.IoTJobTimeoutConfig 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

-- | Contains information about the timeout configuration for a job.
--
-- /See:/ 'newIoTJobTimeoutConfig' smart constructor.
data IoTJobTimeoutConfig = IoTJobTimeoutConfig'
  { -- | The amount of time, in minutes, that devices have to complete the job.
    -- The timer starts when the job status is set to @IN_PROGRESS@. If the job
    -- status doesn\'t change to a terminal state before the time expires, then
    -- the job status is set to @TIMED_OUT@.
    --
    -- The timeout interval must be between 1 minute and 7 days (10080
    -- minutes).
    IoTJobTimeoutConfig -> Maybe Integer
inProgressTimeoutInMinutes :: Prelude.Maybe Prelude.Integer
  }
  deriving (IoTJobTimeoutConfig -> IoTJobTimeoutConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IoTJobTimeoutConfig -> IoTJobTimeoutConfig -> Bool
$c/= :: IoTJobTimeoutConfig -> IoTJobTimeoutConfig -> Bool
== :: IoTJobTimeoutConfig -> IoTJobTimeoutConfig -> Bool
$c== :: IoTJobTimeoutConfig -> IoTJobTimeoutConfig -> Bool
Prelude.Eq, ReadPrec [IoTJobTimeoutConfig]
ReadPrec IoTJobTimeoutConfig
Int -> ReadS IoTJobTimeoutConfig
ReadS [IoTJobTimeoutConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IoTJobTimeoutConfig]
$creadListPrec :: ReadPrec [IoTJobTimeoutConfig]
readPrec :: ReadPrec IoTJobTimeoutConfig
$creadPrec :: ReadPrec IoTJobTimeoutConfig
readList :: ReadS [IoTJobTimeoutConfig]
$creadList :: ReadS [IoTJobTimeoutConfig]
readsPrec :: Int -> ReadS IoTJobTimeoutConfig
$creadsPrec :: Int -> ReadS IoTJobTimeoutConfig
Prelude.Read, Int -> IoTJobTimeoutConfig -> ShowS
[IoTJobTimeoutConfig] -> ShowS
IoTJobTimeoutConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IoTJobTimeoutConfig] -> ShowS
$cshowList :: [IoTJobTimeoutConfig] -> ShowS
show :: IoTJobTimeoutConfig -> String
$cshow :: IoTJobTimeoutConfig -> String
showsPrec :: Int -> IoTJobTimeoutConfig -> ShowS
$cshowsPrec :: Int -> IoTJobTimeoutConfig -> ShowS
Prelude.Show, forall x. Rep IoTJobTimeoutConfig x -> IoTJobTimeoutConfig
forall x. IoTJobTimeoutConfig -> Rep IoTJobTimeoutConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IoTJobTimeoutConfig x -> IoTJobTimeoutConfig
$cfrom :: forall x. IoTJobTimeoutConfig -> Rep IoTJobTimeoutConfig x
Prelude.Generic)

-- |
-- Create a value of 'IoTJobTimeoutConfig' 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:
--
-- 'inProgressTimeoutInMinutes', 'ioTJobTimeoutConfig_inProgressTimeoutInMinutes' - The amount of time, in minutes, that devices have to complete the job.
-- The timer starts when the job status is set to @IN_PROGRESS@. If the job
-- status doesn\'t change to a terminal state before the time expires, then
-- the job status is set to @TIMED_OUT@.
--
-- The timeout interval must be between 1 minute and 7 days (10080
-- minutes).
newIoTJobTimeoutConfig ::
  IoTJobTimeoutConfig
newIoTJobTimeoutConfig :: IoTJobTimeoutConfig
newIoTJobTimeoutConfig =
  IoTJobTimeoutConfig'
    { $sel:inProgressTimeoutInMinutes:IoTJobTimeoutConfig' :: Maybe Integer
inProgressTimeoutInMinutes =
        forall a. Maybe a
Prelude.Nothing
    }

-- | The amount of time, in minutes, that devices have to complete the job.
-- The timer starts when the job status is set to @IN_PROGRESS@. If the job
-- status doesn\'t change to a terminal state before the time expires, then
-- the job status is set to @TIMED_OUT@.
--
-- The timeout interval must be between 1 minute and 7 days (10080
-- minutes).
ioTJobTimeoutConfig_inProgressTimeoutInMinutes :: Lens.Lens' IoTJobTimeoutConfig (Prelude.Maybe Prelude.Integer)
ioTJobTimeoutConfig_inProgressTimeoutInMinutes :: Lens' IoTJobTimeoutConfig (Maybe Integer)
ioTJobTimeoutConfig_inProgressTimeoutInMinutes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IoTJobTimeoutConfig' {Maybe Integer
inProgressTimeoutInMinutes :: Maybe Integer
$sel:inProgressTimeoutInMinutes:IoTJobTimeoutConfig' :: IoTJobTimeoutConfig -> Maybe Integer
inProgressTimeoutInMinutes} -> Maybe Integer
inProgressTimeoutInMinutes) (\s :: IoTJobTimeoutConfig
s@IoTJobTimeoutConfig' {} Maybe Integer
a -> IoTJobTimeoutConfig
s {$sel:inProgressTimeoutInMinutes:IoTJobTimeoutConfig' :: Maybe Integer
inProgressTimeoutInMinutes = Maybe Integer
a} :: IoTJobTimeoutConfig)

instance Data.FromJSON IoTJobTimeoutConfig where
  parseJSON :: Value -> Parser IoTJobTimeoutConfig
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"IoTJobTimeoutConfig"
      ( \Object
x ->
          Maybe Integer -> IoTJobTimeoutConfig
IoTJobTimeoutConfig'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"inProgressTimeoutInMinutes")
      )

instance Prelude.Hashable IoTJobTimeoutConfig where
  hashWithSalt :: Int -> IoTJobTimeoutConfig -> Int
hashWithSalt Int
_salt IoTJobTimeoutConfig' {Maybe Integer
inProgressTimeoutInMinutes :: Maybe Integer
$sel:inProgressTimeoutInMinutes:IoTJobTimeoutConfig' :: IoTJobTimeoutConfig -> Maybe Integer
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
inProgressTimeoutInMinutes

instance Prelude.NFData IoTJobTimeoutConfig where
  rnf :: IoTJobTimeoutConfig -> ()
rnf IoTJobTimeoutConfig' {Maybe Integer
inProgressTimeoutInMinutes :: Maybe Integer
$sel:inProgressTimeoutInMinutes:IoTJobTimeoutConfig' :: IoTJobTimeoutConfig -> Maybe Integer
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
inProgressTimeoutInMinutes

instance Data.ToJSON IoTJobTimeoutConfig where
  toJSON :: IoTJobTimeoutConfig -> Value
toJSON IoTJobTimeoutConfig' {Maybe Integer
inProgressTimeoutInMinutes :: Maybe Integer
$sel:inProgressTimeoutInMinutes:IoTJobTimeoutConfig' :: IoTJobTimeoutConfig -> Maybe Integer
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"inProgressTimeoutInMinutes" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Integer
inProgressTimeoutInMinutes
          ]
      )