{-# 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.DescribedWorkflow
-- 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.DescribedWorkflow 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
import Amazonka.Transfer.Types.Tag
import Amazonka.Transfer.Types.WorkflowStep

-- | Describes the properties of the specified workflow
--
-- /See:/ 'newDescribedWorkflow' smart constructor.
data DescribedWorkflow = DescribedWorkflow'
  { -- | Specifies the text description for the workflow.
    DescribedWorkflow -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | Specifies the steps (actions) to take if errors are encountered during
    -- execution of the workflow.
    DescribedWorkflow -> Maybe [WorkflowStep]
onExceptionSteps :: Prelude.Maybe [WorkflowStep],
    -- | Specifies the details for the steps that are in the specified workflow.
    DescribedWorkflow -> Maybe [WorkflowStep]
steps :: Prelude.Maybe [WorkflowStep],
    -- | Key-value pairs that can be used to group and search for workflows. Tags
    -- are metadata attached to workflows for any purpose.
    DescribedWorkflow -> Maybe (NonEmpty Tag)
tags :: Prelude.Maybe (Prelude.NonEmpty Tag),
    -- | A unique identifier for the workflow.
    DescribedWorkflow -> Maybe Text
workflowId :: Prelude.Maybe Prelude.Text,
    -- | Specifies the unique Amazon Resource Name (ARN) for the workflow.
    DescribedWorkflow -> Text
arn :: Prelude.Text
  }
  deriving (DescribedWorkflow -> DescribedWorkflow -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribedWorkflow -> DescribedWorkflow -> Bool
$c/= :: DescribedWorkflow -> DescribedWorkflow -> Bool
== :: DescribedWorkflow -> DescribedWorkflow -> Bool
$c== :: DescribedWorkflow -> DescribedWorkflow -> Bool
Prelude.Eq, ReadPrec [DescribedWorkflow]
ReadPrec DescribedWorkflow
Int -> ReadS DescribedWorkflow
ReadS [DescribedWorkflow]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribedWorkflow]
$creadListPrec :: ReadPrec [DescribedWorkflow]
readPrec :: ReadPrec DescribedWorkflow
$creadPrec :: ReadPrec DescribedWorkflow
readList :: ReadS [DescribedWorkflow]
$creadList :: ReadS [DescribedWorkflow]
readsPrec :: Int -> ReadS DescribedWorkflow
$creadsPrec :: Int -> ReadS DescribedWorkflow
Prelude.Read, Int -> DescribedWorkflow -> ShowS
[DescribedWorkflow] -> ShowS
DescribedWorkflow -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribedWorkflow] -> ShowS
$cshowList :: [DescribedWorkflow] -> ShowS
show :: DescribedWorkflow -> String
$cshow :: DescribedWorkflow -> String
showsPrec :: Int -> DescribedWorkflow -> ShowS
$cshowsPrec :: Int -> DescribedWorkflow -> ShowS
Prelude.Show, forall x. Rep DescribedWorkflow x -> DescribedWorkflow
forall x. DescribedWorkflow -> Rep DescribedWorkflow x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribedWorkflow x -> DescribedWorkflow
$cfrom :: forall x. DescribedWorkflow -> Rep DescribedWorkflow x
Prelude.Generic)

-- |
-- Create a value of 'DescribedWorkflow' 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:
--
-- 'description', 'describedWorkflow_description' - Specifies the text description for the workflow.
--
-- 'onExceptionSteps', 'describedWorkflow_onExceptionSteps' - Specifies the steps (actions) to take if errors are encountered during
-- execution of the workflow.
--
-- 'steps', 'describedWorkflow_steps' - Specifies the details for the steps that are in the specified workflow.
--
-- 'tags', 'describedWorkflow_tags' - Key-value pairs that can be used to group and search for workflows. Tags
-- are metadata attached to workflows for any purpose.
--
-- 'workflowId', 'describedWorkflow_workflowId' - A unique identifier for the workflow.
--
-- 'arn', 'describedWorkflow_arn' - Specifies the unique Amazon Resource Name (ARN) for the workflow.
newDescribedWorkflow ::
  -- | 'arn'
  Prelude.Text ->
  DescribedWorkflow
newDescribedWorkflow :: Text -> DescribedWorkflow
newDescribedWorkflow Text
pArn_ =
  DescribedWorkflow'
    { $sel:description:DescribedWorkflow' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:onExceptionSteps:DescribedWorkflow' :: Maybe [WorkflowStep]
onExceptionSteps = forall a. Maybe a
Prelude.Nothing,
      $sel:steps:DescribedWorkflow' :: Maybe [WorkflowStep]
steps = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:DescribedWorkflow' :: Maybe (NonEmpty Tag)
tags = forall a. Maybe a
Prelude.Nothing,
      $sel:workflowId:DescribedWorkflow' :: Maybe Text
workflowId = forall a. Maybe a
Prelude.Nothing,
      $sel:arn:DescribedWorkflow' :: Text
arn = Text
pArn_
    }

-- | Specifies the text description for the workflow.
describedWorkflow_description :: Lens.Lens' DescribedWorkflow (Prelude.Maybe Prelude.Text)
describedWorkflow_description :: Lens' DescribedWorkflow (Maybe Text)
describedWorkflow_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribedWorkflow' {Maybe Text
description :: Maybe Text
$sel:description:DescribedWorkflow' :: DescribedWorkflow -> Maybe Text
description} -> Maybe Text
description) (\s :: DescribedWorkflow
s@DescribedWorkflow' {} Maybe Text
a -> DescribedWorkflow
s {$sel:description:DescribedWorkflow' :: Maybe Text
description = Maybe Text
a} :: DescribedWorkflow)

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

