{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.SWF.RegisterWorkflowType
-- 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)
--
-- Registers a new /workflow type/ and its configuration settings in the
-- specified domain.
--
-- The retention period for the workflow history is set by the
-- RegisterDomain action.
--
-- If the type already exists, then a @TypeAlreadyExists@ fault is
-- returned. You cannot change the configuration settings of a workflow
-- type once it is registered and it must be registered as a new version.
--
-- __Access Control__
--
-- You can use IAM policies to control this action\'s access to Amazon SWF
-- resources as follows:
--
-- -   Use a @Resource@ element with the domain name to limit the action to
--     only specified domains.
--
-- -   Use an @Action@ element to allow or deny permission to call this
--     action.
--
-- -   Constrain the following parameters by using a @Condition@ element
--     with the appropriate keys.
--
--     -   @defaultTaskList.name@: String constraint. The key is
--         @swf:defaultTaskList.name@.
--
--     -   @name@: String constraint. The key is @swf:name@.
--
--     -   @version@: String constraint. The key is @swf:version@.
--
-- If the caller doesn\'t have sufficient permissions to invoke the action,
-- or the parameter values fall outside the specified constraints, the
-- action fails. The associated event attribute\'s @cause@ parameter is set
-- to @OPERATION_NOT_PERMITTED@. For details and example IAM policies, see
-- <https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html Using IAM to Manage Access to Amazon SWF Workflows>
-- in the /Amazon SWF Developer Guide/.
module Amazonka.SWF.RegisterWorkflowType
  ( -- * Creating a Request
    RegisterWorkflowType (..),
    newRegisterWorkflowType,

    -- * Request Lenses
    registerWorkflowType_defaultLambdaRole,
    registerWorkflowType_defaultChildPolicy,
    registerWorkflowType_defaultTaskList,
    registerWorkflowType_defaultTaskPriority,
    registerWorkflowType_defaultExecutionStartToCloseTimeout,
    registerWorkflowType_defaultTaskStartToCloseTimeout,
    registerWorkflowType_description,
    registerWorkflowType_domain,
    registerWorkflowType_name,
    registerWorkflowType_version,

    -- * Destructuring the Response
    RegisterWorkflowTypeResponse (..),
    newRegisterWorkflowTypeResponse,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SWF.Types

-- | /See:/ 'newRegisterWorkflowType' smart constructor.
data RegisterWorkflowType = RegisterWorkflowType'
  { -- | The default IAM role attached to this workflow type.
    --
    -- Executions of this workflow type need IAM roles to invoke Lambda
    -- functions. If you don\'t specify an IAM role when you start this
    -- workflow type, the default Lambda role is attached to the execution. For
    -- more information, see
    -- <https://docs.aws.amazon.com/amazonswf/latest/developerguide/lambda-task.html>
    -- in the /Amazon SWF Developer Guide/.
    RegisterWorkflowType -> Maybe Text
defaultLambdaRole :: Prelude.Maybe Prelude.Text,
    -- | If set, specifies the default policy to use for the child workflow
    -- executions when a workflow execution of this type is terminated, by
    -- calling the TerminateWorkflowExecution action explicitly or due to an
    -- expired timeout. This default can be overridden when starting a workflow
    -- execution using the StartWorkflowExecution action or the
    -- @StartChildWorkflowExecution@ Decision.
    --
    -- The supported child policies are:
    --
    -- -   @TERMINATE@ – The child executions are terminated.
    --
    -- -   @REQUEST_CANCEL@ – A request to cancel is attempted for each child
    --     execution by recording a @WorkflowExecutionCancelRequested@ event in
    --     its history. It is up to the decider to take appropriate actions
    --     when it receives an execution history with this event.
    --
    -- -   @ABANDON@ – No action is taken. The child executions continue to
    --     run.
    RegisterWorkflowType -> Maybe ChildPolicy
defaultChildPolicy :: Prelude.Maybe ChildPolicy,
    -- | If set, specifies the default task list to use for scheduling decision
    -- tasks for executions of this workflow type. This default is used only if
    -- a task list isn\'t provided when starting the execution through the
    -- StartWorkflowExecution Action or @StartChildWorkflowExecution@ Decision.
    RegisterWorkflowType -> Maybe TaskList
defaultTaskList :: Prelude.Maybe TaskList,
    -- | The default task priority to assign to the workflow type. If not
    -- assigned, then @0@ is used. Valid values are integers that range from
    -- Java\'s @Integer.MIN_VALUE@ (-2147483648) to @Integer.MAX_VALUE@
    -- (2147483647). Higher numbers indicate higher priority.
    --
    -- For more information about setting task priority, see
    -- <https://docs.aws.amazon.com/amazonswf/latest/developerguide/programming-priority.html Setting Task Priority>
    -- in the /Amazon SWF Developer Guide/.
    RegisterWorkflowType -> Maybe Text
defaultTaskPriority :: Prelude.Maybe Prelude.Text,
    -- | If set, specifies the default maximum duration for executions of this
    -- workflow type. You can override this default when starting an execution
    -- through the StartWorkflowExecution Action or
    -- @StartChildWorkflowExecution@ Decision.
    --
    -- The duration is specified in seconds; an integer greater than or equal
    -- to 0. Unlike some of the other timeout parameters in Amazon SWF, you
    -- cannot specify a value of \"NONE\" for
    -- @defaultExecutionStartToCloseTimeout@; there is a one-year max limit on
    -- the time that a workflow execution can run. Exceeding this limit always
    -- causes the workflow execution to time out.
    RegisterWorkflowType -> Maybe Text
defaultExecutionStartToCloseTimeout :: Prelude.Maybe Prelude.Text,
    -- | If set, specifies the default maximum duration of decision tasks for
    -- this workflow type. This default can be overridden when starting a
    -- workflow execution using the StartWorkflowExecution action or the
    -- @StartChildWorkflowExecution@ Decision.
    --
    -- The duration is specified in seconds, an integer greater than or equal
    -- to @0@. You can use @NONE@ to specify unlimited duration.
    RegisterWorkflowType -> Maybe Text
defaultTaskStartToCloseTimeout :: Prelude.Maybe Prelude.Text,
    -- | Textual description of the workflow type.
    RegisterWorkflowType -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The name of the domain in which to register the workflow type.
    RegisterWorkflowType -> Text
domain :: Prelude.Text,
    -- | The name of the workflow type.
    --
    -- The specified string must not start or end with whitespace. It must not
    -- contain a @:@ (colon), @\/@ (slash), @|@ (vertical bar), or any control
    -- characters (@\\u0000-\\u001f@ | @\\u007f-\\u009f@). Also, it must not
    -- /be/ the literal string @arn@.
    RegisterWorkflowType -> Text
name :: Prelude.Text,
    -- | The version of the workflow type.
    --
    -- The workflow type consists of the name and version, the combination of
    -- which must be unique within the domain. To get a list of all currently
    -- registered workflow types, use the ListWorkflowTypes action.
    --
    -- The specified string must not start or end with whitespace. It must not
    -- contain a @:@ (colon), @\/@ (slash), @|@ (vertical bar), or any control
    -- characters (@\\u0000-\\u001f@ | @\\u007f-\\u009f@). Also, it must not
    -- /be/ the literal string @arn@.
    RegisterWorkflowType -> Text
version :: Prelude.Text
  }
  deriving (RegisterWorkflowType -> RegisterWorkflowType -> Bool
(RegisterWorkflowType -> RegisterWorkflowType -> Bool)
-> (RegisterWorkflowType -> RegisterWorkflowType -> Bool)
-> Eq RegisterWorkflowType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegisterWorkflowType -> RegisterWorkflowType -> Bool
$c/= :: RegisterWorkflowType -> RegisterWorkflowType -> Bool
== :: RegisterWorkflowType -> RegisterWorkflowType -> Bool
$c== :: RegisterWorkflowType -> RegisterWorkflowType -> Bool
Prelude.Eq, ReadPrec [RegisterWorkflowType]
ReadPrec RegisterWorkflowType
Int -> ReadS RegisterWorkflowType
ReadS [RegisterWorkflowType]
(Int -> ReadS RegisterWorkflowType)
-> ReadS [RegisterWorkflowType]
-> ReadPrec RegisterWorkflowType
-> ReadPrec [RegisterWorkflowType]
-> Read RegisterWorkflowType
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RegisterWorkflowType]
$creadListPrec :: ReadPrec [RegisterWorkflowType]
readPrec :: ReadPrec RegisterWorkflowType
$creadPrec :: ReadPrec RegisterWorkflowType
readList :: ReadS [RegisterWorkflowType]
$creadList :: ReadS [RegisterWorkflowType]
readsPrec :: Int -> ReadS RegisterWorkflowType
$creadsPrec :: Int -> ReadS RegisterWorkflowType
Prelude.Read, Int -> RegisterWorkflowType -> ShowS
[RegisterWorkflowType] -> ShowS
RegisterWorkflowType -> String
(Int -> RegisterWorkflowType -> ShowS)
-> (RegisterWorkflowType -> String)
-> ([RegisterWorkflowType] -> ShowS)
-> Show RegisterWorkflowType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RegisterWorkflowType] -> ShowS
$cshowList :: [RegisterWorkflowType] -> ShowS
show :: RegisterWorkflowType -> String
$cshow :: RegisterWorkflowType -> String
showsPrec :: Int -> RegisterWorkflowType -> ShowS
$cshowsPrec :: Int -> RegisterWorkflowType -> ShowS
Prelude.Show, (forall x. RegisterWorkflowType -> Rep RegisterWorkflowType x)
-> (forall x. Rep RegisterWorkflowType x -> RegisterWorkflowType)
-> Generic RegisterWorkflowType
forall x. Rep RegisterWorkflowType x -> RegisterWorkflowType
forall x. RegisterWorkflowType -> Rep RegisterWorkflowType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RegisterWorkflowType x -> RegisterWorkflowType
$cfrom :: forall x. RegisterWorkflowType -> Rep RegisterWorkflowType x
Prelude.Generic)

