{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Snowball.Types.JobListEntry 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
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 creation date for this job.
    JobListEntry -> Maybe POSIX
creationDate :: Prelude.Maybe Data.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,
    -- | 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 job.
    JobListEntry -> Maybe JobType
jobType :: Prelude.Maybe JobType,
    -- | The type of device used with this job.
    JobListEntry -> Maybe SnowballType
snowballType :: Prelude.Maybe SnowballType
  }
  deriving (JobListEntry -> JobListEntry -> Bool
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]
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
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. 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:
--
-- '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.
--
-- '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.
--
-- 'jobType', 'jobListEntry_jobType' - The type of job.
--
-- 'snowballType', 'jobListEntry_snowballType' - The type of device used with this job.
newJobListEntry ::
  JobListEntry
newJobListEntry :: JobListEntry
newJobListEntry =
  JobListEntry'
    { $sel:creationDate:JobListEntry' :: Maybe POSIX
creationDate = forall a. Maybe a
Prelude.Nothing,
      $sel:description:JobListEntry' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:isMaster:JobListEntry' :: Maybe Bool
isMaster = forall a. Maybe a
Prelude.Nothing,
      $sel:jobId:JobListEntry' :: Maybe Text
jobId = forall a. Maybe a
Prelude.Nothing,
      $sel:jobState:JobListEntry' :: Maybe JobState
jobState = forall a. Maybe a
Prelude.Nothing,
      $sel:jobType:JobListEntry' :: Maybe JobType
jobType = forall a. Maybe a
Prelude.Nothing,
      $sel:snowballType:JobListEntry' :: Maybe SnowballType
snowballType = forall a. Maybe a
Prelude.Nothing
    }

-- | The creation date for this job.
jobListEntry_creationDate :: Lens.Lens' JobListEntry (Prelude.Maybe Prelude.UTCTime)
jobListEntry_creationDate :: Lens' JobListEntry (Maybe UTCTime)
jobListEntry_creationDate = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._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 :: Lens' JobListEntry (Maybe Text)
jobListEntry_description = 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 :: Lens' JobListEntry (Maybe Bool)
jobListEntry_isMaster = 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)

-- | 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 :: Lens' JobListEntry (Maybe Text)
jobListEntry_jobId = 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 :: Lens' JobListEntry (Maybe JobState)
jobListEntry_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 job.
jobListEntry_jobType :: Lens.Lens' JobListEntry (Prelude.Maybe JobType)
jobListEntry_jobType :: Lens' JobListEntry (Maybe JobType)
jobListEntry_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 type of device used with this job.
jobListEntry_snowballType :: Lens.Lens' JobListEntry (Prelude.Maybe SnowballType)
jobListEntry_snowballType :: Lens' JobListEntry (Maybe SnowballType)
jobListEntry_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)

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

instance Prelude.Hashable JobListEntry where
  hashWithSalt :: Int -> JobListEntry -> Int
hashWithSalt Int
_salt JobListEntry' {Maybe Bool
Maybe Text
Maybe POSIX
Maybe JobState
Maybe JobType
Maybe SnowballType
snowballType :: Maybe SnowballType
jobType :: Maybe JobType
jobState :: Maybe JobState
jobId :: Maybe Text
isMaster :: Maybe Bool
description :: Maybe Text
creationDate :: Maybe POSIX
$sel:snowballType:JobListEntry' :: JobListEntry -> Maybe SnowballType
$sel:jobType:JobListEntry' :: JobListEntry -> Maybe JobType
$sel:jobState:JobListEntry' :: JobListEntry -> Maybe JobState
$sel:jobId:JobListEntry' :: JobListEntry -> Maybe Text
$sel:isMaster:JobListEntry' :: JobListEntry -> Maybe Bool
$sel:description:JobListEntry' :: JobListEntry -> Maybe Text
$sel:creationDate:JobListEntry' :: JobListEntry -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
creationDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
isMaster
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
jobId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe JobState
jobState
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe JobType
jobType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SnowballType
snowballType

instance Prelude.NFData JobListEntry where
  rnf :: JobListEntry -> ()
rnf JobListEntry' {Maybe Bool
Maybe Text
Maybe POSIX
Maybe JobState
Maybe JobType
Maybe SnowballType
snowballType :: Maybe SnowballType
jobType :: Maybe JobType
jobState :: Maybe JobState
jobId :: Maybe Text
isMaster :: Maybe Bool
description :: Maybe Text
creationDate :: Maybe POSIX
$sel:snowballType:JobListEntry' :: JobListEntry -> Maybe SnowballType
$sel:jobType:JobListEntry' :: JobListEntry -> Maybe JobType
$sel:jobState:JobListEntry' :: JobListEntry -> Maybe JobState
$sel:jobId:JobListEntry' :: JobListEntry -> Maybe Text
$sel:isMaster:JobListEntry' :: JobListEntry -> Maybe Bool
$sel:description:JobListEntry' :: JobListEntry -> Maybe Text
$sel:creationDate:JobListEntry' :: JobListEntry -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
creationDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
isMaster
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
jobId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe JobState
jobState
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe JobType
jobType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SnowballType
snowballType