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

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

-- | A job that runs on a device.
--
-- /See:/ 'newDeviceJob' smart constructor.
data DeviceJob = DeviceJob'
  { -- | The job\'s ID.
    DeviceJob -> Maybe Text
jobId :: Prelude.Maybe Prelude.Text,
    -- | When the job was created.
    DeviceJob -> Maybe POSIX
createdTime :: Prelude.Maybe Core.POSIX,
    -- | The name of the target device
    DeviceJob -> Maybe Text
deviceName :: Prelude.Maybe Prelude.Text,
    -- | The ID of the target device.
    DeviceJob -> Maybe Text
deviceId :: Prelude.Maybe Prelude.Text
  }
  deriving (DeviceJob -> DeviceJob -> Bool
(DeviceJob -> DeviceJob -> Bool)
-> (DeviceJob -> DeviceJob -> Bool) -> Eq DeviceJob
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeviceJob -> DeviceJob -> Bool
$c/= :: DeviceJob -> DeviceJob -> Bool
== :: DeviceJob -> DeviceJob -> Bool
$c== :: DeviceJob -> DeviceJob -> Bool
Prelude.Eq, ReadPrec [DeviceJob]
ReadPrec DeviceJob
Int -> ReadS DeviceJob
ReadS [DeviceJob]
(Int -> ReadS DeviceJob)
-> ReadS [DeviceJob]
-> ReadPrec DeviceJob
-> ReadPrec [DeviceJob]
-> Read DeviceJob
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeviceJob]
$creadListPrec :: ReadPrec [DeviceJob]
readPrec :: ReadPrec DeviceJob
$creadPrec :: ReadPrec DeviceJob
readList :: ReadS [DeviceJob]
$creadList :: ReadS [DeviceJob]
readsPrec :: Int -> ReadS DeviceJob
$creadsPrec :: Int -> ReadS DeviceJob
Prelude.Read, Int -> DeviceJob -> ShowS
[DeviceJob] -> ShowS
DeviceJob -> String
(Int -> DeviceJob -> ShowS)
-> (DeviceJob -> String)
-> ([DeviceJob] -> ShowS)
-> Show DeviceJob
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeviceJob] -> ShowS
$cshowList :: [DeviceJob] -> ShowS
show :: DeviceJob -> String
$cshow :: DeviceJob -> String
showsPrec :: Int -> DeviceJob -> ShowS
$cshowsPrec :: Int -> DeviceJob -> ShowS
Prelude.Show, (forall x. DeviceJob -> Rep DeviceJob x)
-> (forall x. Rep DeviceJob x -> DeviceJob) -> Generic DeviceJob
forall x. Rep DeviceJob x -> DeviceJob
forall x. DeviceJob -> Rep DeviceJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeviceJob x -> DeviceJob
$cfrom :: forall x. DeviceJob -> Rep DeviceJob x
Prelude.Generic)

-- |
-- Create a value of 'DeviceJob' 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:
--
-- 'jobId', 'deviceJob_jobId' - The job\'s ID.
--
-- 'createdTime', 'deviceJob_createdTime' - When the job was created.
--
-- 'deviceName', 'deviceJob_deviceName' - The name of the target device
--
-- 'deviceId', 'deviceJob_deviceId' - The ID of the target device.
newDeviceJob ::
  DeviceJob
newDeviceJob :: DeviceJob
newDeviceJob =
  DeviceJob' :: Maybe Text -> Maybe POSIX -> Maybe Text -> Maybe Text -> DeviceJob
DeviceJob'
    { $sel:jobId:DeviceJob' :: Maybe Text
jobId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:createdTime:DeviceJob' :: Maybe POSIX
createdTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:deviceName:DeviceJob' :: Maybe Text
deviceName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:deviceId:DeviceJob' :: Maybe Text
deviceId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The job\'s ID.
deviceJob_jobId :: Lens.Lens' DeviceJob (Prelude.Maybe Prelude.Text)
deviceJob_jobId :: (Maybe Text -> f (Maybe Text)) -> DeviceJob -> f DeviceJob
deviceJob_jobId = (DeviceJob -> Maybe Text)
-> (DeviceJob -> Maybe Text -> DeviceJob)
-> Lens DeviceJob DeviceJob (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceJob' {Maybe Text
jobId :: Maybe Text
$sel:jobId:DeviceJob' :: DeviceJob -> Maybe Text
jobId} -> Maybe Text
jobId) (\s :: DeviceJob
s@DeviceJob' {} Maybe Text
a -> DeviceJob
s {$sel:jobId:DeviceJob' :: Maybe Text
jobId = Maybe Text
a} :: DeviceJob)

