{-# 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.Transfer.Types.ExecutionResults
-- 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.Transfer.Types.ExecutionResults where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Transfer.Types.ExecutionStepResult

-- | Specifies the steps in the workflow, as well as the steps to execute in
-- case of any errors during workflow execution.
--
-- /See:/ 'newExecutionResults' smart constructor.
data ExecutionResults = ExecutionResults'
  { -- | Specifies the steps (actions) to take if errors are encountered during
    -- execution of the workflow.
    ExecutionResults -> Maybe (NonEmpty ExecutionStepResult)
onExceptionSteps :: Prelude.Maybe (Prelude.NonEmpty ExecutionStepResult),
    -- | Specifies the details for the steps that are in the specified workflow.
    ExecutionResults -> Maybe (NonEmpty ExecutionStepResult)
steps :: Prelude.Maybe (Prelude.NonEmpty ExecutionStepResult)
  }
  deriving (ExecutionResults -> ExecutionResults -> Bool
(ExecutionResults -> ExecutionResults -> Bool)
-> (ExecutionResults -> ExecutionResults -> Bool)
-> Eq ExecutionResults
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExecutionResults -> ExecutionResults -> Bool
$c/= :: ExecutionResults -> ExecutionResults -> Bool
== :: ExecutionResults -> ExecutionResults -> Bool
$c== :: ExecutionResults -> ExecutionResults -> Bool
Prelude.Eq, ReadPrec [ExecutionResults]
ReadPrec ExecutionResults
Int -> ReadS ExecutionResults
ReadS [ExecutionResults]
(Int -> ReadS ExecutionResults)
-> ReadS [ExecutionResults]
-> ReadPrec ExecutionResults
-> ReadPrec [ExecutionResults]
-> Read ExecutionResults
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExecutionResults]
$creadListPrec :: ReadPrec [ExecutionResults]
readPrec :: ReadPrec ExecutionResults
$creadPrec :: ReadPrec ExecutionResults
readList :: ReadS [ExecutionResults]
$creadList :: ReadS [ExecutionResults]
readsPrec :: Int -> ReadS ExecutionResults
$creadsPrec :: Int -> ReadS ExecutionResults
Prelude.Read, Int -> ExecutionResults -> ShowS
[ExecutionResults] -> ShowS
ExecutionResults -> String
(Int -> ExecutionResults -> ShowS)
-> (ExecutionResults -> String)
-> ([ExecutionResults] -> ShowS)
-> Show ExecutionResults
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExecutionResults] -> ShowS
$cshowList :: [ExecutionResults] -> ShowS
show :: ExecutionResults -> String
$cshow :: ExecutionResults -> String
showsPrec :: Int -> ExecutionResults -> ShowS
$cshowsPrec :: Int -> ExecutionResults -> ShowS
Prelude.Show, (forall x. ExecutionResults -> Rep ExecutionResults x)
-> (forall x. Rep ExecutionResults x -> ExecutionResults)
-> Generic ExecutionResults
forall x. Rep ExecutionResults x -> ExecutionResults
forall x. ExecutionResults -> Rep ExecutionResults x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ExecutionResults x -> ExecutionResults
$cfrom :: forall x. ExecutionResults -> Rep ExecutionResults x
Prelude.Generic)

-- |
-- Create a value of 'ExecutionResults' 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:
--
-- 'onExceptionSteps', 'executionResults_onExceptionSteps' - Specifies the steps (actions) to take if errors are encountered during
-- execution of the workflow.
--
-- 'steps', 'executionResults_steps' - Specifies the details for the steps that are in the specified workflow.
newExecutionResults ::
  ExecutionResults
newExecutionResults :: ExecutionResults
newExecutionResults =
  ExecutionResults' :: Maybe (NonEmpty ExecutionStepResult)
-> Maybe (NonEmpty ExecutionStepResult) -> ExecutionResults
ExecutionResults'
    { $sel:onExceptionSteps:ExecutionResults' :: Maybe (NonEmpty ExecutionStepResult)
onExceptionSteps =
        Maybe (NonEmpty ExecutionStepResult)
forall a. Maybe a
Prelude.Nothing,
      $sel:steps:ExecutionResults' :: Maybe (NonEmpty ExecutionStepResult)
steps = Maybe (NonEmpty ExecutionStepResult)
forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies the steps (actions) to take if errors are encountered during
-- execution of the workflow.
executionResults_onExceptionSteps :: Lens.Lens' ExecutionResults (Prelude.Maybe (Prelude.NonEmpty ExecutionStepResult))
executionResults_onExceptionSteps :: (Maybe (NonEmpty ExecutionStepResult)
 -> f (Maybe (NonEmpty ExecutionStepResult)))
-> ExecutionResults -> f ExecutionResults
executionResults_onExceptionSteps = (ExecutionResults -> Maybe (NonEmpty ExecutionStepResult))
-> (ExecutionResults
    -> Maybe (NonEmpty ExecutionStepResult) -> ExecutionResults)
-> Lens
     ExecutionResults
     ExecutionResults
     (Maybe (NonEmpty ExecutionStepResult))
     (Maybe (NonEmpty ExecutionStepResult))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecutionResults' {Maybe (NonEmpty ExecutionStepResult)
onExceptionSteps :: Maybe (NonEmpty ExecutionStepResult)
$sel:onExceptionSteps:ExecutionResults' :: ExecutionResults -> Maybe (NonEmpty ExecutionStepResult)
onExceptionSteps} -> Maybe (NonEmpty ExecutionStepResult)
onExceptionSteps) (\s :: ExecutionResults
s@ExecutionResults' {} Maybe (NonEmpty ExecutionStepResult)
a -> ExecutionResults
s {$sel:onExceptionSteps:ExecutionResults' :: Maybe (NonEmpty ExecutionStepResult)
onExceptionSteps = Maybe (NonEmpty ExecutionStepResult)
a} :: ExecutionResults) ((Maybe (NonEmpty ExecutionStepResult)
  -> f (Maybe (NonEmpty ExecutionStepResult)))
 -> ExecutionResults -> f ExecutionResults)
