{-# 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-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.DescribedWorkflow where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 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],
    -- | A unique identifier for the workflow.
    DescribedWorkflow -> Maybe Text
workflowId :: Prelude.Maybe Prelude.Text,
    -- | Specifies the text description for the workflow.
    DescribedWorkflow -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | 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),
    -- | Specifies the unique Amazon Resource Name (ARN) for the workflow.
    DescribedWorkflow -> Text
arn :: Prelude.Text
  }
  deriving (DescribedWorkflow -> DescribedWorkflow -> Bool
(DescribedWorkflow -> DescribedWorkflow -> Bool)
-> (DescribedWorkflow -> DescribedWorkflow -> Bool)
-> Eq DescribedWorkflow
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]
(Int -> ReadS DescribedWorkflow)
-> ReadS [DescribedWorkflow]
-> ReadPrec DescribedWorkflow
-> ReadPrec [DescribedWorkflow]
-> Read 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
(Int -> DescribedWorkflow -> ShowS)
-> (DescribedWorkflow -> String)
-> ([DescribedWorkflow] -> ShowS)
-> Show DescribedWorkflow
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. DescribedWorkflow -> Rep DescribedWorkflow x)
-> (forall x. Rep DescribedWorkflow x -> DescribedWorkflow)
-> Generic DescribedWorkflow
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:
--
-- '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.
--
-- 'workflowId', 'describedWorkflow_workflowId' - A unique identifier for the workflow.
--
-- 'description', 'describedWorkflow_description' - Specifies the text description for the 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.
--
-- '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' :: Maybe [WorkflowStep]
-> Maybe [WorkflowStep]
-> Maybe Text
-> Maybe Text
-> Maybe (NonEmpty Tag)
-> Text
-> DescribedWorkflow
DescribedWorkflow'
    { $sel:onExceptionSteps:DescribedWorkflow' :: Maybe [WorkflowStep]
onExceptionSteps =
        Maybe [WorkflowStep]
forall a. Maybe a
Prelude.Nothing,
      $sel:steps:DescribedWorkflow' :: Maybe [WorkflowStep]
steps = Maybe [WorkflowStep]
forall a. Maybe a
Prelude.Nothing,
      $sel:workflowId:DescribedWorkflow' :: Maybe Text
workflowId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:DescribedWorkflow' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:DescribedWorkflow' :: Maybe (NonEmpty Tag)
tags = Maybe (NonEmpty Tag)
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:DescribedWorkflow' :: Text
arn = Text
pArn_
    }

-- | 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 :: (Maybe [WorkflowStep] -> f (Maybe [WorkflowStep]))
-> DescribedWorkflow -> f DescribedWorkflow
describedWorkflow_onExceptionSteps = (DescribedWorkflow -> Maybe [WorkflowStep])
-> (DescribedWorkflow -> Maybe [WorkflowStep] -> DescribedWorkflow)
-> Lens
     DescribedWorkflow
     DescribedWorkflow
     (Maybe [WorkflowStep])
     (Maybe [WorkflowStep])
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) ((Maybe [WorkflowStep] -> f (Maybe [WorkflowStep]))
 -> DescribedWorkflow -> f DescribedWorkflow)
-> ((Maybe [WorkflowStep] -> f (Maybe [WorkflowStep]))
    -> Maybe [WorkflowStep] -> f (Maybe [WorkflowStep]))
-> (Maybe [WorkflowStep] -> f (Maybe [WorkflowStep]))
-> DescribedWorkflow
-> f DescribedWorkflow
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [WorkflowStep] [WorkflowStep] [WorkflowStep] [WorkflowStep]
-> Iso
     (Maybe [WorkflowStep])
     (Maybe [WorkflowStep])
     (Maybe [WorkflowStep])
     (Maybe [WorkflowStep])
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 [WorkflowStep] [WorkflowStep] [WorkflowStep] [WorkflowStep]
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 :: (Maybe [WorkflowStep] -> f (Maybe [WorkflowStep]))
-> DescribedWorkflow -> f DescribedWorkflow
describedWorkflow_steps = (DescribedWorkflow -> Maybe [WorkflowStep])
-> (DescribedWorkflow -> Maybe [WorkflowStep] -> DescribedWorkflow)
-> Lens
     DescribedWorkflow
     DescribedWorkflow
     (Maybe [WorkflowStep])
     (Maybe [WorkflowStep])
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) ((Maybe [WorkflowStep] -> f (Maybe [WorkflowStep]))
 -> DescribedWorkflow -> f DescribedWorkflow)
-> ((Maybe [WorkflowStep] -> f (Maybe [WorkflowStep]))
    -> Maybe [WorkflowStep] -> f (Maybe [WorkflowStep]))
