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

import qualified Amazonka.Core as Core
import Amazonka.IoTAnalytics.Types.DatasetActionSummary
import Amazonka.IoTAnalytics.Types.DatasetStatus
import Amazonka.IoTAnalytics.Types.DatasetTrigger
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A summary of information about a dataset.
--
-- /See:/ 'newDatasetSummary' smart constructor.
data DatasetSummary = DatasetSummary'
  { -- | The time the dataset was created.
    DatasetSummary -> Maybe POSIX
creationTime :: Prelude.Maybe Core.POSIX,
    -- | The status of the dataset.
    DatasetSummary -> Maybe DatasetStatus
status :: Prelude.Maybe DatasetStatus,
    -- | A list of @DataActionSummary@ objects.
    DatasetSummary -> Maybe (NonEmpty DatasetActionSummary)
actions :: Prelude.Maybe (Prelude.NonEmpty DatasetActionSummary),
    -- | A list of triggers. A trigger causes dataset content to be populated at
    -- a specified time interval or when another dataset is populated. The list
    -- of triggers can be empty or contain up to five @DataSetTrigger@ objects
    DatasetSummary -> Maybe [DatasetTrigger]
triggers :: Prelude.Maybe [DatasetTrigger],
    -- | The name of the dataset.
    DatasetSummary -> Maybe Text
datasetName :: Prelude.Maybe Prelude.Text,
    -- | The last time the dataset was updated.
    DatasetSummary -> Maybe POSIX
lastUpdateTime :: 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' - The time the dataset was created.
--
-- 'status', 'datasetSummary_status' - The status of the dataset.
--
-- 'actions', 'datasetSummary_actions' - A list of @DataActionSummary@ objects.
--
-- 'triggers', 'datasetSummary_triggers' - A list of triggers. A trigger causes dataset content to be populated at
-- a specified time interval or when another dataset is populated. The list
-- of triggers can be empty or contain up to five @DataSetTrigger@ objects
--
-- 'datasetName', 'datasetSummary_datasetName' - The name of the dataset.
--
-- 'lastUpdateTime', 'datasetSummary_lastUpdateTime' - The last time the dataset was updated.
newDatasetSummary ::
  DatasetSummary
newDatasetSummary :: DatasetSummary
newDatasetSummary =
  DatasetSummary' :: Maybe POSIX
-> Maybe DatasetStatus
-> Maybe (NonEmpty DatasetActionSummary)
-> Maybe [DatasetTrigger]
-> Maybe Text
-> Maybe POSIX
-> DatasetSummary
DatasetSummary'
    { $sel:creationTime:DatasetSummary' :: Maybe POSIX
creationTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:status:DatasetSummary' :: Maybe DatasetStatus
status = Maybe DatasetStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:actions:DatasetSummary' :: Maybe (NonEmpty DatasetActionSummary)
actions = Maybe (NonEmpty DatasetActionSummary)
forall a. Maybe a
Prelude.Nothing,
      $sel:triggers:DatasetSummary' :: Maybe [DatasetTrigger]
triggers = Maybe [DatasetTrigger]
forall a. Maybe a
Prelude.Nothing,
      $sel:datasetName:DatasetSummary' :: Maybe Text
datasetName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdateTime:DatasetSummary' :: Maybe POSIX
lastUpdateTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | The time 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 status of the dataset.
datasetSummary_status :: Lens.Lens' DatasetSummary (Prelude.Maybe DatasetStatus)
datasetSummary_status :: (Maybe DatasetStatus -> f (Maybe DatasetStatus))
-> DatasetSummary -> f DatasetSummary
datasetSummary_status = (DatasetSummary -> Maybe DatasetStatus)
-> (DatasetSummary -> Maybe DatasetStatus -> DatasetSummary)
-> Lens
     DatasetSummary
     DatasetSummary
     (Maybe DatasetStatus)
     (Maybe DatasetStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DatasetSummary' {Maybe DatasetStatus
status :: Maybe DatasetStatus
$sel:status:DatasetSummary' :: DatasetSummary -> Maybe DatasetStatus
status} -> Maybe DatasetStatus
status) (\s :: DatasetSummary
s@DatasetSummary' {} Maybe DatasetStatus
a -> DatasetSummary
s {$sel:status:DatasetSummary' :: Maybe DatasetStatus
status = Maybe DatasetStatus
a} :: DatasetSummary)

-- | A list of @DataActionSummary@ objects.
datasetSummary_actions :: Lens.Lens' DatasetSummary (Prelude.Maybe (Prelude.NonEmpty DatasetActionSummary))
datasetSummary_actions :: (Maybe (NonEmpty DatasetActionSummary)
 -> f (Maybe (NonEmpty DatasetActionSummary)))
-> DatasetSummary -> f DatasetSummary
datasetSummary_actions = (DatasetSummary -> Maybe (NonEmpty DatasetActionSummary))
-> (DatasetSummary
    -> Maybe (NonEmpty DatasetActionSummary) -> DatasetSummary)
-> Lens
     DatasetSummary
     DatasetSummary
     (Maybe (NonEmpty DatasetActionSummary))
     (Maybe (NonEmpty DatasetActionSummary))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DatasetSummary' {Maybe (NonEmpty DatasetActionSummary)
actions :: Maybe (NonEmpty DatasetActionSummary)
$sel:actions:DatasetSummary' :: DatasetSummary -> Maybe (NonEmpty DatasetActionSummary)
actions} -> Maybe (NonEmpty DatasetActionSummary)
actions) (\s :: DatasetSummary
s@DatasetSummary' {} Maybe (NonEmpty DatasetActionSummary)
a -> DatasetSummary
s {$sel:actions:DatasetSummary' :: Maybe (NonEmpty DatasetActionSummary)
actions = Maybe (NonEmpty DatasetActionSummary)
a} :: DatasetSummary) ((Maybe (NonEmpty DatasetActionSummary)
  -> f (Maybe (NonEmpty DatasetActionSummary)))
 -> DatasetSummary -> f DatasetSummary)
