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

import qualified Amazonka.Core as Core
import Amazonka.IoTAnalytics.Types.ReprocessingSummary
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A summary of information about a pipeline.
--
-- /See:/ 'newPipelineSummary' smart constructor.
data PipelineSummary = PipelineSummary'
  { -- | When the pipeline was created.
    PipelineSummary -> Maybe POSIX
creationTime :: Prelude.Maybe Core.POSIX,
    -- | The name of the pipeline.
    PipelineSummary -> Maybe Text
pipelineName :: Prelude.Maybe Prelude.Text,
    -- | A summary of information about the pipeline reprocessing.
    PipelineSummary -> Maybe [ReprocessingSummary]
reprocessingSummaries :: Prelude.Maybe [ReprocessingSummary],
    -- | When the pipeline was last updated.
    PipelineSummary -> Maybe POSIX
lastUpdateTime :: Prelude.Maybe Core.POSIX
  }
  deriving (PipelineSummary -> PipelineSummary -> Bool
(PipelineSummary -> PipelineSummary -> Bool)
-> (PipelineSummary -> PipelineSummary -> Bool)
-> Eq PipelineSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PipelineSummary -> PipelineSummary -> Bool
$c/= :: PipelineSummary -> PipelineSummary -> Bool
== :: PipelineSummary -> PipelineSummary -> Bool
$c== :: PipelineSummary -> PipelineSummary -> Bool
Prelude.Eq, ReadPrec [PipelineSummary]
ReadPrec PipelineSummary
Int -> ReadS PipelineSummary
ReadS [PipelineSummary]
(Int -> ReadS PipelineSummary)
-> ReadS [PipelineSummary]
-> ReadPrec PipelineSummary
-> ReadPrec [PipelineSummary]
-> Read PipelineSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PipelineSummary]
$creadListPrec :: ReadPrec [PipelineSummary]
readPrec :: ReadPrec PipelineSummary
$creadPrec :: ReadPrec PipelineSummary
readList :: ReadS [PipelineSummary]
$creadList :: ReadS [PipelineSummary]
readsPrec :: Int -> ReadS PipelineSummary
$creadsPrec :: Int -> ReadS PipelineSummary
Prelude.Read, Int -> PipelineSummary -> ShowS
[PipelineSummary] -> ShowS
PipelineSummary -> String
(Int -> PipelineSummary -> ShowS)
-> (PipelineSummary -> String)
-> ([PipelineSummary] -> ShowS)
-> Show PipelineSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PipelineSummary] -> ShowS
$cshowList :: [PipelineSummary] -> ShowS
show :: PipelineSummary -> String
$cshow :: PipelineSummary -> String
showsPrec :: Int -> PipelineSummary -> ShowS
$cshowsPrec :: Int -> PipelineSummary -> ShowS
Prelude.Show, (forall x. PipelineSummary -> Rep PipelineSummary x)
-> (forall x. Rep PipelineSummary x -> PipelineSummary)
-> Generic PipelineSummary
forall x. Rep PipelineSummary x -> PipelineSummary
forall x. PipelineSummary -> Rep PipelineSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PipelineSummary x -> PipelineSummary
$cfrom :: forall x. PipelineSummary -> Rep PipelineSummary x
Prelude.Generic)

-- |
-- Create a value of 'PipelineSummary' 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', 'pipelineSummary_creationTime' - When the pipeline was created.
--
-- 'pipelineName', 'pipelineSummary_pipelineName' - The name of the pipeline.
--
-- 'reprocessingSummaries', 'pipelineSummary_reprocessingSummaries' - A summary of information about the pipeline reprocessing.
--
-- 'lastUpdateTime', 'pipelineSummary_lastUpdateTime' - When the pipeline was last updated.
newPipelineSummary ::
  PipelineSummary
newPipelineSummary :: PipelineSummary
newPipelineSummary =
  PipelineSummary' :: Maybe POSIX
-> Maybe Text
-> Maybe [ReprocessingSummary]
-> Maybe POSIX
-> PipelineSummary
PipelineSummary'
    { $sel:creationTime:PipelineSummary' :: Maybe POSIX
creationTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:pipelineName:PipelineSummary' :: Maybe Text
pipelineName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:reprocessingSummaries:PipelineSummary' :: Maybe [ReprocessingSummary]
reprocessingSummaries = Maybe [ReprocessingSummary]
forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdateTime:PipelineSummary' :: Maybe POSIX
lastUpdateTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | When the pipeline was created.
pipelineSummary_creationTime :: Lens.Lens' PipelineSummary (Prelude.Maybe Prelude.UTCTime)
pipelineSummary_creationTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> PipelineSummary -> f PipelineSummary
pipelineSummary_creationTime = (PipelineSummary -> Maybe POSIX)
-> (PipelineSummary -> Maybe POSIX -> PipelineSummary)
-> Lens PipelineSummary PipelineSummary (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PipelineSummary' {Maybe POSIX
creationTime :: Maybe POSIX
$sel:creationTime:PipelineSummary' :: PipelineSummary -> Maybe POSIX
creationTime} -> Maybe POSIX
creationTime) (\s :: PipelineSummary
s@PipelineSummary' {} Maybe POSIX
a -> PipelineSummary
s {$sel:creationTime:PipelineSummary' :: Maybe POSIX
creationTime = Maybe POSIX
a} :: PipelineSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> PipelineSummary -> f PipelineSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> PipelineSummary
-> f PipelineSummary
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 pipeline.
pipelineSummary_pipelineName :: Lens.Lens' PipelineSummary (Prelude.Maybe Prelude.Text)
pipelineSummary_pipelineName :: (Maybe Text -> f (Maybe Text))
-> PipelineSummary -> f PipelineSummary
pipelineSummary_pipelineName = (PipelineSummary -> Maybe Text)
-> (PipelineSummary -> Maybe Text -> PipelineSummary)
-> Lens PipelineSummary PipelineSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PipelineSummary' {Maybe Text
pipelineName :: Maybe Text
$sel:pipelineName:PipelineSummary' :: PipelineSummary -> Maybe Text
pipelineName} -> Maybe Text
pipelineName) (\s :: PipelineSummary
s@PipelineSummary' {} Maybe Text
a -> PipelineSummary
s {$sel:pipelineName:PipelineSummary' :: Maybe Text
pipelineName = Maybe Text
a} :: PipelineSummary)

