{-# 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.IoTThingsGraph.Types.FlowExecutionSummary
-- 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.IoTThingsGraph.Types.FlowExecutionSummary where

import qualified Amazonka.Core as Core
import Amazonka.IoTThingsGraph.Types.FlowExecutionStatus
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | An object that contains summary information about a flow execution.
--
-- /See:/ 'newFlowExecutionSummary' smart constructor.
data FlowExecutionSummary = FlowExecutionSummary'
  { -- | The current status of the flow execution.
    FlowExecutionSummary -> Maybe FlowExecutionStatus
status :: Prelude.Maybe FlowExecutionStatus,
    -- | The ID of the flow.
    FlowExecutionSummary -> Maybe Text
flowTemplateId :: Prelude.Maybe Prelude.Text,
    -- | The date and time when the flow execution summary was created.
    FlowExecutionSummary -> Maybe POSIX
createdAt :: Prelude.Maybe Core.POSIX,
    -- | The ID of the flow execution.
    FlowExecutionSummary -> Maybe Text
flowExecutionId :: Prelude.Maybe Prelude.Text,
    -- | The ID of the system instance that contains the flow.
    FlowExecutionSummary -> Maybe Text
systemInstanceId :: Prelude.Maybe Prelude.Text,
    -- | The date and time when the flow execution summary was last updated.
    FlowExecutionSummary -> Maybe POSIX
updatedAt :: Prelude.Maybe Core.POSIX
  }
  deriving (FlowExecutionSummary -> FlowExecutionSummary -> Bool
(FlowExecutionSummary -> FlowExecutionSummary -> Bool)
-> (FlowExecutionSummary -> FlowExecutionSummary -> Bool)
-> Eq FlowExecutionSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FlowExecutionSummary -> FlowExecutionSummary -> Bool
$c/= :: FlowExecutionSummary -> FlowExecutionSummary -> Bool
== :: FlowExecutionSummary -> FlowExecutionSummary -> Bool
$c== :: FlowExecutionSummary -> FlowExecutionSummary -> Bool
Prelude.Eq, ReadPrec [FlowExecutionSummary]
ReadPrec FlowExecutionSummary
Int -> ReadS FlowExecutionSummary
ReadS [FlowExecutionSummary]
(Int -> ReadS FlowExecutionSummary)
-> ReadS [FlowExecutionSummary]
-> ReadPrec FlowExecutionSummary
-> ReadPrec [FlowExecutionSummary]
-> Read FlowExecutionSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FlowExecutionSummary]
$creadListPrec :: ReadPrec [FlowExecutionSummary]
readPrec :: ReadPrec FlowExecutionSummary
$creadPrec :: ReadPrec FlowExecutionSummary
readList :: ReadS [FlowExecutionSummary]
$creadList :: ReadS [FlowExecutionSummary]
readsPrec :: Int -> ReadS FlowExecutionSummary
$creadsPrec :: Int -> ReadS FlowExecutionSummary
Prelude.Read, Int -> FlowExecutionSummary -> ShowS
[FlowExecutionSummary] -> ShowS
FlowExecutionSummary -> String
(Int -> FlowExecutionSummary -> ShowS)
-> (FlowExecutionSummary -> String)
-> ([FlowExecutionSummary] -> ShowS)
-> Show FlowExecutionSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FlowExecutionSummary] -> ShowS
$cshowList :: [FlowExecutionSummary] -> ShowS
show :: FlowExecutionSummary -> String
$cshow :: FlowExecutionSummary -> String
showsPrec :: Int -> FlowExecutionSummary -> ShowS
$cshowsPrec :: Int -> FlowExecutionSummary -> ShowS
Prelude.Show, (forall x. FlowExecutionSummary -> Rep FlowExecutionSummary x)
-> (forall x. Rep FlowExecutionSummary x -> FlowExecutionSummary)
-> Generic FlowExecutionSummary
forall x. Rep FlowExecutionSummary x -> FlowExecutionSummary
forall x. FlowExecutionSummary -> Rep FlowExecutionSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FlowExecutionSummary x -> FlowExecutionSummary
$cfrom :: forall x. FlowExecutionSummary -> Rep FlowExecutionSummary x
Prelude.Generic)

-- |
-- Create a value of 'FlowExecutionSummary' 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:
--
-- 'status', 'flowExecutionSummary_status' - The current status of the flow execution.
--
-- 'flowTemplateId', 'flowExecutionSummary_flowTemplateId' - The ID of the flow.
--
-- 'createdAt', 'flowExecutionSummary_createdAt' - The date and time when the flow execution summary was created.
--
-- 'flowExecutionId', 'flowExecutionSummary_flowExecutionId' - The ID of the flow execution.
--
-- 'systemInstanceId', 'flowExecutionSummary_systemInstanceId' - The ID of the system instance that contains the flow.
--
-- 'updatedAt', 'flowExecutionSummary_updatedAt' - The date and time when the flow execution summary was last updated.
newFlowExecutionSummary ::
  FlowExecutionSummary