-> ((Maybe (NonEmpty DatasetActionSummary)
     -> f (Maybe (NonEmpty DatasetActionSummary)))
    -> Maybe (NonEmpty DatasetActionSummary)
    -> f (Maybe (NonEmpty DatasetActionSummary)))
-> (Maybe (NonEmpty DatasetActionSummary)
    -> f (Maybe (NonEmpty DatasetActionSummary)))
-> DatasetSummary
-> f DatasetSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty DatasetActionSummary)
  (NonEmpty DatasetActionSummary)
  (NonEmpty DatasetActionSummary)
  (NonEmpty DatasetActionSummary)
-> Iso
     (Maybe (NonEmpty DatasetActionSummary))
     (Maybe (NonEmpty DatasetActionSummary))
     (Maybe (NonEmpty DatasetActionSummary))
     (Maybe (NonEmpty DatasetActionSummary))
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
  (NonEmpty DatasetActionSummary)
  (NonEmpty DatasetActionSummary)
  (NonEmpty DatasetActionSummary)
  (NonEmpty DatasetActionSummary)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A list of triggers. A trigger causes dataset content to be populated at
-- a specified time interval or when another dataset is populated. The list
-- of triggers can be empty or contain up to five @DataSetTrigger@ objects
datasetSummary_triggers :: Lens.Lens' DatasetSummary (Prelude.Maybe [DatasetTrigger])
datasetSummary_triggers :: (Maybe [DatasetTrigger] -> f (Maybe [DatasetTrigger]))
-> DatasetSummary -> f DatasetSummary
datasetSummary_triggers = (DatasetSummary -> Maybe [DatasetTrigger])
-> (DatasetSummary -> Maybe [DatasetTrigger] -> DatasetSummary)
-> Lens
     DatasetSummary
     DatasetSummary
     (Maybe [DatasetTrigger])
     (Maybe [DatasetTrigger])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DatasetSummary' {Maybe [DatasetTrigger]
