{-# 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.Panorama.Types.DeviceJobConfig
-- 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.Panorama.Types.DeviceJobConfig where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Panorama.Types.OTAJobConfig
import qualified Amazonka.Prelude as Prelude

-- | A job\'s configuration.
--
-- /See:/ 'newDeviceJobConfig' smart constructor.
data DeviceJobConfig = DeviceJobConfig'
  { -- | A configuration for an over-the-air (OTA) upgrade. Required for OTA
    -- jobs.
    DeviceJobConfig -> Maybe OTAJobConfig
oTAJobConfig :: Prelude.Maybe OTAJobConfig
  }
  deriving (DeviceJobConfig -> DeviceJobConfig -> Bool
(DeviceJobConfig -> DeviceJobConfig -> Bool)
-> (DeviceJobConfig -> DeviceJobConfig -> Bool)
-> Eq DeviceJobConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeviceJobConfig -> DeviceJobConfig -> Bool
$c/= :: DeviceJobConfig -> DeviceJobConfig -> Bool
== :: DeviceJobConfig -> DeviceJobConfig -> Bool
$c== :: DeviceJobConfig -> DeviceJobConfig -> Bool
Prelude.Eq, ReadPrec [DeviceJobConfig]
ReadPrec DeviceJobConfig
Int -> ReadS DeviceJobConfig
ReadS [DeviceJobConfig]
(Int -> ReadS DeviceJobConfig)
-> ReadS [DeviceJobConfig]
-> ReadPrec DeviceJobConfig
-> ReadPrec [DeviceJobConfig]
-> Read DeviceJobConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeviceJobConfig]
$creadListPrec :: ReadPrec [DeviceJobConfig]
readPrec :: ReadPrec DeviceJobConfig
$creadPrec :: ReadPrec DeviceJobConfig
readList :: ReadS [DeviceJobConfig]
$creadList :: ReadS [DeviceJobConfig]
readsPrec :: Int -> ReadS DeviceJobConfig
$creadsPrec :: Int -> ReadS DeviceJobConfig
Prelude.Read, Int -> DeviceJobConfig -> ShowS
[DeviceJobConfig] -> ShowS
DeviceJobConfig -> String
(Int -> DeviceJobConfig -> ShowS)
-> (DeviceJobConfig -> String)
-> ([DeviceJobConfig] -> ShowS)
-> Show DeviceJobConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeviceJobConfig] -> ShowS
$cshowList :: [DeviceJobConfig] -> ShowS
show :: DeviceJobConfig -> String
$cshow :: DeviceJobConfig -> String
showsPrec :: Int -> DeviceJobConfig -> ShowS
$cshowsPrec :: Int -> DeviceJobConfig -> ShowS
Prelude.Show, (forall x. DeviceJobConfig -> Rep DeviceJobConfig x)
-> (forall x. Rep DeviceJobConfig x -> DeviceJobConfig)
-> Generic DeviceJobConfig
forall x. Rep DeviceJobConfig x -> DeviceJobConfig
forall x. DeviceJobConfig -> Rep DeviceJobConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeviceJobConfig x -> DeviceJobConfig
$cfrom :: forall x. DeviceJobConfig -> Rep DeviceJobConfig x
Prelude.Generic)

-- |
-- Create a value of 'DeviceJobConfig' 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:
--
-- 'oTAJobConfig', 'deviceJobConfig_oTAJobConfig' - A configuration for an over-the-air (OTA) upgrade. Required for OTA
-- jobs.
newDeviceJobConfig ::
  DeviceJobConfig
newDeviceJobConfig :: DeviceJobConfig
newDeviceJobConfig =
  DeviceJobConfig' :: Maybe OTAJobConfig -> DeviceJobConfig
DeviceJobConfig' {$sel:oTAJobConfig:DeviceJobConfig' :: Maybe OTAJobConfig
oTAJobConfig = Maybe OTAJobConfig
forall a. Maybe a
Prelude.Nothing}

-- | A configuration for an over-the-air (OTA) upgrade. Required for OTA
-- jobs.
deviceJobConfig_oTAJobConfig :: Lens.Lens' DeviceJobConfig (Prelude.Maybe OTAJobConfig)
deviceJobConfig_oTAJobConfig :: (Maybe OTAJobConfig -> f (Maybe OTAJobConfig))
-> DeviceJobConfig -> f DeviceJobConfig
deviceJobConfig_oTAJobConfig = (DeviceJobConfig -> Maybe OTAJobConfig)
-> (DeviceJobConfig -> Maybe OTAJobConfig -> DeviceJobConfig)
-> Lens
     DeviceJobConfig
     DeviceJobConfig
     (Maybe OTAJobConfig)
     (Maybe OTAJobConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceJobConfig' {Maybe OTAJobConfig
oTAJobConfig :: Maybe OTAJobConfig
$sel:oTAJobConfig:DeviceJobConfig' :: DeviceJobConfig -> Maybe OTAJobConfig
oTAJobConfig} -> Maybe OTAJobConfig
oTAJobConfig) (\s :: DeviceJobConfig
s@DeviceJobConfig' {} Maybe OTAJobConfig
a -> DeviceJobConfig
s {$sel:oTAJobConfig:DeviceJobConfig' :: Maybe OTAJobConfig
oTAJobConfig = Maybe OTAJobConfig
a} :: DeviceJobConfig)

instance Prelude.Hashable DeviceJobConfig

instance Prelude.NFData DeviceJobConfig

instance Core.ToJSON DeviceJobConfig where
  toJSON :: DeviceJobConfig -> Value
toJSON DeviceJobConfig' {Maybe OTAJobConfig
oTAJobConfig :: Maybe OTAJobConfig
$sel:oTAJobConfig:DeviceJobConfig' :: DeviceJobConfig -> Maybe OTAJobConfig
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"OTAJobConfig" Text -> OTAJobConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (OTAJobConfig -> Pair) -> Maybe OTAJobConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe OTAJobConfig
oTAJobConfig]
      )