{-# 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.Snowball.Types.JobListEntry
-- 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.Snowball.Types.JobListEntry where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Snowball.Types.JobState
import Amazonka.Snowball.Types.JobType
import Amazonka.Snowball.Types.SnowballType

-- | Each @JobListEntry@ object contains a job\'s state, a job\'s ID, and a
-- value that indicates whether the job is a job part, in the case of an
-- export job.
--
-- /See:/ 'newJobListEntry' smart constructor.
data JobListEntry = JobListEntry'
  { -- | The type of job.
    JobListEntry -> Maybe JobType
jobType :: Prelude.Maybe JobType,
    -- | The automatically generated ID for a job, for example
    -- @JID123e4567-e89b-12d3-a456-426655440000@.
    JobListEntry -> Maybe Text
jobId :: Prelude.Maybe Prelude.Text,
    -- | The current state of this job.
    JobListEntry -> Maybe JobState
jobState :: Prelude.Maybe JobState,
    -- | The type of device used with this job.
    JobListEntry -> Maybe SnowballType
snowballType :: Prelude.Maybe SnowballType,
    -- | The creation date for this job.
    JobListEntry -> Maybe POSIX
creationDate :: Prelude.Maybe Core.POSIX,
    -- | The optional description of this specific job, for example
    -- @Important Photos 2016-08-11@.
    JobListEntry -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | A value that indicates that this job is a main job. A main job
    -- represents a successful request to create an export job. Main jobs
    -- aren\'t associated with any Snowballs. Instead, each main job will have
    -- at least one job part, and each job part is associated with a Snowball.
    -- It might take some time before the job parts associated with a
    -- particular main job are listed, because they are created after the main
    -- job is created.
    JobListEntry -> Maybe Bool
isMaster :: Prelude.Maybe Prelude.Bool
  }
  deriving (JobListEntry -> JobListEntry -> Bool
(JobListEntry -> JobListEntry -> Bool)
-> (JobListEntry -> JobListEntry -> Bool) -> Eq JobListEntry
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: JobListEntry -> JobListEntry -> Bool
$c/= :: JobListEntry -> JobListEntry -> Bool
== :: JobListEntry -> JobListEntry -> Bool
$c== :: JobListEntry -> JobListEntry -> Bool
Prelude.Eq, ReadPrec [JobListEntry]
ReadPrec JobListEntry
Int -> ReadS JobListEntry
ReadS [JobListEntry]
(Int -> ReadS JobListEntry)
-> ReadS [JobListEntry]
-> ReadPrec JobListEntry
-> ReadPrec [JobListEntry]
-> Read JobListEntry
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [JobListEntry]
$creadListPrec :: ReadPrec [JobListEntry]
readPrec :: ReadPrec JobListEntry
$creadPrec :: ReadPrec JobListEntry
readList :: ReadS [JobListEntry]
$creadList :: ReadS [JobListEntry]
readsPrec :: Int -> ReadS JobListEntry
$creadsPrec :: Int -> ReadS JobListEntry
Prelude.Read, Int -> JobListEntry -> ShowS
[JobListEntry] -> ShowS
JobListEntry -> String
(Int -> JobListEntry -> ShowS)
-> (JobListEntry -> String)
-> ([JobListEntry] -> ShowS)
-> Show JobListEntry
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [JobListEntry] -> ShowS
$cshowList :: [JobListEntry] -> ShowS
show :: JobListEntry -> String
$cshow :: JobListEntry -> String
showsPrec :: Int -> JobListEntry -> ShowS
$cshowsPrec :: Int -> JobListEntry -> ShowS
Prelude.Show, (forall x. JobListEntry -> Rep JobListEntry x)
-> (forall x. Rep JobListEntry x -> JobListEntry)
-> Generic JobListEntry
forall x. Rep JobListEntry x -> JobListEntry
forall x. JobListEntry -> Rep JobListEntry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep JobListEntry x -> JobListEntry
$cfrom :: forall x. JobListEntry -> Rep JobListEntry x
Prelude.Generic)

-- |
-- Create a value of 'JobListEntry' 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:
--
-- 'jobType', 'jobListEntry_jobType' - The type of job.
--
-- 'jobId', 'jobListEntry_jobId' - The automatically generated ID for a job, for example
-- @JID123e4567-e89b-12d3-a456-426655440000@.
--
-- 'jobState', 'jobListEntry_jobState' - The current state of this job.
--
-- 'snowballType', 'jobListEntry_snowballType' - The type of device used with this job.
--
-- 'creationDate', 'jobListEntry_creationDate' - The creation date for this job.
--
-- 'description', 'jobListEntry_description' - The optional description of this specific job, for example
-- @Important Photos 2016-08-11@.
--
-- 'isMaster', 'jobListEntry_isMaster' - A value that indicates that this job is a main job. A main job
-- represents a successful request to create an export job. Main jobs
-- aren\'t associated with any Snowballs. Instead, each main job will have
-- at least one job part, and each job part is associated with a Snowball.
-- It might take some time before the job parts associated with a
-- particular main job are listed, because they are created after the main
-- job is created.
newJobListEntry ::
  JobListEntry
newJobListEntry :: JobListEntry
newJobListEntry =
  JobListEntry' :: Maybe JobType
-> Maybe Text
-> Maybe JobState
-> Maybe SnowballType
-> Maybe POSIX
-> Maybe Text
-> Maybe Bool
-> JobListEntry
JobListEntry'
    { $sel:jobType:JobListEntry' :: Maybe JobType
jobType = Maybe JobType
forall a. Maybe a
Prelude.Nothing,
      $sel:jobId:JobListEntry' :: Maybe Text
jobId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:jobState:JobListEntry' :: Maybe JobState
jobState = Maybe JobState
forall a. Maybe a
Prelude.Nothing,
      $sel:snowballType:JobListEntry' :: Maybe SnowballType
snowballType = Maybe SnowballType
forall a. Maybe a
Prelude.Nothing,
      $sel:creationDate:JobListEntry' :: Maybe POSIX
creationDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:description:JobListEntry' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:isMaster:JobListEntry' :: Maybe Bool
isMaster = Maybe Bool
forall a. Maybe a
Prelude.Nothing
    }

-- | The type of job.
jobListEntry_jobType :: Lens.Lens' JobListEntry (Prelude.Maybe JobType)
jobListEntry_jobType :: (Maybe JobType -> f (Maybe JobType))
-> JobListEntry -> f JobListEntry
jobListEntry_jobType = (JobListEntry -> Maybe JobType)
-> (JobListEntry -> Maybe JobType -> JobListEntry)
-> Lens JobListEntry JobListEntry (Maybe JobType) (Maybe JobType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobListEntry' {Maybe JobType
jobType :: Maybe JobType
$sel:jobType:JobListEntry' :: JobListEntry -> Maybe JobType
jobType} -> Maybe JobType
jobType) (\s :: JobListEntry
s@JobListEntry' {} Maybe JobType
a -> JobListEntry
s {$sel:jobType:JobListEntry' :: Maybe JobType
jobType = Maybe JobType
a} :: JobListEntry)

