{-# 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.Personalize.Types.DatasetExportJobSummary
-- 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.Personalize.Types.DatasetExportJobSummary where

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

-- | Provides a summary of the properties of a dataset export job. For a
-- complete listing, call the DescribeDatasetExportJob API.
--
-- /See:/ 'newDatasetExportJobSummary' smart constructor.
data DatasetExportJobSummary = DatasetExportJobSummary'
  { -- | If a dataset export job fails, the reason behind the failure.
    DatasetExportJobSummary -> Maybe Text
failureReason :: Prelude.Maybe Prelude.Text,
    -- | The status of the dataset export job.
    --
    -- A dataset export job can be in one of the following states:
    --
    -- -   CREATE PENDING > CREATE IN_PROGRESS > ACTIVE -or- CREATE FAILED
    DatasetExportJobSummary -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the dataset export job.
    DatasetExportJobSummary -> Maybe Text
datasetExportJobArn :: Prelude.Maybe Prelude.Text,
    -- | The name of the dataset export job.
    DatasetExportJobSummary -> Maybe Text
jobName :: Prelude.Maybe Prelude.Text,
    -- | The date and time (in Unix time) that the dataset export job status was
    -- last updated.
    DatasetExportJobSummary -> Maybe POSIX
lastUpdatedDateTime :: Prelude.Maybe Core.POSIX,
    -- | The date and time (in Unix time) that the dataset export job was
    -- created.
    DatasetExportJobSummary -> Maybe POSIX
creationDateTime :: Prelude.Maybe Core.POSIX
  }
  deriving (DatasetExportJobSummary -> DatasetExportJobSummary -> Bool
(DatasetExportJobSummary -> DatasetExportJobSummary -> Bool)
-> (DatasetExportJobSummary -> DatasetExportJobSummary -> Bool)
-> Eq DatasetExportJobSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DatasetExportJobSummary -> DatasetExportJobSummary -> Bool
$c/= :: DatasetExportJobSummary -> DatasetExportJobSummary -> Bool
== :: DatasetExportJobSummary -> DatasetExportJobSummary -> Bool
$c== :: DatasetExportJobSummary -> DatasetExportJobSummary -> Bool
Prelude.Eq, ReadPrec [DatasetExportJobSummary]
ReadPrec DatasetExportJobSummary
Int -> ReadS DatasetExportJobSummary
ReadS [DatasetExportJobSummary]
(Int -> ReadS DatasetExportJobSummary)
-> ReadS [DatasetExportJobSummary]
-> ReadPrec DatasetExportJobSummary
-> ReadPrec [DatasetExportJobSummary]
-> Read DatasetExportJobSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DatasetExportJobSummary]
$creadListPrec :: ReadPrec [DatasetExportJobSummary]
readPrec :: ReadPrec DatasetExportJobSummary
$creadPrec :: ReadPrec DatasetExportJobSummary
readList :: ReadS [DatasetExportJobSummary]
$creadList :: ReadS [DatasetExportJobSummary]
readsPrec :: Int -> ReadS DatasetExportJobSummary
$creadsPrec :: Int -> ReadS DatasetExportJobSummary
Prelude.Read, Int -> DatasetExportJobSummary -> ShowS
[DatasetExportJobSummary] -> ShowS
DatasetExportJobSummary -> String
(Int -> DatasetExportJobSummary -> ShowS)
-> (DatasetExportJobSummary -> String)
-> ([DatasetExportJobSummary] -> ShowS)
-> Show DatasetExportJobSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DatasetExportJobSummary] -> ShowS
$cshowList :: [DatasetExportJobSummary] -> ShowS
show :: DatasetExportJobSummary -> String
$cshow :: DatasetExportJobSummary -> String
showsPrec :: Int -> DatasetExportJobSummary -> ShowS
$cshowsPrec :: Int -> DatasetExportJobSummary -> ShowS
Prelude.Show, (forall x.
 DatasetExportJobSummary -> Rep DatasetExportJobSummary x)
