{-# 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.DatasetSummary
-- 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.DatasetSummary 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. For a complete
-- listing, call the DescribeDataset API.
--
-- /See:/ 'newDatasetSummary' smart constructor.
data DatasetSummary = DatasetSummary'
  { -- | 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
    DatasetSummary -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the dataset.
    DatasetSummary -> Maybe Text
datasetArn :: Prelude.Maybe Prelude.Text,
    -- | The date and time (in Unix time) that the dataset was last updated.
    DatasetSummary -> Maybe POSIX
lastUpdatedDateTime :: Prelude.Maybe Core.POSIX,
    -- | The name of the dataset.
    DatasetSummary -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The dataset type. One of the following values:
    --
    -- -   Interactions
    --
    -- -   Items
    --
    -- -   Users
    --
    -- -   Event-Interactions
    DatasetSummary -> Maybe Text
datasetType :: Prelude.Maybe Prelude.Text,
    -- | The date and time (in Unix time) that the dataset was created.
    DatasetSummary -> Maybe POSIX
creationDateTime :: Prelude.Maybe Core.POSIX
  }
  deriving (DatasetSummary -> DatasetSummary -> Bool
(DatasetSummary -> DatasetSummary -> Bool)
-> (DatasetSummary -> DatasetSummary -> Bool) -> Eq DatasetSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DatasetSummary -> DatasetSummary -> Bool
$c/= :: DatasetSummary -> DatasetSummary -> Bool
== :: DatasetSummary -> DatasetSummary -> Bool
$c== :: DatasetSummary -> DatasetSummary -> Bool
Prelude.Eq, ReadPrec [DatasetSummary]
ReadPrec DatasetSummary
Int -> ReadS DatasetSummary
ReadS [DatasetSummary]
(Int -> ReadS DatasetSummary)
-> ReadS [DatasetSummary]
-> ReadPrec DatasetSummary
-> ReadPrec [DatasetSummary]
-> Read DatasetSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DatasetSummary]
$creadListPrec :: ReadPrec [DatasetSummary]
readPrec :: ReadPrec DatasetSummary
$creadPrec :: ReadPrec DatasetSummary
readList :: ReadS [DatasetSummary]
$creadList :: ReadS [DatasetSummary]
readsPrec :: Int -> ReadS DatasetSummary
$creadsPrec :: Int -> ReadS DatasetSummary
Prelude.Read, Int -> DatasetSummary -> ShowS
[DatasetSummary] -> ShowS
DatasetSummary -> String
(Int -> DatasetSummary -> ShowS)
-> (DatasetSummary -> String)
-> ([DatasetSummary] -> ShowS)
-> Show DatasetSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DatasetSummary] -> ShowS
$cshowList :: [DatasetSummary] -> ShowS
show :: DatasetSummary -> String
$cshow :: DatasetSummary -> String
showsPrec :: Int -> DatasetSummary -> ShowS
$cshowsPrec :: Int -> DatasetSummary -> ShowS
Prelude.Show, (forall x. DatasetSummary -> Rep DatasetSummary x)
-> (forall x. Rep DatasetSummary x -> DatasetSummary)
-> Generic DatasetSummary
forall x. Rep DatasetSummary x -> DatasetSummary
forall x. DatasetSummary -> Rep DatasetSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DatasetSummary x -> DatasetSummary
$cfrom :: forall x. DatasetSummary -> Rep DatasetSummary x
Prelude.Generic)

-- |
-- Create a value of 'DatasetSummary' 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', 'datasetSummary_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', 'datasetSummary_datasetArn' - The Amazon Resource Name (ARN) of the dataset.
--
-- 'lastUpdatedDateTime', 'datasetSummary_lastUpdatedDateTime' - The date and time (in Unix time) that the dataset was last updated.
--
-- 'name', 'datasetSummary_name' - The name of the dataset.
--
-- 'datasetType', 'datasetSummary_datasetType' - The dataset type. One of the following values:
--
-- -   Interactions
--
-- -   Items
--
-- -   Users
--
-- -   Event-Interactions
--
-- 'creationDateTime', 'datasetSummary_creationDateTime' - The date and time (in Unix time) that the dataset was created.
newDatasetSummary ::
  DatasetSummary
