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

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

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

-- |
-- Create a value of 'Pipeline' 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', 'pipeline_creationTime' - When the pipeline was created.
--
-- 'arn', 'pipeline_arn' - The ARN of the pipeline.
--
-- 'activities', 'pipeline_activities' - The activities that perform transformations on the messages.
--
-- 'name', 'pipeline_name' - The name of the pipeline.
--
-- 'reprocessingSummaries', 'pipeline_reprocessingSummaries' - A summary of information about the pipeline reprocessing.
--
-- 'lastUpdateTime', 'pipeline_lastUpdateTime' - The last time the pipeline was updated.
newPipeline ::
  Pipeline
newPipeline :: Pipeline
newPipeline =
  Pipeline' :: Maybe POSIX
-> Maybe Text
-> Maybe (NonEmpty PipelineActivity)
-> Maybe Text
-> Maybe [ReprocessingSummary]
-> Maybe POSIX
-> Pipeline
Pipeline'
    { $sel:creationTime:Pipeline' :: Maybe POSIX
creationTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:Pipeline' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:activities:Pipeline' :: Maybe (NonEmpty PipelineActivity)
activities = Maybe (NonEmpty PipelineActivity)
forall a. Maybe a
Prelude.Nothing,
      $sel:name:Pipeline' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:reprocessingSummaries:Pipeline' :: Maybe [ReprocessingSummary]
reprocessingSummaries = Maybe [ReprocessingSummary]
forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdateTime:Pipeline' :: Maybe POSIX
lastUpdateTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

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

-- | The activities that perform transformations on the messages.
pipeline_activities :: Lens.Lens' Pipeline (Prelude.Maybe (Prelude.NonEmpty PipelineActivity))
pipeline_activities :: (Maybe (NonEmpty PipelineActivity)
 -> f (Maybe (NonEmpty PipelineActivity)))
-> Pipeline -> f Pipeline
pipeline_activities = (Pipeline -> Maybe (NonEmpty PipelineActivity))
-> (Pipeline -> Maybe (NonEmpty PipelineActivity) -> Pipeline)
-> Lens
     Pipeline
     Pipeline
     (Maybe (NonEmpty PipelineActivity))
     (Maybe (NonEmpty PipelineActivity))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Pipeline' {Maybe (NonEmpty PipelineActivity)
activities :: Maybe (NonEmpty PipelineActivity)
$sel:activities:Pipeline' :: Pipeline -> Maybe (NonEmpty PipelineActivity)
activities} -> Maybe (NonEmpty PipelineActivity)
activities) (\s :: Pipeline
s@Pipeline' {} Maybe (NonEmpty PipelineActivity)
a -> Pipeline
s {$sel:activities:Pipeline' :: Maybe (NonEmpty PipelineActivity)
activities = Maybe (NonEmpty PipelineActivity)
a} :: Pipeline) ((Maybe (NonEmpty PipelineActivity)
  -> f (Maybe (NonEmpty PipelineActivity)))
 -> Pipeline -> f Pipeline)
-> ((Maybe (NonEmpty PipelineActivity)
     -> f (Maybe (NonEmpty PipelineActivity)))
    -> Maybe (NonEmpty PipelineActivity)
    -> f (Maybe (NonEmpty PipelineActivity)))
-> (Maybe (NonEmpty PipelineActivity)
    -> f (Maybe (NonEmpty PipelineActivity)))
-> Pipeline
-> f Pipeline
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty PipelineActivity)
  (NonEmpty PipelineActivity)
  (NonEmpty PipelineActivity)
  (NonEmpty PipelineActivity)
-> Iso
     (Maybe (NonEmpty PipelineActivity))
     (Maybe (NonEmpty PipelineActivity))
     (Maybe (NonEmpty PipelineActivity))
     (Maybe (NonEmpty PipelineActivity))
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 PipelineActivity)
  (NonEmpty PipelineActivity)
  (NonEmpty PipelineActivity)
  (NonEmpty PipelineActivity)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

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

-- | The last time the pipeline was updated.
pipeline_lastUpdateTime :: Lens.Lens' Pipeline (Prelude.Maybe Prelude.UTCTime)
pipeline_lastUpdateTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Pipeline -> f Pipeline
pipeline_lastUpdateTime = (Pipeline -> Maybe POSIX)
-> (Pipeline -> Maybe POSIX -> Pipeline)
-> Lens Pipeline Pipeline (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Pipeline' {Maybe POSIX
lastUpdateTime :: Maybe POSIX
$sel:lastUpdateTime:Pipeline' :: Pipeline -> Maybe POSIX
lastUpdateTime} -> Maybe POSIX
lastUpdateTime) (\s :: Pipeline
s@Pipeline' {} Maybe POSIX
a -> Pipeline
s {$sel:lastUpdateTime:Pipeline' :: Maybe POSIX
lastUpdateTime = Maybe POSIX
a} :: Pipeline) ((Maybe POSIX -> f (Maybe POSIX)) -> Pipeline -> f Pipeline)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Pipeline
-> f Pipeline
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 Pipeline where
  parseJSON :: Value -> Parser Pipeline
parseJSON =
    String -> (Object -> Parser Pipeline) -> Value -> Parser Pipeline
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Pipeline"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> Maybe (NonEmpty PipelineActivity)
-> Maybe Text
-> Maybe [ReprocessingSummary]
-> Maybe POSIX
-> Pipeline
Pipeline'
            (Maybe POSIX
 -> Maybe Text
 -> Maybe (NonEmpty PipelineActivity)
 -> Maybe Text
 -> Maybe [ReprocessingSummary]
 -> Maybe POSIX
 -> Pipeline)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe (NonEmpty PipelineActivity)
      -> Maybe Text
      -> Maybe [ReprocessingSummary]
      -> Maybe POSIX
      -> Pipeline)
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 (NonEmpty PipelineActivity)
   -> Maybe Text
   -> Maybe [ReprocessingSummary]
   -> Maybe POSIX
   -> Pipeline)
-> Parser (Maybe Text)
-> Parser
     (Maybe (NonEmpty PipelineActivity)
      -> Maybe Text
      -> Maybe [ReprocessingSummary]
      -> Maybe POSIX
      -> Pipeline)
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
"arn")
            Parser
  (Maybe (NonEmpty PipelineActivity)
   -> Maybe Text
   -> Maybe [ReprocessingSummary]
   -> Maybe POSIX
   -> Pipeline)
-> Parser (Maybe (NonEmpty PipelineActivity))
-> Parser
     (Maybe Text
      -> Maybe [ReprocessingSummary] -> Maybe POSIX -> Pipeline)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (NonEmpty PipelineActivity))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"activities")
            Parser
  (Maybe Text
   -> Maybe [ReprocessingSummary] -> Maybe POSIX -> Pipeline)
-> Parser (Maybe Text)
-> Parser (Maybe [ReprocessingSummary] -> Maybe POSIX -> Pipeline)
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 [ReprocessingSummary] -> Maybe POSIX -> Pipeline)
-> Parser (Maybe [ReprocessingSummary])
-> Parser (Maybe POSIX -> Pipeline)
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 -> Pipeline)
-> Parser (Maybe POSIX) -> Parser Pipeline
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 Pipeline

instance Prelude.NFData Pipeline