-- | When the job was created.
deviceJob_createdTime :: Lens.Lens' DeviceJob (Prelude.Maybe Prelude.UTCTime)
deviceJob_createdTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> DeviceJob -> f DeviceJob
deviceJob_createdTime = (DeviceJob -> Maybe POSIX)
-> (DeviceJob -> Maybe POSIX -> DeviceJob)
-> Lens DeviceJob DeviceJob (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceJob' {Maybe POSIX
createdTime :: Maybe POSIX
$sel:createdTime:DeviceJob' :: DeviceJob -> Maybe POSIX
createdTime} -> Maybe POSIX
createdTime) (\s :: DeviceJob
s@DeviceJob' {} Maybe POSIX
a -> DeviceJob
s {$sel:createdTime:DeviceJob' :: Maybe POSIX
createdTime = Maybe POSIX
a} :: DeviceJob) ((Maybe POSIX -> f (Maybe POSIX)) -> DeviceJob -> f DeviceJob)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> DeviceJob
-> f DeviceJob
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The name of the target device
deviceJob_deviceName :: Lens.Lens' DeviceJob (Prelude.Maybe Prelude.Text)
deviceJob_deviceName :: (Maybe Text -> f (Maybe Text)) -> DeviceJob -> f DeviceJob
deviceJob_deviceName = (DeviceJob -> Maybe Text)
-> (DeviceJob -> Maybe Text -> DeviceJob)
-> Lens DeviceJob DeviceJob (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceJob' {Maybe Text
deviceName :: Maybe Text
$sel:deviceName:DeviceJob' :: DeviceJob -> Maybe Text
deviceName} -> Maybe Text
deviceName) (\s :: DeviceJob
s@DeviceJob' {} Maybe Text
a -> DeviceJob
s {$sel:deviceName:DeviceJob' :: Maybe Text
deviceName = Maybe Text
a} :: DeviceJob)

-- | The ID of the target device.
deviceJob_deviceId :: Lens.Lens' DeviceJob (Prelude.Maybe Prelude.Text)
deviceJob_deviceId :: (Maybe Text -> f (Maybe Text)) -> DeviceJob -> f DeviceJob
deviceJob_deviceId = (DeviceJob -> Maybe Text)
-> (DeviceJob -> Maybe Text -> DeviceJob)
-> Lens DeviceJob DeviceJob (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceJob' {Maybe Text
deviceId :: Maybe Text
$sel:deviceId:DeviceJob' :: DeviceJob -> Maybe Text
deviceId} -> Maybe Text
deviceId) (\s :: DeviceJob
s@DeviceJob' {} Maybe Text
a -> DeviceJob
s {$sel:deviceId:DeviceJob' :: Maybe Text
deviceId = Maybe Text
a} :: DeviceJob)

instance Core.FromJSON DeviceJob where
  parseJSON :: Value -> Parser DeviceJob
parseJSON =
    String -> (Object -> Parser DeviceJob) -> Value -> Parser DeviceJob
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DeviceJob"
      ( \Object
x ->
          Maybe Text -> Maybe POSIX -> Maybe Text -> Maybe Text -> DeviceJob
DeviceJob'
            (Maybe Text
 -> Maybe POSIX -> Maybe Text -> Maybe Text -> DeviceJob)
-> Parser (Maybe Text)
-> Parser (Maybe POSIX -> Maybe Text -> Maybe Text -> DeviceJob)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"JobId")
            Parser (Maybe POSIX -> Maybe Text -> Maybe Text -> DeviceJob)
-> Parser (Maybe POSIX)
-> Parser (Maybe Text -> Maybe Text -> DeviceJob)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CreatedTime")
            Parser (Maybe Text -> Maybe Text -> DeviceJob)
-> Parser (Maybe Text) -> Parser (Maybe Text -> DeviceJob)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DeviceName")
            Parser (Maybe Text -> DeviceJob)
-> Parser (Maybe Text) -> Parser DeviceJob
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DeviceId")
      )

instance Prelude.Hashable DeviceJob

instance Prelude.NFData DeviceJob