-> (forall x.
    Rep DatasetExportJobSummary x -> DatasetExportJobSummary)
-> Generic DatasetExportJobSummary
forall x. Rep DatasetExportJobSummary x -> DatasetExportJobSummary
forall x. DatasetExportJobSummary -> Rep DatasetExportJobSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DatasetExportJobSummary x -> DatasetExportJobSummary
$cfrom :: forall x. DatasetExportJobSummary -> Rep DatasetExportJobSummary x
Prelude.Generic)

-- |
-- Create a value of 'DatasetExportJobSummary' 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:
--
-- 'failureReason', 'datasetExportJobSummary_failureReason' - If a dataset export job fails, the reason behind the failure.
--
-- 'status', 'datasetExportJobSummary_status' - The status of the dataset export job.
--
-- A dataset export job can be in one of the following states:
--
-- -   CREATE PENDING > CREATE IN_PROGRESS > ACTIVE -or- CREATE FAILED
--
-- 'datasetExportJobArn', 'datasetExportJobSummary_datasetExportJobArn' - The Amazon Resource Name (ARN) of the dataset export job.
--
-- 'jobName', 'datasetExportJobSummary_jobName' - The name of the dataset export job.
--
-- 'lastUpdatedDateTime', 'datasetExportJobSummary_lastUpdatedDateTime' - The date and time (in Unix time) that the dataset export job status was
-- last updated.
--
-- 'creationDateTime', 'datasetExportJobSummary_creationDateTime' - The date and time (in Unix time) that the dataset export job was
-- created.
newDatasetExportJobSummary ::
  DatasetExportJobSummary
newDatasetExportJobSummary :: DatasetExportJobSummary
newDatasetExportJobSummary =
  DatasetExportJobSummary' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe POSIX
-> DatasetExportJobSummary
DatasetExportJobSummary'
    { $sel:failureReason:DatasetExportJobSummary' :: Maybe Text
failureReason =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:status:DatasetExportJobSummary' :: Maybe Text
status = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:datasetExportJobArn:DatasetExportJobSummary' :: Maybe Text
datasetExportJobArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:jobName:DatasetExportJobSummary' :: Maybe Text
jobName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedDateTime:DatasetExportJobSummary' :: Maybe POSIX
lastUpdatedDateTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:creationDateTime:DatasetExportJobSummary' :: Maybe POSIX
creationDateTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | If a dataset export job fails, the reason behind the failure.
datasetExportJobSummary_failureReason :: Lens.Lens' DatasetExportJobSummary (Prelude.Maybe Prelude.Text)
datasetExportJobSummary_failureReason :: (Maybe Text -> f (Maybe Text))
-> DatasetExportJobSummary -> f DatasetExportJobSummary
datasetExportJobSummary_failureReason = (DatasetExportJobSummary -> Maybe Text)
-> (DatasetExportJobSummary
    -> Maybe Text -> DatasetExportJobSummary)
-> Lens
     DatasetExportJobSummary
     DatasetExportJobSummary
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DatasetExportJobSummary' {Maybe Text
failureReason :: Maybe Text
$sel:failureReason:DatasetExportJobSummary' :: DatasetExportJobSummary -> Maybe Text
failureReason} -> Maybe Text
failureReason) (\s :: DatasetExportJobSummary
s@DatasetExportJobSummary' {} Maybe Text
a -> DatasetExportJobSummary
s {$sel:failureReason:DatasetExportJobSummary' :: Maybe Text
failureReason = Maybe Text
a} :: DatasetExportJobSummary)