-- |
-- Create a value of 'RegisterWorkflowType' 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:
--
-- 'defaultLambdaRole', 'registerWorkflowType_defaultLambdaRole' - The default IAM role attached to this workflow type.
--
-- Executions of this workflow type need IAM roles to invoke Lambda
-- functions. If you don\'t specify an IAM role when you start this
-- workflow type, the default Lambda role is attached to the execution. For
-- more information, see
-- <https://docs.aws.amazon.com/amazonswf/latest/developerguide/lambda-task.html>
-- in the /Amazon SWF Developer Guide/.
--
-- 'defaultChildPolicy', 'registerWorkflowType_defaultChildPolicy' - If set, specifies the default policy to use for the child workflow
-- executions when a workflow execution of this type is terminated, by
-- calling the TerminateWorkflowExecution action explicitly or due to an
-- expired timeout. This default can be overridden when starting a workflow
-- execution using the StartWorkflowExecution action or the
-- @StartChildWorkflowExecution@ Decision.
--
-- The supported child policies are:
--
-- -   @TERMINATE@ – The child executions are terminated.
--
-- -   @REQUEST_CANCEL@ – A request to cancel is attempted for each child
--     execution by recording a @WorkflowExecutionCancelRequested@ event in
--     its history. It is up to the decider to take appropriate actions
--     when it receives an execution history with this event.
--
-- -   @ABANDON@ – No action is taken. The child executions continue to
--     run.
--
-- 'defaultTaskList', 'registerWorkflowType_defaultTaskList' - If set, specifies the default task list to use for scheduling decision
-- tasks for executions of this workflow type. This default is used only if
-- a task list isn\'t provided when starting the execution through the
-- StartWorkflowExecution Action or @StartChildWorkflowExecution@ Decision.
--
-- 'defaultTaskPriority', 'registerWorkflowType_defaultTaskPriority' - The default task priority to assign to the workflow type. If not
-- assigned, then @0@ is used. Valid values are integers that range from
-- Java\'s @Integer.MIN_VALUE@ (-2147483648) to @Integer.MAX_VALUE@
-- (2147483647). Higher numbers indicate higher priority.
--
-- For more information about setting task priority, see
-- <https://docs.aws.amazon.com/amazonswf/latest/developerguide/programming-priority.html Setting Task Priority>
-- in the /Amazon SWF Developer Guide/.
--
-- 'defaultExecutionStartToCloseTimeout', 'registerWorkflowType_defaultExecutionStartToCloseTimeout' - If set, specifies the default maximum duration for executions of this
-- workflow type. You can override this default when starting an execution
-- through the StartWorkflowExecution Action or
-- @StartChildWorkflowExecution@ Decision.
--
-- The duration is specified in seconds; an integer greater than or equal
-- to 0. Unlike some of the other timeout parameters in Amazon SWF, you
-- cannot specify a value of \"NONE\" for
-- @defaultExecutionStartToCloseTimeout@; there is a one-year max limit on
-- the time that a workflow execution can run. Exceeding this limit always
-- causes the workflow execution to time out.
--
-- 'defaultTaskStartToCloseTimeout', 'registerWorkflowType_defaultTaskStartToCloseTimeout' - If set, specifies the default maximum duration of decision tasks for
-- this workflow type. This default can be overridden when starting a
-- workflow execution using the StartWorkflowExecution action or the
-- @StartChildWorkflowExecution@ Decision.
--
-- The duration is specified in seconds, an integer greater than or equal
-- to @0@. You can use @NONE@ to specify unlimited duration.
--
-- 'description', 'registerWorkflowType_description' - Textual description of the workflow type.
--
-- 'domain', 'registerWorkflowType_domain' - The name of the domain in which to register the workflow type.
--
-- 'name', 'registerWorkflowType_name' - The name of the workflow type.
--
-- The specified string must not start or end with whitespace. It must not
-- contain a @:@ (colon), @\/@ (slash), @|@ (vertical bar), or any control
-- characters (@\\u0000-\\u001f@ | @\\u007f-\\u009f@). Also, it must not
-- /be/ the literal string @arn@.
--
-- 'version', 'registerWorkflowType_version' - The version of the workflow type.
--
-- The workflow type consists of the name and version, the combination of
-- which must be unique within the domain. To get a list of all currently
-- registered workflow types, use the ListWorkflowTypes action.
--
-- The specified string must not start or end with whitespace. It must not
-- contain a @:@ (colon), @\/@ (slash), @|@ (vertical bar), or any control
-- characters (@\\u0000-\\u001f@ | @\\u007f-\\u009f@). Also, it must not
-- /be/ the literal string @arn@.
newRegisterWorkflowType ::
  -- | 'domain'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  -- | 'version'
  Prelude.Text ->
  RegisterWorkflowType
