{-# 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.AppFlow.Types.ExecutionResult
-- 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.AppFlow.Types.ExecutionResult where

import Amazonka.AppFlow.Types.ErrorInfo
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Specifies the end result of the flow run.
--
-- /See:/ 'newExecutionResult' smart constructor.
data ExecutionResult = ExecutionResult'
  { -- | The number of records processed in the flow run.
    ExecutionResult -> Maybe Integer
recordsProcessed :: Prelude.Maybe Prelude.Integer,
    -- | The total number of bytes written as a result of the flow run.
    ExecutionResult -> Maybe Integer
bytesWritten :: Prelude.Maybe Prelude.Integer,
    -- | The total number of bytes processed by the flow run.
    ExecutionResult -> Maybe Integer
bytesProcessed :: Prelude.Maybe Prelude.Integer,
    -- | Provides any error message information related to the flow run.
    ExecutionResult -> Maybe ErrorInfo
errorInfo :: Prelude.Maybe ErrorInfo
  }
  deriving (ExecutionResult -> ExecutionResult -> Bool
(ExecutionResult -> ExecutionResult -> Bool)
-> (ExecutionResult -> ExecutionResult -> Bool)
-> Eq ExecutionResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExecutionResult -> ExecutionResult -> Bool
$c/= :: ExecutionResult -> ExecutionResult -> Bool
== :: ExecutionResult -> ExecutionResult -> Bool
$c== :: ExecutionResult -> ExecutionResult -> Bool
Prelude.Eq, ReadPrec [ExecutionResult]
ReadPrec ExecutionResult
Int -> ReadS ExecutionResult
ReadS [ExecutionResult]
(Int -> ReadS ExecutionResult)
-> ReadS [ExecutionResult]
-> ReadPrec ExecutionResult
-> ReadPrec [ExecutionResult]
-> Read ExecutionResult
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExecutionResult]
$creadListPrec :: ReadPrec [ExecutionResult]
readPrec :: ReadPrec ExecutionResult
$creadPrec :: ReadPrec ExecutionResult
readList :: ReadS [ExecutionResult]
$creadList :: ReadS [ExecutionResult]
readsPrec :: Int -> ReadS ExecutionResult
$creadsPrec :: Int -> ReadS ExecutionResult
Prelude.Read, Int -> ExecutionResult -> ShowS
[ExecutionResult] -> ShowS
ExecutionResult -> String
(Int -> ExecutionResult -> ShowS)
-> (ExecutionResult -> String)
-> ([ExecutionResult] -> ShowS)
-> Show ExecutionResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExecutionResult] -> ShowS
$cshowList :: [ExecutionResult] -> ShowS
show :: ExecutionResult -> String
$cshow :: ExecutionResult -> String
showsPrec :: Int -> ExecutionResult -> ShowS
$cshowsPrec :: Int -> ExecutionResult -> ShowS
Prelude.Show, (forall x. ExecutionResult -> Rep ExecutionResult x)
-> (forall x. Rep ExecutionResult x -> ExecutionResult)
-> Generic ExecutionResult
forall x. Rep ExecutionResult x -> ExecutionResult
forall x. ExecutionResult -> Rep ExecutionResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ExecutionResult x -> ExecutionResult
$cfrom :: forall x. ExecutionResult -> Rep ExecutionResult x
Prelude.Generic)

-- |
-- Create a value of 'ExecutionResult' 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:
--
-- 'recordsProcessed', 'executionResult_recordsProcessed' - The number of records processed in the flow run.
--
-- 'bytesWritten', 'executionResult_bytesWritten' - The total number of bytes written as a result of the flow run.
--
-- 'bytesProcessed', 'executionResult_bytesProcessed' - The total number of bytes processed by the flow run.
--
-- 'errorInfo', 'executionResult_errorInfo' - Provides any error message information related to the flow run.
newExecutionResult ::
  ExecutionResult
newExecutionResult :: ExecutionResult
newExecutionResult =
  ExecutionResult' :: Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> Maybe ErrorInfo
-> ExecutionResult
ExecutionResult'
    { $sel:recordsProcessed:ExecutionResult' :: Maybe Integer
recordsProcessed =
        Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:bytesWritten:ExecutionResult' :: Maybe Integer
bytesWritten = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:bytesProcessed:ExecutionResult' :: Maybe Integer
bytesProcessed = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:errorInfo:ExecutionResult' :: Maybe ErrorInfo
errorInfo = Maybe ErrorInfo
forall a. Maybe a
Prelude.Nothing
    }

-- | The number of records processed in the flow run.
executionResult_recordsProcessed :: Lens.Lens' ExecutionResult (Prelude.Maybe Prelude.Integer)
executionResult_recordsProcessed :: (Maybe Integer -> f (Maybe Integer))
-> ExecutionResult -> f ExecutionResult
executionResult_recordsProcessed = (ExecutionResult -> Maybe Integer)
-> (ExecutionResult -> Maybe Integer -> ExecutionResult)
-> Lens
     ExecutionResult ExecutionResult (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecutionResult' {Maybe Integer
recordsProcessed :: Maybe Integer
$sel:recordsProcessed:ExecutionResult' :: ExecutionResult -> Maybe Integer
recordsProcessed} -> Maybe Integer
recordsProcessed) (\s :: ExecutionResult
s@ExecutionResult' {} Maybe Integer
a -> ExecutionResult
s {$sel:recordsProcessed:ExecutionResult' :: Maybe Integer
recordsProcessed = Maybe Integer
a} :: ExecutionResult)

