{-# 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.Dataset
-- 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.Dataset where

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

-- | Provides metadata for a dataset.
--
-- /See:/ 'newDataset' smart constructor.
data Dataset = Dataset'
  { -- | The status of the dataset.
    --
    -- A dataset can be in one of the following states:
    --
    -- -   CREATE PENDING > CREATE IN_PROGRESS > ACTIVE -or- CREATE FAILED
    --
    -- -   DELETE PENDING > DELETE IN_PROGRESS
    Dataset -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the dataset that you want metadata
    -- for.
    Dataset -> Maybe Text
datasetArn :: Prelude.Maybe Prelude.Text,
    -- | A time stamp that shows when the dataset was updated.
    Dataset -> Maybe POSIX
lastUpdatedDateTime :: Prelude.Maybe Core.POSIX,
    -- | The ARN of the associated schema.
    Dataset -> Maybe Text
schemaArn :: Prelude.Maybe Prelude.Text,
    -- | The name of the dataset.
    Dataset -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | One of the following values:
    --
    -- -   Interactions
    --
    -- -   Items
    --
    -- -   Users
    Dataset -> Maybe Text
datasetType :: Prelude.Maybe Prelude.Text,
    -- | The creation date and time (in Unix time) of the dataset.
    Dataset -> Maybe POSIX
creationDateTime :: Prelude.Maybe Core.POSIX,
    -- | The Amazon Resource Name (ARN) of the dataset group.
    Dataset -> Maybe Text
datasetGroupArn :: Prelude.Maybe Prelude.Text
  }
  deriving (Dataset -> Dataset -> Bool
(Dataset -> Dataset -> Bool)
-> (Dataset -> Dataset -> Bool) -> Eq Dataset
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Dataset -> Dataset -> Bool
$c/= :: Dataset -> Dataset -> Bool
== :: Dataset -> Dataset -> Bool
$c== :: Dataset -> Dataset -> Bool
Prelude.Eq, ReadPrec [Dataset]
ReadPrec Dataset
Int -> ReadS Dataset
ReadS [Dataset]
(Int -> ReadS Dataset)
-> ReadS [Dataset]
-> ReadPrec Dataset
-> ReadPrec [Dataset]
-> Read Dataset
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Dataset]
$creadListPrec :: ReadPrec [Dataset]
readPrec :: ReadPrec Dataset
$creadPrec :: ReadPrec Dataset
readList :: ReadS [Dataset]
$creadList :: ReadS [Dataset]
readsPrec :: Int -> ReadS Dataset
$creadsPrec :: Int -> ReadS Dataset
Prelude.Read, Int -> Dataset -> ShowS
[Dataset] -> ShowS
Dataset -> String
(Int -> Dataset -> ShowS)
-> (Dataset -> String) -> ([Dataset] -> ShowS) -> Show Dataset
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Dataset] -> ShowS
$cshowList :: [Dataset] -> ShowS
show :: Dataset -> String
$cshow :: Dataset -> String
showsPrec :: Int -> Dataset -> ShowS
$cshowsPrec :: Int -> Dataset -> ShowS
Prelude.Show, (forall x. Dataset -> Rep Dataset x)
-> (forall x. Rep Dataset x -> Dataset) -> Generic Dataset
forall x. Rep Dataset x -> Dataset
forall x. Dataset -> Rep Dataset x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Dataset x -> Dataset
$cfrom :: forall x. Dataset -> Rep Dataset x
Prelude.Generic)