-- | The status of the dataset export job.
--
-- A dataset export job can be in one of the following states:
--
-- -   CREATE PENDING > CREATE IN_PROGRESS > ACTIVE -or- CREATE FAILED
datasetExportJobSummary_status :: Lens.Lens' DatasetExportJobSummary (Prelude.Maybe Prelude.Text)
datasetExportJobSummary_status :: (Maybe Text -> f (Maybe Text))
-> DatasetExportJobSummary -> f DatasetExportJobSummary
datasetExportJobSummary_status = (DatasetExportJobSummary -> Maybe Text)
-> (DatasetExportJobSummary
    -> Maybe Text -> DatasetExportJobSummary)
-> Lens
     DatasetExportJobSummary
     DatasetExportJobSummary
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DatasetExportJobSummary' {Maybe Text
status :: Maybe Text
$sel:status:DatasetExportJobSummary' :: DatasetExportJobSummary -> Maybe Text
status} -> Maybe Text
status) (\s :: DatasetExportJobSummary
s@DatasetExportJobSummary' {} Maybe Text
a -> DatasetExportJobSummary
s {$sel:status:DatasetExportJobSummary' :: Maybe Text
status = Maybe Text
a} :: DatasetExportJobSummary)

-- | The Amazon Resource Name (ARN) of the dataset export job.
datasetExportJobSummary_datasetExportJobArn :: Lens.Lens' DatasetExportJobSummary (Prelude.Maybe Prelude.Text)
datasetExportJobSummary_datasetExportJobArn :: (Maybe Text -> f (Maybe Text))
-> DatasetExportJobSummary -> f DatasetExportJobSummary
datasetExportJobSummary_datasetExportJobArn = (DatasetExportJobSummary -> Maybe Text)
-> (DatasetExportJobSummary
    -> Maybe Text -> DatasetExportJobSummary)
-> Lens
     DatasetExportJobSummary
     DatasetExportJobSummary
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DatasetExportJobSummary' {Maybe Text
datasetExportJobArn :: Maybe Text
$sel:datasetExportJobArn:DatasetExportJobSummary' :: DatasetExportJobSummary -> Maybe Text
datasetExportJobArn} -> Maybe Text
datasetExportJobArn) (\s :: DatasetExportJobSummary
s@DatasetExportJobSummary' {} Maybe Text
a -> DatasetExportJobSummary
s {$sel:datasetExportJobArn:DatasetExportJobSummary' :: Maybe Text
datasetExportJobArn = Maybe Text
a} :: DatasetExportJobSummary)

-- | The name of the dataset export job.
datasetExportJobSummary_jobName :: Lens.Lens' DatasetExportJobSummary (Prelude.Maybe Prelude.Text)
datasetExportJobSummary_jobName :: (Maybe Text -> f (Maybe Text))
-> DatasetExportJobSummary -> f DatasetExportJobSummary
datasetExportJobSummary_jobName = (DatasetExportJobSummary -> Maybe Text)
-> (DatasetExportJobSummary
    -> Maybe Text -> DatasetExportJobSummary)
-> Lens
     DatasetExportJobSummary
     DatasetExportJobSummary
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DatasetExportJobSummary' {Maybe Text
jobName :: Maybe Text
$sel:jobName:DatasetExportJobSummary' :: DatasetExportJobSummary -> Maybe Text
jobName} -> Maybe Text
jobName) (\s :: DatasetExportJobSummary
s@DatasetExportJobSummary' {} Maybe Text
a -> DatasetExportJobSummary
s {$sel:jobName:DatasetExportJobSummary' :: Maybe Text
jobName = Maybe Text
a} :: DatasetExportJobSummary)

-- | The date and time (in Unix time) that the dataset export job status was
-- last updated.
datasetExportJobSummary_lastUpdatedDateTime :: Lens.Lens' DatasetExportJobSummary (Prelude.Maybe Prelude.UTCTime)
datasetExportJobSummary_lastUpdatedDateTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> DatasetExportJobSummary -> f DatasetExportJobSummary
datasetExportJobSummary_lastUpdatedDateTime = (DatasetExportJobSummary -> Maybe POSIX)
-> (DatasetExportJobSummary
    -> Maybe POSIX -> DatasetExportJobSummary)
