{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.IoTAnalytics.Types.Pipeline where

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

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

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

-- | The ARN of the pipeline.
pipeline_arn :: Lens.Lens' Pipeline (Prelude.Maybe Prelude.Text)
pipeline_arn :: Lens' Pipeline (Maybe Text)
pipeline_arn = 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)

-- | When the pipeline was created.
pipeline_creationTime :: Lens.Lens' Pipeline (Prelude.Maybe Prelude.UTCTime)
pipeline_creationTime :: Lens' Pipeline (Maybe UTCTime)
pipeline_creationTime = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The last time the pipeline was updated.
pipeline_lastUpdateTime :: Lens.Lens' Pipeline (Prelude.Maybe Prelude.UTCTime)
pipeline_lastUpdateTime :: Lens' Pipeline (Maybe UTCTime)
pipeline_lastUpdateTime = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The name of the pipeline.
pipeline_name :: Lens.Lens' Pipeline (Prelude.Maybe Prelude.Text)
pipeline_name :: Lens' Pipeline (Maybe Text)
pipeline_name = 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 :: Lens' Pipeline (Maybe [ReprocessingSummary])
pipeline_reprocessingSummaries = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON Pipeline where
  parseJSON :: Value -> Parser Pipeline
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Pipeline"
      ( \Object
x ->
          Maybe (NonEmpty PipelineActivity)
-> Maybe Text
-> Maybe POSIX
-> Maybe POSIX
-> Maybe Text
-> Maybe [ReprocessingSummary]
-> Pipeline
Pipeline'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"activities")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"arn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"creationTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"lastUpdateTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"name")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"reprocessingSummaries"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable Pipeline where
  hashWithSalt :: Int -> Pipeline -> Int
hashWithSalt Int
_salt Pipeline' {Maybe [ReprocessingSummary]
Maybe (NonEmpty PipelineActivity)
Maybe Text
Maybe POSIX
reprocessingSummaries :: Maybe [ReprocessingSummary]
name :: Maybe Text
lastUpdateTime :: Maybe POSIX
creationTime :: Maybe POSIX
arn :: Maybe Text
activities :: Maybe (NonEmpty PipelineActivity)
$sel:reprocessingSummaries:Pipeline' :: Pipeline -> Maybe [ReprocessingSummary]
$sel:name:Pipeline' :: Pipeline -> Maybe Text
$sel:lastUpdateTime:Pipeline' :: Pipeline -> Maybe POSIX
$sel:creationTime:Pipeline' :: Pipeline -> Maybe POSIX
$sel:arn:Pipeline' :: Pipeline -> Maybe Text
$sel:activities:Pipeline' :: Pipeline -> Maybe (NonEmpty PipelineActivity)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty PipelineActivity)
activities
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
creationTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastUpdateTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [ReprocessingSummary]
reprocessingSummaries

instance Prelude.NFData Pipeline where
  rnf :: Pipeline -> ()
rnf Pipeline' {Maybe [ReprocessingSummary]
Maybe (NonEmpty PipelineActivity)
Maybe Text
Maybe POSIX
reprocessingSummaries :: Maybe [ReprocessingSummary]
name :: Maybe Text
lastUpdateTime :: Maybe POSIX
creationTime :: Maybe POSIX
arn :: Maybe Text
activities :: Maybe (NonEmpty PipelineActivity)
$sel:reprocessingSummaries:Pipeline' :: Pipeline -> Maybe [ReprocessingSummary]
$sel:name:Pipeline' :: Pipeline -> Maybe Text
$sel:lastUpdateTime:Pipeline' :: Pipeline -> Maybe POSIX
$sel:creationTime:Pipeline' :: Pipeline -> Maybe POSIX
$sel:arn:Pipeline' :: Pipeline -> Maybe Text
$sel:activities:Pipeline' :: Pipeline -> Maybe (NonEmpty PipelineActivity)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty PipelineActivity)
activities
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
creationTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastUpdateTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [ReprocessingSummary]
reprocessingSummaries