-- |
-- Create a value of 'Dataset' 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:
--
-- 'status', 'dataset_status' - The status of the dataset.
--
-- A dataset can be in one of the following states:
--
-- -   CREATE PENDING > CREATE IN_PROGRESS > ACTIVE -or- CREATE FAILED
--
-- -   DELETE PENDING > DELETE IN_PROGRESS
--
-- 'datasetArn', 'dataset_datasetArn' - The Amazon Resource Name (ARN) of the dataset that you want metadata
-- for.
--
-- 'lastUpdatedDateTime', 'dataset_lastUpdatedDateTime' - A time stamp that shows when the dataset was updated.
--
-- 'schemaArn', 'dataset_schemaArn' - The ARN of the associated schema.
--
-- 'name', 'dataset_name' - The name of the dataset.
--
-- 'datasetType', 'dataset_datasetType' - One of the following values:
--
-- -   Interactions
--
-- -   Items
--
-- -   Users
--
-- 'creationDateTime', 'dataset_creationDateTime' - The creation date and time (in Unix time) of the dataset.
--
-- 'datasetGroupArn', 'dataset_datasetGroupArn' - The Amazon Resource Name (ARN) of the dataset group.
newDataset ::
  Dataset
newDataset :: Dataset
newDataset =
  Dataset' :: Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Dataset
Dataset'
    { $sel:status:Dataset' :: Maybe Text
status = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:datasetArn:Dataset' :: Maybe Text
datasetArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedDateTime:Dataset' :: Maybe POSIX
lastUpdatedDateTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:schemaArn:Dataset' :: Maybe Text
schemaArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:Dataset' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:datasetType:Dataset' :: Maybe Text
datasetType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:creationDateTime:Dataset' :: Maybe POSIX
creationDateTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:datasetGroupArn:Dataset' :: Maybe Text
datasetGroupArn = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

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

-- | The Amazon Resource Name (ARN) of the dataset that you want metadata
-- for.
dataset_datasetArn :: Lens.Lens' Dataset (Prelude.Maybe Prelude.Text)
dataset_datasetArn :: (Maybe Text -> f (Maybe Text)) -> Dataset -> f Dataset
dataset_datasetArn = (Dataset -> Maybe Text)
-> (Dataset -> Maybe Text -> Dataset)
-> Lens Dataset Dataset (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Dataset' {Maybe Text
datasetArn :: Maybe Text
$sel:datasetArn:Dataset' :: Dataset -> Maybe Text
datasetArn} -> Maybe Text
datasetArn) (\s :: Dataset
s@Dataset' {} Maybe Text
a -> Dataset
s {$sel:datasetArn:Dataset' :: Maybe Text
datasetArn = Maybe Text
a} :: Dataset)

-- | A time stamp that shows when the dataset was updated.
dataset_lastUpdatedDateTime :: Lens.Lens' Dataset (Prelude.Maybe Prelude.UTCTime)
dataset_lastUpdatedDateTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Dataset -> f Dataset
dataset_lastUpdatedDateTime = (Dataset -> Maybe POSIX)
-> (Dataset -> Maybe POSIX -> Dataset)
-> Lens Dataset Dataset (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Dataset' {Maybe POSIX
lastUpdatedDateTime :: Maybe POSIX
$sel:lastUpdatedDateTime:Dataset' :: Dataset -> Maybe POSIX
lastUpdatedDateTime} -> Maybe POSIX
lastUpdatedDateTime) (\s :: Dataset
s@Dataset' {} Maybe POSIX
a -> Dataset
s {$sel:lastUpdatedDateTime:Dataset' :: Maybe POSIX
lastUpdatedDateTime = Maybe POSIX
a} :: Dataset) ((Maybe POSIX -> f (Maybe POSIX)) -> Dataset -> f Dataset)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Dataset
-> f Dataset
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 ARN of the associated schema.
dataset_schemaArn :: Lens.Lens' Dataset (Prelude.Maybe Prelude.Text)
dataset_schemaArn :: (Maybe Text -> f (Maybe Text)) -> Dataset -> f Dataset
dataset_schemaArn = (Dataset -> Maybe Text)
-> (Dataset -> Maybe Text -> Dataset)
-> Lens Dataset Dataset (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Dataset' {Maybe Text
schemaArn :: Maybe Text
$sel:schemaArn:Dataset' :: Dataset -> Maybe Text
schemaArn} -> Maybe Text
schemaArn) (\s :: Dataset
s@Dataset' {} Maybe Text
a -> Dataset
s {$sel:schemaArn:Dataset' :: Maybe Text
schemaArn = Maybe Text
a} :: Dataset)

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