triggers :: Maybe [DatasetTrigger]
$sel:triggers:DatasetSummary' :: DatasetSummary -> Maybe [DatasetTrigger]
triggers} -> Maybe [DatasetTrigger]
triggers) (\s :: DatasetSummary
s@DatasetSummary' {} Maybe [DatasetTrigger]
a -> DatasetSummary
s {$sel:triggers:DatasetSummary' :: Maybe [DatasetTrigger]
triggers = Maybe [DatasetTrigger]
a} :: DatasetSummary) ((Maybe [DatasetTrigger] -> f (Maybe [DatasetTrigger]))
 -> DatasetSummary -> f DatasetSummary)
-> ((Maybe [DatasetTrigger] -> f (Maybe [DatasetTrigger]))
    -> Maybe [DatasetTrigger] -> f (Maybe [DatasetTrigger]))
-> (Maybe [DatasetTrigger] -> f (Maybe [DatasetTrigger]))
-> DatasetSummary
-> f DatasetSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [DatasetTrigger] [DatasetTrigger] [DatasetTrigger] [DatasetTrigger]
-> Iso
     (Maybe [DatasetTrigger])
     (Maybe [DatasetTrigger])
     (Maybe [DatasetTrigger])
     (Maybe [DatasetTrigger])
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
  [DatasetTrigger] [DatasetTrigger] [DatasetTrigger] [DatasetTrigger]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | 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)

-- | The last time the dataset was updated.
datasetSummary_lastUpdateTime :: Lens.Lens' DatasetSummary (Prelude.Maybe Prelude.UTCTime)
datasetSummary_lastUpdateTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> DatasetSummary -> f DatasetSummary
datasetSummary_lastUpdateTime = (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
lastUpdateTime :: Maybe POSIX
$sel:lastUpdateTime:DatasetSummary' :: DatasetSummary -> Maybe POSIX
lastUpdateTime} -> Maybe POSIX
lastUpdateTime) (\s :: DatasetSummary
s@DatasetSummary' {} Maybe POSIX
a -> DatasetSummary
s {$sel:lastUpdateTime:DatasetSummary' :: Maybe POSIX
lastUpdateTime = 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 DatasetStatus
-> Maybe (NonEmpty DatasetActionSummary)
-> Maybe [DatasetTrigger]
-> Maybe Text
-> Maybe POSIX
-> DatasetSummary
DatasetSummary'
            (Maybe POSIX
 -> Maybe DatasetStatus
 -> Maybe (NonEmpty DatasetActionSummary)
 -> Maybe [DatasetTrigger]
 -> Maybe Text
 -> Maybe POSIX
 -> DatasetSummary)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe DatasetStatus
      -> Maybe (NonEmpty DatasetActionSummary)
      -> Maybe [DatasetTrigger]
      -> 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 DatasetStatus
   -> Maybe (NonEmpty DatasetActionSummary)
   -> Maybe [DatasetTrigger]
   -> Maybe Text
   -> Maybe POSIX
   -> DatasetSummary)
-> Parser (Maybe DatasetStatus)
-> Parser
     (Maybe (NonEmpty DatasetActionSummary)
      -> Maybe [DatasetTrigger]
      -> 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 DatasetStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"status")
            Parser
  (Maybe (NonEmpty DatasetActionSummary)
   -> Maybe [DatasetTrigger]
   -> Maybe Text
   -> Maybe POSIX
   -> DatasetSummary)
-> Parser (Maybe (NonEmpty DatasetActionSummary))
-> Parser
     (Maybe [DatasetTrigger]
      -> 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 (NonEmpty DatasetActionSummary))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"actions")
            Parser
  (Maybe [DatasetTrigger]
   -> Maybe Text -> Maybe POSIX -> DatasetSummary)
-> Parser (Maybe [DatasetTrigger])
-> 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 (Maybe [DatasetTrigger]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"triggers" Parser (Maybe (Maybe [DatasetTrigger]))
-> Maybe [DatasetTrigger] -> Parser (Maybe [DatasetTrigger])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [DatasetTrigger]
forall a. Monoid a => a
Prelude.mempty)
            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
"lastUpdateTime")
      )

instance Prelude.Hashable DatasetSummary

instance Prelude.NFData DatasetSummary