-- | The automatically generated ID for a job, for example
-- @JID123e4567-e89b-12d3-a456-426655440000@.
jobListEntry_jobId :: Lens.Lens' JobListEntry (Prelude.Maybe Prelude.Text)
jobListEntry_jobId :: (Maybe Text -> f (Maybe Text)) -> JobListEntry -> f JobListEntry
jobListEntry_jobId = (JobListEntry -> Maybe Text)
-> (JobListEntry -> Maybe Text -> JobListEntry)
-> Lens JobListEntry JobListEntry (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobListEntry' {Maybe Text
jobId :: Maybe Text
$sel:jobId:JobListEntry' :: JobListEntry -> Maybe Text
jobId} -> Maybe Text
jobId) (\s :: JobListEntry
s@JobListEntry' {} Maybe Text
a -> JobListEntry
s {$sel:jobId:JobListEntry' :: Maybe Text
jobId = Maybe Text
a} :: JobListEntry)

-- | The current state of this job.
jobListEntry_jobState :: Lens.Lens' JobListEntry (Prelude.Maybe JobState)
jobListEntry_jobState :: (Maybe JobState -> f (Maybe JobState))
-> JobListEntry -> f JobListEntry
jobListEntry_jobState = (JobListEntry -> Maybe JobState)
-> (JobListEntry -> Maybe JobState -> JobListEntry)
-> Lens JobListEntry JobListEntry (Maybe JobState) (Maybe JobState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobListEntry' {Maybe JobState
jobState :: Maybe JobState
$sel:jobState:JobListEntry' :: JobListEntry -> Maybe JobState
jobState} -> Maybe JobState
jobState) (\s :: JobListEntry
s@JobListEntry' {} Maybe JobState
a -> JobListEntry
s {$sel:jobState:JobListEntry' :: Maybe JobState
jobState = Maybe JobState
a} :: JobListEntry)