newRegisterWorkflowType :: Text -> Text -> Text -> RegisterWorkflowType
newRegisterWorkflowType Text
pDomain_ Text
pName_ Text
pVersion_ =
  RegisterWorkflowType' :: Maybe Text
-> Maybe ChildPolicy
-> Maybe TaskList
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Text
-> Text
-> Text
-> RegisterWorkflowType
RegisterWorkflowType'
    { $sel:defaultLambdaRole:RegisterWorkflowType' :: Maybe Text
defaultLambdaRole =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:defaultChildPolicy:RegisterWorkflowType' :: Maybe ChildPolicy
defaultChildPolicy = Maybe ChildPolicy
forall a. Maybe a
Prelude.Nothing,
      $sel:defaultTaskList:RegisterWorkflowType' :: Maybe TaskList
defaultTaskList = Maybe TaskList
forall a. Maybe a
Prelude.Nothing,
      $sel:defaultTaskPriority:RegisterWorkflowType' :: Maybe Text
defaultTaskPriority = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:defaultExecutionStartToCloseTimeout:RegisterWorkflowType' :: Maybe Text
defaultExecutionStartToCloseTimeout =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:defaultTaskStartToCloseTimeout:RegisterWorkflowType' :: Maybe Text
defaultTaskStartToCloseTimeout = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:RegisterWorkflowType' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:domain:RegisterWorkflowType' :: Text
domain = Text
pDomain_,
      $sel:name:RegisterWorkflowType' :: Text
name = Text
pName_,
      $sel:version:RegisterWorkflowType' :: Text
version = Text
pVersion_
    }