-- | A summary of information about the pipeline reprocessing.
pipelineSummary_reprocessingSummaries :: Lens.Lens' PipelineSummary (Prelude.Maybe [ReprocessingSummary])
pipelineSummary_reprocessingSummaries :: (Maybe [ReprocessingSummary] -> f (Maybe [ReprocessingSummary]))
-> PipelineSummary -> f PipelineSummary
pipelineSummary_reprocessingSummaries = (PipelineSummary -> Maybe [ReprocessingSummary])
-> (PipelineSummary
    -> Maybe [ReprocessingSummary] -> PipelineSummary)
-> Lens
     PipelineSummary
     PipelineSummary
     (Maybe [ReprocessingSummary])
     (Maybe [ReprocessingSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PipelineSummary' {Maybe [ReprocessingSummary]
reprocessingSummaries :: Maybe [ReprocessingSummary]
$sel:reprocessingSummaries:PipelineSummary' :: PipelineSummary -> Maybe [ReprocessingSummary]
reprocessingSummaries} -> Maybe [ReprocessingSummary]
reprocessingSummaries) (\s :: PipelineSummary
s@PipelineSummary' {} Maybe [ReprocessingSummary]
a -> PipelineSummary
s {$sel:reprocessingSummaries:PipelineSummary' :: Maybe [ReprocessingSummary]
reprocessingSummaries = Maybe [ReprocessingSummary]
a} :: PipelineSummary) ((Maybe [ReprocessingSummary] -> f (Maybe [ReprocessingSummary]))
 -> PipelineSummary -> f PipelineSummary)
-> ((Maybe [ReprocessingSummary]
     -> f (Maybe [ReprocessingSummary]))
    -> Maybe [ReprocessingSummary] -> f (Maybe [ReprocessingSummary]))
-> (Maybe [ReprocessingSummary] -> f (Maybe [ReprocessingSummary]))
-> PipelineSummary
-> f PipelineSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ReprocessingSummary]
  [ReprocessingSummary]
  [ReprocessingSummary]
  [ReprocessingSummary]
-> Iso
     (Maybe [ReprocessingSummary])
     (Maybe [ReprocessingSummary])
     (Maybe [ReprocessingSummary])
     (Maybe [ReprocessingSummary])
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
  [ReprocessingSummary]
  [ReprocessingSummary]
  [ReprocessingSummary]
  [ReprocessingSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | When the pipeline was last updated.
pipelineSummary_lastUpdateTime :: Lens.Lens' PipelineSummary (Prelude.Maybe Prelude.UTCTime)
pipelineSummary_lastUpdateTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> PipelineSummary -> f PipelineSummary
pipelineSummary_lastUpdateTime = (PipelineSummary -> Maybe POSIX)
-> (PipelineSummary -> Maybe POSIX -> PipelineSummary)
-> Lens PipelineSummary PipelineSummary (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PipelineSummary' {Maybe POSIX
lastUpdateTime :: Maybe POSIX
$sel:lastUpdateTime:PipelineSummary' :: PipelineSummary -> Maybe POSIX
lastUpdateTime} -> Maybe POSIX
lastUpdateTime) (\s :: PipelineSummary
s@PipelineSummary' {} Maybe POSIX
a -> PipelineSummary
s {$sel:lastUpdateTime:PipelineSummary' :: Maybe POSIX
lastUpdateTime = Maybe POSIX
a} :: PipelineSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> PipelineSummary -> f PipelineSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> PipelineSummary
-> f PipelineSummary
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 PipelineSummary where
  parseJSON :: Value -> Parser PipelineSummary
parseJSON =
    String
-> (Object -> Parser PipelineSummary)
-> Value
-> Parser PipelineSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"PipelineSummary"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> Maybe [ReprocessingSummary]
-> Maybe POSIX
-> PipelineSummary
PipelineSummary'
            (Maybe POSIX
 -> Maybe Text
 -> Maybe [ReprocessingSummary]
 -> Maybe POSIX
 -> PipelineSummary)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe [ReprocessingSummary] -> Maybe POSIX -> PipelineSummary)
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 [ReprocessingSummary] -> Maybe POSIX -> PipelineSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe [ReprocessingSummary] -> Maybe POSIX -> PipelineSummary)
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
"pipelineName")
            Parser
  (Maybe [ReprocessingSummary] -> Maybe POSIX -> PipelineSummary)
-> Parser (Maybe [ReprocessingSummary])
-> Parser (Maybe POSIX -> PipelineSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [ReprocessingSummary]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"reprocessingSummaries"
                            Parser (Maybe (Maybe [ReprocessingSummary]))
-> Maybe [ReprocessingSummary]
-> Parser (Maybe [ReprocessingSummary])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [ReprocessingSummary]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser (Maybe POSIX -> PipelineSummary)
-> Parser (Maybe POSIX) -> Parser PipelineSummary
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 PipelineSummary

instance Prelude.NFData PipelineSummary