-- | The type of device used with this job.
jobListEntry_snowballType :: Lens.Lens' JobListEntry (Prelude.Maybe SnowballType)
jobListEntry_snowballType :: (Maybe SnowballType -> f (Maybe SnowballType))
-> JobListEntry -> f JobListEntry
jobListEntry_snowballType = (JobListEntry -> Maybe SnowballType)
-> (JobListEntry -> Maybe SnowballType -> JobListEntry)
-> Lens
     JobListEntry JobListEntry (Maybe SnowballType) (Maybe SnowballType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobListEntry' {Maybe SnowballType
snowballType :: Maybe SnowballType
$sel:snowballType:JobListEntry' :: JobListEntry -> Maybe SnowballType
snowballType} -> Maybe SnowballType
snowballType) (\s :: JobListEntry
s@JobListEntry' {} Maybe SnowballType
a -> JobListEntry
s {$sel:snowballType:JobListEntry' :: Maybe SnowballType
snowballType = Maybe SnowballType
a} :: JobListEntry)

-- | The creation date for this job.
jobListEntry_creationDate :: Lens.Lens' JobListEntry (Prelude.Maybe Prelude.UTCTime)
jobListEntry_creationDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> JobListEntry -> f JobListEntry
jobListEntry_creationDate = (JobListEntry -> Maybe POSIX)
-> (JobListEntry -> Maybe POSIX -> JobListEntry)
-> Lens JobListEntry JobListEntry (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobListEntry' {Maybe POSIX
creationDate :: Maybe POSIX
$sel:creationDate:JobListEntry' :: JobListEntry -> Maybe POSIX
creationDate} -> Maybe POSIX
creationDate) (\s :: JobListEntry
s@JobListEntry' {} Maybe POSIX
a -> JobListEntry
s {$sel:creationDate:JobListEntry' :: Maybe POSIX
creationDate = Maybe POSIX
a} :: JobListEntry) ((Maybe POSIX -> f (Maybe POSIX))
 -> JobListEntry -> f JobListEntry)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> JobListEntry
-> f JobListEntry
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 optional description of this specific job, for example
-- @Important Photos 2016-08-11@.
jobListEntry_description :: Lens.Lens' JobListEntry (Prelude.Maybe Prelude.Text)
jobListEntry_description :: (Maybe Text -> f (Maybe Text)) -> JobListEntry -> f JobListEntry
jobListEntry_description = (JobListEntry -> Maybe Text)
-> (JobListEntry -> Maybe Text -> JobListEntry)
-> Lens JobListEntry JobListEntry (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobListEntry' {Maybe Text
description :: Maybe Text
$sel:description:JobListEntry' :: JobListEntry -> Maybe Text
description} -> Maybe Text
description) (\s :: JobListEntry
s@JobListEntry' {} Maybe Text
a -> JobListEntry
s {$sel:description:JobListEntry' :: Maybe Text
description = Maybe Text
a} :: JobListEntry)

