{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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_defaultChildPolicy,
    registerWorkflowType_defaultExecutionStartToCloseTimeout,
    registerWorkflowType_defaultLambdaRole,
    registerWorkflowType_defaultTaskList,
    registerWorkflowType_defaultTaskPriority,
    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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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'
  { -- | 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 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,
    -- | 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 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 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
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]
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
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. 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:
--
-- '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.
--
-- '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.
--
-- '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/.
--
-- '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/.
--
-- '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'
    { $sel:defaultChildPolicy:RegisterWorkflowType' :: Maybe ChildPolicy
defaultChildPolicy =
        forall a. Maybe a
Prelude.Nothing,
      $sel:defaultExecutionStartToCloseTimeout:RegisterWorkflowType' :: Maybe Text
defaultExecutionStartToCloseTimeout =
        forall a. Maybe a
Prelude.Nothing,
      $sel:defaultLambdaRole:RegisterWorkflowType' :: Maybe Text
defaultLambdaRole = forall a. Maybe a
Prelude.Nothing,
      $sel:defaultTaskList:RegisterWorkflowType' :: Maybe TaskList
defaultTaskList = forall a. Maybe a
Prelude.Nothing,
      $sel:defaultTaskPriority:RegisterWorkflowType' :: Maybe Text
defaultTaskPriority = forall a. Maybe a
Prelude.Nothing,
      $sel:defaultTaskStartToCloseTimeout:RegisterWorkflowType' :: Maybe Text
defaultTaskStartToCloseTimeout = forall a. Maybe a
Prelude.Nothing,
      $sel:description:RegisterWorkflowType' :: Maybe Text
description = 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_
    }

-- | 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 :: Lens' RegisterWorkflowType (Maybe ChildPolicy)
registerWorkflowType_defaultChildPolicy = 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 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 :: Lens' RegisterWorkflowType (Maybe Text)
registerWorkflowType_defaultExecutionStartToCloseTimeout = 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)

-- | 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 :: Lens' RegisterWorkflowType (Maybe Text)
registerWorkflowType_defaultLambdaRole = 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 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 :: Lens' RegisterWorkflowType (Maybe TaskList)
registerWorkflowType_defaultTaskList = 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 :: Lens' RegisterWorkflowType (Maybe Text)
registerWorkflowType_defaultTaskPriority = 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 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 :: Lens' RegisterWorkflowType (Maybe Text)
registerWorkflowType_defaultTaskStartToCloseTimeout = 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 :: Lens' RegisterWorkflowType (Maybe Text)
registerWorkflowType_description = 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 :: Lens' RegisterWorkflowType Text
registerWorkflowType_domain = 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 :: Lens' RegisterWorkflowType Text
registerWorkflowType_name = 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 :: Lens' RegisterWorkflowType Text
registerWorkflowType_version = 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 :: (Service -> Service)
-> RegisterWorkflowType -> Request RegisterWorkflowType
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy RegisterWorkflowType
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse RegisterWorkflowType)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull RegisterWorkflowTypeResponse
RegisterWorkflowTypeResponse'

instance Prelude.Hashable RegisterWorkflowType where
  hashWithSalt :: Int -> RegisterWorkflowType -> Int
hashWithSalt Int
_salt RegisterWorkflowType' {Maybe Text
Maybe ChildPolicy
Maybe TaskList
Text
version :: Text
name :: Text
domain :: Text
description :: Maybe Text
defaultTaskStartToCloseTimeout :: Maybe Text
defaultTaskPriority :: Maybe Text
defaultTaskList :: Maybe TaskList
defaultLambdaRole :: Maybe Text
defaultExecutionStartToCloseTimeout :: Maybe Text
defaultChildPolicy :: Maybe ChildPolicy
$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:defaultTaskPriority:RegisterWorkflowType' :: RegisterWorkflowType -> Maybe Text
$sel:defaultTaskList:RegisterWorkflowType' :: RegisterWorkflowType -> Maybe TaskList
$sel:defaultLambdaRole:RegisterWorkflowType' :: RegisterWorkflowType -> Maybe Text
$sel:defaultExecutionStartToCloseTimeout:RegisterWorkflowType' :: RegisterWorkflowType -> Maybe Text
$sel:defaultChildPolicy:RegisterWorkflowType' :: RegisterWorkflowType -> Maybe ChildPolicy
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ChildPolicy
defaultChildPolicy
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
defaultExecutionStartToCloseTimeout
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
defaultLambdaRole
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TaskList
defaultTaskList
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
defaultTaskPriority
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
defaultTaskStartToCloseTimeout
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
domain
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
version

