{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

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

-- | The total number of bytes processed by the flow run.
executionResult_bytesProcessed :: Lens.Lens' ExecutionResult (Prelude.Maybe Prelude.Integer)
executionResult_bytesProcessed :: Lens' ExecutionResult (Maybe Integer)
executionResult_bytesProcessed = 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)

-- | The total number of bytes written as a result of the flow run.
executionResult_bytesWritten :: Lens.Lens' ExecutionResult (Prelude.Maybe Prelude.Integer)
executionResult_bytesWritten :: Lens' ExecutionResult (Maybe Integer)
executionResult_bytesWritten = 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)

-- | Provides any error message information related to the flow run.
executionResult_errorInfo :: Lens.Lens' ExecutionResult (Prelude.Maybe ErrorInfo)
executionResult_errorInfo :: Lens' ExecutionResult (Maybe ErrorInfo)
executionResult_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)

-- | The number of records processed in the flow run.
executionResult_recordsProcessed :: Lens.Lens' ExecutionResult (Prelude.Maybe Prelude.Integer)
executionResult_recordsProcessed :: Lens' ExecutionResult (Maybe Integer)
executionResult_recordsProcessed = 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)

instance Data.FromJSON ExecutionResult where
  parseJSON :: Value -> Parser ExecutionResult
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ExecutionResult"
      ( \Object
x ->
          Maybe Integer
-> Maybe Integer
-> Maybe ErrorInfo
-> Maybe Integer
-> ExecutionResult
ExecutionResult'
            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
"bytesProcessed")
            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
"bytesWritten")
            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
"errorInfo")
            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
"recordsProcessed")
      )

instance Prelude.Hashable ExecutionResult where
  hashWithSalt :: Int -> ExecutionResult -> Int
hashWithSalt Int
_salt ExecutionResult' {Maybe Integer
Maybe ErrorInfo
recordsProcessed :: Maybe Integer
errorInfo :: Maybe ErrorInfo
bytesWritten :: Maybe Integer
bytesProcessed :: Maybe Integer
$sel:recordsProcessed:ExecutionResult' :: ExecutionResult -> Maybe Integer
$sel:errorInfo:ExecutionResult' :: ExecutionResult -> Maybe ErrorInfo
$sel:bytesWritten:ExecutionResult' :: ExecutionResult -> Maybe Integer
$sel:bytesProcessed:ExecutionResult' :: ExecutionResult -> Maybe Integer
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
bytesProcessed
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
bytesWritten
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ErrorInfo
errorInfo
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
recordsProcessed

instance Prelude.NFData ExecutionResult where
  rnf :: ExecutionResult -> ()
rnf ExecutionResult' {Maybe Integer
Maybe ErrorInfo
recordsProcessed :: Maybe Integer
errorInfo :: Maybe ErrorInfo
bytesWritten :: Maybe Integer
bytesProcessed :: Maybe Integer
$sel:recordsProcessed:ExecutionResult' :: ExecutionResult -> Maybe Integer
$sel:errorInfo:ExecutionResult' :: ExecutionResult -> Maybe ErrorInfo
$sel:bytesWritten:ExecutionResult' :: ExecutionResult -> Maybe Integer
$sel:bytesProcessed:ExecutionResult' :: ExecutionResult -> Maybe Integer
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
bytesProcessed
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
bytesWritten
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ErrorInfo
errorInfo
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
recordsProcessed