-- | A value that indicates that this job is a main job. A main job
-- represents a successful request to create an export job. Main jobs
-- aren\'t associated with any Snowballs. Instead, each main job will have
-- at least one job part, and each job part is associated with a Snowball.
-- It might take some time before the job parts associated with a
-- particular main job are listed, because they are created after the main
-- job is created.
jobListEntry_isMaster :: Lens.Lens' JobListEntry (Prelude.Maybe Prelude.Bool)
jobListEntry_isMaster :: (Maybe Bool -> f (Maybe Bool)) -> JobListEntry -> f JobListEntry
jobListEntry_isMaster = (JobListEntry -> Maybe Bool)
-> (JobListEntry -> Maybe Bool -> JobListEntry)
-> Lens JobListEntry JobListEntry (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobListEntry' {Maybe Bool
isMaster :: Maybe Bool
$sel:isMaster:JobListEntry' :: JobListEntry -> Maybe Bool
isMaster} -> Maybe Bool
isMaster) (\s :: JobListEntry
s@JobListEntry' {} Maybe Bool
a -> JobListEntry
s {$sel:isMaster:JobListEntry' :: Maybe Bool
isMaster = Maybe Bool
a} :: JobListEntry)

instance Core.FromJSON JobListEntry where
  parseJSON :: Value -> Parser JobListEntry
parseJSON =
    String
-> (Object -> Parser JobListEntry) -> Value -> Parser JobListEntry
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"JobListEntry"
      ( \Object
x ->
          Maybe JobType
-> Maybe Text
-> Maybe JobState
-> Maybe SnowballType
-> Maybe POSIX
-> Maybe Text
-> Maybe Bool
-> JobListEntry
JobListEntry'
            (Maybe JobType
 -> Maybe Text
 -> Maybe JobState
 -> Maybe SnowballType
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Bool
 -> JobListEntry)
-> Parser (Maybe JobType)
-> Parser
     (Maybe Text
      -> Maybe JobState
      -> Maybe SnowballType
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Bool
      -> JobListEntry)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe JobType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"JobType")
            Parser
  (Maybe Text
   -> Maybe JobState
   -> Maybe SnowballType
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Bool
   -> JobListEntry)
-> Parser (Maybe Text)
-> Parser
     (Maybe JobState
      -> Maybe SnowballType
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Bool
      -> JobListEntry)
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
"JobId")
            Parser
  (Maybe JobState
   -> Maybe SnowballType
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Bool
   -> JobListEntry)
-> Parser (Maybe JobState)
-> Parser
     (Maybe SnowballType
      -> Maybe POSIX -> Maybe Text -> Maybe Bool -> JobListEntry)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe JobState)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"JobState")
            Parser
  (Maybe SnowballType
   -> Maybe POSIX -> Maybe Text -> Maybe Bool -> JobListEntry)
-> Parser (Maybe SnowballType)
-> Parser (Maybe POSIX -> Maybe Text -> Maybe Bool -> JobListEntry)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SnowballType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SnowballType")
            Parser (Maybe POSIX -> Maybe Text -> Maybe Bool -> JobListEntry)
-> Parser (Maybe POSIX)
-> Parser (Maybe Text -> Maybe Bool -> JobListEntry)
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
"CreationDate")
            Parser (Maybe Text -> Maybe Bool -> JobListEntry)
-> Parser (Maybe Text) -> Parser (Maybe Bool -> JobListEntry)
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
"Description")
            Parser (Maybe Bool -> JobListEntry)
-> Parser (Maybe Bool) -> Parser JobListEntry
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"IsMaster")
      )

instance Prelude.Hashable JobListEntry

instance Prelude.NFData JobListEntry