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

import qualified Amazonka.Core as Core
import Amazonka.ImportExport.Types.JobType
import qualified Amazonka.Lens as Lens
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 :: Core.ISO8601
  }
  deriving (Job -> Job -> Bool
(Job -> Job -> Bool) -> (Job -> Job -> Bool) -> Eq Job
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]
(Int -> ReadS Job)
-> ReadS [Job] -> ReadPrec Job -> ReadPrec [Job] -> Read 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
(Int -> Job -> ShowS)
-> (Job -> String) -> ([Job] -> ShowS) -> Show Job
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. Job -> Rep Job x)
-> (forall x. Rep Job x -> Job) -> Generic Job
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' :: JobType -> Text -> Bool -> ISO8601 -> Job
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 = Tagged UTCTime (Identity UTCTime)
-> Tagged ISO8601 (Identity ISO8601)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged ISO8601 (Identity ISO8601))
-> UTCTime -> ISO8601
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreationDate_
    }

-- | Undocumented member.
job_jobType :: Lens.Lens' Job JobType
job_jobType :: (JobType -> f JobType) -> Job -> f Job
job_jobType = (Job -> JobType)
-> (Job -> JobType -> Job) -> Lens Job Job JobType 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 :: (Text -> f Text) -> Job -> f Job
job_jobId = (Job -> Text) -> (Job -> Text -> Job) -> Lens Job Job Text Text
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 :: (Bool -> f Bool) -> Job -> f Job
job_isCanceled = (Job -> Bool) -> (Job -> Bool -> Job) -> Lens Job Job Bool Bool
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 :: (UTCTime -> f UTCTime) -> Job -> f Job
job_creationDate = (Job -> ISO8601)
-> (Job -> ISO8601 -> Job) -> Lens Job Job ISO8601 ISO8601
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) ((ISO8601 -> f ISO8601) -> Job -> f Job)
-> ((UTCTime -> f UTCTime) -> ISO8601 -> f ISO8601)
-> (UTCTime -> f UTCTime)
-> Job
-> f Job
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> ISO8601 -> f ISO8601
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

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

instance Prelude.Hashable Job

instance Prelude.NFData Job