-- | Key-value pairs that can be used to group and search for workflows. Tags
-- are metadata attached to workflows for any purpose.
describedWorkflow_tags :: Lens.Lens' DescribedWorkflow (Prelude.Maybe (Prelude.NonEmpty Tag))
describedWorkflow_tags :: Lens' DescribedWorkflow (Maybe (NonEmpty Tag))
describedWorkflow_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribedWorkflow' {Maybe (NonEmpty Tag)
tags :: Maybe (NonEmpty Tag)
$sel:tags:DescribedWorkflow' :: DescribedWorkflow -> Maybe (NonEmpty Tag)
tags} -> Maybe (NonEmpty Tag)
tags) (\s :: DescribedWorkflow
s@DescribedWorkflow' {} Maybe (NonEmpty Tag)
a -> DescribedWorkflow
s {$sel:tags:DescribedWorkflow' :: Maybe (NonEmpty Tag)
tags = Maybe (NonEmpty Tag)
a} :: DescribedWorkflow) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A unique identifier for the workflow.
describedWorkflow_workflowId :: Lens.Lens' DescribedWorkflow (Prelude.Maybe Prelude.Text)
describedWorkflow_workflowId :: Lens' DescribedWorkflow (Maybe Text)
describedWorkflow_workflowId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribedWorkflow' {Maybe Text
workflowId :: Maybe Text
$sel:workflowId:DescribedWorkflow' :: DescribedWorkflow -> Maybe Text
workflowId} -> Maybe Text
workflowId) (\s :: DescribedWorkflow
s@DescribedWorkflow' {} Maybe Text
a -> DescribedWorkflow
s {$sel:workflowId:DescribedWorkflow' :: Maybe Text
workflowId = Maybe Text
a} :: DescribedWorkflow)

-- | Specifies the unique Amazon Resource Name (ARN) for the workflow.
describedWorkflow_arn :: Lens.Lens' DescribedWorkflow Prelude.Text
describedWorkflow_arn :: Lens' DescribedWorkflow Text
describedWorkflow_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribedWorkflow' {Text
arn :: Text
$sel:arn:DescribedWorkflow' :: DescribedWorkflow -> Text
arn} -> Text
arn) (\s :: DescribedWorkflow
s@DescribedWorkflow' {} Text
a -> DescribedWorkflow
s {$sel:arn:DescribedWorkflow' :: Text
arn = Text
a} :: DescribedWorkflow)

instance Data.FromJSON DescribedWorkflow where
  parseJSON :: Value -> Parser DescribedWorkflow
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DescribedWorkflow"
      ( \Object
x ->
          Maybe Text
-> Maybe [WorkflowStep]
-> Maybe [WorkflowStep]
-> Maybe (NonEmpty Tag)
-> Maybe Text
-> Text
-> DescribedWorkflow
DescribedWorkflow'
            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
"Description")
            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
"OnExceptionSteps"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            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
"Steps" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"Tags")
            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
"WorkflowId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Arn")
      )

instance Prelude.Hashable DescribedWorkflow where
  hashWithSalt :: Int -> DescribedWorkflow -> Int
hashWithSalt Int
_salt DescribedWorkflow' {Maybe [WorkflowStep]
Maybe (NonEmpty Tag)
Maybe Text
Text
arn :: Text
workflowId :: Maybe Text
tags :: Maybe (NonEmpty Tag)
steps :: Maybe [WorkflowStep]
onExceptionSteps :: Maybe [WorkflowStep]
description :: Maybe Text
$sel:arn:DescribedWorkflow' :: DescribedWorkflow -> Text
$sel:workflowId:DescribedWorkflow' :: DescribedWorkflow -> Maybe Text
$sel:tags:DescribedWorkflow' :: DescribedWorkflow -> Maybe (NonEmpty Tag)
$sel:steps:DescribedWorkflow' :: DescribedWorkflow -> Maybe [WorkflowStep]
$sel:onExceptionSteps:DescribedWorkflow' :: DescribedWorkflow -> Maybe [WorkflowStep]
$sel:description:DescribedWorkflow' :: DescribedWorkflow -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [WorkflowStep]
onExceptionSteps
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [WorkflowStep]
steps
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Tag)
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
workflowId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
arn

instance Prelude.NFData DescribedWorkflow where
  rnf :: DescribedWorkflow -> ()
rnf DescribedWorkflow' {Maybe [WorkflowStep]
Maybe (NonEmpty Tag)
Maybe Text
Text
arn :: Text
workflowId :: Maybe Text
tags :: Maybe (NonEmpty Tag)
steps :: Maybe [WorkflowStep]
onExceptionSteps :: Maybe [WorkflowStep]
description :: Maybe Text
$sel:arn:DescribedWorkflow' :: DescribedWorkflow -> Text
$sel:workflowId:DescribedWorkflow' :: DescribedWorkflow -> Maybe Text
$sel:tags:DescribedWorkflow' :: DescribedWorkflow -> Maybe (NonEmpty Tag)
$sel:steps:DescribedWorkflow' :: DescribedWorkflow -> Maybe [WorkflowStep]
$sel:onExceptionSteps:DescribedWorkflow' :: DescribedWorkflow -> Maybe [WorkflowStep]
$sel:description:DescribedWorkflow' :: DescribedWorkflow -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [WorkflowStep]
onExceptionSteps
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [WorkflowStep]
steps
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Tag)
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
workflowId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
arn