{-# 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.Forecast.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.Forecast.Types.DatasetSummary where

import qualified Amazonka.Core as Core
import Amazonka.Forecast.Types.DatasetType
import Amazonka.Forecast.Types.Domain
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Provides a summary of the dataset properties used in the ListDatasets
-- operation. To get the complete set of properties, call the
-- DescribeDataset operation, and provide the @DatasetArn@.
--
-- /See:/ 'newDatasetSummary' smart constructor.
data DatasetSummary = DatasetSummary'
  { -- | When the dataset was created.
    DatasetSummary -> Maybe POSIX
creationTime :: Prelude.Maybe Core.POSIX,
    -- | The Amazon Resource Name (ARN) of the dataset.
    DatasetSummary -> Maybe Text
datasetArn :: Prelude.Maybe Prelude.Text,
    -- | The domain associated with the dataset.
    DatasetSummary -> Maybe Domain
domain :: Prelude.Maybe Domain,
    -- | The dataset type.
    DatasetSummary -> Maybe DatasetType
datasetType :: Prelude.Maybe DatasetType,
    -- | The name of the dataset.
    DatasetSummary -> Maybe Text
datasetName :: Prelude.Maybe Prelude.Text,
    -- | When you create a dataset, @LastModificationTime@ is the same as
    -- @CreationTime@. While data is being imported to the dataset,
    -- @LastModificationTime@ is the current time of the @ListDatasets@ call.
    -- After a CreateDatasetImportJob operation has finished,
    -- @LastModificationTime@ is when the import job completed or failed.
    DatasetSummary -> Maybe POSIX
lastModificationTime :: 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:
--
-- 'creationTime', 'datasetSummary_creationTime' - When the dataset was created.
--
-- 'datasetArn', 'datasetSummary_datasetArn' - The Amazon Resource Name (ARN) of the dataset.
--
-- 'domain', 'datasetSummary_domain' - The domain associated with the dataset.
--
-- 'datasetType', 'datasetSummary_datasetType' - The dataset type.
--
-- 'datasetName', 'datasetSummary_datasetName' - The name of the dataset.
--
-- 'lastModificationTime', 'datasetSummary_lastModificationTime' - When you create a dataset, @LastModificationTime@ is the same as
-- @CreationTime@. While data is being imported to the dataset,
-- @LastModificationTime@ is the current time of the @ListDatasets@ call.
-- After a CreateDatasetImportJob operation has finished,
-- @LastModificationTime@ is when the import job completed or failed.
newDatasetSummary ::
  DatasetSummary
newDatasetSummary :: DatasetSummary
newDatasetSummary =
  DatasetSummary' :: Maybe POSIX
-> Maybe Text
-> Maybe Domain
-> Maybe DatasetType
-> Maybe Text
-> Maybe POSIX
-> DatasetSummary
DatasetSummary'
    { $sel:creationTime:DatasetSummary' :: Maybe POSIX
creationTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:datasetArn:DatasetSummary' :: Maybe Text
datasetArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:domain:DatasetSummary' :: Maybe Domain
domain = Maybe Domain
forall a. Maybe a
Prelude.Nothing,
      $sel:datasetType:DatasetSummary' :: Maybe DatasetType
datasetType = Maybe DatasetType
forall a. Maybe a
Prelude.Nothing,
      $sel:datasetName:DatasetSummary' :: Maybe Text
datasetName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastModificationTime:DatasetSummary' :: Maybe POSIX
lastModificationTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | When the dataset was created.
datasetSummary_creationTime :: Lens.Lens' DatasetSummary (Prelude.Maybe Prelude.UTCTime)
datasetSummary_creationTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> DatasetSummary -> f DatasetSummary
datasetSummary_creationTime = (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
creationTime :: Maybe POSIX
$sel:creationTime:DatasetSummary' :: DatasetSummary -> Maybe POSIX
creationTime} -> Maybe POSIX
creationTime) (\s :: DatasetSummary
s@DatasetSummary' {} Maybe POSIX
a -> DatasetSummary
s {$sel:creationTime:DatasetSummary' :: Maybe POSIX
creationTime = 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 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 domain associated with the dataset.
datasetSummary_domain :: Lens.Lens' DatasetSummary (Prelude.Maybe Domain)
datasetSummary_domain :: (Maybe Domain -> f (Maybe Domain))
-> DatasetSummary -> f DatasetSummary
datasetSummary_domain = (DatasetSummary -> Maybe Domain)
-> (DatasetSummary -> Maybe Domain -> DatasetSummary)
-> Lens DatasetSummary DatasetSummary (Maybe Domain) (Maybe Domain)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DatasetSummary' {Maybe Domain
domain :: Maybe Domain
$sel:domain:DatasetSummary' :: DatasetSummary -> Maybe Domain
domain} -> Maybe Domain
domain) (\s :: DatasetSummary
s@DatasetSummary' {} Maybe Domain
a -> DatasetSummary
s {$sel:domain:DatasetSummary' :: Maybe Domain
domain = Maybe Domain
a} :: DatasetSummary)

-- | The dataset type.
datasetSummary_datasetType :: Lens.Lens' DatasetSummary (Prelude.Maybe DatasetType)
datasetSummary_datasetType :: (Maybe DatasetType -> f (Maybe DatasetType))
-> DatasetSummary -> f DatasetSummary
datasetSummary_datasetType = (DatasetSummary -> Maybe DatasetType)
-> (DatasetSummary -> Maybe DatasetType -> DatasetSummary)
-> Lens
     DatasetSummary
     DatasetSummary
     (Maybe DatasetType)
     (Maybe DatasetType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DatasetSummary' {Maybe DatasetType
datasetType :: Maybe DatasetType
$sel:datasetType:DatasetSummary' :: DatasetSummary -> Maybe DatasetType
datasetType} -> Maybe DatasetType
datasetType) (\s :: DatasetSummary
s@DatasetSummary' {} Maybe DatasetType
a -> DatasetSummary
s {$sel:datasetType:DatasetSummary' :: Maybe DatasetType
datasetType = Maybe DatasetType
a} :: DatasetSummary)

-- | The name of the dataset.
datasetSummary_datasetName :: Lens.Lens' DatasetSummary (Prelude.Maybe Prelude.Text)
datasetSummary_datasetName :: (Maybe Text -> f (Maybe Text))
-> DatasetSummary -> f DatasetSummary
datasetSummary_datasetName = (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
datasetName :: Maybe Text
$sel:datasetName:DatasetSummary' :: DatasetSummary -> Maybe Text
datasetName} -> Maybe Text
datasetName) (\s :: DatasetSummary
s@DatasetSummary' {} Maybe Text
a -> DatasetSummary
s {$sel:datasetName:DatasetSummary' :: Maybe Text
datasetName = Maybe Text
a} :: DatasetSummary)