-> ((Maybe (NonEmpty ExecutionStepResult)
     -> f (Maybe (NonEmpty ExecutionStepResult)))
    -> Maybe (NonEmpty ExecutionStepResult)
    -> f (Maybe (NonEmpty ExecutionStepResult)))
-> (Maybe (NonEmpty ExecutionStepResult)
    -> f (Maybe (NonEmpty ExecutionStepResult)))
-> ExecutionResults
-> f ExecutionResults
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty ExecutionStepResult)
  (NonEmpty ExecutionStepResult)
  (NonEmpty ExecutionStepResult)
  (NonEmpty ExecutionStepResult)
-> Iso
     (Maybe (NonEmpty ExecutionStepResult))
     (Maybe (NonEmpty ExecutionStepResult))
     (Maybe (NonEmpty ExecutionStepResult))
     (Maybe (NonEmpty ExecutionStepResult))
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 ExecutionStepResult)
  (NonEmpty ExecutionStepResult)
  (NonEmpty ExecutionStepResult)
  (NonEmpty ExecutionStepResult)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Specifies the details for the steps that are in the specified workflow.
executionResults_steps :: Lens.Lens' ExecutionResults (Prelude.Maybe (Prelude.NonEmpty ExecutionStepResult))
executionResults_steps :: (Maybe (NonEmpty ExecutionStepResult)
 -> f (Maybe (NonEmpty ExecutionStepResult)))
-> ExecutionResults -> f ExecutionResults
executionResults_steps = (ExecutionResults -> Maybe (NonEmpty ExecutionStepResult))
-> (ExecutionResults
    -> Maybe (NonEmpty ExecutionStepResult) -> ExecutionResults)
-> Lens
     ExecutionResults
     ExecutionResults
     (Maybe (NonEmpty ExecutionStepResult))
     (Maybe (NonEmpty ExecutionStepResult))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecutionResults' {Maybe (NonEmpty ExecutionStepResult)
steps :: Maybe (NonEmpty ExecutionStepResult)
$sel:steps:ExecutionResults' :: ExecutionResults -> Maybe (NonEmpty ExecutionStepResult)
steps} -> Maybe (NonEmpty ExecutionStepResult)
steps) (\s :: ExecutionResults
s@ExecutionResults' {} Maybe (NonEmpty ExecutionStepResult)
a -> ExecutionResults
s {$sel:steps:ExecutionResults' :: Maybe (NonEmpty ExecutionStepResult)
steps = Maybe (NonEmpty ExecutionStepResult)
a} :: ExecutionResults) ((Maybe (NonEmpty ExecutionStepResult)
  -> f (Maybe (NonEmpty ExecutionStepResult)))
 -> ExecutionResults -> f ExecutionResults)
-> ((Maybe (NonEmpty ExecutionStepResult)
     -> f (Maybe (NonEmpty ExecutionStepResult)))
    -> Maybe (NonEmpty ExecutionStepResult)
    -> f (Maybe (NonEmpty ExecutionStepResult)))
-> (Maybe (NonEmpty ExecutionStepResult)
    -> f (Maybe (NonEmpty ExecutionStepResult)))
-> ExecutionResults
-> f ExecutionResults
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty ExecutionStepResult)
  (NonEmpty ExecutionStepResult)
  (NonEmpty ExecutionStepResult)
  (NonEmpty ExecutionStepResult)
-> Iso
     (Maybe (NonEmpty ExecutionStepResult))
     (Maybe (NonEmpty ExecutionStepResult))
     (Maybe (NonEmpty ExecutionStepResult))
     (Maybe (NonEmpty ExecutionStepResult))
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 ExecutionStepResult)
  (NonEmpty ExecutionStepResult)
  (NonEmpty ExecutionStepResult)
  (NonEmpty ExecutionStepResult)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON ExecutionResults where
  parseJSON :: Value -> Parser ExecutionResults
parseJSON =
    String
-> (Object -> Parser ExecutionResults)
-> Value
-> Parser ExecutionResults
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ExecutionResults"
      ( \Object
x ->
          Maybe (NonEmpty ExecutionStepResult)
-> Maybe (NonEmpty ExecutionStepResult) -> ExecutionResults
ExecutionResults'
            (Maybe (NonEmpty ExecutionStepResult)
 -> Maybe (NonEmpty ExecutionStepResult) -> ExecutionResults)
-> Parser (Maybe (NonEmpty ExecutionStepResult))
-> Parser
     (Maybe (NonEmpty ExecutionStepResult) -> ExecutionResults)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (NonEmpty ExecutionStepResult))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"OnExceptionSteps")
            Parser (Maybe (NonEmpty ExecutionStepResult) -> ExecutionResults)
-> Parser (Maybe (NonEmpty ExecutionStepResult))
-> Parser ExecutionResults
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (NonEmpty ExecutionStepResult))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Steps")
      )

instance Prelude.Hashable ExecutionResults

instance Prelude.NFData ExecutionResults