newFlowExecutionSummary :: FlowExecutionSummary
newFlowExecutionSummary =
  FlowExecutionSummary' :: Maybe FlowExecutionStatus
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> FlowExecutionSummary
FlowExecutionSummary'
    { $sel:status:FlowExecutionSummary' :: Maybe FlowExecutionStatus
status = Maybe FlowExecutionStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:flowTemplateId:FlowExecutionSummary' :: Maybe Text
flowTemplateId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:createdAt:FlowExecutionSummary' :: Maybe POSIX
createdAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:flowExecutionId:FlowExecutionSummary' :: Maybe Text
flowExecutionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:systemInstanceId:FlowExecutionSummary' :: Maybe Text
systemInstanceId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:updatedAt:FlowExecutionSummary' :: Maybe POSIX
updatedAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | The current status of the flow execution.
flowExecutionSummary_status :: Lens.Lens' FlowExecutionSummary (Prelude.Maybe FlowExecutionStatus)
flowExecutionSummary_status :: (Maybe FlowExecutionStatus -> f (Maybe FlowExecutionStatus))
-> FlowExecutionSummary -> f FlowExecutionSummary
flowExecutionSummary_status = (FlowExecutionSummary -> Maybe FlowExecutionStatus)
-> (FlowExecutionSummary
    -> Maybe FlowExecutionStatus -> FlowExecutionSummary)
-> Lens
     FlowExecutionSummary
     FlowExecutionSummary
     (Maybe FlowExecutionStatus)
     (Maybe FlowExecutionStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FlowExecutionSummary' {Maybe FlowExecutionStatus
status :: Maybe FlowExecutionStatus
$sel:status:FlowExecutionSummary' :: FlowExecutionSummary -> Maybe FlowExecutionStatus
status} -> Maybe FlowExecutionStatus
status) (\s :: FlowExecutionSummary
s@FlowExecutionSummary' {} Maybe FlowExecutionStatus
a -> FlowExecutionSummary
s {$sel:status:FlowExecutionSummary' :: Maybe FlowExecutionStatus
status = Maybe FlowExecutionStatus
a} :: FlowExecutionSummary)

-- | The ID of the flow.
flowExecutionSummary_flowTemplateId :: Lens.Lens' FlowExecutionSummary (Prelude.Maybe Prelude.Text)
flowExecutionSummary_flowTemplateId :: (Maybe Text -> f (Maybe Text))
-> FlowExecutionSummary -> f FlowExecutionSummary
flowExecutionSummary_flowTemplateId = (FlowExecutionSummary -> Maybe Text)
-> (FlowExecutionSummary -> Maybe Text -> FlowExecutionSummary)
-> Lens
     FlowExecutionSummary FlowExecutionSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FlowExecutionSummary' {Maybe Text
flowTemplateId :: Maybe Text
$sel:flowTemplateId:FlowExecutionSummary' :: FlowExecutionSummary -> Maybe Text
flowTemplateId} -> Maybe Text
flowTemplateId) (\s :: FlowExecutionSummary
s@FlowExecutionSummary' {} Maybe Text
a -> FlowExecutionSummary
s {$sel:flowTemplateId:FlowExecutionSummary' :: Maybe Text
flowTemplateId = Maybe Text
a} :: FlowExecutionSummary)

-- | The date and time when the flow execution summary was created.
flowExecutionSummary_createdAt :: Lens.Lens' FlowExecutionSummary (Prelude.Maybe Prelude.UTCTime)
flowExecutionSummary_createdAt :: (Maybe UTCTime -> f (Maybe UTCTime))
-> FlowExecutionSummary -> f FlowExecutionSummary
flowExecutionSummary_createdAt = (FlowExecutionSummary -> Maybe POSIX)
-> (FlowExecutionSummary -> Maybe POSIX -> FlowExecutionSummary)
-> Lens
     FlowExecutionSummary
     FlowExecutionSummary
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FlowExecutionSummary' {Maybe POSIX
createdAt :: Maybe POSIX
$sel:createdAt:FlowExecutionSummary' :: FlowExecutionSummary -> Maybe POSIX
createdAt} -> Maybe POSIX
createdAt) (\s :: FlowExecutionSummary
s@FlowExecutionSummary' {} Maybe POSIX
a -> FlowExecutionSummary
s {$sel:createdAt:FlowExecutionSummary' :: Maybe POSIX
createdAt = Maybe POSIX
a} :: FlowExecutionSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> FlowExecutionSummary -> f FlowExecutionSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> FlowExecutionSummary
-> f FlowExecutionSummary
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 ID of the flow execution.
flowExecutionSummary_flowExecutionId :: Lens.Lens' FlowExecutionSummary (Prelude.Maybe Prelude.Text)
flowExecutionSummary_flowExecutionId :: (Maybe Text -> f (Maybe Text))
-> FlowExecutionSummary -> f FlowExecutionSummary
flowExecutionSummary_flowExecutionId = (FlowExecutionSummary -> Maybe Text)
-> (FlowExecutionSummary -> Maybe Text -> FlowExecutionSummary)
-> Lens
     FlowExecutionSummary FlowExecutionSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FlowExecutionSummary' {Maybe Text
flowExecutionId :: Maybe Text
$sel:flowExecutionId:FlowExecutionSummary' :: FlowExecutionSummary -> Maybe Text
flowExecutionId} -> Maybe Text
flowExecutionId) (\s :: FlowExecutionSummary
s@FlowExecutionSummary' {} Maybe Text
a -> FlowExecutionSummary
s {$sel:flowExecutionId:FlowExecutionSummary' :: Maybe Text
flowExecutionId = Maybe Text
a} :: FlowExecutionSummary)