-- | When you create a dataset, @LastModificationTime@ is the same as
-- @CreationTime@. While data is being imported to the dataset,
-- @LastModificationTime@ is the current time of the @ListDatasets@ call.
-- After a CreateDatasetImportJob operation has finished,
-- @LastModificationTime@ is when the import job completed or failed.
datasetSummary_lastModificationTime :: Lens.Lens' DatasetSummary (Prelude.Maybe Prelude.UTCTime)
datasetSummary_lastModificationTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> DatasetSummary -> f DatasetSummary
datasetSummary_lastModificationTime = (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
lastModificationTime :: Maybe POSIX
$sel:lastModificationTime:DatasetSummary' :: DatasetSummary -> Maybe POSIX
lastModificationTime} -> Maybe POSIX
lastModificationTime) (\s :: DatasetSummary
s@DatasetSummary' {} Maybe POSIX
a -> DatasetSummary
s {$sel:lastModificationTime:DatasetSummary' :: Maybe POSIX
lastModificationTime = 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 POSIX
-> Maybe Text
-> Maybe Domain
-> Maybe DatasetType
-> Maybe Text
-> Maybe POSIX
-> DatasetSummary
DatasetSummary'
            (Maybe POSIX
 -> Maybe Text
 -> Maybe Domain
 -> Maybe DatasetType
 -> Maybe Text
 -> Maybe POSIX
 -> DatasetSummary)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe Domain
      -> Maybe DatasetType
      -> Maybe Text
      -> Maybe POSIX
      -> DatasetSummary)
forall (f :: * -> *) a b. Functor 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
"CreationTime")
            Parser
  (Maybe Text
   -> Maybe Domain
   -> Maybe DatasetType
   -> Maybe Text
   -> Maybe POSIX
   -> DatasetSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Domain
      -> Maybe DatasetType
      -> 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 Domain
   -> Maybe DatasetType
   -> Maybe Text
   -> Maybe POSIX
   -> DatasetSummary)
-> Parser (Maybe Domain)
-> Parser
     (Maybe DatasetType -> 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 Domain)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Domain")
            Parser
  (Maybe DatasetType -> Maybe Text -> Maybe POSIX -> DatasetSummary)
-> Parser (Maybe DatasetType)
-> 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 DatasetType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DatasetType")
            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
"DatasetName")
            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
"LastModificationTime")
      )

instance Prelude.Hashable DatasetSummary

instance Prelude.NFData DatasetSummary