-- | The default IAM role attached to this workflow type.
--
-- Executions of this workflow type need IAM roles to invoke Lambda
-- functions. If you don\'t specify an IAM role when you start this
-- workflow type, the default Lambda role is attached to the execution. For
-- more information, see
-- <https://docs.aws.amazon.com/amazonswf/latest/developerguide/lambda-task.html>
-- in the /Amazon SWF Developer Guide/.
registerWorkflowType_defaultLambdaRole :: Lens.Lens' RegisterWorkflowType (Prelude.Maybe Prelude.Text)
registerWorkflowType_defaultLambdaRole :: (Maybe Text -> f (Maybe Text))
-> RegisterWorkflowType -> f RegisterWorkflowType
registerWorkflowType_defaultLambdaRole = (RegisterWorkflowType -> Maybe Text)
-> (RegisterWorkflowType -> Maybe Text -> RegisterWorkflowType)
-> Lens
     RegisterWorkflowType RegisterWorkflowType (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterWorkflowType' {Maybe Text
defaultLambdaRole :: Maybe Text
$sel:defaultLambdaRole:RegisterWorkflowType' :: RegisterWorkflowType -> Maybe Text
defaultLambdaRole} -> Maybe Text
defaultLambdaRole) (\s :: RegisterWorkflowType
s@RegisterWorkflowType' {} Maybe Text
a -> RegisterWorkflowType
s {$sel:defaultLambdaRole:RegisterWorkflowType' :: Maybe Text
defaultLambdaRole = Maybe Text
a} :: RegisterWorkflowType)

-- | If set, specifies the default policy to use for the child workflow
-- executions when a workflow execution of this type is terminated, by
-- calling the TerminateWorkflowExecution action explicitly or due to an
-- expired timeout. This default can be overridden when starting a workflow
-- execution using the StartWorkflowExecution action or the
-- @StartChildWorkflowExecution@ Decision.
--
-- The supported child policies are:
--
-- -   @TERMINATE@ – The child executions are terminated.
--
-- -   @REQUEST_CANCEL@ – A request to cancel is attempted for each child
--     execution by recording a @WorkflowExecutionCancelRequested@ event in
--     its history. It is up to the decider to take appropriate actions
--     when it receives an execution history with this event.
--
-- -   @ABANDON@ – No action is taken. The child executions continue to
--     run.
registerWorkflowType_defaultChildPolicy :: Lens.Lens' RegisterWorkflowType (Prelude.Maybe ChildPolicy)
registerWorkflowType_defaultChildPolicy :: (Maybe ChildPolicy -> f (Maybe ChildPolicy))
-> RegisterWorkflowType -> f RegisterWorkflowType
registerWorkflowType_defaultChildPolicy = (RegisterWorkflowType -> Maybe ChildPolicy)
-> (RegisterWorkflowType
    -> Maybe ChildPolicy -> RegisterWorkflowType)