-> (Maybe [WorkflowStep] -> f (Maybe [WorkflowStep]))
-> DescribedWorkflow
-> f DescribedWorkflow
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [WorkflowStep] [WorkflowStep] [WorkflowStep] [WorkflowStep]
-> Iso
     (Maybe [WorkflowStep])
     (Maybe [WorkflowStep])
     (Maybe [WorkflowStep])
     (Maybe [WorkflowStep])
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 [WorkflowStep] [WorkflowStep] [WorkflowStep] [WorkflowStep]
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 :: (Maybe Text -> f (Maybe Text))
-> DescribedWorkflow -> f DescribedWorkflow
describedWorkflow_workflowId = (DescribedWorkflow -> Maybe Text)
-> (DescribedWorkflow -> Maybe Text -> DescribedWorkflow)
-> Lens
     DescribedWorkflow DescribedWorkflow (Maybe Text) (Maybe Text)
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 text description for the workflow.
describedWorkflow_description :: Lens.Lens' DescribedWorkflow (Prelude.Maybe Prelude.Text)
describedWorkflow_description :: (Maybe Text -> f (Maybe Text))
-> DescribedWorkflow -> f DescribedWorkflow
describedWorkflow_description = (DescribedWorkflow -> Maybe Text)
-> (DescribedWorkflow -> Maybe Text -> DescribedWorkflow)
-> Lens
     DescribedWorkflow DescribedWorkflow (Maybe Text) (Maybe Text)
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)

-- | 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 :: (Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> DescribedWorkflow -> f DescribedWorkflow
describedWorkflow_tags = (DescribedWorkflow -> Maybe (NonEmpty Tag))
-> (DescribedWorkflow -> Maybe (NonEmpty Tag) -> DescribedWorkflow)
-> Lens
     DescribedWorkflow
     DescribedWorkflow
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty Tag))
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) ((Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
 -> DescribedWorkflow -> f DescribedWorkflow)
-> ((Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
    -> Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> (Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> DescribedWorkflow
-> f DescribedWorkflow
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag)
-> Iso
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty Tag))
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 Tag) (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Specifies the unique Amazon Resource Name (ARN) for the workflow.
describedWorkflow_arn :: Lens.Lens' DescribedWorkflow Prelude.Text
describedWorkflow_arn :: (Text -> f Text) -> DescribedWorkflow -> f DescribedWorkflow
describedWorkflow_arn = (DescribedWorkflow -> Text)
-> (DescribedWorkflow -> Text -> DescribedWorkflow)
-> Lens DescribedWorkflow DescribedWorkflow Text Text
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 Core.FromJSON DescribedWorkflow where
  parseJSON :: Value -> Parser DescribedWorkflow
parseJSON =
    String
-> (Object -> Parser DescribedWorkflow)
-> Value
-> Parser DescribedWorkflow
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DescribedWorkflow"
      ( \Object
x ->
          Maybe [WorkflowStep]
-> Maybe [WorkflowStep]
-> Maybe Text
-> Maybe Text
-> Maybe (NonEmpty Tag)
-> Text
-> DescribedWorkflow
DescribedWorkflow'
            (Maybe [WorkflowStep]
 -> Maybe [WorkflowStep]
 -> Maybe Text
 -> Maybe Text
 -> Maybe (NonEmpty Tag)
 -> Text
 -> DescribedWorkflow)
-> Parser (Maybe [WorkflowStep])
-> Parser
     (Maybe [WorkflowStep]
      -> Maybe Text
      -> Maybe Text
      -> Maybe (NonEmpty Tag)
      -> Text
      -> DescribedWorkflow)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe [WorkflowStep]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"OnExceptionSteps"
                            Parser (Maybe (Maybe [WorkflowStep]))
-> Maybe [WorkflowStep] -> Parser (Maybe [WorkflowStep])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [WorkflowStep]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe [WorkflowStep]
   -> Maybe Text
   -> Maybe Text
   -> Maybe (NonEmpty Tag)
   -> Text
   -> DescribedWorkflow)
-> Parser (Maybe [WorkflowStep])
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe (NonEmpty Tag) -> Text -> DescribedWorkflow)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [WorkflowStep]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Steps" Parser (Maybe (Maybe [WorkflowStep]))
-> Maybe [WorkflowStep] -> Parser (Maybe [WorkflowStep])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [WorkflowStep]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe (NonEmpty Tag) -> Text -> DescribedWorkflow)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe (NonEmpty Tag) -> Text -> DescribedWorkflow)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"WorkflowId")
            Parser
  (Maybe Text -> Maybe (NonEmpty Tag) -> Text -> DescribedWorkflow)
-> Parser (Maybe Text)
-> Parser (Maybe (NonEmpty Tag) -> Text -> DescribedWorkflow)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Description")
            Parser (Maybe (NonEmpty Tag) -> Text -> DescribedWorkflow)
-> Parser (Maybe (NonEmpty Tag))
-> Parser (Text -> DescribedWorkflow)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (NonEmpty Tag))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Tags")
            Parser (Text -> DescribedWorkflow)
-> Parser Text -> Parser DescribedWorkflow
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Arn")
      )

instance Prelude.Hashable DescribedWorkflow

instance Prelude.NFData DescribedWorkflow