-- | The ID of the system instance that contains the flow.
flowExecutionSummary_systemInstanceId :: Lens.Lens' FlowExecutionSummary (Prelude.Maybe Prelude.Text)
flowExecutionSummary_systemInstanceId :: (Maybe Text -> f (Maybe Text))
-> FlowExecutionSummary -> f FlowExecutionSummary
flowExecutionSummary_systemInstanceId = (FlowExecutionSummary -> Maybe Text)
-> (FlowExecutionSummary -> Maybe Text -> FlowExecutionSummary)
-> Lens
     FlowExecutionSummary FlowExecutionSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FlowExecutionSummary' {Maybe Text
systemInstanceId :: Maybe Text
$sel:systemInstanceId:FlowExecutionSummary' :: FlowExecutionSummary -> Maybe Text
systemInstanceId} -> Maybe Text
systemInstanceId) (\s :: FlowExecutionSummary
s@FlowExecutionSummary' {} Maybe Text
a -> FlowExecutionSummary
s {$sel:systemInstanceId:FlowExecutionSummary' :: Maybe Text
systemInstanceId = Maybe Text
a} :: FlowExecutionSummary)

-- | The date and time when the flow execution summary was last updated.
flowExecutionSummary_updatedAt :: Lens.Lens' FlowExecutionSummary (Prelude.Maybe Prelude.UTCTime)
flowExecutionSummary_updatedAt :: (Maybe UTCTime -> f (Maybe UTCTime))
-> FlowExecutionSummary -> f FlowExecutionSummary
flowExecutionSummary_updatedAt = (FlowExecutionSummary -> Maybe POSIX)
-> (FlowExecutionSummary -> Maybe POSIX -> FlowExecutionSummary)
-> Lens
     FlowExecutionSummary
     FlowExecutionSummary
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FlowExecutionSummary' {Maybe POSIX
updatedAt :: Maybe POSIX
$sel:updatedAt:FlowExecutionSummary' :: FlowExecutionSummary -> Maybe POSIX
updatedAt} -> Maybe POSIX
updatedAt) (\s :: FlowExecutionSummary
s@FlowExecutionSummary' {} Maybe POSIX
a -> FlowExecutionSummary
s {$sel:updatedAt:FlowExecutionSummary' :: Maybe POSIX
updatedAt = Maybe POSIX
a} :: FlowExecutionSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> FlowExecutionSummary -> f FlowExecutionSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> FlowExecutionSummary
-> f FlowExecutionSummary
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 FlowExecutionSummary where
  parseJSON :: Value -> Parser FlowExecutionSummary
parseJSON =
    String
-> (Object -> Parser FlowExecutionSummary)
-> Value
-> Parser FlowExecutionSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"FlowExecutionSummary"
      ( \Object
x ->
          Maybe FlowExecutionStatus
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> FlowExecutionSummary
FlowExecutionSummary'
            (Maybe FlowExecutionStatus
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> FlowExecutionSummary)
-> Parser (Maybe FlowExecutionStatus)
-> Parser
     (Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> FlowExecutionSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe FlowExecutionStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"status")
            Parser
  (Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> FlowExecutionSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Maybe Text -> Maybe Text -> Maybe POSIX -> FlowExecutionSummary)
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
"flowTemplateId")
            Parser
  (Maybe POSIX
   -> Maybe Text -> Maybe Text -> Maybe POSIX -> FlowExecutionSummary)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe POSIX -> FlowExecutionSummary)
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
"createdAt")
            Parser
  (Maybe Text -> Maybe Text -> Maybe POSIX -> FlowExecutionSummary)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe POSIX -> FlowExecutionSummary)
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
"flowExecutionId")
            Parser (Maybe Text -> Maybe POSIX -> FlowExecutionSummary)
-> Parser (Maybe Text)
-> Parser (Maybe POSIX -> FlowExecutionSummary)
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
"systemInstanceId")
            Parser (Maybe POSIX -> FlowExecutionSummary)
-> Parser (Maybe POSIX) -> Parser FlowExecutionSummary
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
"updatedAt")
      )

instance Prelude.Hashable FlowExecutionSummary

instance Prelude.NFData FlowExecutionSummary