newDatasetSummary :: DatasetSummary
newDatasetSummary =
  DatasetSummary' :: Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> DatasetSummary
DatasetSummary'
    { $sel:status:DatasetSummary' :: Maybe Text
status = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:datasetArn:DatasetSummary' :: Maybe Text
datasetArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedDateTime:DatasetSummary' :: Maybe POSIX
lastUpdatedDateTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:name:DatasetSummary' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:datasetType:DatasetSummary' :: Maybe Text
datasetType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:creationDateTime:DatasetSummary' :: Maybe POSIX
creationDateTime = Maybe POSIX
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
datasetSummary_status :: Lens.Lens' DatasetSummary (Prelude.Maybe Prelude.Text)
datasetSummary_status :: (Maybe Text -> f (Maybe Text))
-> DatasetSummary -> f DatasetSummary
datasetSummary_status = (DatasetSummary -> Maybe Text)
-> (DatasetSummary -> Maybe Text -> DatasetSummary)
-> Lens DatasetSummary DatasetSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DatasetSummary' {Maybe Text
status :: Maybe Text
$sel:status:DatasetSummary' :: DatasetSummary -> Maybe Text
status} -> Maybe Text
status) (\s :: DatasetSummary
s@DatasetSummary' {} Maybe Text
a -> DatasetSummary
s {$sel:status:DatasetSummary' :: Maybe Text
status = Maybe Text
a} :: DatasetSummary)

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

-- | The date and time (in Unix time) that the dataset was last updated.
datasetSummary_lastUpdatedDateTime :: Lens.Lens' DatasetSummary (Prelude.Maybe Prelude.UTCTime)
datasetSummary_lastUpdatedDateTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> DatasetSummary -> f DatasetSummary
datasetSummary_lastUpdatedDateTime = (DatasetSummary -> Maybe POSIX)
-> (DatasetSummary -> Maybe POSIX -> DatasetSummary)
-> Lens DatasetSummary DatasetSummary (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DatasetSummary' {Maybe POSIX
lastUpdatedDateTime :: Maybe POSIX
$sel:lastUpdatedDateTime:DatasetSummary' :: DatasetSummary -> Maybe POSIX
lastUpdatedDateTime} -> Maybe POSIX
lastUpdatedDateTime) (\s :: DatasetSummary
s@DatasetSummary' {} Maybe POSIX
a -> DatasetSummary
s {$sel:lastUpdatedDateTime:DatasetSummary' :: Maybe POSIX
lastUpdatedDateTime = Maybe POSIX
a} :: DatasetSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> DatasetSummary -> f DatasetSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> DatasetSummary
-> f DatasetSummary
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 name of the dataset.
datasetSummary_name :: Lens.Lens' DatasetSummary (Prelude.Maybe Prelude.Text)
datasetSummary_name :: (Maybe Text -> f (Maybe Text))
-> DatasetSummary -> f DatasetSummary
datasetSummary_name = (DatasetSummary -> Maybe Text)
-> (DatasetSummary -> Maybe Text -> DatasetSummary)
-> Lens DatasetSummary DatasetSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DatasetSummary' {Maybe Text
name :: Maybe Text
$sel:name:DatasetSummary' :: DatasetSummary -> Maybe Text
name} -> Maybe Text
name) (\s :: DatasetSummary
s@DatasetSummary' {} Maybe Text
a -> DatasetSummary
s {$sel:name:DatasetSummary' :: Maybe Text
name = Maybe Text
a} :: DatasetSummary)

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

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

instance Prelude.NFData DatasetSummary