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

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

-- | Each step type has its own @StepDetails@ structure.
--
-- /See:/ 'newCustomStepDetails' smart constructor.
data CustomStepDetails = CustomStepDetails'
  { -- | The name of the step, used as an identifier.
    CustomStepDetails -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | Specifies which file to use as input to the workflow step: either the
    -- output from the previous step, or the originally uploaded file for the
    -- workflow.
    --
    -- -   Enter @${previous.file}@ to use the previous file as the input. In
    --     this case, this workflow step uses the output file from the previous
    --     workflow step as input. This is the default value.
    --
    -- -   Enter @${original.file}@ to use the originally-uploaded file
    --     location as input for this step.
    CustomStepDetails -> Maybe Text
sourceFileLocation :: Prelude.Maybe Prelude.Text,
    -- | The ARN for the lambda function that is being called.
    CustomStepDetails -> Maybe Text
target :: Prelude.Maybe Prelude.Text,
    -- | Timeout, in seconds, for the step.
    CustomStepDetails -> Maybe Natural
timeoutSeconds :: Prelude.Maybe Prelude.Natural
  }
  deriving (CustomStepDetails -> CustomStepDetails -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CustomStepDetails -> CustomStepDetails -> Bool
$c/= :: CustomStepDetails -> CustomStepDetails -> Bool
== :: CustomStepDetails -> CustomStepDetails -> Bool
$c== :: CustomStepDetails -> CustomStepDetails -> Bool
Prelude.Eq, ReadPrec [CustomStepDetails]
ReadPrec CustomStepDetails
Int -> ReadS CustomStepDetails
ReadS [CustomStepDetails]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CustomStepDetails]
$creadListPrec :: ReadPrec [CustomStepDetails]
readPrec :: ReadPrec CustomStepDetails
$creadPrec :: ReadPrec CustomStepDetails
readList :: ReadS [CustomStepDetails]
$creadList :: ReadS [CustomStepDetails]
readsPrec :: Int -> ReadS CustomStepDetails
$creadsPrec :: Int -> ReadS CustomStepDetails
Prelude.Read, Int -> CustomStepDetails -> ShowS
[CustomStepDetails] -> ShowS
CustomStepDetails -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CustomStepDetails] -> ShowS
$cshowList :: [CustomStepDetails] -> ShowS
show :: CustomStepDetails -> String
$cshow :: CustomStepDetails -> String
showsPrec :: Int -> CustomStepDetails -> ShowS
$cshowsPrec :: Int -> CustomStepDetails -> ShowS
Prelude.Show, forall x. Rep CustomStepDetails x -> CustomStepDetails
forall x. CustomStepDetails -> Rep CustomStepDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CustomStepDetails x -> CustomStepDetails
$cfrom :: forall x. CustomStepDetails -> Rep CustomStepDetails x
Prelude.Generic)

-- |
-- Create a value of 'CustomStepDetails' 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:
--
-- 'name', 'customStepDetails_name' - The name of the step, used as an identifier.
--
-- 'sourceFileLocation', 'customStepDetails_sourceFileLocation' - Specifies which file to use as input to the workflow step: either the
-- output from the previous step, or the originally uploaded file for the
-- workflow.
--
-- -   Enter @${previous.file}@ to use the previous file as the input. In
--     this case, this workflow step uses the output file from the previous
--     workflow step as input. This is the default value.
--
-- -   Enter @${original.file}@ to use the originally-uploaded file
--     location as input for this step.
--
-- 'target', 'customStepDetails_target' - The ARN for the lambda function that is being called.
--
-- 'timeoutSeconds', 'customStepDetails_timeoutSeconds' - Timeout, in seconds, for the step.
newCustomStepDetails ::
  CustomStepDetails
newCustomStepDetails :: CustomStepDetails
newCustomStepDetails =
  CustomStepDetails'
    { $sel:name:CustomStepDetails' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:sourceFileLocation:CustomStepDetails' :: Maybe Text
sourceFileLocation = forall a. Maybe a
Prelude.Nothing,
      $sel:target:CustomStepDetails' :: Maybe Text
target = forall a. Maybe a
Prelude.Nothing,
      $sel:timeoutSeconds:CustomStepDetails' :: Maybe Natural
timeoutSeconds = forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the step, used as an identifier.
customStepDetails_name :: Lens.Lens' CustomStepDetails (Prelude.Maybe Prelude.Text)
customStepDetails_name :: Lens' CustomStepDetails (Maybe Text)
customStepDetails_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomStepDetails' {Maybe Text
name :: Maybe Text
$sel:name:CustomStepDetails' :: CustomStepDetails -> Maybe Text
name} -> Maybe Text
name) (\s :: CustomStepDetails
s@CustomStepDetails' {} Maybe Text
a -> CustomStepDetails
s {$sel:name:CustomStepDetails' :: Maybe Text
name = Maybe Text
a} :: CustomStepDetails)