instance Prelude.NFData RegisterWorkflowType where
  rnf :: RegisterWorkflowType -> ()
rnf RegisterWorkflowType' {Maybe Text
Maybe ChildPolicy
Maybe TaskList
Text
version :: Text
name :: Text
domain :: Text
description :: Maybe Text
defaultTaskStartToCloseTimeout :: Maybe Text
defaultTaskPriority :: Maybe Text
defaultTaskList :: Maybe TaskList
defaultLambdaRole :: Maybe Text
defaultExecutionStartToCloseTimeout :: Maybe Text
defaultChildPolicy :: Maybe ChildPolicy
$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:defaultTaskPriority:RegisterWorkflowType' :: RegisterWorkflowType -> Maybe Text
$sel:defaultTaskList:RegisterWorkflowType' :: RegisterWorkflowType -> Maybe TaskList
$sel:defaultLambdaRole:RegisterWorkflowType' :: RegisterWorkflowType -> Maybe Text
$sel:defaultExecutionStartToCloseTimeout:RegisterWorkflowType' :: RegisterWorkflowType -> Maybe Text
$sel:defaultChildPolicy:RegisterWorkflowType' :: RegisterWorkflowType -> Maybe ChildPolicy
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ChildPolicy
defaultChildPolicy
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
defaultExecutionStartToCloseTimeout
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
defaultLambdaRole
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TaskList
defaultTaskList
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
defaultTaskPriority
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
defaultTaskStartToCloseTimeout
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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 Text
domain
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
version

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

instance Data.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
defaultTaskPriority :: Maybe Text
defaultTaskList :: Maybe TaskList
defaultLambdaRole :: Maybe Text
defaultExecutionStartToCloseTimeout :: Maybe Text
defaultChildPolicy :: Maybe ChildPolicy
$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:defaultTaskPriority:RegisterWorkflowType' :: RegisterWorkflowType -> Maybe Text
$sel:defaultTaskList:RegisterWorkflowType' :: RegisterWorkflowType -> Maybe TaskList
$sel:defaultLambdaRole:RegisterWorkflowType' :: RegisterWorkflowType -> Maybe Text
$sel:defaultExecutionStartToCloseTimeout:RegisterWorkflowType' :: RegisterWorkflowType -> Maybe Text
$sel:defaultChildPolicy:RegisterWorkflowType' :: RegisterWorkflowType -> Maybe ChildPolicy
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"defaultChildPolicy" 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 ChildPolicy
defaultChildPolicy,
            (Key
"defaultExecutionStartToCloseTimeout" 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
defaultExecutionStartToCloseTimeout,
            (Key
"defaultLambdaRole" 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
defaultLambdaRole,
            (Key
"defaultTaskList" 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 TaskList
defaultTaskList,
            (Key
"defaultTaskPriority" 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
defaultTaskPriority,
            (Key
"defaultTaskStartToCloseTimeout" 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
defaultTaskStartToCloseTimeout,
            (Key
"description" 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
description,
            forall a. a -> Maybe a
Prelude.Just (Key
"domain" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
domain),
            forall a. a -> Maybe a
Prelude.Just (Key
"name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
            forall a. a -> Maybe a
Prelude.Just (Key
"version" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
version)
          ]
      )

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

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

-- | /See:/ 'newRegisterWorkflowTypeResponse' smart constructor.
data RegisterWorkflowTypeResponse = RegisterWorkflowTypeResponse'
  {
  }
  deriving (RegisterWorkflowTypeResponse
-> RegisterWorkflowTypeResponse -> Bool
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]
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
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.
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 where
  rnf :: RegisterWorkflowTypeResponse -> ()
rnf RegisterWorkflowTypeResponse
_ = ()