-- | One of the following values:
--
-- -   Interactions
--
-- -   Items
--
-- -   Users
dataset_datasetType :: Lens.Lens' Dataset (Prelude.Maybe Prelude.Text)
dataset_datasetType :: (Maybe Text -> f (Maybe Text)) -> Dataset -> f Dataset
dataset_datasetType = (Dataset -> Maybe Text)
-> (Dataset -> Maybe Text -> Dataset)
-> Lens Dataset Dataset (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Dataset' {Maybe Text
datasetType :: Maybe Text
$sel:datasetType:Dataset' :: Dataset -> Maybe Text
datasetType} -> Maybe Text
datasetType) (\s :: Dataset
s@Dataset' {} Maybe Text
a -> Dataset
s {$sel:datasetType:Dataset' :: Maybe Text
datasetType = Maybe Text
a} :: Dataset)

-- | The creation date and time (in Unix time) of the dataset.
dataset_creationDateTime :: Lens.Lens' Dataset (Prelude.Maybe Prelude.UTCTime)
dataset_creationDateTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Dataset -> f Dataset
dataset_creationDateTime = (Dataset -> Maybe POSIX)
-> (Dataset -> Maybe POSIX -> Dataset)
-> Lens Dataset Dataset (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Dataset' {Maybe POSIX
creationDateTime :: Maybe POSIX
$sel:creationDateTime:Dataset' :: Dataset -> Maybe POSIX
creationDateTime} -> Maybe POSIX
creationDateTime) (\s :: Dataset
s@Dataset' {} Maybe POSIX
a -> Dataset
s {$sel:creationDateTime:Dataset' :: Maybe POSIX
creationDateTime = Maybe POSIX
a} :: Dataset) ((Maybe POSIX -> f (Maybe POSIX)) -> Dataset -> f Dataset)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Dataset
-> f Dataset
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 group.
dataset_datasetGroupArn :: Lens.Lens' Dataset (Prelude.Maybe Prelude.Text)
dataset_datasetGroupArn :: (Maybe Text -> f (Maybe Text)) -> Dataset -> f Dataset
dataset_datasetGroupArn = (Dataset -> Maybe Text)
-> (Dataset -> Maybe Text -> Dataset)
-> Lens Dataset Dataset (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Dataset' {Maybe Text
datasetGroupArn :: Maybe Text
$sel:datasetGroupArn:Dataset' :: Dataset -> Maybe Text
datasetGroupArn} -> Maybe Text
datasetGroupArn) (\s :: Dataset
s@Dataset' {} Maybe Text
a -> Dataset
s {$sel:datasetGroupArn:Dataset' :: Maybe Text
datasetGroupArn = Maybe Text
a} :: Dataset)

instance Core.FromJSON Dataset where
  parseJSON :: Value -> Parser Dataset
parseJSON =
    String -> (Object -> Parser Dataset) -> Value -> Parser Dataset
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Dataset"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Dataset
Dataset'
            (Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe Text
 -> Dataset)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Dataset)
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
"status")
            Parser
  (Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Dataset)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Dataset)
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
"datasetArn")
            Parser
  (Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Dataset)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Dataset)
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 Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Dataset)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe POSIX -> Maybe Text -> Dataset)
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
"schemaArn")
            Parser
  (Maybe Text -> Maybe Text -> Maybe POSIX -> Maybe Text -> Dataset)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe POSIX -> Maybe Text -> Dataset)
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
"name")
            Parser (Maybe Text -> Maybe POSIX -> Maybe Text -> Dataset)
-> Parser (Maybe Text)
-> Parser (Maybe POSIX -> Maybe Text -> Dataset)
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
"datasetType")
            Parser (Maybe POSIX -> Maybe Text -> Dataset)
-> Parser (Maybe POSIX) -> Parser (Maybe Text -> Dataset)
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")
            Parser (Maybe Text -> Dataset)
-> Parser (Maybe Text) -> Parser Dataset
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
"datasetGroupArn")
      )

instance Prelude.Hashable Dataset

instance Prelude.NFData Dataset