-> Lens
     RegisterWorkflowType
     RegisterWorkflowType
     (Maybe ChildPolicy)
     (Maybe ChildPolicy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterWorkflowType' {Maybe ChildPolicy
defaultChildPolicy :: Maybe ChildPolicy
$sel:defaultChildPolicy:RegisterWorkflowType' :: RegisterWorkflowType -> Maybe ChildPolicy
defaultChildPolicy} -> Maybe ChildPolicy
defaultChildPolicy) (\s :: RegisterWorkflowType
s@RegisterWorkflowType' {} Maybe ChildPolicy
a -> RegisterWorkflowType
s {$sel:defaultChildPolicy:RegisterWorkflowType' :: Maybe ChildPolicy
defaultChildPolicy = Maybe ChildPolicy
a} :: RegisterWorkflowType)

-- | If set, specifies the default task list to use for scheduling decision
-- tasks for executions of this workflow type. This default is used only if
-- a task list isn\'t provided when starting the execution through the
-- StartWorkflowExecution Action or @StartChildWorkflowExecution@ Decision.
registerWorkflowType_defaultTaskList :: Lens.Lens' RegisterWorkflowType (Prelude.Maybe TaskList)
registerWorkflowType_defaultTaskList :: (Maybe TaskList -> f (Maybe TaskList))
-> RegisterWorkflowType -> f RegisterWorkflowType
registerWorkflowType_defaultTaskList = (RegisterWorkflowType -> Maybe TaskList)
-> (RegisterWorkflowType -> Maybe TaskList -> RegisterWorkflowType)
-> Lens
     RegisterWorkflowType
     RegisterWorkflowType
     (Maybe TaskList)
     (Maybe TaskList)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterWorkflowType' {Maybe TaskList
defaultTaskList :: Maybe TaskList
$sel:defaultTaskList:RegisterWorkflowType' :: RegisterWorkflowType -> Maybe TaskList
defaultTaskList} -> Maybe TaskList
defaultTaskList) (\s :: RegisterWorkflowType
s@RegisterWorkflowType' {} Maybe TaskList
a -> RegisterWorkflowType
s {$sel:defaultTaskList:RegisterWorkflowType' :: Maybe TaskList
defaultTaskList = Maybe TaskList
a} :: RegisterWorkflowType)

-- | The default task priority to assign to the workflow type. If not
-- assigned, then @0@ is used. Valid values are integers that range from
-- Java\'s @Integer.MIN_VALUE@ (-2147483648) to @Integer.MAX_VALUE@
-- (2147483647). Higher numbers indicate higher priority.
--
-- For more information about setting task priority, see
-- <https://docs.aws.amazon.com/amazonswf/latest/developerguide/programming-priority.html Setting Task Priority>
-- in the /Amazon SWF Developer Guide/.
registerWorkflowType_defaultTaskPriority :: Lens.Lens' RegisterWorkflowType (Prelude.Maybe Prelude.Text)
registerWorkflowType_defaultTaskPriority :: (Maybe Text -> f (Maybe Text))
-> RegisterWorkflowType -> f RegisterWorkflowType
registerWorkflowType_defaultTaskPriority = (RegisterWorkflowType -> Maybe Text)
-> (RegisterWorkflowType -> Maybe Text -> RegisterWorkflowType)
-> Lens
     RegisterWorkflowType RegisterWorkflowType (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterWorkflowType' {Maybe Text
defaultTaskPriority :: Maybe Text
$sel:defaultTaskPriority:RegisterWorkflowType' :: RegisterWorkflowType -> Maybe Text
defaultTaskPriority} -> Maybe Text
defaultTaskPriority) (\s :: RegisterWorkflowType
s@RegisterWorkflowType' {} Maybe Text
a -> RegisterWorkflowType
s {$sel:defaultTaskPriority:RegisterWorkflowType' :: Maybe Text
defaultTaskPriority = Maybe Text
a} :: RegisterWorkflowType)

-- | If set, specifies the default maximum duration for executions of this
-- workflow type. You can override this default when starting an execution
-- through the StartWorkflowExecution Action or
-- @StartChildWorkflowExecution@ Decision.
--
-- The duration is specified in seconds; an integer greater than or equal
-- to 0. Unlike some of the other timeout parameters in Amazon SWF, you
-- cannot specify a value of \"NONE\" for
-- @defaultExecutionStartToCloseTimeout@; there is a one-year max limit on
-- the time that a workflow execution can run. Exceeding this limit always
-- causes the workflow execution to time out.
registerWorkflowType_defaultExecutionStartToCloseTimeout :: Lens.Lens' RegisterWorkflowType (Prelude.Maybe Prelude.Text)
registerWorkflowType_defaultExecutionStartToCloseTimeout :: (Maybe Text -> f (Maybe Text))
-> RegisterWorkflowType -> f RegisterWorkflowType
registerWorkflowType_defaultExecutionStartToCloseTimeout = (RegisterWorkflowType -> Maybe Text)
-> (RegisterWorkflowType -> Maybe Text -> RegisterWorkflowType)
-> Lens
     RegisterWorkflowType RegisterWorkflowType (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterWorkflowType' {Maybe Text
defaultExecutionStartToCloseTimeout :: Maybe Text
$sel:defaultExecutionStartToCloseTimeout:RegisterWorkflowType' :: RegisterWorkflowType -> Maybe Text
defaultExecutionStartToCloseTimeout} -> Maybe Text
defaultExecutionStartToCloseTimeout) (\s :: RegisterWorkflowType
s@RegisterWorkflowType' {} Maybe Text
a -> RegisterWorkflowType
s {$sel:defaultExecutionStartToCloseTimeout:RegisterWorkflowType' :: Maybe Text
defaultExecutionStartToCloseTimeout = Maybe Text
a} :: RegisterWorkflowType)

