{-# 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.ImportExport.Types.Job
-- 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.ImportExport.Types.Job where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ImportExport.Types.JobType
import qualified Amazonka.Prelude as Prelude

-- | Representation of a job returned by the ListJobs operation.
--
-- /See:/ 'newJob' smart constructor.
data Job = Job'
  { Job -> JobType
jobType :: JobType,
    Job -> Text
jobId :: Prelude.Text,
    Job -> Bool
isCanceled :: Prelude.Bool,
    Job -> ISO8601
creationDate :: Data.ISO8601
  }
  deriving (Job -> Job -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Job -> Job -> Bool
$c/= :: Job -> Job -> Bool
== :: Job -> Job -> Bool
$c== :: Job -> Job -> Bool
Prelude.Eq, ReadPrec [Job]
ReadPrec Job
Int -> ReadS Job
ReadS [Job]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Job]
$creadListPrec :: ReadPrec [Job]
readPrec :: ReadPrec Job
$creadPrec :: ReadPrec Job
readList :: ReadS [Job]
$creadList :: ReadS [Job]
readsPrec :: Int -> ReadS Job
$creadsPrec :: Int -> ReadS Job
Prelude.Read, Int -> Job -> ShowS
[Job] -> ShowS
Job -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Job] -> ShowS
$cshowList :: [Job] -> ShowS
show :: Job -> String
$cshow :: Job -> String
showsPrec :: Int -> Job -> ShowS
$cshowsPrec :: Int -> Job -> ShowS
Prelude.Show, forall x. Rep Job x -> Job
forall x. Job -> Rep Job x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Job x -> Job
$cfrom :: forall x. Job -> Rep Job x
Prelude.Generic)

-- |
-- Create a value of 'Job' 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', 'job_jobType' - Undocumented member.
--
-- 'jobId', 'job_jobId' - Undocumented member.
--
-- 'isCanceled', 'job_isCanceled' - Undocumented member.
--
-- 'creationDate', 'job_creationDate' - Undocumented member.
newJob ::
  -- | 'jobType'
  JobType ->
  -- | 'jobId'
  Prelude.Text ->
  -- | 'isCanceled'
  Prelude.Bool ->
  -- | 'creationDate'
  Prelude.UTCTime ->
  Job
newJob :: JobType -> Text -> Bool -> UTCTime -> Job
newJob JobType
pJobType_ Text
pJobId_ Bool
pIsCanceled_ UTCTime
pCreationDate_ =
  Job'
    { $sel:jobType:Job' :: JobType
jobType = JobType
pJobType_,
      $sel:jobId:Job' :: Text
jobId = Text
pJobId_,
      $sel:isCanceled:Job' :: Bool
isCanceled = Bool
pIsCanceled_,
      $sel:creationDate:Job' :: ISO8601
creationDate = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreationDate_
    }

-- | Undocumented member.
job_jobType :: Lens.Lens' Job JobType
job_jobType :: Lens' Job JobType
job_jobType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Job' {JobType
jobType :: JobType
$sel:jobType:Job' :: Job -> JobType
jobType} -> JobType
jobType) (\s :: Job
s@Job' {} JobType
a -> Job
s {$sel:jobType:Job' :: JobType
jobType = JobType
a} :: Job)

-- | Undocumented member.
job_jobId :: Lens.Lens' Job Prelude.Text
job_jobId :: Lens' Job Text
job_jobId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Job' {Text
jobId :: Text
$sel:jobId:Job' :: Job -> Text
jobId} -> Text
jobId) (\s :: Job
s@Job' {} Text
a -> Job
s {$sel:jobId:Job' :: Text
jobId = Text
a} :: Job)

-- | Undocumented member.
job_isCanceled :: Lens.Lens' Job Prelude.Bool
job_isCanceled :: Lens' Job Bool
job_isCanceled = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Job' {Bool
isCanceled :: Bool
$sel:isCanceled:Job' :: Job -> Bool
isCanceled} -> Bool
isCanceled) (\s :: Job
s@Job' {} Bool
a -> Job
s {$sel:isCanceled:Job' :: Bool
isCanceled = Bool
a} :: Job)

-- | Undocumented member.
job_creationDate :: Lens.Lens' Job Prelude.UTCTime
job_creationDate :: Lens' Job UTCTime
job_creationDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Job' {ISO8601
creationDate :: ISO8601
$sel:creationDate:Job' :: Job -> ISO8601
creationDate} -> ISO8601
creationDate) (\s :: Job
s@Job' {} ISO8601
a -> Job
s {$sel:creationDate:Job' :: ISO8601
creationDate = ISO8601
a} :: Job) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

instance Data.FromXML Job where
  parseXML :: [Node] -> Either String Job
parseXML [Node]
x =
    JobType -> Text -> Bool -> ISO8601 -> Job
Job'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"JobType")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"JobId")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"IsCanceled")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"CreationDate")

instance Prelude.Hashable Job where
  hashWithSalt :: Int -> Job -> Int
hashWithSalt Int
_salt Job' {Bool
Text
ISO8601
JobType
creationDate :: ISO8601
isCanceled :: Bool
jobId :: Text
jobType :: JobType
$sel:creationDate:Job' :: Job -> ISO8601
$sel:isCanceled:Job' :: Job -> Bool
$sel:jobId:Job' :: Job -> Text
$sel:jobType:Job' :: Job -> JobType
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` JobType
jobType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
jobId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Bool
isCanceled
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ISO8601
creationDate

instance Prelude.NFData Job where
  rnf :: Job -> ()
rnf Job' {Bool
Text
ISO8601
JobType
creationDate :: ISO8601
isCanceled :: Bool
jobId :: Text
jobType :: JobType
$sel:creationDate:Job' :: Job -> ISO8601
$sel:isCanceled:Job' :: Job -> Bool
$sel:jobId:Job' :: Job -> Text
$sel:jobType:Job' :: Job -> JobType
..} =
    forall a. NFData a => a -> ()
Prelude.rnf JobType
jobType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
jobId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Bool
isCanceled
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ISO8601
creationDate