registerWorkflowType method
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. 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 isswf:defaultTaskList.name
. -
name
: String constraint. The key isswf:name
. -
version
: String constraint. The key isswf:version
.
-
cause
parameter is
set to OPERATION_NOT_PERMITTED
. For details and example IAM
policies, see Using
IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF
Developer Guide.
May throw TypeAlreadyExistsFault. May throw LimitExceededFault. May throw UnknownResourceFault. May throw OperationNotPermittedFault.
Parameter domain
:
The name of the domain in which to register the workflow type.
Parameter 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
.
Parameter version
:
The version 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
.
Parameter 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 aWorkflowExecutionCancelRequested
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.
Parameter 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.
Parameter defaultLambdaRole
:
The default IAM role attached to this workflow type.
Parameter 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.
Parameter 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 Setting Task Priority in the Amazon SWF Developer Guide.
Parameter 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.
Parameter description
:
Textual description of the workflow type.
Implementation
Future<void> registerWorkflowType({
required String domain,
required String name,
required String version,
ChildPolicy? defaultChildPolicy,
String? defaultExecutionStartToCloseTimeout,
String? defaultLambdaRole,
TaskList? defaultTaskList,
String? defaultTaskPriority,
String? defaultTaskStartToCloseTimeout,
String? description,
}) async {
ArgumentError.checkNotNull(domain, 'domain');
_s.validateStringLength(
'domain',
domain,
1,
256,
isRequired: true,
);
ArgumentError.checkNotNull(name, 'name');
_s.validateStringLength(
'name',
name,
1,
256,
isRequired: true,
);
ArgumentError.checkNotNull(version, 'version');
_s.validateStringLength(
'version',
version,
1,
64,
isRequired: true,
);
_s.validateStringLength(
'defaultExecutionStartToCloseTimeout',
defaultExecutionStartToCloseTimeout,
0,
8,
);
_s.validateStringLength(
'defaultLambdaRole',
defaultLambdaRole,
1,
1600,
);
_s.validateStringLength(
'defaultTaskStartToCloseTimeout',
defaultTaskStartToCloseTimeout,
0,
8,
);
_s.validateStringLength(
'description',
description,
0,
1024,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.0',
'X-Amz-Target': 'SimpleWorkflowService.RegisterWorkflowType'
};
await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'domain': domain,
'name': name,
'version': version,
if (defaultChildPolicy != null)
'defaultChildPolicy': defaultChildPolicy.toValue(),
if (defaultExecutionStartToCloseTimeout != null)
'defaultExecutionStartToCloseTimeout':
defaultExecutionStartToCloseTimeout,
if (defaultLambdaRole != null) 'defaultLambdaRole': defaultLambdaRole,
if (defaultTaskList != null) 'defaultTaskList': defaultTaskList,
if (defaultTaskPriority != null)
'defaultTaskPriority': defaultTaskPriority,
if (defaultTaskStartToCloseTimeout != null)
'defaultTaskStartToCloseTimeout': defaultTaskStartToCloseTimeout,
if (description != null) 'description': description,
},
);
}