-- | If set, specifies the default maximum duration of decision tasks for
-- this workflow type. This default can be overridden when starting a
-- workflow execution using the StartWorkflowExecution action or the
-- @StartChildWorkflowExecution@ Decision.
--
-- The duration is specified in seconds, an integer greater than or equal
-- to @0@. You can use @NONE@ to specify unlimited duration.
registerWorkflowType_defaultTaskStartToCloseTimeout :: Lens.Lens' RegisterWorkflowType (Prelude.Maybe Prelude.Text)
registerWorkflowType_defaultTaskStartToCloseTimeout :: (Maybe Text -> f (Maybe Text))
-> RegisterWorkflowType -> f RegisterWorkflowType
registerWorkflowType_defaultTaskStartToCloseTimeout = (RegisterWorkflowType -> Maybe Text)
-> (RegisterWorkflowType -> Maybe Text -> RegisterWorkflowType)
-> Lens
     RegisterWorkflowType RegisterWorkflowType (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterWorkflowType' {Maybe Text
defaultTaskStartToCloseTimeout :: Maybe Text
$sel:defaultTaskStartToCloseTimeout:RegisterWorkflowType' :: RegisterWorkflowType -> Maybe Text
defaultTaskStartToCloseTimeout} -> Maybe Text
defaultTaskStartToCloseTimeout) (\s :: RegisterWorkflowType
s@RegisterWorkflowType' {} Maybe Text
a -> RegisterWorkflowType
s {$sel:defaultTaskStartToCloseTimeout:RegisterWorkflowType' :: Maybe Text
defaultTaskStartToCloseTimeout = Maybe Text
a} :: RegisterWorkflowType)

-- | Textual description of the workflow type.
registerWorkflowType_description :: Lens.Lens' RegisterWorkflowType (Prelude.Maybe Prelude.Text)
registerWorkflowType_description :: (Maybe Text -> f (Maybe Text))
-> RegisterWorkflowType -> f RegisterWorkflowType
registerWorkflowType_description = (RegisterWorkflowType -> Maybe Text)
-> (RegisterWorkflowType -> Maybe Text -> RegisterWorkflowType)
-> Lens
     RegisterWorkflowType RegisterWorkflowType (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterWorkflowType' {Maybe Text
description :: Maybe Text
$sel:description:RegisterWorkflowType' :: RegisterWorkflowType -> Maybe Text
description} -> Maybe Text
description) (\s :: RegisterWorkflowType
s@RegisterWorkflowType' {} Maybe Text
a -> RegisterWorkflowType
s {$sel:description:RegisterWorkflowType' :: Maybe Text
description = Maybe Text
a} :: RegisterWorkflowType)

-- | The name of the domain in which to register the workflow type.
registerWorkflowType_domain :: Lens.Lens' RegisterWorkflowType Prelude.Text
registerWorkflowType_domain :: (Text -> f Text) -> RegisterWorkflowType -> f RegisterWorkflowType
registerWorkflowType_domain = (RegisterWorkflowType -> Text)
-> (RegisterWorkflowType -> Text -> RegisterWorkflowType)
-> Lens RegisterWorkflowType RegisterWorkflowType Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterWorkflowType' {Text
domain :: Text
$sel:domain:RegisterWorkflowType' :: RegisterWorkflowType -> Text
domain} -> Text
domain) (\s :: RegisterWorkflowType
s@RegisterWorkflowType' {} Text
a -> RegisterWorkflowType
s {$sel:domain:RegisterWorkflowType' :: Text
domain = Text
a} :: RegisterWorkflowType)

-- | The name of the workflow type.
--
-- The specified string must not start or end with whitespace. It must not
-- contain a @:@ (colon), @\/@ (slash), @|@ (vertical bar), or any control
-- characters (@\\u0000-\\u001f@ | @\\u007f-\\u009f@). Also, it must not
-- /be/ the literal string @arn@.
registerWorkflowType_name :: Lens.Lens' RegisterWorkflowType Prelude.Text
registerWorkflowType_name :: (Text -> f Text) -> RegisterWorkflowType -> f RegisterWorkflowType
registerWorkflowType_name = (RegisterWorkflowType -> Text)
-> (RegisterWorkflowType -> Text -> RegisterWorkflowType)
-> Lens RegisterWorkflowType RegisterWorkflowType Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterWorkflowType' {Text
name :: Text
$sel:name:RegisterWorkflowType' :: RegisterWorkflowType -> Text
name} -> Text
name) (\s :: RegisterWorkflowType
s@RegisterWorkflowType' {} Text
a -> RegisterWorkflowType
s {$sel:name:RegisterWorkflowType' :: Text
name = Text
a} :: RegisterWorkflowType)