-> Lens
     DatasetExportJobSummary
     DatasetExportJobSummary
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DatasetExportJobSummary' {Maybe POSIX
lastUpdatedDateTime :: Maybe POSIX
$sel:lastUpdatedDateTime:DatasetExportJobSummary' :: DatasetExportJobSummary -> Maybe POSIX
lastUpdatedDateTime} -> Maybe POSIX
lastUpdatedDateTime) (\s :: DatasetExportJobSummary
s@DatasetExportJobSummary' {} Maybe POSIX
a -> DatasetExportJobSummary
s {$sel:lastUpdatedDateTime:DatasetExportJobSummary' :: Maybe POSIX
lastUpdatedDateTime = Maybe POSIX
a} :: DatasetExportJobSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> DatasetExportJobSummary -> f DatasetExportJobSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> DatasetExportJobSummary
-> f DatasetExportJobSummary
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 date and time (in Unix time) that the dataset export job was
-- created.
datasetExportJobSummary_creationDateTime :: Lens.Lens' DatasetExportJobSummary (Prelude.Maybe Prelude.UTCTime)
datasetExportJobSummary_creationDateTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> DatasetExportJobSummary -> f DatasetExportJobSummary
datasetExportJobSummary_creationDateTime = (DatasetExportJobSummary -> Maybe POSIX)
-> (DatasetExportJobSummary
    -> Maybe POSIX -> DatasetExportJobSummary)
-> Lens
     DatasetExportJobSummary
     DatasetExportJobSummary
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DatasetExportJobSummary' {Maybe POSIX
creationDateTime :: Maybe POSIX
$sel:creationDateTime:DatasetExportJobSummary' :: DatasetExportJobSummary -> Maybe POSIX
creationDateTime} -> Maybe POSIX
creationDateTime) (\s :: DatasetExportJobSummary
s@DatasetExportJobSummary' {} Maybe POSIX
a -> DatasetExportJobSummary
s {$sel:creationDateTime:DatasetExportJobSummary' :: Maybe POSIX
creationDateTime = Maybe POSIX
a} :: DatasetExportJobSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> DatasetExportJobSummary -> f DatasetExportJobSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> DatasetExportJobSummary
-> f DatasetExportJobSummary
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

instance Core.FromJSON DatasetExportJobSummary where
  parseJSON :: Value -> Parser DatasetExportJobSummary
parseJSON =
    String
-> (Object -> Parser DatasetExportJobSummary)
-> Value
-> Parser DatasetExportJobSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DatasetExportJobSummary"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe POSIX
-> DatasetExportJobSummary
DatasetExportJobSummary'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe POSIX
 -> DatasetExportJobSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe POSIX
      -> DatasetExportJobSummary)
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
"failureReason")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe POSIX
   -> DatasetExportJobSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe POSIX
      -> DatasetExportJobSummary)
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
"status")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe POSIX
   -> DatasetExportJobSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe POSIX -> Maybe POSIX -> DatasetExportJobSummary)
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
"datasetExportJobArn")
            Parser
  (Maybe Text
   -> Maybe POSIX -> Maybe POSIX -> DatasetExportJobSummary)
-> Parser (Maybe Text)
-> Parser (Maybe POSIX -> Maybe POSIX -> DatasetExportJobSummary)
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
"jobName")
            Parser (Maybe POSIX -> Maybe POSIX -> DatasetExportJobSummary)
-> Parser (Maybe POSIX)
-> Parser (Maybe POSIX -> DatasetExportJobSummary)
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
"lastUpdatedDateTime")
            Parser (Maybe POSIX -> DatasetExportJobSummary)
-> Parser (Maybe POSIX) -> Parser DatasetExportJobSummary
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
"creationDateTime")
      )

instance Prelude.Hashable DatasetExportJobSummary

instance Prelude.NFData DatasetExportJobSummary