-- | The total number of bytes written as a result of the flow run.
executionResult_bytesWritten :: Lens.Lens' ExecutionResult (Prelude.Maybe Prelude.Integer)
executionResult_bytesWritten :: (Maybe Integer -> f (Maybe Integer))
-> ExecutionResult -> f ExecutionResult
executionResult_bytesWritten = (ExecutionResult -> Maybe Integer)
-> (ExecutionResult -> Maybe Integer -> ExecutionResult)
-> Lens
     ExecutionResult ExecutionResult (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecutionResult' {Maybe Integer
bytesWritten :: Maybe Integer
$sel:bytesWritten:ExecutionResult' :: ExecutionResult -> Maybe Integer
bytesWritten} -> Maybe Integer
bytesWritten) (\s :: ExecutionResult
s@ExecutionResult' {} Maybe Integer
a -> ExecutionResult
s {$sel:bytesWritten:ExecutionResult' :: Maybe Integer
bytesWritten = Maybe Integer
a} :: ExecutionResult)

-- | The total number of bytes processed by the flow run.
executionResult_bytesProcessed :: Lens.Lens' ExecutionResult (Prelude.Maybe Prelude.Integer)
executionResult_bytesProcessed :: (Maybe Integer -> f (Maybe Integer))
-> ExecutionResult -> f ExecutionResult
executionResult_bytesProcessed = (ExecutionResult -> Maybe Integer)
-> (ExecutionResult -> Maybe Integer -> ExecutionResult)
-> Lens
     ExecutionResult ExecutionResult (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecutionResult' {Maybe Integer
bytesProcessed :: Maybe Integer
$sel:bytesProcessed:ExecutionResult' :: ExecutionResult -> Maybe Integer
bytesProcessed} -> Maybe Integer
bytesProcessed) (\s :: ExecutionResult
s@ExecutionResult' {} Maybe Integer
a -> ExecutionResult
s {$sel:bytesProcessed:ExecutionResult' :: Maybe Integer
bytesProcessed = Maybe Integer
a} :: ExecutionResult)

-- | Provides any error message information related to the flow run.
executionResult_errorInfo :: Lens.Lens' ExecutionResult (Prelude.Maybe ErrorInfo)
executionResult_errorInfo :: (Maybe ErrorInfo -> f (Maybe ErrorInfo))
-> ExecutionResult -> f ExecutionResult
executionResult_errorInfo = (ExecutionResult -> Maybe ErrorInfo)
-> (ExecutionResult -> Maybe ErrorInfo -> ExecutionResult)
-> Lens
     ExecutionResult ExecutionResult (Maybe ErrorInfo) (Maybe ErrorInfo)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecutionResult' {Maybe ErrorInfo
errorInfo :: Maybe ErrorInfo
$sel:errorInfo:ExecutionResult' :: ExecutionResult -> Maybe ErrorInfo
errorInfo} -> Maybe ErrorInfo
errorInfo) (\s :: ExecutionResult
s@ExecutionResult' {} Maybe ErrorInfo
a -> ExecutionResult
s {$sel:errorInfo:ExecutionResult' :: Maybe ErrorInfo
errorInfo = Maybe ErrorInfo
a} :: ExecutionResult)

instance Core.FromJSON ExecutionResult where
  parseJSON :: Value -> Parser ExecutionResult
parseJSON =
    String
-> (Object -> Parser ExecutionResult)
-> Value
-> Parser ExecutionResult
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ExecutionResult"
      ( \Object
x ->
          Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> Maybe ErrorInfo
-> ExecutionResult
ExecutionResult'
            (Maybe Integer
 -> Maybe Integer
 -> Maybe Integer
 -> Maybe ErrorInfo
 -> ExecutionResult)
-> Parser (Maybe Integer)
-> Parser
     (Maybe Integer
      -> Maybe Integer -> Maybe ErrorInfo -> ExecutionResult)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"recordsProcessed")
            Parser
  (Maybe Integer
   -> Maybe Integer -> Maybe ErrorInfo -> ExecutionResult)
-> Parser (Maybe Integer)
-> Parser (Maybe Integer -> Maybe ErrorInfo -> ExecutionResult)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"bytesWritten")
            Parser (Maybe Integer -> Maybe ErrorInfo -> ExecutionResult)
-> Parser (Maybe Integer)
-> Parser (Maybe ErrorInfo -> ExecutionResult)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"bytesProcessed")
            Parser (Maybe ErrorInfo -> ExecutionResult)
-> Parser (Maybe ErrorInfo) -> Parser ExecutionResult
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ErrorInfo)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"errorInfo")
      )

instance Prelude.Hashable ExecutionResult

instance Prelude.NFData ExecutionResult