-- | The version of the workflow type.
--
-- The workflow type consists of the name and version, the combination of
-- which must be unique within the domain. To get a list of all currently
-- registered workflow types, use the ListWorkflowTypes action.
--
-- The specified string must not start or end with whitespace. It must not
-- contain a @:@ (colon), @\/@ (slash), @|@ (vertical bar), or any control
-- characters (@\\u0000-\\u001f@ | @\\u007f-\\u009f@). Also, it must not
-- /be/ the literal string @arn@.
registerWorkflowType_version :: Lens.Lens' RegisterWorkflowType Prelude.Text
registerWorkflowType_version :: (Text -> f Text) -> RegisterWorkflowType -> f RegisterWorkflowType
registerWorkflowType_version = (RegisterWorkflowType -> Text)
-> (RegisterWorkflowType -> Text -> RegisterWorkflowType)
-> Lens RegisterWorkflowType RegisterWorkflowType Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterWorkflowType' {Text
version :: Text
$sel:version:RegisterWorkflowType' :: RegisterWorkflowType -> Text
version} -> Text
version) (\s :: RegisterWorkflowType
s@RegisterWorkflowType' {} Text
a -> RegisterWorkflowType
s {$sel:version:RegisterWorkflowType' :: Text
version = Text
a} :: RegisterWorkflowType)

instance Core.AWSRequest RegisterWorkflowType where
  type
    AWSResponse RegisterWorkflowType =
      RegisterWorkflowTypeResponse
  request :: RegisterWorkflowType -> Request RegisterWorkflowType
request = Service -> RegisterWorkflowType -> Request RegisterWorkflowType
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy RegisterWorkflowType
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse RegisterWorkflowType)))
response =
    AWSResponse RegisterWorkflowType
-> Logger
-> Service
-> Proxy RegisterWorkflowType
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse RegisterWorkflowType)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse RegisterWorkflowType
RegisterWorkflowTypeResponse
RegisterWorkflowTypeResponse'

instance Prelude.Hashable RegisterWorkflowType

instance Prelude.NFData RegisterWorkflowType

instance Core.ToHeaders RegisterWorkflowType where
  toHeaders :: RegisterWorkflowType -> [Header]
toHeaders =
    [Header] -> RegisterWorkflowType -> [Header]
