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

-- |
-- Create a value of 'DatasetImportJobSummary' 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', 'datasetImportJobSummary_failureReason' - If a dataset import job fails, the reason behind the failure.
--
-- 'status', 'datasetImportJobSummary_status' - The status of the dataset import job.
--
-- A dataset import job can be in one of the following states:
--
-- -   CREATE PENDING > CREATE IN_PROGRESS > ACTIVE -or- CREATE FAILED
--
-- 'jobName', 'datasetImportJobSummary_jobName' - The name of the dataset import job.
--
-- 'lastUpdatedDateTime', 'datasetImportJobSummary_lastUpdatedDateTime' - The date and time (in Unix time) that the dataset import job status was
-- last updated.
--
-- 'datasetImportJobArn', 'datasetImportJobSummary_datasetImportJobArn' - The Amazon Resource Name (ARN) of the dataset import job.
--
-- 'creationDateTime', 'datasetImportJobSummary_creationDateTime' - The date and time (in Unix time) that the dataset import job was
-- created.
newDatasetImportJobSummary ::
  DatasetImportJobSummary
newDatasetImportJobSummary :: DatasetImportJobSummary
newDatasetImportJobSummary =
  DatasetImportJobSummary' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> DatasetImportJobSummary
DatasetImportJobSummary'
    { $sel:failureReason:DatasetImportJobSummary' :: Maybe Text
failureReason =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:status:DatasetImportJobSummary' :: Maybe Text
status = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:jobName:DatasetImportJobSummary' :: Maybe Text
jobName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedDateTime:DatasetImportJobSummary' :: Maybe POSIX
lastUpdatedDateTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:datasetImportJobArn:DatasetImportJobSummary' :: Maybe Text
datasetImportJobArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:creationDateTime:DatasetImportJobSummary' :: Maybe POSIX
creationDateTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

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

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

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

-- | The date and time (in Unix time) that the dataset import job status was
-- last updated.
datasetImportJobSummary_lastUpdatedDateTime :: Lens.Lens' DatasetImportJobSummary (Prelude.Maybe Prelude.UTCTime)
datasetImportJobSummary_lastUpdatedDateTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> DatasetImportJobSummary -> f DatasetImportJobSummary
datasetImportJobSummary_lastUpdatedDateTime = (DatasetImportJobSummary -> Maybe POSIX)
-> (DatasetImportJobSummary
    -> Maybe POSIX -> DatasetImportJobSummary)
-> Lens
     DatasetImportJobSummary
     DatasetImportJobSummary
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DatasetImportJobSummary' {Maybe POSIX
lastUpdatedDateTime :: Maybe POSIX
$sel:lastUpdatedDateTime:DatasetImportJobSummary' :: DatasetImportJobSummary -> Maybe POSIX
lastUpdatedDateTime} -> Maybe POSIX
lastUpdatedDateTime) (\s :: DatasetImportJobSummary
s@DatasetImportJobSummary' {} Maybe POSIX
a -> DatasetImportJobSummary
s {$sel:lastUpdatedDateTime:DatasetImportJobSummary' :: Maybe POSIX
lastUpdatedDateTime = Maybe POSIX
a} :: DatasetImportJobSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> DatasetImportJobSummary -> f DatasetImportJobSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> DatasetImportJobSummary
-> f DatasetImportJobSummary
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 Amazon Resource Name (ARN) of the dataset import job.
datasetImportJobSummary_datasetImportJobArn :: Lens.Lens' DatasetImportJobSummary (Prelude.Maybe Prelude.Text)
datasetImportJobSummary_datasetImportJobArn :: (Maybe Text -> f (Maybe Text))
-> DatasetImportJobSummary -> f DatasetImportJobSummary
datasetImportJobSummary_datasetImportJobArn = (DatasetImportJobSummary -> Maybe Text)
-> (DatasetImportJobSummary
    -> Maybe Text -> DatasetImportJobSummary)
-> Lens
     DatasetImportJobSummary
     DatasetImportJobSummary
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DatasetImportJobSummary' {Maybe Text
datasetImportJobArn :: Maybe Text
$sel:datasetImportJobArn:DatasetImportJobSummary' :: DatasetImportJobSummary -> Maybe Text
datasetImportJobArn} -> Maybe Text
datasetImportJobArn) (\s :: DatasetImportJobSummary
s@DatasetImportJobSummary' {} Maybe Text
a -> DatasetImportJobSummary
s {$sel:datasetImportJobArn:DatasetImportJobSummary' :: Maybe Text
datasetImportJobArn = Maybe Text
a} :: DatasetImportJobSummary)

-- | The date and time (in Unix time) that the dataset import job was
-- created.
datasetImportJobSummary_creationDateTime :: Lens.Lens' DatasetImportJobSummary (Prelude.Maybe Prelude.UTCTime)
datasetImportJobSummary_creationDateTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> DatasetImportJobSummary -> f DatasetImportJobSummary
datasetImportJobSummary_creationDateTime = (DatasetImportJobSummary -> Maybe POSIX)
-> (DatasetImportJobSummary
    -> Maybe POSIX -> DatasetImportJobSummary)
-> Lens
     DatasetImportJobSummary
     DatasetImportJobSummary
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DatasetImportJobSummary' {Maybe POSIX
creationDateTime :: Maybe POSIX
$sel:creationDateTime:DatasetImportJobSummary' :: DatasetImportJobSummary -> Maybe POSIX
creationDateTime} -> Maybe POSIX
creationDateTime) (\s :: DatasetImportJobSummary
s@DatasetImportJobSummary' {} Maybe POSIX
a -> DatasetImportJobSummary
s {$sel:creationDateTime:DatasetImportJobSummary' :: Maybe POSIX
creationDateTime = Maybe POSIX
a} :: DatasetImportJobSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> DatasetImportJobSummary -> f DatasetImportJobSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> DatasetImportJobSummary
-> f DatasetImportJobSummary
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 DatasetImportJobSummary where
  parseJSON :: Value -> Parser DatasetImportJobSummary
parseJSON =
    String
-> (Object -> Parser DatasetImportJobSummary)
-> Value
-> Parser DatasetImportJobSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DatasetImportJobSummary"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> DatasetImportJobSummary
DatasetImportJobSummary'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe POSIX
 -> DatasetImportJobSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe POSIX
      -> DatasetImportJobSummary)
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 POSIX
   -> Maybe Text
   -> Maybe POSIX
   -> DatasetImportJobSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe POSIX
      -> DatasetImportJobSummary)
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 POSIX
   -> Maybe Text
   -> Maybe POSIX
   -> DatasetImportJobSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Maybe Text -> Maybe POSIX -> DatasetImportJobSummary)
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 Text -> Maybe POSIX -> DatasetImportJobSummary)
-> Parser (Maybe POSIX)
-> Parser (Maybe Text -> Maybe POSIX -> DatasetImportJobSummary)
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 Text -> Maybe POSIX -> DatasetImportJobSummary)
-> Parser (Maybe Text)
-> Parser (Maybe POSIX -> DatasetImportJobSummary)
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
"datasetImportJobArn")
            Parser (Maybe POSIX -> DatasetImportJobSummary)
-> Parser (Maybe POSIX) -> Parser DatasetImportJobSummary
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 DatasetImportJobSummary

instance Prelude.NFData DatasetImportJobSummary