-- | Specifies which file to use as input to the workflow step: either the
-- output from the previous step, or the originally uploaded file for the
-- workflow.
--
-- -   Enter @${previous.file}@ to use the previous file as the input. In
--     this case, this workflow step uses the output file from the previous
--     workflow step as input. This is the default value.
--
-- -   Enter @${original.file}@ to use the originally-uploaded file
--     location as input for this step.
customStepDetails_sourceFileLocation :: Lens.Lens' CustomStepDetails (Prelude.Maybe Prelude.Text)
customStepDetails_sourceFileLocation :: Lens' CustomStepDetails (Maybe Text)
customStepDetails_sourceFileLocation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomStepDetails' {Maybe Text
sourceFileLocation :: Maybe Text
$sel:sourceFileLocation:CustomStepDetails' :: CustomStepDetails -> Maybe Text
sourceFileLocation} -> Maybe Text
sourceFileLocation) (\s :: CustomStepDetails
s@CustomStepDetails' {} Maybe Text
a -> CustomStepDetails
s {$sel:sourceFileLocation:CustomStepDetails' :: Maybe Text
sourceFileLocation = Maybe Text
a} :: CustomStepDetails)

-- | The ARN for the lambda function that is being called.
customStepDetails_target :: Lens.Lens' CustomStepDetails (Prelude.Maybe Prelude.Text)
customStepDetails_target :: Lens' CustomStepDetails (Maybe Text)
customStepDetails_target = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomStepDetails' {Maybe Text
target :: Maybe Text
$sel:target:CustomStepDetails' :: CustomStepDetails -> Maybe Text
target} -> Maybe Text
target) (\s :: CustomStepDetails
s@CustomStepDetails' {} Maybe Text
a -> CustomStepDetails
s {$sel:target:CustomStepDetails' :: Maybe Text
target = Maybe Text
a} :: CustomStepDetails)

-- | Timeout, in seconds, for the step.
customStepDetails_timeoutSeconds :: Lens.Lens' CustomStepDetails (Prelude.Maybe Prelude.Natural)
customStepDetails_timeoutSeconds :: Lens' CustomStepDetails (Maybe Natural)
customStepDetails_timeoutSeconds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomStepDetails' {Maybe Natural
timeoutSeconds :: Maybe Natural
$sel:timeoutSeconds:CustomStepDetails' :: CustomStepDetails -> Maybe Natural
timeoutSeconds} -> Maybe Natural
timeoutSeconds) (\s :: CustomStepDetails
s@CustomStepDetails' {} Maybe Natural
a -> CustomStepDetails
s {$sel:timeoutSeconds:CustomStepDetails' :: Maybe Natural
timeoutSeconds = Maybe Natural
a} :: CustomStepDetails)

instance Data.FromJSON CustomStepDetails where
  parseJSON :: Value -> Parser CustomStepDetails
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"CustomStepDetails"
      ( \Object
x ->
          Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Natural -> CustomStepDetails
CustomStepDetails'
            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
"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
"SourceFileLocation")
            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
"Target")
            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
"TimeoutSeconds")
      )

instance Prelude.Hashable CustomStepDetails where
  hashWithSalt :: Int -> CustomStepDetails -> Int
hashWithSalt Int
_salt CustomStepDetails' {Maybe Natural
Maybe Text
timeoutSeconds :: Maybe Natural
target :: Maybe Text
sourceFileLocation :: Maybe Text
name :: Maybe Text
$sel:timeoutSeconds:CustomStepDetails' :: CustomStepDetails -> Maybe Natural
$sel:target:CustomStepDetails' :: CustomStepDetails -> Maybe Text
$sel:sourceFileLocation:CustomStepDetails' :: CustomStepDetails -> Maybe Text
$sel:name:CustomStepDetails' :: CustomStepDetails -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
sourceFileLocation
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
target
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
timeoutSeconds

instance Prelude.NFData CustomStepDetails where
  rnf :: CustomStepDetails -> ()
rnf CustomStepDetails' {Maybe Natural
Maybe Text
timeoutSeconds :: Maybe Natural
target :: Maybe Text
sourceFileLocation :: Maybe Text
name :: Maybe Text
$sel:timeoutSeconds:CustomStepDetails' :: CustomStepDetails -> Maybe Natural
$sel:target:CustomStepDetails' :: CustomStepDetails -> Maybe Text
$sel:sourceFileLocation:CustomStepDetails' :: CustomStepDetails -> Maybe Text
$sel:name:CustomStepDetails' :: CustomStepDetails -> Maybe Text
..} =
    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 Text
sourceFileLocation
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
target
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
timeoutSeconds

instance Data.ToJSON CustomStepDetails where
  toJSON :: CustomStepDetails -> Value
toJSON CustomStepDetails' {Maybe Natural
Maybe Text
timeoutSeconds :: Maybe Natural
target :: Maybe Text
sourceFileLocation :: Maybe Text
name :: Maybe Text
$sel:timeoutSeconds:CustomStepDetails' :: CustomStepDetails -> Maybe Natural
$sel:target:CustomStepDetails' :: CustomStepDetails -> Maybe Text
$sel:sourceFileLocation:CustomStepDetails' :: CustomStepDetails -> Maybe Text
$sel:name:CustomStepDetails' :: CustomStepDetails -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
name,
            (Key
"SourceFileLocation" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
sourceFileLocation,
            (Key
"Target" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
target,
            (Key
"TimeoutSeconds" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
timeoutSeconds
          ]
      )