forall a b. a -> b -> a
Prelude.const
      ( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"SimpleWorkflowService.RegisterWorkflowType" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON RegisterWorkflowType where
  toJSON :: RegisterWorkflowType -> Value
toJSON RegisterWorkflowType' {Maybe Text
Maybe ChildPolicy
Maybe TaskList
Text
version :: Text
name :: Text
domain :: Text
description :: Maybe Text
defaultTaskStartToCloseTimeout :: Maybe Text
defaultExecutionStartToCloseTimeout :: Maybe Text
defaultTaskPriority :: Maybe Text
defaultTaskList :: Maybe TaskList
defaultChildPolicy :: Maybe ChildPolicy
defaultLambdaRole :: Maybe Text
$sel:version:RegisterWorkflowType' :: RegisterWorkflowType -> Text
$sel:name:RegisterWorkflowType' :: RegisterWorkflowType -> Text
$sel:domain:RegisterWorkflowType' :: RegisterWorkflowType -> Text
$sel:description:RegisterWorkflowType' :: RegisterWorkflowType -> Maybe Text
$sel:defaultTaskStartToCloseTimeout:RegisterWorkflowType' :: RegisterWorkflowType -> Maybe Text
$sel:defaultExecutionStartToCloseTimeout:RegisterWorkflowType' :: RegisterWorkflowType -> Maybe Text
$sel:defaultTaskPriority:RegisterWorkflowType' :: RegisterWorkflowType -> Maybe Text
$sel:defaultTaskList:RegisterWorkflowType' :: RegisterWorkflowType -> Maybe TaskList
$sel:defaultChildPolicy:RegisterWorkflowType' :: RegisterWorkflowType -> Maybe ChildPolicy
$sel:defaultLambdaRole:RegisterWorkflowType' :: RegisterWorkflowType -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"defaultLambdaRole" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
defaultLambdaRole,
            (Text
"defaultChildPolicy" Text -> ChildPolicy -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ChildPolicy -> Pair) -> Maybe ChildPolicy -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ChildPolicy
defaultChildPolicy,
            (Text
"defaultTaskList" Text -> TaskList -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (TaskList -> Pair) -> Maybe TaskList -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe TaskList
defaultTaskList,
            (Text
"defaultTaskPriority" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
defaultTaskPriority,
            (Text
"defaultExecutionStartToCloseTimeout" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
defaultExecutionStartToCloseTimeout,
            (Text
"defaultTaskStartToCloseTimeout" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
defaultTaskStartToCloseTimeout,
            (Text
"description" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"domain" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
domain),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"version" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
version)
          ]
      )

instance Core.ToPath RegisterWorkflowType where
  toPath :: RegisterWorkflowType -> ByteString
toPath = ByteString -> RegisterWorkflowType -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery RegisterWorkflowType where
  toQuery :: RegisterWorkflowType -> QueryString
toQuery = QueryString -> RegisterWorkflowType -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newRegisterWorkflowTypeResponse' smart constructor.
data RegisterWorkflowTypeResponse = RegisterWorkflowTypeResponse'
  {
  }
  deriving (RegisterWorkflowTypeResponse
-> RegisterWorkflowTypeResponse -> Bool
(RegisterWorkflowTypeResponse
 -> RegisterWorkflowTypeResponse -> Bool)
-> (RegisterWorkflowTypeResponse
    -> RegisterWorkflowTypeResponse -> Bool)
-> Eq RegisterWorkflowTypeResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegisterWorkflowTypeResponse
-> RegisterWorkflowTypeResponse -> Bool
$c/= :: RegisterWorkflowTypeResponse
-> RegisterWorkflowTypeResponse -> Bool
== :: RegisterWorkflowTypeResponse
-> RegisterWorkflowTypeResponse -> Bool
$c== :: RegisterWorkflowTypeResponse
-> RegisterWorkflowTypeResponse -> Bool
Prelude.Eq, ReadPrec [RegisterWorkflowTypeResponse]
ReadPrec RegisterWorkflowTypeResponse
Int -> ReadS RegisterWorkflowTypeResponse
ReadS [RegisterWorkflowTypeResponse]
(Int -> ReadS RegisterWorkflowTypeResponse)
-> ReadS [RegisterWorkflowTypeResponse]
-> ReadPrec RegisterWorkflowTypeResponse
-> ReadPrec [RegisterWorkflowTypeResponse]
-> Read RegisterWorkflowTypeResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RegisterWorkflowTypeResponse]
$creadListPrec :: ReadPrec [RegisterWorkflowTypeResponse]
readPrec :: ReadPrec RegisterWorkflowTypeResponse
$creadPrec :: ReadPrec RegisterWorkflowTypeResponse
readList :: ReadS [RegisterWorkflowTypeResponse]
$creadList :: ReadS [RegisterWorkflowTypeResponse]
readsPrec :: Int -> ReadS RegisterWorkflowTypeResponse
$creadsPrec :: Int -> ReadS RegisterWorkflowTypeResponse
Prelude.Read, Int -> RegisterWorkflowTypeResponse -> ShowS
[RegisterWorkflowTypeResponse] -> ShowS
RegisterWorkflowTypeResponse -> String
(Int -> RegisterWorkflowTypeResponse -> ShowS)
-> (RegisterWorkflowTypeResponse -> String)
-> ([RegisterWorkflowTypeResponse] -> ShowS)
-> Show RegisterWorkflowTypeResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RegisterWorkflowTypeResponse] -> ShowS
$cshowList :: [RegisterWorkflowTypeResponse] -> ShowS
show :: RegisterWorkflowTypeResponse -> String
$cshow :: RegisterWorkflowTypeResponse -> String
showsPrec :: Int -> RegisterWorkflowTypeResponse -> ShowS
$cshowsPrec :: Int -> RegisterWorkflowTypeResponse -> ShowS
Prelude.Show, (forall x.
 RegisterWorkflowTypeResponse -> Rep RegisterWorkflowTypeResponse x)
-> (forall x.
    Rep RegisterWorkflowTypeResponse x -> RegisterWorkflowTypeResponse)
-> Generic RegisterWorkflowTypeResponse
forall x.
Rep RegisterWorkflowTypeResponse x -> RegisterWorkflowTypeResponse
forall x.
RegisterWorkflowTypeResponse -> Rep RegisterWorkflowTypeResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RegisterWorkflowTypeResponse x -> RegisterWorkflowTypeResponse
$cfrom :: forall x.
RegisterWorkflowTypeResponse -> Rep RegisterWorkflowTypeResponse x
Prelude.Generic)

-- |
-- Create a value of 'RegisterWorkflowTypeResponse' 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.
newRegisterWorkflowTypeResponse ::
  RegisterWorkflowTypeResponse
newRegisterWorkflowTypeResponse :: RegisterWorkflowTypeResponse
newRegisterWorkflowTypeResponse =
  RegisterWorkflowTypeResponse
RegisterWorkflowTypeResponse'

instance Prelude.NFData RegisterWorkflowTypeResponse