id
stringlengths
8
78
source
stringclasses
743 values
chunk_id
int64
1
5.05k
text
stringlengths
593
49.7k
swf-api-033
swf-api.pdf
33
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 Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide. Request Syntax { "defaultTaskHeartbeatTimeout": "string", "defaultTaskList": { "name": "string" }, "defaultTaskPriority": "string", "defaultTaskScheduleToCloseTimeout": "string", "defaultTaskScheduleToStartTimeout": "string", RegisterActivityType API Version 2012-01-25 153 Amazon Simple Workflow Service API Reference "defaultTaskStartToCloseTimeout": "string", "description": "string", "domain": "string", "name": "string", "version": "string" } Request Parameters For information about the parameters that are common to all actions, see Common Parameters. The request accepts the following data in JSON format. defaultTaskHeartbeatTimeout If set, specifies the default maximum time before which a worker processing a task of this type must report progress by calling RecordActivityTaskHeartbeat. If the timeout is exceeded, the activity task is automatically timed out. This default can be overridden when scheduling an activity task using the ScheduleActivityTask Decision. If the activity worker subsequently attempts to record a heartbeat or returns a result, the activity worker receives an UnknownResource fault. In this case, Amazon SWF no longer considers the activity task to be valid; the activity worker should clean up the activity task. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration. Type: String Length Constraints: Maximum length of 8. Required: No defaultTaskList If set, specifies the default task list to use for scheduling tasks of this activity type. This default task list is used if a task list isn't provided when a task is scheduled through the ScheduleActivityTask Decision. Type: TaskList object Required: No Request Parameters API Version 2012-01-25 154 Amazon Simple Workflow Service defaultTaskPriority API Reference The default task priority to assign to the activity 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 in the Amazon SWF Developer Guide.. Type: String Required: No defaultTaskScheduleToCloseTimeout If set, specifies the default maximum duration for a task of this activity type. This default can be overridden when scheduling an activity task using the ScheduleActivityTask Decision. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration. Type: String Length Constraints: Maximum length of 8. Required: No defaultTaskScheduleToStartTimeout If set, specifies the default maximum duration that a task of this activity type can wait before being assigned to a worker. This default can be overridden when scheduling an activity task using the ScheduleActivityTask Decision. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration. Type: String Length Constraints: Maximum length of 8. Required: No Request Parameters API Version 2012-01-25 155 Amazon Simple Workflow Service API Reference defaultTaskStartToCloseTimeout If set, specifies the default maximum duration that a worker can take to process tasks of this activity type. This default can be overridden when scheduling an activity task using the ScheduleActivityTask Decision. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration. Type: String Length Constraints: Maximum length of 8. Required: No description A textual description of the activity type. Type: String Length Constraints: Maximum length of 1024. Required: No domain The name of the domain in which this activity is to be registered. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes name The name of the activity type within the domain. The specified string 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. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Request Parameters API Version 2012-01-25 156 Amazon Simple Workflow Service Required: Yes version The version of the activity type. Note API Reference The activity type consists of the name and version, the combination of which must be unique within the domain. The specified string 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. Type: String Length Constraints: Minimum length of 1. Maximum length
swf-api-034
swf-api.pdf
34
must not be the literal string arn. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Request Parameters API Version 2012-01-25 156 Amazon Simple Workflow Service Required: Yes version The version of the activity type. Note API Reference The activity type consists of the name and version, the combination of which must be unique within the domain. The specified string 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. Type: String Length Constraints: Minimum length of 1. Maximum length of 64. Required: Yes Response Elements If the action is successful, the service sends back an HTTP 200 response with an empty HTTP body. Errors For information about the errors that are common to all actions, see Common Errors. LimitExceededFault Returned by any operation if a system imposed limitation has been reached. To address this fault you should either clean up unused resources or increase the limit by contacting AWS. HTTP Status Code: 400 OperationNotPermittedFault Returned when the caller doesn't have sufficient permissions to invoke the action. HTTP Status Code: 400 Response Elements API Version 2012-01-25 157 Amazon Simple Workflow Service TypeAlreadyExistsFault API Reference Returned if the type already exists in the specified domain. You may get this fault if you are registering a type that is either already registered or deprecated, or if you undeprecate a type that is currently registered. HTTP Status Code: 400 UnknownResourceFault Returned when the named resource cannot be found with in the scope of this operation (region or domain). This could happen if the named resource was never created or is no longer available for this operation. HTTP Status Code: 400 Examples RegisterActivityType Example This example illustrates one usage of RegisterActivityType. Sample Request POST / HTTP/1.1 Host: swf.us-east-1.amazonaws.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.25) Gecko/20111212 Firefox/3.6.25 ( .NET CLR 3.5.30729; .NET4.0E) Accept: application/json, text/javascript, */* Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 115 Connection: keep-alive Content-Type: application/x-amz-json-1.0 X-Requested-With: XMLHttpRequest X-Amz-Date: Sun, 15 Jan 2012 00:14:06 GMT X-Amz-Target: SimpleWorkflowService.RegisterActivityType Content-Encoding: amz-1.0 X-Amzn-Authorization: AWS3 AWSAccessKeyId=AKIAIOSFODNN7EXAMPLE,Algorithm=HmacSHA256,SignedHeaders=Host;X-Amz- Date;X-Amz-Target;Content- Encoding,Signature=F9cptqaGWa2H7LW3dpctF9J5svsB6FRZ4krghCRnml0= Examples API Version 2012-01-25 158 Amazon Simple Workflow Service API Reference Referer: http://swf.us-east-1.amazonaws.com/explorer/index.html Content-Length: 343 Pragma: no-cache Cache-Control: no-cache { "domain": "867530901", "defaultTaskScheduleToStartTimeout": "300", "name": "activityVerify", "defaultTaskHeartbeatTimeout": "120", "defaultTaskPriority": "10", "defaultTaskStartToCloseTimeout": "600", "defaultTaskScheduleToCloseTimeout": "900", "version": "1.0", "defaultTaskList": { "name": "mainTaskList" }, "description": "Verify the customer credit card" } Sample Response HTTP/1.1 200 OK Content-Length: 0 Content-Type: application/json x-amzn-RequestId: d68969c7-3f0d-11e1-9b11-7182192d0b57 See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS Command Line Interface • AWS SDK for .NET • AWS SDK for C++ • AWS SDK for Go v2 • AWS SDK for Java V2 • AWS SDK for JavaScript V3 • AWS SDK for Kotlin See Also API Version 2012-01-25 159 Amazon Simple Workflow Service • AWS SDK for PHP V3 • AWS SDK for Python • AWS SDK for Ruby V3 API Reference See Also API Version 2012-01-25 160 Amazon Simple Workflow Service RegisterDomain Registers a new domain. Access Control API Reference You can use IAM policies to control this action's access to Amazon SWF resources as follows: • You cannot use an IAM policy to control domain access for this action. The name of the domain being registered is available as the resource of this action. • Use an Action element to allow or deny permission to call this action. • You cannot use an IAM policy to constrain this action's parameters. 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 Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide. Request Syntax { "description": "string", "name": "string", "tags": [ { "key": "string", "value": "string" } ], "workflowExecutionRetentionPeriodInDays": "string" } Request Parameters For information about the parameters that are common to all actions, see Common Parameters. The request accepts the following data in JSON format. RegisterDomain API Version 2012-01-25 161 API Reference Amazon Simple Workflow Service description A text description of the domain. Type: String Length Constraints: Maximum length of 1024. Required: No name Name of the domain to register. The name must be unique in the region that the domain is registered in. 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. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes tags Tags to be added when registering a domain. Tags may
swf-api-035
swf-api.pdf
35
A text description of the domain. Type: String Length Constraints: Maximum length of 1024. Required: No name Name of the domain to register. The name must be unique in the region that the domain is registered in. 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. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes tags Tags to be added when registering a domain. Tags may only contain unicode letters, digits, whitespace, or these symbols: _ . : / = + - @. Type: Array of ResourceTag objects Required: No workflowExecutionRetentionPeriodInDays The duration (in days) that records and histories of workflow executions on the domain should be kept by the service. After the retention period, the workflow execution isn't available in the results of visibility calls. If you pass the value NONE or 0 (zero), then the workflow execution history isn't retained. As soon as the workflow execution completes, the execution record and its history are deleted. Request Parameters API Version 2012-01-25 162 Amazon Simple Workflow Service API Reference The maximum workflow execution retention period is 90 days. For more information about Amazon SWF service limits, see: Amazon SWF Service Limits in the Amazon SWF Developer Guide. Type: String Length Constraints: Minimum length of 1. Maximum length of 8. Required: Yes Response Elements If the action is successful, the service sends back an HTTP 200 response with an empty HTTP body. Errors For information about the errors that are common to all actions, see Common Errors. DomainAlreadyExistsFault Returned if the domain already exists. You may get this fault if you are registering a domain that is either already registered or deprecated, or if you undeprecate a domain that is currently registered. HTTP Status Code: 400 LimitExceededFault Returned by any operation if a system imposed limitation has been reached. To address this fault you should either clean up unused resources or increase the limit by contacting AWS. HTTP Status Code: 400 OperationNotPermittedFault Returned when the caller doesn't have sufficient permissions to invoke the action. HTTP Status Code: 400 TooManyTagsFault You've exceeded the number of tags allowed for a domain. HTTP Status Code: 400 Response Elements API Version 2012-01-25 163 API Reference Amazon Simple Workflow Service Examples RegisterDomain Example This example illustrates one usage of RegisterDomain. Sample Request POST / HTTP/1.1 Host: swf.us-east-1.amazonaws.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.25) Gecko/20111212 Firefox/3.6.25 ( .NET CLR 3.5.30729; .NET4.0E) Accept: application/json, text/javascript, */* Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 115 Connection: keep-alive Content-Type: application/x-amz-json-1.0 X-Requested-With: XMLHttpRequest X-Amz-Date: Fri, 13 Jan 2012 18:42:12 GMT X-Amz-Target: SimpleWorkflowService.RegisterDomain Content-Encoding: amz-1.0 X-Amzn-Authorization: AWS3 AWSAccessKeyId=AKIAIOSFODNN7EXAMPLE,Algorithm=HmacSHA256,SignedHeaders=Host;X-Amz- Date;X-Amz-Target;Content-Encoding,Signature=tzjkF55lxAxPhzp/BRGFYQRQRq6CqrM254dTDE/ EncI= Referer: http://swf.us-east-1.amazonaws.com/explorer/index.html Content-Length: 91 Pragma: no-cache Cache-Control: no-cache {"name": "867530902", "description": "music", "workflowExecutionRetentionPeriodInDays": "60"} Sample Response HTTP/1.1 200 OK Content-Length: 0 Content-Type: application/json x-amzn-RequestId: 4ec4ac3f-3e16-11e1-9b11-7182192d0b57 Examples API Version 2012-01-25 164 Amazon Simple Workflow Service See Also API Reference For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS Command Line Interface • AWS SDK for .NET • AWS SDK for C++ • AWS SDK for Go v2 • AWS SDK for Java V2 • AWS SDK for JavaScript V3 • AWS SDK for Kotlin • AWS SDK for PHP V3 • AWS SDK for Python • AWS SDK for Ruby V3 See Also API Version 2012-01-25 165 Amazon Simple Workflow Service API Reference RegisterWorkflowType 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. Important 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 Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide. Request Syntax { "defaultChildPolicy": "string", "defaultExecutionStartToCloseTimeout": "string", "defaultLambdaRole": "string",
swf-api-036
swf-api.pdf
36
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 Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide. Request Syntax { "defaultChildPolicy": "string", "defaultExecutionStartToCloseTimeout": "string", "defaultLambdaRole": "string", "defaultTaskList": { "name": "string" }, RegisterWorkflowType API Version 2012-01-25 166 Amazon Simple Workflow Service API Reference "defaultTaskPriority": "string", "defaultTaskStartToCloseTimeout": "string", "description": "string", "domain": "string", "name": "string", "version": "string" } Request Parameters For information about the parameters that are common to all actions, see Common Parameters. The request accepts the following data in JSON format. 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. Type: String Valid Values: TERMINATE | REQUEST_CANCEL | ABANDON Required: No 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. Request Parameters API Version 2012-01-25 167 Amazon Simple Workflow Service API Reference 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. Type: String Length Constraints: Maximum length of 8. Required: No defaultLambdaRole The default IAM role attached to this workflow type. Note 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. Type: String Length Constraints: Minimum length of 1. Maximum length of 1600. Required: No 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. Type: TaskList object Required: No Request Parameters API Version 2012-01-25 168 Amazon Simple Workflow Service defaultTaskPriority API Reference 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. Type: String Required: No 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. Type: String Length Constraints: Maximum length of 8. Required: No description Textual description of the workflow type. Type: String Length Constraints: Maximum length of 1024. Required: No domain The name of the domain in which to register the workflow type. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Request Parameters API Version 2012-01-25 169 Amazon Simple Workflow Service Required: Yes name The name of the workflow type. API Reference The specified string 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. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes version The version of the workflow type. Note 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
swf-api-037
swf-api.pdf
37
Yes name The name of the workflow type. API Reference The specified string 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. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes version The version of the workflow type. Note 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 contain a : (colon), / (slash), | (vertical bar), or any control characters (\u0000-\u001f | \u007f-\u009f). Also, it must not be the literal string arn. Type: String Length Constraints: Minimum length of 1. Maximum length of 64. Required: Yes Response Elements If the action is successful, the service sends back an HTTP 200 response with an empty HTTP body. Errors For information about the errors that are common to all actions, see Common Errors. Response Elements API Version 2012-01-25 170 Amazon Simple Workflow Service LimitExceededFault API Reference Returned by any operation if a system imposed limitation has been reached. To address this fault you should either clean up unused resources or increase the limit by contacting AWS. HTTP Status Code: 400 OperationNotPermittedFault Returned when the caller doesn't have sufficient permissions to invoke the action. HTTP Status Code: 400 TypeAlreadyExistsFault Returned if the type already exists in the specified domain. You may get this fault if you are registering a type that is either already registered or deprecated, or if you undeprecate a type that is currently registered. HTTP Status Code: 400 UnknownResourceFault Returned when the named resource cannot be found with in the scope of this operation (region or domain). This could happen if the named resource was never created or is no longer available for this operation. HTTP Status Code: 400 Examples RegisterWorkflowType Example This example illustrates one usage of RegisterWorkflowType. Sample Request POST / HTTP/1.1 Host: swf.us-east-1.amazonaws.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.25) Gecko/20111212 Firefox/3.6.25 ( .NET CLR 3.5.30729; .NET4.0E) Accept: application/json, text/javascript, */* Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Examples API Version 2012-01-25 171 Amazon Simple Workflow Service API Reference Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 115 Connection: keep-alive Content-Type: application/x-amz-json-1.0 X-Requested-With: XMLHttpRequest X-Amz-Date: Fri, 13 Jan 2012 18:59:33 GMT X-Amz-Target: SimpleWorkflowService.RegisterWorkflowType Content-Encoding: amz-1.0 X-Amzn-Authorization: AWS3 AWSAccessKeyId=AKIAIOSFODNN7EXAMPLE,Algorithm=HmacSHA256,SignedHeaders=Host;X-Amz- Date;X-Amz-Target;Content-Encoding,Signature=p5FUOoV3QXAafb7aK5z79Ztu5v0w9NeEqLu0ei +P9FA= Referer: http://swf.us-east-1.amazonaws.com/explorer/index.html Content-Length: 300 Pragma: no-cache Cache-Control: no-cache { "defaultExecutionStartToCloseTimeout": "3600", "domain": "867530901", "name": "customerOrderWorkflow", "defaultChildPolicy": "TERMINATE", "defaultTaskPriority": "10", "defaultTaskStartToCloseTimeout": "600", "version": "1.0", "defaultTaskList": { "name": "mainTaskList" }, "description": "Handle customer orders" } Sample Response HTTP/1.1 200 OK Content-Length: 0 Content-Type: application/json x-amzn-RequestId: bb469e67-3e18-11e1-9914-a356b6ea8bdf See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: See Also API Version 2012-01-25 172 API Reference Amazon Simple Workflow Service • AWS Command Line Interface • AWS SDK for .NET • AWS SDK for C++ • AWS SDK for Go v2 • AWS SDK for Java V2 • AWS SDK for JavaScript V3 • AWS SDK for Kotlin • AWS SDK for PHP V3 • AWS SDK for Python • AWS SDK for Ruby V3 See Also API Version 2012-01-25 173 Amazon Simple Workflow Service API Reference RequestCancelWorkflowExecution Records a WorkflowExecutionCancelRequested event in the currently running workflow execution identified by the given domain, workflowId, and runId. This logically requests the cancellation of the workflow execution as a whole. It is up to the decider to take appropriate actions when it receives an execution history with this event. Note If the runId isn't specified, the WorkflowExecutionCancelRequested event is recorded in the history of the current open workflow execution with the specified workflowId in the domain. Note Because this action allows the workflow to properly clean up and gracefully close, it should be used instead of TerminateWorkflowExecution when possible. 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. • You cannot use an IAM policy to constrain this action's parameters. 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 Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide. Request Syntax { "domain": "string", RequestCancelWorkflowExecution API Version 2012-01-25 174 Amazon Simple Workflow Service "runId": "string", "workflowId": "string" } Request Parameters API Reference For information about the parameters that are common to all actions, see Common Parameters. The request accepts the following
swf-api-038
swf-api.pdf
38
this action's parameters. 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 Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide. Request Syntax { "domain": "string", RequestCancelWorkflowExecution API Version 2012-01-25 174 Amazon Simple Workflow Service "runId": "string", "workflowId": "string" } Request Parameters API Reference For information about the parameters that are common to all actions, see Common Parameters. The request accepts the following data in JSON format. domain The name of the domain containing the workflow execution to cancel. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes runId The runId of the workflow execution to cancel. Type: String Length Constraints: Maximum length of 64. Required: No workflowId The workflowId of the workflow execution to cancel. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes Response Elements If the action is successful, the service sends back an HTTP 200 response with an empty HTTP body. Request Parameters API Version 2012-01-25 175 Amazon Simple Workflow Service API Reference Errors For information about the errors that are common to all actions, see Common Errors. OperationNotPermittedFault Returned when the caller doesn't have sufficient permissions to invoke the action. HTTP Status Code: 400 UnknownResourceFault Returned when the named resource cannot be found with in the scope of this operation (region or domain). This could happen if the named resource was never created or is no longer available for this operation. HTTP Status Code: 400 Examples RequestCancelWorkflowExecution Example This example illustrates one usage of RequestCancelWorkflowExecution. Sample Request POST / HTTP/1.1 Host: swf.us-east-1.amazonaws.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.25) Gecko/20111212 Firefox/3.6.25 ( .NET CLR 3.5.30729; .NET4.0E) Accept: application/json, text/javascript, */* Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 115 Connection: keep-alive Content-Type: application/x-amz-json-1.0 X-Requested-With: XMLHttpRequest X-Amz-Date: Mon, 16 Jan 2012 04:49:06 GMT X-Amz-Target: SimpleWorkflowService.RequestCancelWorkflowExecution Content-Encoding: amz-1.0 X-Amzn-Authorization: AWS3 AWSAccessKeyId=AKIAIOSFODNN7EXAMPLE,Algorithm=HmacSHA256,SignedHeaders=Host;X-Amz- Errors API Version 2012-01-25 176 Amazon Simple Workflow Service API Reference Date;X-Amz-Target;Content-Encoding,Signature=xODwV3kbpJbWVa6bQiV2zQAw9euGI3uXI82urc +bVeo= Referer: http://swf.us-east-1.amazonaws.com/explorer/index.html Content-Length: 106 Pragma: no-cache Cache-Control: no-cache {"domain": "867530901", "workflowId": "20110927-T-1", "runId": "94861fda-a714-4126-95d7-55ba847da8ab"} Sample Response HTTP/1.1 200 OK Content-Length: 0 Content-Type: application/json x-amzn-RequestId: 6bd0627e-3ffd-11e1-9b11-7182192d0b57 See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS Command Line Interface • AWS SDK for .NET • AWS SDK for C++ • AWS SDK for Go v2 • AWS SDK for Java V2 • AWS SDK for JavaScript V3 • AWS SDK for Kotlin • AWS SDK for PHP V3 • AWS SDK for Python • AWS SDK for Ruby V3 See Also API Version 2012-01-25 177 Amazon Simple Workflow Service API Reference RespondActivityTaskCanceled Used by workers to tell the service that the ActivityTask identified by the taskToken was successfully canceled. Additional details can be provided using the details argument. These details (if provided) appear in the ActivityTaskCanceled event added to the workflow history. Important Only use this operation if the canceled flag of a RecordActivityTaskHeartbeat request returns true and if the activity can be safely undone or abandoned. A task is considered open from the time that it is scheduled until it is closed. Therefore a task is reported as open while a worker is processing it. A task is closed after it has been specified in a call to RespondActivityTaskCompleted, RespondActivityTaskCanceled, RespondActivityTaskFailed, or the task has timed out. 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. • You cannot use an IAM policy to constrain this action's parameters. 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 Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide. Request Syntax { "details": "string", "taskToken": "string" } RespondActivityTaskCanceled API Version 2012-01-25 178 Amazon Simple Workflow Service Request Parameters API Reference For information about the parameters that are common to all actions, see Common Parameters. The request accepts the following data in JSON format. details Information about the cancellation. Type: String Length Constraints: Maximum length of 32768. Required: No taskToken The taskToken of the ActivityTask. Important taskToken is generated by the service and should be treated as an opaque value. If the task is passed to another process, its taskToken must also be passed. This enables it to provide its progress
swf-api-039
swf-api.pdf
39
Syntax { "details": "string", "taskToken": "string" } RespondActivityTaskCanceled API Version 2012-01-25 178 Amazon Simple Workflow Service Request Parameters API Reference For information about the parameters that are common to all actions, see Common Parameters. The request accepts the following data in JSON format. details Information about the cancellation. Type: String Length Constraints: Maximum length of 32768. Required: No taskToken The taskToken of the ActivityTask. Important taskToken is generated by the service and should be treated as an opaque value. If the task is passed to another process, its taskToken must also be passed. This enables it to provide its progress and respond with results. Type: String Length Constraints: Minimum length of 1. Maximum length of 1024. Required: Yes Response Elements If the action is successful, the service sends back an HTTP 200 response with an empty HTTP body. Errors For information about the errors that are common to all actions, see Common Errors. Request Parameters API Version 2012-01-25 179 Amazon Simple Workflow Service OperationNotPermittedFault API Reference Returned when the caller doesn't have sufficient permissions to invoke the action. HTTP Status Code: 400 UnknownResourceFault Returned when the named resource cannot be found with in the scope of this operation (region or domain). This could happen if the named resource was never created or is no longer available for this operation. HTTP Status Code: 400 Examples RespondActivityTaskCanceled Example This example illustrates one usage of RespondActivityTaskCanceled. Sample Request POST / HTTP/1.1 Host: swf.us-east-1.amazonaws.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.25) Gecko/20111212 Firefox/3.6.25 ( .NET CLR 3.5.30729; .NET4.0E) Accept: application/json, text/javascript, */* Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 115 Connection: keep-alive Content-Type: application/x-amz-json-1.0 X-Requested-With: XMLHttpRequest X-Amz-Date: Mon, 16 Jan 2012 04:36:44 GMT X-Amz-Target: SimpleWorkflowService.RespondActivityTaskCanceled Content-Encoding: amz-1.0 X-Amzn-Authorization: AWS3 AWSAccessKeyId=AKIAIOSFODNN7EXAMPLE,Algorithm=HmacSHA256,SignedHeaders=Host;X-Amz- Date;X-Amz-Target;Content- Encoding,Signature=7ZMb0Np0OyXw6hrFSBFDAfBnSaEP1TH7cAG29DL5BUI= Referer: http://swf.us-east-1.amazonaws.com/explorer/index.html Content-Length: 640 Examples API Version 2012-01-25 180 Amazon Simple Workflow Service Pragma: no-cache Cache-Control: no-cache API Reference {"taskToken": "AAAAKgAAAAEAAAAAAAAAAQlFok8Ay875ki85gos/ Okm9kWg1Jm6DbwiBZgxyCrW2OS+DQQtrCTMr+KH1ouxrCVOkTXPOUY/M4Ujfr1CrsMi6S0DMD8/ N6yxzd34+PIIvRY8w9M5z89PbPQKjKHKbz2ocbTnHgRThaBO4ZmeadNyZWSeQyZXmsQFmFuHfaH9P2ibzrDS1dU +s/iw/R9RBrRWArsph/FIfWdRUJfu/ FH9IFPSb3KYKMVaJAOyWhcR1KrRGywIGxPC7m9tQjapXqitoRYj42qgABydT4NVR5cLCkeYW0LKxUGVU46+gNvRaUfYzP31JVARQh5d0j7S/ ERi10m6bamPJ3UcZfLFbM42mIINywmcTORMpQ/nPGLU1iECYrtnAV0YTlGZfGm +Vi6Gcgwyi4hEjg7TCBjc6WBw3JuAfFvUPU5cfvAoX7quUZRA7JUnYGObE0y9zYuTnCx6C1GL7Ks2MEA0coIiAl4JZx6qsGYfeKjIGntTsoCEe1zjp5gRqfeD74kfeZg0HmqA0xiFGZ40OHbImnF5YHsedYfLk6u09SAkQMD8iJhT8", "details": "customer canceled transaction"} Sample Response HTTP/1.1 200 OK Content-Length: 0 Content-Type: application/json x-amzn-RequestId: b1a001a6-3ffb-11e1-9b11-7182192d0b57 See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS Command Line Interface • AWS SDK for .NET • AWS SDK for C++ • AWS SDK for Go v2 • AWS SDK for Java V2 • AWS SDK for JavaScript V3 • AWS SDK for Kotlin • AWS SDK for PHP V3 • AWS SDK for Python • AWS SDK for Ruby V3 See Also API Version 2012-01-25 181 Amazon Simple Workflow Service API Reference RespondActivityTaskCompleted Used by workers to tell the service that the ActivityTask identified by the taskToken completed successfully with a result (if provided). The result appears in the ActivityTaskCompleted event in the workflow history. Important If the requested task doesn't complete successfully, use RespondActivityTaskFailed instead. If the worker finds that the task is canceled through the canceled flag returned by RecordActivityTaskHeartbeat, it should cancel the task, clean up and then call RespondActivityTaskCanceled. A task is considered open from the time that it is scheduled until it is closed. Therefore a task is reported as open while a worker is processing it. A task is closed after it has been specified in a call to RespondActivityTaskCompleted, RespondActivityTaskCanceled, RespondActivityTaskFailed, or the task has timed out. 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. • You cannot use an IAM policy to constrain this action's parameters. 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 Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide. Request Syntax { "result": "string", "taskToken": "string" } RespondActivityTaskCompleted API Version 2012-01-25 182 Amazon Simple Workflow Service Request Parameters API Reference For information about the parameters that are common to all actions, see Common Parameters. The request accepts the following data in JSON format. result The result of the activity task. It is a free form string that is implementation specific. Type: String Length Constraints: Maximum length of 32768. Required: No taskToken The taskToken of the ActivityTask. Important taskToken is generated by the service and should be treated as an opaque value. If the task is passed to another process, its taskToken must also be passed. This enables it to provide its progress and respond with results. Type: String Length Constraints: Minimum length of 1. Maximum length of 1024. Required: Yes Response Elements If the action is successful, the service sends back an HTTP
swf-api-040
swf-api.pdf
40
result The result of the activity task. It is a free form string that is implementation specific. Type: String Length Constraints: Maximum length of 32768. Required: No taskToken The taskToken of the ActivityTask. Important taskToken is generated by the service and should be treated as an opaque value. If the task is passed to another process, its taskToken must also be passed. This enables it to provide its progress and respond with results. Type: String Length Constraints: Minimum length of 1. Maximum length of 1024. Required: Yes Response Elements If the action is successful, the service sends back an HTTP 200 response with an empty HTTP body. Errors For information about the errors that are common to all actions, see Common Errors. Request Parameters API Version 2012-01-25 183 Amazon Simple Workflow Service OperationNotPermittedFault API Reference Returned when the caller doesn't have sufficient permissions to invoke the action. HTTP Status Code: 400 UnknownResourceFault Returned when the named resource cannot be found with in the scope of this operation (region or domain). This could happen if the named resource was never created or is no longer available for this operation. HTTP Status Code: 400 Examples RespondActivityTaskCompleted Example This example illustrates one usage of RespondActivityTaskCompleted. Sample Request POST / HTTP/1.1 Host: swf.us-east-1.amazonaws.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.25) Gecko/20111212 Firefox/3.6.25 ( .NET CLR 3.5.30729; .NET4.0E) Accept: application/json, text/javascript, */* Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 115 Connection: keep-alive Content-Type: application/x-amz-json-1.0 X-Requested-With: XMLHttpRequest X-Amz-Date: Mon, 16 Jan 2012 03:56:15 GMT X-Amz-Target: SimpleWorkflowService.RespondActivityTaskCompleted Content-Encoding: amz-1.0 X-Amzn-Authorization: AWS3 AWSAccessKeyId=AKIAIOSFODNN7EXAMPLE,Algorithm=HmacSHA256,SignedHeaders=Host;X- Amz-Date;X-Amz-Target;Content-Encoding,Signature=M+ygHbMHSHJiVrsAQTW/BfkgHoNzLPnPD +dVywJiPXE= Referer: http://swf.us-east-1.amazonaws.com/explorer/index.html Content-Length: 638 Examples API Version 2012-01-25 184 Amazon Simple Workflow Service Pragma: no-cache Cache-Control: no-cache API Reference {"taskToken": "AAAAKgAAAAEAAAAAAAAAAX9p3pcp3857oLXFUuwdxRU5/ zmn9f40XaMF7VohAH4jOtjXpZu7GdOzEi0b3cWYHbG5b5dpdcTXHUDPVMHXiUxCgr+Nc/wUW9016W4YxJGs/ jmxzPln8qLftU+SW135Q0UuKp5XRGoRTJp3tbHn2pY1vC8gDB/K69J6q668U1pd4Cd9o43// lGgOIjN0/Ihg+DO+83HNcOuVEQMM28kNMXf7yePh31M4dMKJwQaQZG13huJXDwzJOoZQz+XFuqFly +lPnCE4XvsnhfAvTsh50EtNDEtQzPCFJoUeld9g64V/FS/39PHL3M93PBUuroPyHuCwHsNC6fZ7gM/ XOKmW4kKnXPoQweEUkFV/J6E6+M1reBO7nJADTrLSnajg6MY/viWsEYmMw/ DS5FlquFaDIhFkLhWUWN+V2KqiKS23GYwpzgZ7fgcWHQF2NLEY3zrjam4LW/ UW5VLCyM3FpVD3erCTi9IvUgslPzyVGuWNAoTmgJEWvimgwiHxJMxxc9JBDR390iMmImxVl3eeSDUWx8reQltiviadPDjyRmVhYP8", "result": "customer credit card verified"} Sample Response HTTP/1.1 200 OK Content-Length: 0 Content-Type: application/json x-amzn-RequestId: 0976f0f4-3ff6-11e1-9a27-0760db01a4a8 See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS Command Line Interface • AWS SDK for .NET • AWS SDK for C++ • AWS SDK for Go v2 • AWS SDK for Java V2 • AWS SDK for JavaScript V3 • AWS SDK for Kotlin • AWS SDK for PHP V3 • AWS SDK for Python • AWS SDK for Ruby V3 See Also API Version 2012-01-25 185 Amazon Simple Workflow Service API Reference RespondActivityTaskFailed Used by workers to tell the service that the ActivityTask identified by the taskToken has failed with reason (if specified). The reason and details appear in the ActivityTaskFailed event added to the workflow history. A task is considered open from the time that it is scheduled until it is closed. Therefore a task is reported as open while a worker is processing it. A task is closed after it has been specified in a call to RespondActivityTaskCompleted, RespondActivityTaskCanceled, RespondActivityTaskFailed, or the task has timed out. 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. • You cannot use an IAM policy to constrain this action's parameters. 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 Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide. Request Syntax { "details": "string", "reason": "string", "taskToken": "string" } Request Parameters For information about the parameters that are common to all actions, see Common Parameters. The request accepts the following data in JSON format. RespondActivityTaskFailed API Version 2012-01-25 186 API Reference Amazon Simple Workflow Service details Detailed information about the failure. Type: String Length Constraints: Maximum length of 32768. Required: No reason Description of the error that may assist in diagnostics. Type: String Length Constraints: Maximum length of 256. Required: No taskToken The taskToken of the ActivityTask. Important taskToken is generated by the service and should be treated as an opaque value. If the task is passed to another process, its taskToken must also be passed. This enables it to provide its progress and respond with results. Type: String Length Constraints: Minimum length of 1. Maximum length of 1024. Required: Yes Response Elements If the action is successful, the service sends back an HTTP 200 response with an empty HTTP body. Errors For information about the errors that are common to all actions, see Common Errors. Response Elements API Version 2012-01-25 187 Amazon Simple Workflow Service OperationNotPermittedFault API Reference Returned when the caller doesn't have sufficient permissions to invoke the action. HTTP Status Code: 400 UnknownResourceFault Returned when
swf-api-041
swf-api.pdf
41
another process, its taskToken must also be passed. This enables it to provide its progress and respond with results. Type: String Length Constraints: Minimum length of 1. Maximum length of 1024. Required: Yes Response Elements If the action is successful, the service sends back an HTTP 200 response with an empty HTTP body. Errors For information about the errors that are common to all actions, see Common Errors. Response Elements API Version 2012-01-25 187 Amazon Simple Workflow Service OperationNotPermittedFault API Reference Returned when the caller doesn't have sufficient permissions to invoke the action. HTTP Status Code: 400 UnknownResourceFault Returned when the named resource cannot be found with in the scope of this operation (region or domain). This could happen if the named resource was never created or is no longer available for this operation. HTTP Status Code: 400 Examples RespondActivityTaskFailed Example This example illustrates one usage of RespondActivityTaskFailed. Sample Request POST / HTTP/1.1 Host: swf.us-east-1.amazonaws.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.25) Gecko/20111212 Firefox/3.6.25 ( .NET CLR 3.5.30729; .NET4.0E) Accept: application/json, text/javascript, */* Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 115 Connection: keep-alive Content-Type: application/x-amz-json-1.0 X-Requested-With: XMLHttpRequest X-Amz-Date: Mon, 16 Jan 2012 04:17:24 GMT X-Amz-Target: SimpleWorkflowService.RespondActivityTaskFailed Content-Encoding: amz-1.0 X-Amzn-Authorization: AWS3 AWSAccessKeyId=AKIAIOSFODNN7EXAMPLE,Algorithm=HmacSHA256,SignedHeaders=Host;X- Amz-Date;X-Amz-Target;Content-Encoding,Signature=JC+/uds/ mFEq8qca2WFs5kfp2eAEONc70IqFgHErhpc= Referer: http://swf.us-east-1.amazonaws.com/explorer/index.html Content-Length: 682 Examples API Version 2012-01-25 188 Amazon Simple Workflow Service Pragma: no-cache Cache-Control: no-cache {"taskToken": API Reference "AAAAKgAAAAEAAAAAAAAAAdG7j7YFEl9pfKdXRL3Cy3Q3c1Z8QwdOSX53bKiUV6MMGXvf3Lrinmmzj1HFFl5lcwHzEFxLbMaSZ/ lMt/RFJPumHXAnUqlYjZLODhrBqsIzDQFKcbCFMq7y4jm0EFzsV2Suv8iu/obcZ/ idU8qjd9uG/82zumG2xz1Z4IbOFwOTlpj2++5YVH4ftyycIcjlDw58r0O1vAo4PEondkqjyn +YxBxyZLy1z1fvMi0zeO8Lh16w96y6v+KdVc/ ECoez1Og8sROaXG0l8ptW5YR733LIuUBK4sxWa12egF5i4e8AV8JloojOaq0jy4iFsIscRazOSQErjo15Guz89BK2XW911P3I +X7nJjH0wwW55XGCs0jezvsEC8M6D9Ob7CgWr6RrnK3g1AKemcby2XqgQRN52DMIYxzV+lMS/ QBYKOqtkLoMY0NKeuRVwm9f1zCY00v6kxqK9m2zFvaxqlJ5/JVCWMNWEWJfQZVtC3GzMWmzeCt7Auq8A5/Caq/ DKyOhTIhY/Go00iiDA6ecP8taTYiVzb8VR5xEiQ1uCxnECkwW", "reason": "could not verify customer credit card", "details": "card number invalid"} Sample Response HTTP/1.1 200 OK Content-Length: 0 Content-Type: application/json x-amzn-RequestId: feadaedd-3ff8-11e1-9e8f-57bb03e21482 See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS Command Line Interface • AWS SDK for .NET • AWS SDK for C++ • AWS SDK for Go v2 • AWS SDK for Java V2 • AWS SDK for JavaScript V3 • AWS SDK for Kotlin • AWS SDK for PHP V3 • AWS SDK for Python • AWS SDK for Ruby V3 See Also API Version 2012-01-25 189 Amazon Simple Workflow Service API Reference RespondDecisionTaskCompleted Used by deciders to tell the service that the DecisionTask identified by the taskToken has successfully completed. The decisions argument specifies the list of decisions made while processing the task. A DecisionTaskCompleted event is added to the workflow history. The executionContext specified is attached to the event in the workflow execution history. Access Control If an IAM policy grants permission to use RespondDecisionTaskCompleted, it can express permissions for the list of decisions in the decisions parameter. Each of the decisions has one or more parameters, much like a regular API call. To allow for policies to be as readable as possible, you can express permissions on decisions as if they were actual API calls, including applying conditions to some parameters. For more information, see Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide. Request Syntax { "decisions": [ { "cancelTimerDecisionAttributes": { "timerId": "string" }, "cancelWorkflowExecutionDecisionAttributes": { "details": "string" }, "completeWorkflowExecutionDecisionAttributes": { "result": "string" }, "continueAsNewWorkflowExecutionDecisionAttributes": { "childPolicy": "string", "executionStartToCloseTimeout": "string", "input": "string", "lambdaRole": "string", "tagList": [ "string" ], "taskList": { "name": "string" }, "taskPriority": "string", RespondDecisionTaskCompleted API Version 2012-01-25 190 Amazon Simple Workflow Service API Reference "taskStartToCloseTimeout": "string", "workflowTypeVersion": "string" }, "decisionType": "string", "failWorkflowExecutionDecisionAttributes": { "details": "string", "reason": "string" }, "recordMarkerDecisionAttributes": { "details": "string", "markerName": "string" }, "requestCancelActivityTaskDecisionAttributes": { "activityId": "string" }, "requestCancelExternalWorkflowExecutionDecisionAttributes": { "control": "string", "runId": "string", "workflowId": "string" }, "scheduleActivityTaskDecisionAttributes": { "activityId": "string", "activityType": { "name": "string", "version": "string" }, "control": "string", "heartbeatTimeout": "string", "input": "string", "scheduleToCloseTimeout": "string", "scheduleToStartTimeout": "string", "startToCloseTimeout": "string", "taskList": { "name": "string" }, "taskPriority": "string" }, "scheduleLambdaFunctionDecisionAttributes": { "control": "string", "id": "string", "input": "string", "name": "string", "startToCloseTimeout": "string" }, Request Syntax API Version 2012-01-25 191 Amazon Simple Workflow Service API Reference "signalExternalWorkflowExecutionDecisionAttributes": { "control": "string", "input": "string", "runId": "string", "signalName": "string", "workflowId": "string" }, "startChildWorkflowExecutionDecisionAttributes": { "childPolicy": "string", "control": "string", "executionStartToCloseTimeout": "string", "input": "string", "lambdaRole": "string", "tagList": [ "string" ], "taskList": { "name": "string" }, "taskPriority": "string", "taskStartToCloseTimeout": "string", "workflowId": "string", "workflowType": { "name": "string", "version": "string" } }, "startTimerDecisionAttributes": { "control": "string", "startToFireTimeout": "string", "timerId": "string" } } ], "executionContext": "string", "taskList": { "name": "string" }, "taskListScheduleToStartTimeout": "string", "taskToken": "string" } Request Parameters For information about the parameters that are common to all actions, see Common Parameters. Request Parameters API Version 2012-01-25 192 Amazon Simple Workflow Service API Reference The request accepts the following data in JSON format. decisions The list of decisions (possibly empty) made by the decider while processing this decision task. See the docs for the Decision structure for details. Type: Array of Decision objects Required: No executionContext User defined context to add to workflow execution. Type: String Length Constraints: Maximum length of 32768. Required: No taskList The task list to use for the future decision tasks of this workflow execution. This
swf-api-042
swf-api.pdf
42
about the parameters that are common to all actions, see Common Parameters. Request Parameters API Version 2012-01-25 192 Amazon Simple Workflow Service API Reference The request accepts the following data in JSON format. decisions The list of decisions (possibly empty) made by the decider while processing this decision task. See the docs for the Decision structure for details. Type: Array of Decision objects Required: No executionContext User defined context to add to workflow execution. Type: String Length Constraints: Maximum length of 32768. Required: No taskList The task list to use for the future decision tasks of this workflow execution. This list overrides the original task list you specified while starting the workflow execution. Type: TaskList object Required: No taskListScheduleToStartTimeout Specifies a timeout (in seconds) for the task list override. When this parameter is missing, the task list override is permanent. This parameter makes it possible to temporarily override the task list. If a decision task scheduled on the override task list is not started within the timeout, the decision task will time out. Amazon SWF will revert the override and schedule a new decision task to the original task list. If a decision task scheduled on the override task list is started within the timeout, but not completed within the start-to-close timeout, Amazon SWF will also revert the override and schedule a new decision task to the original task list. Type: String Request Parameters API Version 2012-01-25 193 Amazon Simple Workflow Service API Reference Length Constraints: Maximum length of 8. Required: No taskToken The taskToken from the DecisionTask. Important taskToken is generated by the service and should be treated as an opaque value. If the task is passed to another process, its taskToken must also be passed. This enables it to provide its progress and respond with results. Type: String Length Constraints: Minimum length of 1. Maximum length of 1024. Required: Yes Response Elements If the action is successful, the service sends back an HTTP 200 response with an empty HTTP body. Errors For information about the errors that are common to all actions, see Common Errors. OperationNotPermittedFault Returned when the caller doesn't have sufficient permissions to invoke the action. HTTP Status Code: 400 UnknownResourceFault Returned when the named resource cannot be found with in the scope of this operation (region or domain). This could happen if the named resource was never created or is no longer available for this operation. HTTP Status Code: 400 Response Elements API Version 2012-01-25 194 Amazon Simple Workflow Service Examples API Reference RespondDecisionTaskCompleted Example This example illustrates one usage of RespondDecisionTaskCompleted. Sample Request POST / HTTP/1.1 Host: swf.us-east-1.amazonaws.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.25) Gecko/20111212 Firefox/3.6.25 ( .NET CLR 3.5.30729; .NET4.0E) Accept: application/json, text/javascript, */* Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 115 Connection: keep-alive Content-Type: application/x-amz-json-1.0 X-Requested-With: XMLHttpRequest X-Amz-Date: Sun, 15 Jan 2012 23:31:06 GMT X-Amz-Target: SimpleWorkflowService.RespondDecisionTaskCompleted Content-Encoding: amz-1.0 X-Amzn-Authorization: AWS3 AWSAccessKeyId=AKIAIOSFODNN7EXAMPLE,Algorithm=HmacSHA256,SignedHeaders=Host;X- Amz-Date;X-Amz-Target;Content-Encoding,Signature=FL4ouCb8n6j5egcKOXoa +5Vctc8WmA91B2ekKnks2J8= Referer: http://swf.us-east-1.amazonaws.com/explorer/index.html Content-Length: 1184 Pragma: no-cache Cache-Control: no-cache { "executionContext": "Black Friday", "decisions": [ { "scheduleActivityTaskDecisionAttributes": { "control": "digital music", "taskList": { "name": "specialTaskList" }, "scheduleToCloseTimeout": "900", "activityType": { Examples API Version 2012-01-25 195 Amazon Simple Workflow Service API Reference "version": "1.0", "name": "activityVerify" }, "heartbeatTimeout": "120", "activityId": "verification-27", "scheduleToStartTimeout": "300", "startToCloseTimeout": "600", "taskPriority": "100", "input": "5634-0056-4367-0923,12/12,437" }, "decisionType": "ScheduleActivityTask" } ], "taskToken": "AAAAKgAAAAEAAAAAAAAAAQLPoqDSLcx4ksNCEQZCyEBqpKhE +FgFSOvHd9zlCROacKYHh640MkANx2y9YM3CQnec0kEb1oRvB6DxKesTY3U/ UQhvBqPY7E4BYE6hkDj/NmSbt9EwEJ/a+WD+oc2sDNfeVz2x+6wjb5vQdFKwBoQ6MDWLFbAhcgK +ymoRjoBHrPsrNLX3IA6sQaPmQRZQs3FRZonoVzP6uXMCZPnCZQULFjU1kTM8VHzH7ywqWKVmmdvnqyREOCT9VqmYbhLntJXsDj +scAvuNy17MCX9M9AJ7V/5qrLCeYdWA4FBQgY4Ew6IC+dge/UZdVMmpW/uB7nvSk6owQIhapPh5pEUwwY/ yNnoVLTiPOz9KzZlANyw7uDchBRLvUJORFtpP9ZQIouNP8QOvFWm7Idc50ahwGEdTCiG +KDXV8kAzx7wKHs7l1TXYkC15x0h3XPH0MdLeEjipv98EpZaMIVtgGSdRjluOjNWEL2zowZByitleI5bdvxZdgalAXXKEnbYE6/ rfLGReAJKdh2n0dmTMI+tK7uuxIWX6F4ocqSI1Xb2x5zZ" } Sample Response HTTP/1.1 200 OK Content-Length: 0 Content-Type: application/json x-amzn-RequestId: feef79b5-3fd0-11e1-9a27-0760db01a4a8 See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS Command Line Interface • AWS SDK for .NET • AWS SDK for C++ • AWS SDK for Go v2 • AWS SDK for Java V2 See Also API Version 2012-01-25 196 Amazon Simple Workflow Service • AWS SDK for JavaScript V3 • AWS SDK for Kotlin • AWS SDK for PHP V3 • AWS SDK for Python • AWS SDK for Ruby V3 API Reference See Also API Version 2012-01-25 197 Amazon Simple Workflow Service API Reference SignalWorkflowExecution Records a WorkflowExecutionSignaled event in the workflow execution history and creates a decision task for the workflow execution identified by the given domain, workflowId and runId. The event is recorded with the specified user defined signalName and input (if provided). Note If a runId isn't specified, then the WorkflowExecutionSignaled event is recorded in the history of the current open workflow with the matching workflowId in the domain. Note If the specified workflow execution isn't open, this method fails with UnknownResource. 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. • You cannot use an
swf-api-043
swf-api.pdf
43
defined signalName and input (if provided). Note If a runId isn't specified, then the WorkflowExecutionSignaled event is recorded in the history of the current open workflow with the matching workflowId in the domain. Note If the specified workflow execution isn't open, this method fails with UnknownResource. 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. • You cannot use an IAM policy to constrain this action's parameters. 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 Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide. Request Syntax { "domain": "string", "input": "string", "runId": "string", "signalName": "string", "workflowId": "string" SignalWorkflowExecution API Version 2012-01-25 198 Amazon Simple Workflow Service } Request Parameters API Reference For information about the parameters that are common to all actions, see Common Parameters. The request accepts the following data in JSON format. domain The name of the domain containing the workflow execution to signal. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes input Data to attach to the WorkflowExecutionSignaled event in the target workflow execution's history. Type: String Length Constraints: Maximum length of 32768. Required: No runId The runId of the workflow execution to signal. Type: String Length Constraints: Maximum length of 64. Required: No signalName The name of the signal. This name must be meaningful to the target workflow. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Request Parameters API Version 2012-01-25 199 API Reference Amazon Simple Workflow Service Required: Yes workflowId The workflowId of the workflow execution to signal. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes Response Elements If the action is successful, the service sends back an HTTP 200 response with an empty HTTP body. Errors For information about the errors that are common to all actions, see Common Errors. OperationNotPermittedFault Returned when the caller doesn't have sufficient permissions to invoke the action. HTTP Status Code: 400 UnknownResourceFault Returned when the named resource cannot be found with in the scope of this operation (region or domain). This could happen if the named resource was never created or is no longer available for this operation. HTTP Status Code: 400 Examples SignalWorkflowExecution Example This example illustrates one usage of SignalWorkflowExecution. Sample Request POST / HTTP/1.1 Response Elements API Version 2012-01-25 200 Amazon Simple Workflow Service API Reference Host: swf.us-east-1.amazonaws.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.25) Gecko/20111212 Firefox/3.6.25 ( .NET CLR 3.5.30729; .NET4.0E) Accept: application/json, text/javascript, */* Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 115 Connection: keep-alive Content-Type: application/x-amz-json-1.0 X-Requested-With: XMLHttpRequest X-Amz-Date: Sun, 15 Jan 2012 00:06:18 GMT X-Amz-Target: SimpleWorkflowService.SignalWorkflowExecution Content-Encoding: amz-1.0 X-Amzn-Authorization: AWS3 AWSAccessKeyId=AKIAIOSFODNN7EXAMPLE,Algorithm=HmacSHA256,SignedHeaders=Host;X-Amz- Date;X-Amz-Target;Content-Encoding,Signature=lQpBZezK7JNQrXeWuJE+l7S0ZwjOEONCeRyImoyfX +E= Referer: http://swf.us-east-1.amazonaws.com/explorer/index.html Content-Length: 162 Pragma: no-cache Cache-Control: no-cache {"domain": "867530901", "workflowId": "20110927-T-1", "runId": "f5ebbac6-941c-4342-ad69-dfd2f8be6689", "signalName": "CancelOrder", "input": "order 3553"} Sample Response HTTP/1.1 200 OK Content-Length: 0 Content-Type: application/json x-amzn-RequestId: bf78ae15-3f0c-11e1-9914-a356b6ea8bdf See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS Command Line Interface See Also API Version 2012-01-25 201 API Reference Amazon Simple Workflow Service • AWS SDK for .NET • AWS SDK for C++ • AWS SDK for Go v2 • AWS SDK for Java V2 • AWS SDK for JavaScript V3 • AWS SDK for Kotlin • AWS SDK for PHP V3 • AWS SDK for Python • AWS SDK for Ruby V3 See Also API Version 2012-01-25 202 Amazon Simple Workflow Service API Reference StartWorkflowExecution Starts an execution of the workflow type in the specified domain using the provided workflowId and input data. This action returns the newly started workflow execution. 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. • tagList.member.0: The key is swf:tagList.member.0. • tagList.member.1: The key is swf:tagList.member.1. • tagList.member.2: The key is swf:tagList.member.2. • tagList.member.3: The key is swf:tagList.member.3. • tagList.member.4: The key is swf:tagList.member.4. • taskList: String constraint. The key is swf:taskList.name. • workflowType.name: String constraint. The key is swf:workflowType.name. • workflowType.version: String constraint. The key is swf:workflowType.version. If the caller doesn't have sufficient permissions to invoke the action,
swf-api-044
swf-api.pdf
44
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. • tagList.member.0: The key is swf:tagList.member.0. • tagList.member.1: The key is swf:tagList.member.1. • tagList.member.2: The key is swf:tagList.member.2. • tagList.member.3: The key is swf:tagList.member.3. • tagList.member.4: The key is swf:tagList.member.4. • taskList: String constraint. The key is swf:taskList.name. • workflowType.name: String constraint. The key is swf:workflowType.name. • workflowType.version: String constraint. The key is swf:workflowType.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 Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide. Request Syntax { "childPolicy": "string", "domain": "string", "executionStartToCloseTimeout": "string", "input": "string", "lambdaRole": "string", "tagList": [ "string" ], StartWorkflowExecution API Version 2012-01-25 203 API Reference Amazon Simple Workflow Service "taskList": { "name": "string" }, "taskPriority": "string", "taskStartToCloseTimeout": "string", "workflowId": "string", "workflowType": { "name": "string", "version": "string" } } Request Parameters For information about the parameters that are common to all actions, see Common Parameters. The request accepts the following data in JSON format. childPolicy If set, specifies the policy to use for the child workflow executions of this workflow execution if it is terminated, by calling the TerminateWorkflowExecution action explicitly or due to an expired timeout. This policy overrides the default child policy specified when registering the workflow type using RegisterWorkflowType. 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. Note A child policy for this workflow execution must be specified either as a default for the workflow type or through this parameter. If neither this parameter is set nor a default child policy was specified at registration time then a fault is returned. Type: String Request Parameters API Version 2012-01-25 204 Amazon Simple Workflow Service API Reference Valid Values: TERMINATE | REQUEST_CANCEL | ABANDON Required: No domain The name of the domain in which the workflow execution is created. The specified string 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. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes executionStartToCloseTimeout The total duration for this workflow execution. This overrides the defaultExecutionStartToCloseTimeout specified when registering the workflow type. The duration is specified in seconds; an integer greater than or equal to 0. Exceeding this limit causes the workflow execution to time out. Unlike some of the other timeout parameters in Amazon SWF, you cannot specify a value of "NONE" for this timeout; there is a one-year max limit on the time that a workflow execution can run. Note An execution start-to-close timeout must be specified either through this parameter or as a default when the workflow type is registered. If neither this parameter nor a default execution start-to-close timeout is specified, a fault is returned. Type: String Length Constraints: Maximum length of 8. Required: No input The input for the workflow execution. This is a free form string which should be meaningful to the workflow you are starting. This input is made available to the new workflow execution in the WorkflowExecutionStarted history event. Request Parameters API Version 2012-01-25 205 Amazon Simple Workflow Service Type: String Length Constraints: Maximum length of 32768. Required: No lambdaRole The IAM role to attach to this workflow execution. API Reference Note Executions of this workflow type need IAM roles to invoke Lambda functions. If you don't attach an IAM role, any attempt to schedule a Lambda task fails. This results in a ScheduleLambdaFunctionFailed history event. For more information, see https:// docs.aws.amazon.com/amazonswf/latest/developerguide/lambda-task.html in the Amazon SWF Developer Guide. Type: String Length Constraints: Minimum length of 1. Maximum length of 1600. Required: No tagList The list of tags to associate with the workflow execution. You can specify a maximum of 5 tags. You can list workflow executions with a specific tag by calling ListOpenWorkflowExecutions or ListClosedWorkflowExecutions and specifying a TagFilter. Type: Array of strings Array Members: Maximum number of 5 items. Length Constraints: Minimum length of 0. Maximum length of 256. Required: No taskList The task list to use for the decision tasks generated for this workflow execution. This overrides the defaultTaskList specified when registering the workflow type. Request Parameters API Version 2012-01-25
swf-api-045
swf-api.pdf
45
Minimum length of 1. Maximum length of 1600. Required: No tagList The list of tags to associate with the workflow execution. You can specify a maximum of 5 tags. You can list workflow executions with a specific tag by calling ListOpenWorkflowExecutions or ListClosedWorkflowExecutions and specifying a TagFilter. Type: Array of strings Array Members: Maximum number of 5 items. Length Constraints: Minimum length of 0. Maximum length of 256. Required: No taskList The task list to use for the decision tasks generated for this workflow execution. This overrides the defaultTaskList specified when registering the workflow type. Request Parameters API Version 2012-01-25 206 Amazon Simple Workflow Service API Reference Note A task list for this workflow execution must be specified either as a default for the workflow type or through this parameter. If neither this parameter is set nor a default task list was specified at registration time then a fault is returned. The specified string 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. Type: TaskList object Required: No taskPriority The task priority to use for this workflow execution. This overrides any default priority that was assigned when the workflow type was registered. If not set, then the default task priority for the workflow type 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. Type: String Required: No taskStartToCloseTimeout Specifies the maximum duration of decision tasks for this workflow execution. This parameter overrides the defaultTaskStartToCloseTimout specified when registering the workflow type using RegisterWorkflowType. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration. Note A task start-to-close timeout for this workflow execution must be specified either as a default for the workflow type or through this parameter. If neither this parameter is set Request Parameters API Version 2012-01-25 207 Amazon Simple Workflow Service API Reference nor a default task start-to-close timeout was specified at registration time then a fault is returned. Type: String Length Constraints: Maximum length of 8. Required: No workflowId The user defined identifier associated with the workflow execution. You can use this to associate a custom identifier with the workflow execution. You may specify the same identifier if a workflow execution is logically a restart of a previous execution. You cannot have two open workflow executions with the same workflowId at the same time within the same domain. The specified string 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. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes workflowType The type of the workflow to start. Type: WorkflowType object Required: Yes Response Syntax { "runId": "string" } Response Elements If the action is successful, the service sends back an HTTP 200 response. Response Syntax API Version 2012-01-25 208 Amazon Simple Workflow Service API Reference The following data is returned in JSON format by the service. runId The runId of a workflow execution. This ID is generated by the service and can be used to uniquely identify the workflow execution within a domain. Type: String Length Constraints: Minimum length of 1. Maximum length of 64. Errors For information about the errors that are common to all actions, see Common Errors. DefaultUndefinedFault The StartWorkflowExecution API action was called without the required parameters set. Some workflow execution parameters, such as the decision taskList, must be set to start the execution. However, these parameters might have been set as defaults when the workflow type was registered. In this case, you can omit these parameters from the StartWorkflowExecution call and Amazon SWF uses the values defined in the workflow type. Note If these parameters aren't set and no default parameters were defined in the workflow type, this error is displayed. HTTP Status Code: 400 LimitExceededFault Returned by any operation if a system imposed limitation has been reached. To address this fault you should either clean up unused resources or increase the limit by contacting AWS. HTTP Status Code: 400 OperationNotPermittedFault Returned when the caller doesn't have sufficient permissions to invoke the action. Errors API Version 2012-01-25 209 Amazon Simple Workflow Service HTTP Status Code: 400 TypeDeprecatedFault API Reference Returned when the specified activity or workflow type was already deprecated. HTTP Status Code: 400 UnknownResourceFault Returned when the named resource cannot be found with in the scope of this operation (region or domain). This could happen if the named resource was never created or is no longer available for this operation. HTTP
swf-api-046
swf-api.pdf
46
you should either clean up unused resources or increase the limit by contacting AWS. HTTP Status Code: 400 OperationNotPermittedFault Returned when the caller doesn't have sufficient permissions to invoke the action. Errors API Version 2012-01-25 209 Amazon Simple Workflow Service HTTP Status Code: 400 TypeDeprecatedFault API Reference Returned when the specified activity or workflow type was already deprecated. HTTP Status Code: 400 UnknownResourceFault Returned when the named resource cannot be found with in the scope of this operation (region or domain). This could happen if the named resource was never created or is no longer available for this operation. HTTP Status Code: 400 WorkflowExecutionAlreadyStartedFault Returned by StartWorkflowExecution when an open execution with the same workflowId is already running in the specified domain. HTTP Status Code: 400 Examples StartWorkflowExecution Example This example illustrates one usage of StartWorkflowExecution. Sample Request POST / HTTP/1.1 Host: swf.us-east-1.amazonaws.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.25) Gecko/20111212 Firefox/3.6.25 ( .NET CLR 3.5.30729; .NET4.0E) Accept: application/json, text/javascript, */* Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 115 Connection: keep-alive Content-Type: application/x-amz-json-1.0 X-Requested-With: XMLHttpRequest X-Amz-Date: Sat, 14 Jan 2012 22:45:13 GMT Examples API Version 2012-01-25 210 Amazon Simple Workflow Service API Reference X-Amz-Target: SimpleWorkflowService.StartWorkflowExecution Content-Encoding: amz-1.0 X-Amzn-Authorization: AWS3 AWSAccessKeyId=AKIAIOSFODNN7EXAMPLE,Algorithm=HmacSHA256,SignedHeaders=Host;X- Amz-Date;X-Amz-Target;Content-Encoding,Signature=aYxuqLX+TO91kPVg+jh +aA8PWxQazQRN2+SZUGdOgU0= Referer: http://swf.us-east-1.amazonaws.com/explorer/index.html Content-Length: 417 Pragma: no-cache Cache-Control: no-cache { "domain": "867530901", "taskList": { "name": "specialTaskList" }, "taskPriority": "100", "taskStartToCloseTimeout": "600", "workflowId": "20110927-T-1", "childPolicy": "TERMINATE", "executionStartToCloseTimeout": "1800", "input": "arbitrary-string-that-is-meaningful-to-the-workflow", "workflowType": { "version": "1.0", "name": "customerOrderWorkflow" }, "tagList": [ "music purchase", "digital", "ricoh-the-dog" ] } Sample Response HTTP/1.1 200 OK Content-Length: 48 Content-Type: application/json x-amzn-RequestId: 6c25f6e6-3f01-11e1-9a27-0760db01a4a8 { "runId": "1e536162-f1ea-48b0-85f3-aade88eef2f7" } Examples API Version 2012-01-25 211 Amazon Simple Workflow Service See Also API Reference For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS Command Line Interface • AWS SDK for .NET • AWS SDK for C++ • AWS SDK for Go v2 • AWS SDK for Java V2 • AWS SDK for JavaScript V3 • AWS SDK for Kotlin • AWS SDK for PHP V3 • AWS SDK for Python • AWS SDK for Ruby V3 See Also API Version 2012-01-25 212 Amazon Simple Workflow Service TagResource Add a tag to a Amazon SWF domain. Note Amazon SWF supports a maximum of 50 tags per resource. API Reference Request Syntax { "resourceArn": "string", "tags": [ { "key": "string", "value": "string" } ] } Request Parameters For information about the parameters that are common to all actions, see Common Parameters. The request accepts the following data in JSON format. resourceArn The Amazon Resource Name (ARN) for the Amazon SWF domain. Type: String Length Constraints: Minimum length of 1. Maximum length of 1600. Required: Yes tags The list of tags to add to a domain. Tags may only contain unicode letters, digits, whitespace, or these symbols: _ . : / = + - @. TagResource API Version 2012-01-25 213 Amazon Simple Workflow Service API Reference Type: Array of ResourceTag objects Required: Yes Response Elements If the action is successful, the service sends back an HTTP 200 response with an empty HTTP body. Errors For information about the errors that are common to all actions, see Common Errors. LimitExceededFault Returned by any operation if a system imposed limitation has been reached. To address this fault you should either clean up unused resources or increase the limit by contacting AWS. HTTP Status Code: 400 OperationNotPermittedFault Returned when the caller doesn't have sufficient permissions to invoke the action. HTTP Status Code: 400 TooManyTagsFault You've exceeded the number of tags allowed for a domain. HTTP Status Code: 400 UnknownResourceFault Returned when the named resource cannot be found with in the scope of this operation (region or domain). This could happen if the named resource was never created or is no longer available for this operation. HTTP Status Code: 400 See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: Response Elements API Version 2012-01-25 214 API Reference Amazon Simple Workflow Service • AWS Command Line Interface • AWS SDK for .NET • AWS SDK for C++ • AWS SDK for Go v2 • AWS SDK for Java V2 • AWS SDK for JavaScript V3 • AWS SDK for Kotlin • AWS SDK for PHP V3 • AWS SDK for Python • AWS SDK for Ruby V3 See Also API Version 2012-01-25 215 Amazon Simple Workflow Service API Reference TerminateWorkflowExecution Records a WorkflowExecutionTerminated event and forces closure of the workflow execution identified by the given domain, runId, and workflowId. The child policy, registered with the workflow type or specified when starting this execution, is applied to any open child workflow executions of this workflow execution. Important If the identified workflow execution was in progress, it is terminated immediately. Note If a runId isn't specified, then the WorkflowExecutionTerminated
swf-api-047
swf-api.pdf
47
SDK for Kotlin • AWS SDK for PHP V3 • AWS SDK for Python • AWS SDK for Ruby V3 See Also API Version 2012-01-25 215 Amazon Simple Workflow Service API Reference TerminateWorkflowExecution Records a WorkflowExecutionTerminated event and forces closure of the workflow execution identified by the given domain, runId, and workflowId. The child policy, registered with the workflow type or specified when starting this execution, is applied to any open child workflow executions of this workflow execution. Important If the identified workflow execution was in progress, it is terminated immediately. Note If a runId isn't specified, then the WorkflowExecutionTerminated event is recorded in the history of the current open workflow with the matching workflowId in the domain. Note You should consider using RequestCancelWorkflowExecution action instead because it allows the workflow to gracefully close while TerminateWorkflowExecution doesn't. 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. • You cannot use an IAM policy to constrain this action's parameters. 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 Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide. TerminateWorkflowExecution API Version 2012-01-25 216 API Reference Amazon Simple Workflow Service Request Syntax { "childPolicy": "string", "details": "string", "domain": "string", "reason": "string", "runId": "string", "workflowId": "string" } Request Parameters For information about the parameters that are common to all actions, see Common Parameters. The request accepts the following data in JSON format. childPolicy If set, specifies the policy to use for the child workflow executions of the workflow execution being terminated. This policy overrides the child policy specified for the workflow execution at registration time or when starting the execution. 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. Note A child policy for this workflow execution must be specified either as a default for the workflow type or through this parameter. If neither this parameter is set nor a default child policy was specified at registration time then a fault is returned. Type: String Request Syntax API Version 2012-01-25 217 Amazon Simple Workflow Service API Reference Valid Values: TERMINATE | REQUEST_CANCEL | ABANDON Required: No details Details for terminating the workflow execution. Type: String Length Constraints: Maximum length of 32768. Required: No domain The domain of the workflow execution to terminate. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes reason A descriptive reason for terminating the workflow execution. Type: String Length Constraints: Maximum length of 256. Required: No runId The runId of the workflow execution to terminate. Type: String Length Constraints: Maximum length of 64. Required: No workflowId The workflowId of the workflow execution to terminate. Request Parameters API Version 2012-01-25 218 Amazon Simple Workflow Service Type: String API Reference Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes Response Elements If the action is successful, the service sends back an HTTP 200 response with an empty HTTP body. Errors For information about the errors that are common to all actions, see Common Errors. OperationNotPermittedFault Returned when the caller doesn't have sufficient permissions to invoke the action. HTTP Status Code: 400 UnknownResourceFault Returned when the named resource cannot be found with in the scope of this operation (region or domain). This could happen if the named resource was never created or is no longer available for this operation. HTTP Status Code: 400 Examples TerminateWorkflowExecution Example This example illustrates one usage of TerminateWorkflowExecution. Sample Request POST / HTTP/1.1 Host: swf.us-east-1.amazonaws.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.25) Gecko/20111212 Firefox/3.6.25 ( .NET CLR 3.5.30729; .NET4.0E) Accept: application/json, text/javascript, */* Accept-Language: en-us,en;q=0.5 Response Elements API Version 2012-01-25 219 Amazon Simple Workflow Service API Reference Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 115 Connection: keep-alive Content-Type: application/x-amz-json-1.0 X-Requested-With: XMLHttpRequest X-Amz-Date: Mon, 16 Jan 2012 04:56:34 GMT X-Amz-Target: SimpleWorkflowService.TerminateWorkflowExecution Content-Encoding: amz-1.0 X-Amzn-Authorization: AWS3 AWSAccessKeyId=AKIAIOSFODNN7EXAMPLE,Algorithm=HmacSHA256,SignedHeaders=Host;X- Amz-Date;X-Amz-Target;Content-Encoding,Signature=JHMRAjN6JGPawEuhiANHfiCil9KOGfDF/ cuXYmuu9S4= Referer: http://swf.us-east-1.amazonaws.com/explorer/index.html Content-Length: 218 Pragma: no-cache Cache-Control: no-cache {"domain": "867530901", "workflowId": "20110927-T-1", "runId": "94861fda-a714-4126-95d7-55ba847da8ab", "reason": "transaction canceled", "details": "customer credit card declined", "childPolicy": "TERMINATE"} Sample Response HTTP/1.1 200 OK Content-Length: 0 Content-Type: application/json x-amzn-RequestId: 76d68a47-3ffe-11e1-b118-3bfa5e8e7fc3 See Also For more
swf-api-048
swf-api.pdf
48
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.25) Gecko/20111212 Firefox/3.6.25 ( .NET CLR 3.5.30729; .NET4.0E) Accept: application/json, text/javascript, */* Accept-Language: en-us,en;q=0.5 Response Elements API Version 2012-01-25 219 Amazon Simple Workflow Service API Reference Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 115 Connection: keep-alive Content-Type: application/x-amz-json-1.0 X-Requested-With: XMLHttpRequest X-Amz-Date: Mon, 16 Jan 2012 04:56:34 GMT X-Amz-Target: SimpleWorkflowService.TerminateWorkflowExecution Content-Encoding: amz-1.0 X-Amzn-Authorization: AWS3 AWSAccessKeyId=AKIAIOSFODNN7EXAMPLE,Algorithm=HmacSHA256,SignedHeaders=Host;X- Amz-Date;X-Amz-Target;Content-Encoding,Signature=JHMRAjN6JGPawEuhiANHfiCil9KOGfDF/ cuXYmuu9S4= Referer: http://swf.us-east-1.amazonaws.com/explorer/index.html Content-Length: 218 Pragma: no-cache Cache-Control: no-cache {"domain": "867530901", "workflowId": "20110927-T-1", "runId": "94861fda-a714-4126-95d7-55ba847da8ab", "reason": "transaction canceled", "details": "customer credit card declined", "childPolicy": "TERMINATE"} Sample Response HTTP/1.1 200 OK Content-Length: 0 Content-Type: application/json x-amzn-RequestId: 76d68a47-3ffe-11e1-b118-3bfa5e8e7fc3 See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS Command Line Interface • AWS SDK for .NET • AWS SDK for C++ • AWS SDK for Go v2 See Also API Version 2012-01-25 220 Amazon Simple Workflow Service • AWS SDK for Java V2 • AWS SDK for JavaScript V3 • AWS SDK for Kotlin • AWS SDK for PHP V3 • AWS SDK for Python • AWS SDK for Ruby V3 API Reference See Also API Version 2012-01-25 221 Amazon Simple Workflow Service API Reference UndeprecateActivityType Undeprecates a previously deprecated activity type. After an activity type has been undeprecated, you can create new tasks of that activity type. Note This operation is eventually consistent. The results are best effort and may not exactly reflect recent updates and changes. 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. • activityType.name: String constraint. The key is swf:activityType.name. • activityType.version: String constraint. The key is swf:activityType.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 Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide. Request Syntax { "activityType": { "name": "string", "version": "string" }, "domain": "string" } UndeprecateActivityType API Version 2012-01-25 222 Amazon Simple Workflow Service Request Parameters API Reference For information about the parameters that are common to all actions, see Common Parameters. The request accepts the following data in JSON format. activityType The activity type to undeprecate. Type: ActivityType object Required: Yes domain The name of the domain of the deprecated activity type. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes Response Elements If the action is successful, the service sends back an HTTP 200 response with an empty HTTP body. Errors For information about the errors that are common to all actions, see Common Errors. OperationNotPermittedFault Returned when the caller doesn't have sufficient permissions to invoke the action. HTTP Status Code: 400 TypeAlreadyExistsFault Returned if the type already exists in the specified domain. You may get this fault if you are registering a type that is either already registered or deprecated, or if you undeprecate a type that is currently registered. Request Parameters API Version 2012-01-25 223 Amazon Simple Workflow Service HTTP Status Code: 400 UnknownResourceFault API Reference Returned when the named resource cannot be found with in the scope of this operation (region or domain). This could happen if the named resource was never created or is no longer available for this operation. HTTP Status Code: 400 See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS Command Line Interface • AWS SDK for .NET • AWS SDK for C++ • AWS SDK for Go v2 • AWS SDK for Java V2 • AWS SDK for JavaScript V3 • AWS SDK for Kotlin • AWS SDK for PHP V3 • AWS SDK for Python • AWS SDK for Ruby V3 See Also API Version 2012-01-25 224 Amazon Simple Workflow Service API Reference UndeprecateDomain Undeprecates a previously deprecated domain. After a domain has been undeprecated it can be used to create new workflow executions or register new types. Note This operation is eventually consistent. The results are best effort and may not exactly reflect recent updates and changes. 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. • You cannot use an IAM policy to constrain this action's parameters. If the caller doesn't
swf-api-049
swf-api.pdf
49
been undeprecated it can be used to create new workflow executions or register new types. Note This operation is eventually consistent. The results are best effort and may not exactly reflect recent updates and changes. 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. • You cannot use an IAM policy to constrain this action's parameters. 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 Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide. Request Syntax { "name": "string" } Request Parameters For information about the parameters that are common to all actions, see Common Parameters. The request accepts the following data in JSON format. name The name of the domain of the deprecated workflow type. UndeprecateDomain API Version 2012-01-25 225 Amazon Simple Workflow Service Type: String API Reference Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes Response Elements If the action is successful, the service sends back an HTTP 200 response with an empty HTTP body. Errors For information about the errors that are common to all actions, see Common Errors. DomainAlreadyExistsFault Returned if the domain already exists. You may get this fault if you are registering a domain that is either already registered or deprecated, or if you undeprecate a domain that is currently registered. HTTP Status Code: 400 OperationNotPermittedFault Returned when the caller doesn't have sufficient permissions to invoke the action. HTTP Status Code: 400 UnknownResourceFault Returned when the named resource cannot be found with in the scope of this operation (region or domain). This could happen if the named resource was never created or is no longer available for this operation. HTTP Status Code: 400 See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS Command Line Interface Response Elements API Version 2012-01-25 226 API Reference Amazon Simple Workflow Service • AWS SDK for .NET • AWS SDK for C++ • AWS SDK for Go v2 • AWS SDK for Java V2 • AWS SDK for JavaScript V3 • AWS SDK for Kotlin • AWS SDK for PHP V3 • AWS SDK for Python • AWS SDK for Ruby V3 See Also API Version 2012-01-25 227 Amazon Simple Workflow Service API Reference UndeprecateWorkflowType Undeprecates a previously deprecated workflow type. After a workflow type has been undeprecated, you can create new executions of that type. Note This operation is eventually consistent. The results are best effort and may not exactly reflect recent updates and changes. 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. • workflowType.name: String constraint. The key is swf:workflowType.name. • workflowType.version: String constraint. The key is swf:workflowType.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 Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide. Request Syntax { "domain": "string", "workflowType": { "name": "string", "version": "string" } } UndeprecateWorkflowType API Version 2012-01-25 228 Amazon Simple Workflow Service Request Parameters API Reference For information about the parameters that are common to all actions, see Common Parameters. The request accepts the following data in JSON format. domain The name of the domain of the deprecated workflow type. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes workflowType The name of the domain of the deprecated workflow type. Type: WorkflowType object Required: Yes Response Elements If the action is successful, the service sends back an HTTP 200 response with an empty HTTP body. Errors For information about the errors that are common to all actions, see Common Errors. OperationNotPermittedFault Returned when the caller doesn't have sufficient permissions to invoke the action. HTTP Status Code: 400 TypeAlreadyExistsFault Returned if the type already exists in the specified domain. You may get this fault if you are registering a type that is either already registered or deprecated, or if you undeprecate a
swf-api-050
swf-api.pdf
50
name of the domain of the deprecated workflow type. Type: WorkflowType object Required: Yes Response Elements If the action is successful, the service sends back an HTTP 200 response with an empty HTTP body. Errors For information about the errors that are common to all actions, see Common Errors. OperationNotPermittedFault Returned when the caller doesn't have sufficient permissions to invoke the action. HTTP Status Code: 400 TypeAlreadyExistsFault Returned if the type already exists in the specified domain. You may get this fault if you are registering a type that is either already registered or deprecated, or if you undeprecate a type that is currently registered. Request Parameters API Version 2012-01-25 229 Amazon Simple Workflow Service HTTP Status Code: 400 UnknownResourceFault API Reference Returned when the named resource cannot be found with in the scope of this operation (region or domain). This could happen if the named resource was never created or is no longer available for this operation. HTTP Status Code: 400 See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS Command Line Interface • AWS SDK for .NET • AWS SDK for C++ • AWS SDK for Go v2 • AWS SDK for Java V2 • AWS SDK for JavaScript V3 • AWS SDK for Kotlin • AWS SDK for PHP V3 • AWS SDK for Python • AWS SDK for Ruby V3 See Also API Version 2012-01-25 230 API Reference Amazon Simple Workflow Service UntagResource Remove a tag from a Amazon SWF domain. Request Syntax { "resourceArn": "string", "tagKeys": [ "string" ] } Request Parameters For information about the parameters that are common to all actions, see Common Parameters. The request accepts the following data in JSON format. resourceArn The Amazon Resource Name (ARN) for the Amazon SWF domain. Type: String Length Constraints: Minimum length of 1. Maximum length of 1600. Required: Yes tagKeys The list of tags to remove from the Amazon SWF domain. Type: Array of strings Length Constraints: Minimum length of 1. Maximum length of 128. Required: Yes Response Elements If the action is successful, the service sends back an HTTP 200 response with an empty HTTP body. UntagResource API Version 2012-01-25 231 Amazon Simple Workflow Service API Reference Errors For information about the errors that are common to all actions, see Common Errors. LimitExceededFault Returned by any operation if a system imposed limitation has been reached. To address this fault you should either clean up unused resources or increase the limit by contacting AWS. HTTP Status Code: 400 OperationNotPermittedFault Returned when the caller doesn't have sufficient permissions to invoke the action. HTTP Status Code: 400 UnknownResourceFault Returned when the named resource cannot be found with in the scope of this operation (region or domain). This could happen if the named resource was never created or is no longer available for this operation. HTTP Status Code: 400 See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS Command Line Interface • AWS SDK for .NET • AWS SDK for C++ • AWS SDK for Go v2 • AWS SDK for Java V2 • AWS SDK for JavaScript V3 • AWS SDK for Kotlin • AWS SDK for PHP V3 • AWS SDK for Python Errors API Version 2012-01-25 232 Amazon Simple Workflow Service • AWS SDK for Ruby V3 API Reference See Also API Version 2012-01-25 233 Amazon Simple Workflow Service API Reference Data Types The Amazon Simple Workflow Service API contains several data types that various actions use. This section describes each data type in detail. Note The order of each element in a data type structure is not guaranteed. Applications should not assume a particular order. The following data types are supported: • ActivityTask • ActivityTaskCanceledEventAttributes • ActivityTaskCancelRequestedEventAttributes • ActivityTaskCompletedEventAttributes • ActivityTaskFailedEventAttributes • ActivityTaskScheduledEventAttributes • ActivityTaskStartedEventAttributes • ActivityTaskTimedOutEventAttributes • ActivityType • ActivityTypeConfiguration • ActivityTypeInfo • CancelTimerDecisionAttributes • CancelTimerFailedEventAttributes • CancelWorkflowExecutionDecisionAttributes • CancelWorkflowExecutionFailedEventAttributes • ChildWorkflowExecutionCanceledEventAttributes • ChildWorkflowExecutionCompletedEventAttributes • ChildWorkflowExecutionFailedEventAttributes • ChildWorkflowExecutionStartedEventAttributes • ChildWorkflowExecutionTerminatedEventAttributes API Version 2012-01-25 234 Amazon Simple Workflow Service API Reference • ChildWorkflowExecutionTimedOutEventAttributes • CloseStatusFilter • CompleteWorkflowExecutionDecisionAttributes • CompleteWorkflowExecutionFailedEventAttributes • ContinueAsNewWorkflowExecutionDecisionAttributes • ContinueAsNewWorkflowExecutionFailedEventAttributes • Decision • DecisionTask • DecisionTaskCompletedEventAttributes • DecisionTaskScheduledEventAttributes • DecisionTaskStartedEventAttributes • DecisionTaskTimedOutEventAttributes • DomainConfiguration • DomainInfo • ExecutionTimeFilter • ExternalWorkflowExecutionCancelRequestedEventAttributes • ExternalWorkflowExecutionSignaledEventAttributes • FailWorkflowExecutionDecisionAttributes • FailWorkflowExecutionFailedEventAttributes • HistoryEvent • LambdaFunctionCompletedEventAttributes • LambdaFunctionFailedEventAttributes • LambdaFunctionScheduledEventAttributes • LambdaFunctionStartedEventAttributes • LambdaFunctionTimedOutEventAttributes • MarkerRecordedEventAttributes • RecordMarkerDecisionAttributes • RecordMarkerFailedEventAttributes • RequestCancelActivityTaskDecisionAttributes • RequestCancelActivityTaskFailedEventAttributes API Version 2012-01-25 235 Amazon Simple Workflow Service API Reference • RequestCancelExternalWorkflowExecutionDecisionAttributes • RequestCancelExternalWorkflowExecutionFailedEventAttributes • RequestCancelExternalWorkflowExecutionInitiatedEventAttributes • ResourceTag • ScheduleActivityTaskDecisionAttributes • ScheduleActivityTaskFailedEventAttributes • ScheduleLambdaFunctionDecisionAttributes • ScheduleLambdaFunctionFailedEventAttributes • SignalExternalWorkflowExecutionDecisionAttributes • SignalExternalWorkflowExecutionFailedEventAttributes • SignalExternalWorkflowExecutionInitiatedEventAttributes • StartChildWorkflowExecutionDecisionAttributes • StartChildWorkflowExecutionFailedEventAttributes • StartChildWorkflowExecutionInitiatedEventAttributes • StartLambdaFunctionFailedEventAttributes • StartTimerDecisionAttributes • StartTimerFailedEventAttributes • TagFilter • TaskList • TimerCanceledEventAttributes • TimerFiredEventAttributes • TimerStartedEventAttributes • WorkflowExecution • WorkflowExecutionCanceledEventAttributes
swf-api-051
swf-api.pdf
51
• DecisionTaskScheduledEventAttributes • DecisionTaskStartedEventAttributes • DecisionTaskTimedOutEventAttributes • DomainConfiguration • DomainInfo • ExecutionTimeFilter • ExternalWorkflowExecutionCancelRequestedEventAttributes • ExternalWorkflowExecutionSignaledEventAttributes • FailWorkflowExecutionDecisionAttributes • FailWorkflowExecutionFailedEventAttributes • HistoryEvent • LambdaFunctionCompletedEventAttributes • LambdaFunctionFailedEventAttributes • LambdaFunctionScheduledEventAttributes • LambdaFunctionStartedEventAttributes • LambdaFunctionTimedOutEventAttributes • MarkerRecordedEventAttributes • RecordMarkerDecisionAttributes • RecordMarkerFailedEventAttributes • RequestCancelActivityTaskDecisionAttributes • RequestCancelActivityTaskFailedEventAttributes API Version 2012-01-25 235 Amazon Simple Workflow Service API Reference • RequestCancelExternalWorkflowExecutionDecisionAttributes • RequestCancelExternalWorkflowExecutionFailedEventAttributes • RequestCancelExternalWorkflowExecutionInitiatedEventAttributes • ResourceTag • ScheduleActivityTaskDecisionAttributes • ScheduleActivityTaskFailedEventAttributes • ScheduleLambdaFunctionDecisionAttributes • ScheduleLambdaFunctionFailedEventAttributes • SignalExternalWorkflowExecutionDecisionAttributes • SignalExternalWorkflowExecutionFailedEventAttributes • SignalExternalWorkflowExecutionInitiatedEventAttributes • StartChildWorkflowExecutionDecisionAttributes • StartChildWorkflowExecutionFailedEventAttributes • StartChildWorkflowExecutionInitiatedEventAttributes • StartLambdaFunctionFailedEventAttributes • StartTimerDecisionAttributes • StartTimerFailedEventAttributes • TagFilter • TaskList • TimerCanceledEventAttributes • TimerFiredEventAttributes • TimerStartedEventAttributes • WorkflowExecution • WorkflowExecutionCanceledEventAttributes • WorkflowExecutionCancelRequestedEventAttributes • WorkflowExecutionCompletedEventAttributes • WorkflowExecutionConfiguration • WorkflowExecutionContinuedAsNewEventAttributes • WorkflowExecutionFailedEventAttributes • WorkflowExecutionFilter API Version 2012-01-25 236 API Reference Amazon Simple Workflow Service • WorkflowExecutionInfo • WorkflowExecutionOpenCounts • WorkflowExecutionSignaledEventAttributes • WorkflowExecutionStartedEventAttributes • WorkflowExecutionTerminatedEventAttributes • WorkflowExecutionTimedOutEventAttributes • WorkflowType • WorkflowTypeConfiguration • WorkflowTypeFilter • WorkflowTypeInfo API Version 2012-01-25 237 API Reference Amazon Simple Workflow Service ActivityTask Unit of work sent to an activity worker. Contents activityId The unique ID of the task. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes activityType The type of this activity task. Type: ActivityType object Required: Yes startedEventId The ID of the ActivityTaskStarted event recorded in the history. Type: Long Required: Yes taskToken The opaque string used as a handle on the task. This token is used by workers to communicate progress and response information back to the system about the task. Type: String Length Constraints: Minimum length of 1. Maximum length of 1024. Required: Yes workflowExecution The workflow execution that started this activity task. ActivityTask API Version 2012-01-25 238 Amazon Simple Workflow Service API Reference Type: WorkflowExecution object Required: Yes input The inputs provided when the activity task was scheduled. The form of the input is user defined and should be meaningful to the activity implementation. Type: String Length Constraints: Maximum length of 32768. Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 239 Amazon Simple Workflow Service API Reference ActivityTaskCanceledEventAttributes Provides the details of the ActivityTaskCanceled event. Contents scheduledEventId The ID of the ActivityTaskScheduled event that was recorded when this activity task was scheduled. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes startedEventId The ID of the ActivityTaskStarted event recorded when this activity task was started. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes details Details of the cancellation. Type: String Length Constraints: Maximum length of 32768. Required: No latestCancelRequestedEventId If set, contains the ID of the last ActivityTaskCancelRequested event recorded for this activity task. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long ActivityTaskCanceledEventAttributes API Version 2012-01-25 240 Amazon Simple Workflow Service Required: No See Also API Reference For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 241 Amazon Simple Workflow Service API Reference ActivityTaskCancelRequestedEventAttributes Provides the details of the ActivityTaskCancelRequested event. Contents activityId The unique ID of the task. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes decisionTaskCompletedEventId The ID of the DecisionTaskCompleted event corresponding to the decision task that resulted in the RequestCancelActivityTask decision for this cancellation request. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 ActivityTaskCancelRequestedEventAttributes API Version 2012-01-25 242 Amazon Simple Workflow Service API Reference ActivityTaskCompletedEventAttributes Provides the details of the ActivityTaskCompleted event. Contents scheduledEventId The ID of the ActivityTaskScheduled event that was recorded when this activity task was scheduled. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes startedEventId The ID of the ActivityTaskStarted event recorded when this activity task was started. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes result The results of the activity task. Type: String Length Constraints: Maximum length of 32768. Required: No See Also For more information about using this API
swf-api-052
swf-api.pdf
52
the ActivityTaskScheduled event that was recorded when this activity task was scheduled. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes startedEventId The ID of the ActivityTaskStarted event recorded when this activity task was started. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes result The results of the activity task. Type: String Length Constraints: Maximum length of 32768. Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ ActivityTaskCompletedEventAttributes API Version 2012-01-25 243 Amazon Simple Workflow Service • AWS SDK for Java V2 • AWS SDK for Ruby V3 API Reference See Also API Version 2012-01-25 244 Amazon Simple Workflow Service API Reference ActivityTaskFailedEventAttributes Provides the details of the ActivityTaskFailed event. Contents scheduledEventId The ID of the ActivityTaskScheduled event that was recorded when this activity task was scheduled. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes startedEventId The ID of the ActivityTaskStarted event recorded when this activity task was started. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes details The details of the failure. Type: String Length Constraints: Maximum length of 32768. Required: No reason The reason provided for the failure. Type: String Length Constraints: Maximum length of 256. ActivityTaskFailedEventAttributes API Version 2012-01-25 245 Amazon Simple Workflow Service Required: No See Also API Reference For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 246 Amazon Simple Workflow Service API Reference ActivityTaskScheduledEventAttributes Provides the details of the ActivityTaskScheduled event. Contents activityId The unique ID of the activity task. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes activityType The type of the activity task. Type: ActivityType object Required: Yes decisionTaskCompletedEventId The ID of the DecisionTaskCompleted event corresponding to the decision that resulted in the scheduling of this activity task. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes taskList The task list in which the activity task has been scheduled. Type: TaskList object Required: Yes control Data attached to the event that can be used by the decider in subsequent workflow tasks. This data isn't sent to the activity. ActivityTaskScheduledEventAttributes API Version 2012-01-25 247 Amazon Simple Workflow Service Type: String Length Constraints: Maximum length of 32768. Required: No heartbeatTimeout API Reference The maximum time before which the worker processing this task must report progress by calling RecordActivityTaskHeartbeat. If the timeout is exceeded, the activity task is automatically timed out. If the worker subsequently attempts to record a heartbeat or return a result, it is ignored. Type: String Length Constraints: Maximum length of 8. Required: No input The input provided to the activity task. Type: String Length Constraints: Maximum length of 32768. Required: No scheduleToCloseTimeout The maximum amount of time for this activity task. Type: String Length Constraints: Maximum length of 8. Required: No scheduleToStartTimeout The maximum amount of time the activity task can wait to be assigned to a worker. Type: String Length Constraints: Maximum length of 8. Contents API Version 2012-01-25 248 Amazon Simple Workflow Service Required: No startToCloseTimeout API Reference The maximum amount of time a worker may take to process the activity task. Type: String Length Constraints: Maximum length of 8. Required: No taskPriority The priority to assign to the scheduled activity task. If set, this overrides any default priority value that was assigned when the activity type was registered. 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. Type: String Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 249 Amazon Simple Workflow Service API Reference ActivityTaskStartedEventAttributes Provides the details of the ActivityTaskStarted event. Contents scheduledEventId The ID of the ActivityTaskScheduled event that was recorded when this activity task was scheduled. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes identity Identity of
swf-api-053
swf-api.pdf
53
See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 249 Amazon Simple Workflow Service API Reference ActivityTaskStartedEventAttributes Provides the details of the ActivityTaskStarted event. Contents scheduledEventId The ID of the ActivityTaskScheduled event that was recorded when this activity task was scheduled. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes identity Identity of the worker that was assigned this task. This aids diagnostics when problems arise. The form of this identity is user defined. Type: String Length Constraints: Maximum length of 256. Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 ActivityTaskStartedEventAttributes API Version 2012-01-25 250 Amazon Simple Workflow Service API Reference ActivityTaskTimedOutEventAttributes Provides the details of the ActivityTaskTimedOut event. Contents scheduledEventId The ID of the ActivityTaskScheduled event that was recorded when this activity task was scheduled. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes startedEventId The ID of the ActivityTaskStarted event recorded when this activity task was started. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes timeoutType The type of the timeout that caused this event. Type: String Valid Values: START_TO_CLOSE | SCHEDULE_TO_START | SCHEDULE_TO_CLOSE | HEARTBEAT Required: Yes details Contains the content of the details parameter for the last call made by the activity to RecordActivityTaskHeartbeat. Type: String ActivityTaskTimedOutEventAttributes API Version 2012-01-25 251 Amazon Simple Workflow Service API Reference Length Constraints: Maximum length of 2048. Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 252 API Reference Amazon Simple Workflow Service ActivityType Represents an activity type. Contents name The name of this activity. Note The combination of activity type name and version must be unique within a domain. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes version The version of this activity. Note The combination of activity type name and version must be unique with in a domain. Type: String Length Constraints: Minimum length of 1. Maximum length of 64. Required: Yes See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: ActivityType API Version 2012-01-25 253 Amazon Simple Workflow Service • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 API Reference See Also API Version 2012-01-25 254 Amazon Simple Workflow Service API Reference ActivityTypeConfiguration Configuration settings registered with the activity type. Contents defaultTaskHeartbeatTimeout The default maximum time, in seconds, before which a worker processing a task must report progress by calling RecordActivityTaskHeartbeat. You can specify this value only when registering an activity type. The registered default value can be overridden when you schedule a task through the ScheduleActivityTask Decision. If the activity worker subsequently attempts to record a heartbeat or returns a result, the activity worker receives an UnknownResource fault. In this case, Amazon SWF no longer considers the activity task to be valid; the activity worker should clean up the activity task. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration. Type: String Length Constraints: Maximum length of 8. Required: No defaultTaskList The default task list specified for this activity type at registration. This default is used if a task list isn't provided when a task is scheduled through the ScheduleActivityTask Decision. You can override the default registered task list when scheduling a task through the ScheduleActivityTask Decision. Type: TaskList object Required: No defaultTaskPriority The default task priority for tasks of this activity type, specified at registration. If not set, then 0 is used as the default priority. This default can be overridden when scheduling an activity task. ActivityTypeConfiguration API Version 2012-01-25 255 Amazon Simple Workflow Service API Reference 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. Type: String Required: No defaultTaskScheduleToCloseTimeout The default maximum duration, specified when registering the activity type, for tasks of this activity type. You can override
swf-api-054
swf-api.pdf
54
for tasks of this activity type, specified at registration. If not set, then 0 is used as the default priority. This default can be overridden when scheduling an activity task. ActivityTypeConfiguration API Version 2012-01-25 255 Amazon Simple Workflow Service API Reference 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. Type: String Required: No defaultTaskScheduleToCloseTimeout The default maximum duration, specified when registering the activity type, for tasks of this activity type. You can override this default when scheduling a task through the ScheduleActivityTask Decision. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration. Type: String Length Constraints: Maximum length of 8. Required: No defaultTaskScheduleToStartTimeout The default maximum duration, specified when registering the activity type, that a task of an activity type can wait before being assigned to a worker. You can override this default when scheduling a task through the ScheduleActivityTask Decision. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration. Type: String Length Constraints: Maximum length of 8. Required: No defaultTaskStartToCloseTimeout The default maximum duration for tasks of an activity type specified when registering the activity type. You can override this default when scheduling a task through the ScheduleActivityTask Decision. Contents API Version 2012-01-25 256 Amazon Simple Workflow Service API Reference The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration. Type: String Length Constraints: Maximum length of 8. Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 257 API Reference Amazon Simple Workflow Service ActivityTypeInfo Detailed information about an activity type. Contents activityType The ActivityType type structure representing the activity type. Type: ActivityType object Required: Yes creationDate The date and time this activity type was created through RegisterActivityType. Type: Timestamp Required: Yes status The current status of the activity type. Type: String Valid Values: REGISTERED | DEPRECATED Required: Yes deprecationDate If DEPRECATED, the date and time DeprecateActivityType was called. Type: Timestamp Required: No description The description of the activity type provided in RegisterActivityType. Type: String ActivityTypeInfo API Version 2012-01-25 258 Amazon Simple Workflow Service API Reference Length Constraints: Maximum length of 1024. Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 259 Amazon Simple Workflow Service API Reference CancelTimerDecisionAttributes Provides the details of the CancelTimer decision. Access Control You can use IAM policies to control this decision'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. • You cannot use an IAM policy to constrain this action's parameters. 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 Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide. Contents timerId The unique ID of the timer to cancel. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 CancelTimerDecisionAttributes API Version 2012-01-25 260 Amazon Simple Workflow Service API Reference CancelTimerFailedEventAttributes Provides the details of the CancelTimerFailed event. Contents cause The cause of the failure. This information is generated by the system and can be useful for diagnostic purposes. Note If cause is set to OPERATION_NOT_PERMITTED, the decision failed because it lacked sufficient permissions. For details and example IAM policies, see Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide. Type: String Valid Values: TIMER_ID_UNKNOWN | OPERATION_NOT_PERMITTED Required: Yes decisionTaskCompletedEventId The ID of the DecisionTaskCompleted event corresponding to the decision task that resulted in the CancelTimer decision to cancel this timer. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes timerId The
swf-api-055
swf-api.pdf
55
can be useful for diagnostic purposes. Note If cause is set to OPERATION_NOT_PERMITTED, the decision failed because it lacked sufficient permissions. For details and example IAM policies, see Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide. Type: String Valid Values: TIMER_ID_UNKNOWN | OPERATION_NOT_PERMITTED Required: Yes decisionTaskCompletedEventId The ID of the DecisionTaskCompleted event corresponding to the decision task that resulted in the CancelTimer decision to cancel this timer. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes timerId The timerId provided in the CancelTimer decision that failed. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes CancelTimerFailedEventAttributes API Version 2012-01-25 261 Amazon Simple Workflow Service See Also API Reference For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 262 Amazon Simple Workflow Service API Reference CancelWorkflowExecutionDecisionAttributes Provides the details of the CancelWorkflowExecution decision. Access Control You can use IAM policies to control this decision'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. • You cannot use an IAM policy to constrain this action's parameters. 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 Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide. Contents details Details of the cancellation. Type: String Length Constraints: Maximum length of 32768. Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 CancelWorkflowExecutionDecisionAttributes API Version 2012-01-25 263 Amazon Simple Workflow Service API Reference CancelWorkflowExecutionFailedEventAttributes Provides the details of the CancelWorkflowExecutionFailed event. Contents cause The cause of the failure. This information is generated by the system and can be useful for diagnostic purposes. Note If cause is set to OPERATION_NOT_PERMITTED, the decision failed because it lacked sufficient permissions. For details and example IAM policies, see Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide. Type: String Valid Values: UNHANDLED_DECISION | OPERATION_NOT_PERMITTED Required: Yes decisionTaskCompletedEventId The ID of the DecisionTaskCompleted event corresponding to the decision task that resulted in the CancelWorkflowExecution decision for this cancellation request. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ CancelWorkflowExecutionFailedEventAttributes API Version 2012-01-25 264 Amazon Simple Workflow Service • AWS SDK for Java V2 • AWS SDK for Ruby V3 API Reference See Also API Version 2012-01-25 265 Amazon Simple Workflow Service API Reference ChildWorkflowExecutionCanceledEventAttributes Provide details of the ChildWorkflowExecutionCanceled event. Contents initiatedEventId The ID of the StartChildWorkflowExecutionInitiated event corresponding to the StartChildWorkflowExecution Decision to start this child workflow execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes startedEventId The ID of the ChildWorkflowExecutionStarted event recorded when this child workflow execution was started. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes workflowExecution The child workflow execution that was canceled. Type: WorkflowExecution object Required: Yes workflowType The type of the child workflow execution. Type: WorkflowType object Required: Yes ChildWorkflowExecutionCanceledEventAttributes API Version 2012-01-25 266 API Reference Amazon Simple Workflow Service details Details of the cancellation (if provided). Type: String Length Constraints: Maximum length of 32768. Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 267 Amazon Simple Workflow Service API Reference ChildWorkflowExecutionCompletedEventAttributes Provides the details of the ChildWorkflowExecutionCompleted event. Contents initiatedEventId The ID of the StartChildWorkflowExecutionInitiated event corresponding to the StartChildWorkflowExecution Decision to start this child workflow execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes startedEventId The ID of the ChildWorkflowExecutionStarted event recorded when this
swf-api-056
swf-api.pdf
56
in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 267 Amazon Simple Workflow Service API Reference ChildWorkflowExecutionCompletedEventAttributes Provides the details of the ChildWorkflowExecutionCompleted event. Contents initiatedEventId The ID of the StartChildWorkflowExecutionInitiated event corresponding to the StartChildWorkflowExecution Decision to start this child workflow execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes startedEventId The ID of the ChildWorkflowExecutionStarted event recorded when this child workflow execution was started. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes workflowExecution The child workflow execution that was completed. Type: WorkflowExecution object Required: Yes workflowType The type of the child workflow execution. Type: WorkflowType object Required: Yes ChildWorkflowExecutionCompletedEventAttributes API Version 2012-01-25 268 API Reference Amazon Simple Workflow Service result The result of the child workflow execution. Type: String Length Constraints: Maximum length of 32768. Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 269 Amazon Simple Workflow Service API Reference ChildWorkflowExecutionFailedEventAttributes Provides the details of the ChildWorkflowExecutionFailed event. Contents initiatedEventId The ID of the StartChildWorkflowExecutionInitiated event corresponding to the StartChildWorkflowExecution Decision to start this child workflow execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes startedEventId The ID of the ChildWorkflowExecutionStarted event recorded when this child workflow execution was started. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes workflowExecution The child workflow execution that failed. Type: WorkflowExecution object Required: Yes workflowType The type of the child workflow execution. Type: WorkflowType object Required: Yes ChildWorkflowExecutionFailedEventAttributes API Version 2012-01-25 270 API Reference Amazon Simple Workflow Service details The details of the failure (if provided). Type: String Length Constraints: Maximum length of 32768. Required: No reason The reason for the failure (if provided). Type: String Length Constraints: Maximum length of 256. Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 271 Amazon Simple Workflow Service API Reference ChildWorkflowExecutionStartedEventAttributes Provides the details of the ChildWorkflowExecutionStarted event. Contents initiatedEventId The ID of the StartChildWorkflowExecutionInitiated event corresponding to the StartChildWorkflowExecution Decision to start this child workflow execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes workflowExecution The child workflow execution that was started. Type: WorkflowExecution object Required: Yes workflowType The type of the child workflow execution. Type: WorkflowType object Required: Yes See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 ChildWorkflowExecutionStartedEventAttributes API Version 2012-01-25 272 Amazon Simple Workflow Service API Reference See Also API Version 2012-01-25 273 Amazon Simple Workflow Service API Reference ChildWorkflowExecutionTerminatedEventAttributes Provides the details of the ChildWorkflowExecutionTerminated event. Contents initiatedEventId The ID of the StartChildWorkflowExecutionInitiated event corresponding to the StartChildWorkflowExecution Decision to start this child workflow execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes startedEventId The ID of the ChildWorkflowExecutionStarted event recorded when this child workflow execution was started. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes workflowExecution The child workflow execution that was terminated. Type: WorkflowExecution object Required: Yes workflowType The type of the child workflow execution. Type: WorkflowType object Required: Yes ChildWorkflowExecutionTerminatedEventAttributes API Version 2012-01-25 274 Amazon Simple Workflow Service See Also API Reference For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 275 Amazon Simple Workflow Service API Reference ChildWorkflowExecutionTimedOutEventAttributes Provides the details of the ChildWorkflowExecutionTimedOut event. Contents initiatedEventId The ID of the StartChildWorkflowExecutionInitiated event corresponding to the StartChildWorkflowExecution Decision to start this child workflow execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
swf-api-057
swf-api.pdf
57
Simple Workflow Service See Also API Reference For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 275 Amazon Simple Workflow Service API Reference ChildWorkflowExecutionTimedOutEventAttributes Provides the details of the ChildWorkflowExecutionTimedOut event. Contents initiatedEventId The ID of the StartChildWorkflowExecutionInitiated event corresponding to the StartChildWorkflowExecution Decision to start this child workflow execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes startedEventId The ID of the ChildWorkflowExecutionStarted event recorded when this child workflow execution was started. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes timeoutType The type of the timeout that caused the child workflow execution to time out. Type: String Valid Values: START_TO_CLOSE Required: Yes workflowExecution The child workflow execution that timed out. Type: WorkflowExecution object Required: Yes ChildWorkflowExecutionTimedOutEventAttributes API Version 2012-01-25 276 Amazon Simple Workflow Service workflowType The type of the child workflow execution. Type: WorkflowType object Required: Yes See Also API Reference For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 277 Amazon Simple Workflow Service CloseStatusFilter API Reference Used to filter the closed workflow executions in visibility APIs by their close status. Contents status The close status that must match the close status of an execution for it to meet the criteria of this filter. Type: String Valid Values: COMPLETED | FAILED | CANCELED | TERMINATED | CONTINUED_AS_NEW | TIMED_OUT Required: Yes See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 CloseStatusFilter API Version 2012-01-25 278 Amazon Simple Workflow Service API Reference CompleteWorkflowExecutionDecisionAttributes Provides the details of the CompleteWorkflowExecution decision. Access Control You can use IAM policies to control this decision'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. • You cannot use an IAM policy to constrain this action's parameters. 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 Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide. Contents result The result of the workflow execution. The form of the result is implementation defined. Type: String Length Constraints: Maximum length of 32768. Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 CompleteWorkflowExecutionDecisionAttributes API Version 2012-01-25 279 Amazon Simple Workflow Service API Reference CompleteWorkflowExecutionFailedEventAttributes Provides the details of the CompleteWorkflowExecutionFailed event. Contents cause The cause of the failure. This information is generated by the system and can be useful for diagnostic purposes. Note If cause is set to OPERATION_NOT_PERMITTED, the decision failed because it lacked sufficient permissions. For details and example IAM policies, see Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide. Type: String Valid Values: UNHANDLED_DECISION | OPERATION_NOT_PERMITTED Required: Yes decisionTaskCompletedEventId The ID of the DecisionTaskCompleted event corresponding to the decision task that resulted in the CompleteWorkflowExecution decision to complete this execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ CompleteWorkflowExecutionFailedEventAttributes API Version 2012-01-25 280 Amazon Simple Workflow Service • AWS SDK for Java V2 • AWS SDK for Ruby V3 API Reference See Also API Version 2012-01-25 281 Amazon Simple Workflow Service API Reference ContinueAsNewWorkflowExecutionDecisionAttributes Provides the details of the ContinueAsNewWorkflowExecution decision. Access Control You can use IAM policies to control this decision'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.
swf-api-058
swf-api.pdf
58
Simple Workflow Service • AWS SDK for Java V2 • AWS SDK for Ruby V3 API Reference See Also API Version 2012-01-25 281 Amazon Simple Workflow Service API Reference ContinueAsNewWorkflowExecutionDecisionAttributes Provides the details of the ContinueAsNewWorkflowExecution decision. Access Control You can use IAM policies to control this decision'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. • tag – A tag used to identify the workflow execution • taskList – String constraint. The key is swf:taskList.name. • workflowType.version – String constraint. The key is swf:workflowType.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 Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide. Contents childPolicy If set, specifies the policy to use for the child workflow executions of the new execution if it is terminated by calling the TerminateWorkflowExecution action explicitly or due to an expired timeout. This policy overrides the default child policy specified when registering the workflow type using RegisterWorkflowType. 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. ContinueAsNewWorkflowExecutionDecisionAttributes API Version 2012-01-25 282 Amazon Simple Workflow Service API Reference Note A child policy for this workflow execution must be specified either as a default for the workflow type or through this parameter. If neither this parameter is set nor a default child policy was specified at registration time then a fault is returned. Type: String Valid Values: TERMINATE | REQUEST_CANCEL | ABANDON Required: No executionStartToCloseTimeout If set, specifies the total duration for this workflow execution. This overrides the defaultExecutionStartToCloseTimeout specified when registering the workflow type. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration. Note An execution start-to-close timeout for this workflow execution must be specified either as a default for the workflow type or through this field. If neither this field is set nor a default execution start-to-close timeout was specified at registration time then a fault is returned. Type: String Length Constraints: Maximum length of 8. Required: No input The input provided to the new workflow execution. Type: String Length Constraints: Maximum length of 32768. Contents API Version 2012-01-25 283 API Reference Amazon Simple Workflow Service Required: No lambdaRole The IAM role to attach to the new (continued) execution. Type: String Length Constraints: Minimum length of 1. Maximum length of 1600. Required: No tagList The list of tags to associate with the new workflow execution. A maximum of 5 tags can be specified. You can list workflow executions with a specific tag by calling ListOpenWorkflowExecutions or ListClosedWorkflowExecutions and specifying a TagFilter. Type: Array of strings Array Members: Maximum number of 5 items. Length Constraints: Minimum length of 0. Maximum length of 256. Required: No taskList The task list to use for the decisions of the new (continued) workflow execution. Type: TaskList object Required: No taskPriority The task priority that, if set, specifies the priority for the decision tasks for this workflow execution. This overrides the defaultTaskPriority specified when registering the workflow type. 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. Type: String Contents API Version 2012-01-25 284 Amazon Simple Workflow Service Required: No taskStartToCloseTimeout API Reference Specifies the maximum duration of decision tasks for the new workflow execution. This parameter overrides the defaultTaskStartToCloseTimout specified when registering the workflow type using RegisterWorkflowType. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration. Note A task start-to-close timeout for the new workflow execution must be specified either as a default for the workflow type or through this parameter. If neither this parameter is set nor a default task start-to-close timeout was specified at registration time then a fault is returned. Type: String Length Constraints: Maximum length of 8. Required: No workflowTypeVersion The version of the workflow to start. Type: String Length Constraints: Minimum length of 1. Maximum
swf-api-059
swf-api.pdf
59
workflow type using RegisterWorkflowType. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration. Note A task start-to-close timeout for the new workflow execution must be specified either as a default for the workflow type or through this parameter. If neither this parameter is set nor a default task start-to-close timeout was specified at registration time then a fault is returned. Type: String Length Constraints: Maximum length of 8. Required: No workflowTypeVersion The version of the workflow to start. Type: String Length Constraints: Minimum length of 1. Maximum length of 64. Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ See Also API Version 2012-01-25 285 Amazon Simple Workflow Service • AWS SDK for Java V2 • AWS SDK for Ruby V3 API Reference See Also API Version 2012-01-25 286 Amazon Simple Workflow Service API Reference ContinueAsNewWorkflowExecutionFailedEventAttributes Provides the details of the ContinueAsNewWorkflowExecutionFailed event. Contents cause The cause of the failure. This information is generated by the system and can be useful for diagnostic purposes. Note If cause is set to OPERATION_NOT_PERMITTED, the decision failed because it lacked sufficient permissions. For details and example IAM policies, see Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide. Type: String Valid Values: UNHANDLED_DECISION | WORKFLOW_TYPE_DEPRECATED | WORKFLOW_TYPE_DOES_NOT_EXIST | DEFAULT_EXECUTION_START_TO_CLOSE_TIMEOUT_UNDEFINED | DEFAULT_TASK_START_TO_CLOSE_TIMEOUT_UNDEFINED | DEFAULT_TASK_LIST_UNDEFINED | DEFAULT_CHILD_POLICY_UNDEFINED | CONTINUE_AS_NEW_WORKFLOW_EXECUTION_RATE_EXCEEDED | OPERATION_NOT_PERMITTED Required: Yes decisionTaskCompletedEventId The ID of the DecisionTaskCompleted event corresponding to the decision task that resulted in the ContinueAsNewWorkflowExecution decision that started this execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes ContinueAsNewWorkflowExecutionFailedEventAttributes API Version 2012-01-25 287 Amazon Simple Workflow Service See Also API Reference For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 288 Amazon Simple Workflow Service Decision API Reference Specifies a decision made by the decider. A decision can be one of these types: • CancelTimer – Cancels a previously started timer and records a TimerCanceled event in the history. • CancelWorkflowExecution – Closes the workflow execution and records a WorkflowExecutionCanceled event in the history. • CompleteWorkflowExecution – Closes the workflow execution and records a WorkflowExecutionCompleted event in the history . • ContinueAsNewWorkflowExecution – Closes the workflow execution and starts a new workflow execution of the same type using the same workflow ID and a unique run Id. A WorkflowExecutionContinuedAsNew event is recorded in the history. • FailWorkflowExecution – Closes the workflow execution and records a WorkflowExecutionFailed event in the history. • RecordMarker – Records a MarkerRecorded event in the history. Markers can be used for adding custom information in the history for instance to let deciders know that they don't need to look at the history beyond the marker event. • RequestCancelActivityTask – Attempts to cancel a previously scheduled activity task. If the activity task was scheduled but has not been assigned to a worker, then it is canceled. If the activity task was already assigned to a worker, then the worker is informed that cancellation has been requested in the response to RecordActivityTaskHeartbeat. • RequestCancelExternalWorkflowExecution – Requests that a request be made to cancel the specified external workflow execution and records a RequestCancelExternalWorkflowExecutionInitiated event in the history. • ScheduleActivityTask – Schedules an activity task. • SignalExternalWorkflowExecution – Requests a signal to be delivered to the specified external workflow execution and records a SignalExternalWorkflowExecutionInitiated event in the history. • StartChildWorkflowExecution – Requests that a child workflow execution be started and records a StartChildWorkflowExecutionInitiated event in the history. The child workflow execution is a separate workflow execution with its own history. • StartTimer – Starts a timer for this workflow execution and records a TimerStarted event in the history. This timer fires after the specified delay and record a TimerFired event. Decision API Version 2012-01-25 289 Amazon Simple Workflow Service Access Control API Reference If you grant permission to use RespondDecisionTaskCompleted, you can use IAM policies to express permissions for the list of decisions returned by this action as if they were members of the API. Treating decisions as a pseudo API maintains a uniform conceptual model and helps keep policies readable. For details and example IAM policies, see Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide. Decision Failure Decisions can fail for several reasons • The ordering of decisions should follow a logical flow. Some decisions might not make sense in the current context of the workflow execution and therefore fails.
swf-api-060
swf-api.pdf
60
use RespondDecisionTaskCompleted, you can use IAM policies to express permissions for the list of decisions returned by this action as if they were members of the API. Treating decisions as a pseudo API maintains a uniform conceptual model and helps keep policies readable. For details and example IAM policies, see Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide. Decision Failure Decisions can fail for several reasons • The ordering of decisions should follow a logical flow. Some decisions might not make sense in the current context of the workflow execution and therefore fails. • A limit on your account was reached. • The decision lacks sufficient permissions. One of the following events might be added to the history to indicate an error. The event attribute's cause parameter indicates the cause. If cause is set to OPERATION_NOT_PERMITTED, the decision failed because it lacked sufficient permissions. For details and example IAM policies, see Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide. • ScheduleActivityTaskFailed – A ScheduleActivityTask decision failed. This could happen if the activity type specified in the decision isn't registered, is in a deprecated state, or the decision isn't properly configured. • RequestCancelActivityTaskFailed – A RequestCancelActivityTask decision failed. This could happen if there is no open activity task with the specified activityId. • StartTimerFailed – A StartTimer decision failed. This could happen if there is another open timer with the same timerId. • CancelTimerFailed – A CancelTimer decision failed. This could happen if there is no open timer with the specified timerId. • StartChildWorkflowExecutionFailed – A StartChildWorkflowExecution decision failed. This could happen if the workflow type specified isn't registered, is deprecated, or the decision isn't properly configured. • SignalExternalWorkflowExecutionFailed – A SignalExternalWorkflowExecution decision failed. This could happen if the workflowID specified in the decision was incorrect. Decision API Version 2012-01-25 290 Amazon Simple Workflow Service API Reference • RequestCancelExternalWorkflowExecutionFailed – A RequestCancelExternalWorkflowExecution decision failed. This could happen if the workflowID specified in the decision was incorrect. • CancelWorkflowExecutionFailed – A CancelWorkflowExecution decision failed. This could happen if there is an unhandled decision task pending in the workflow execution. • CompleteWorkflowExecutionFailed – A CompleteWorkflowExecution decision failed. This could happen if there is an unhandled decision task pending in the workflow execution. • ContinueAsNewWorkflowExecutionFailed – A ContinueAsNewWorkflowExecution decision failed. This could happen if there is an unhandled decision task pending in the workflow execution or the ContinueAsNewWorkflowExecution decision was not configured correctly. • FailWorkflowExecutionFailed – A FailWorkflowExecution decision failed. This could happen if there is an unhandled decision task pending in the workflow execution. The preceding error events might occur due to an error in the decider logic, which might put the workflow execution in an unstable state The cause field in the event structure for the error event indicates the cause of the error. Note A workflow execution may be closed by the decider by returning one of the following decisions when completing a decision task: CompleteWorkflowExecution, FailWorkflowExecution, CancelWorkflowExecution and ContinueAsNewWorkflowExecution. An UnhandledDecision fault is returned if a workflow closing decision is specified and a signal or activity event had been added to the history while the decision task was being performed by the decider. Unlike the above situations which are logic issues, this fault is always possible because of race conditions in a distributed system. The right action here is to call RespondDecisionTaskCompleted without any decisions. This would result in another decision task with these new events included in the history. The decider should handle the new events and may decide to close the workflow execution. How to Code a Decision You code a decision by first setting the decision type field to one of the above decision values, and then set the corresponding attributes field shown below: Decision API Version 2012-01-25 291 Amazon Simple Workflow Service API Reference • ScheduleActivityTaskDecisionAttributes • RequestCancelActivityTaskDecisionAttributes • CompleteWorkflowExecutionDecisionAttributes • FailWorkflowExecutionDecisionAttributes • CancelWorkflowExecutionDecisionAttributes • ContinueAsNewWorkflowExecutionDecisionAttributes • RecordMarkerDecisionAttributes • StartTimerDecisionAttributes • CancelTimerDecisionAttributes • SignalExternalWorkflowExecutionDecisionAttributes • RequestCancelExternalWorkflowExecutionDecisionAttributes • StartChildWorkflowExecutionDecisionAttributes Contents decisionType Specifies the type of the decision. Type: String Valid Values: ScheduleActivityTask | RequestCancelActivityTask | CompleteWorkflowExecution | FailWorkflowExecution | CancelWorkflowExecution | ContinueAsNewWorkflowExecution | RecordMarker | StartTimer | CancelTimer | SignalExternalWorkflowExecution | RequestCancelExternalWorkflowExecution | StartChildWorkflowExecution | ScheduleLambdaFunction Required: Yes cancelTimerDecisionAttributes Provides the details of the CancelTimer decision. It isn't set for other decision types. Type: CancelTimerDecisionAttributes object Required: No Contents API Version 2012-01-25 292 Amazon Simple Workflow Service API Reference cancelWorkflowExecutionDecisionAttributes Provides the details of the CancelWorkflowExecution decision. It isn't set for other decision types. Type: CancelWorkflowExecutionDecisionAttributes object Required: No completeWorkflowExecutionDecisionAttributes Provides the details of the CompleteWorkflowExecution decision. It isn't set for other decision types. Type: CompleteWorkflowExecutionDecisionAttributes object Required: No continueAsNewWorkflowExecutionDecisionAttributes Provides the details of the ContinueAsNewWorkflowExecution decision. It isn't set for other decision types. Type: ContinueAsNewWorkflowExecutionDecisionAttributes object Required: No failWorkflowExecutionDecisionAttributes Provides the details
swf-api-061
swf-api.pdf
61
StartChildWorkflowExecution | ScheduleLambdaFunction Required: Yes cancelTimerDecisionAttributes Provides the details of the CancelTimer decision. It isn't set for other decision types. Type: CancelTimerDecisionAttributes object Required: No Contents API Version 2012-01-25 292 Amazon Simple Workflow Service API Reference cancelWorkflowExecutionDecisionAttributes Provides the details of the CancelWorkflowExecution decision. It isn't set for other decision types. Type: CancelWorkflowExecutionDecisionAttributes object Required: No completeWorkflowExecutionDecisionAttributes Provides the details of the CompleteWorkflowExecution decision. It isn't set for other decision types. Type: CompleteWorkflowExecutionDecisionAttributes object Required: No continueAsNewWorkflowExecutionDecisionAttributes Provides the details of the ContinueAsNewWorkflowExecution decision. It isn't set for other decision types. Type: ContinueAsNewWorkflowExecutionDecisionAttributes object Required: No failWorkflowExecutionDecisionAttributes Provides the details of the FailWorkflowExecution decision. It isn't set for other decision types. Type: FailWorkflowExecutionDecisionAttributes object Required: No recordMarkerDecisionAttributes Provides the details of the RecordMarker decision. It isn't set for other decision types. Type: RecordMarkerDecisionAttributes object Required: No requestCancelActivityTaskDecisionAttributes Provides the details of the RequestCancelActivityTask decision. It isn't set for other decision types. Contents API Version 2012-01-25 293 Amazon Simple Workflow Service API Reference Type: RequestCancelActivityTaskDecisionAttributes object Required: No requestCancelExternalWorkflowExecutionDecisionAttributes Provides the details of the RequestCancelExternalWorkflowExecution decision. It isn't set for other decision types. Type: RequestCancelExternalWorkflowExecutionDecisionAttributes object Required: No scheduleActivityTaskDecisionAttributes Provides the details of the ScheduleActivityTask decision. It isn't set for other decision types. Type: ScheduleActivityTaskDecisionAttributes object Required: No scheduleLambdaFunctionDecisionAttributes Provides the details of the ScheduleLambdaFunction decision. It isn't set for other decision types. Type: ScheduleLambdaFunctionDecisionAttributes object Required: No signalExternalWorkflowExecutionDecisionAttributes Provides the details of the SignalExternalWorkflowExecution decision. It isn't set for other decision types. Type: SignalExternalWorkflowExecutionDecisionAttributes object Required: No startChildWorkflowExecutionDecisionAttributes Provides the details of the StartChildWorkflowExecution decision. It isn't set for other decision types. Type: StartChildWorkflowExecutionDecisionAttributes object Contents API Version 2012-01-25 294 Amazon Simple Workflow Service Required: No startTimerDecisionAttributes API Reference Provides the details of the StartTimer decision. It isn't set for other decision types. Type: StartTimerDecisionAttributes object Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 295 Amazon Simple Workflow Service DecisionTask API Reference A structure that represents a decision task. Decision tasks are sent to deciders in order for them to make decisions. Contents events A paginated list of history events of the workflow execution. The decider uses this during the processing of the decision task. Type: Array of HistoryEvent objects Required: Yes startedEventId The ID of the DecisionTaskStarted event recorded in the history. Type: Long Required: Yes taskToken The opaque string used as a handle on the task. This token is used by workers to communicate progress and response information back to the system about the task. Type: String Length Constraints: Minimum length of 1. Maximum length of 1024. Required: Yes workflowExecution The workflow execution for which this decision task was created. Type: WorkflowExecution object Required: Yes workflowType The type of the workflow execution for which this decision task was created. DecisionTask API Version 2012-01-25 296 Amazon Simple Workflow Service Type: WorkflowType object Required: Yes nextPageToken API Reference If a NextPageToken was returned by a previous call, there are more results available. To retrieve the next page of results, make the call again using the returned token in nextPageToken. Keep all other arguments unchanged. The configured maximumPageSize determines how many results can be returned in a single call. Type: String Length Constraints: Maximum length of 2048. Required: No previousStartedEventId The ID of the DecisionTaskStarted event of the previous decision task of this workflow execution that was processed by the decider. This can be used to determine the events in the history new since the last decision task received by the decider. Type: Long Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 297 Amazon Simple Workflow Service API Reference DecisionTaskCompletedEventAttributes Provides the details of the DecisionTaskCompleted event. Contents scheduledEventId The ID of the DecisionTaskScheduled event that was recorded when this decision task was scheduled. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes startedEventId The ID of the DecisionTaskStarted event recorded when this decision task was started. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes executionContext User defined context for the workflow execution. Type: String Length Constraints: Maximum length of 32768. Required: No taskList Represents a task list. Type: TaskList object Required: No DecisionTaskCompletedEventAttributes API Version 2012-01-25 298 Amazon Simple Workflow Service API Reference taskListScheduleToStartTimeout The maximum amount of time the decision task can wait to be assigned to a
swf-api-062
swf-api.pdf
62
to this event. Type: Long Required: Yes startedEventId The ID of the DecisionTaskStarted event recorded when this decision task was started. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes executionContext User defined context for the workflow execution. Type: String Length Constraints: Maximum length of 32768. Required: No taskList Represents a task list. Type: TaskList object Required: No DecisionTaskCompletedEventAttributes API Version 2012-01-25 298 Amazon Simple Workflow Service API Reference taskListScheduleToStartTimeout The maximum amount of time the decision task can wait to be assigned to a worker. Type: String Length Constraints: Maximum length of 8. Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 299 Amazon Simple Workflow Service API Reference DecisionTaskScheduledEventAttributes Provides details about the DecisionTaskScheduled event. Contents taskList The name of the task list in which the decision task was scheduled. Type: TaskList object Required: Yes scheduleToStartTimeout The maximum amount of time the decision task can wait to be assigned to a worker. Type: String Length Constraints: Maximum length of 8. Required: No startToCloseTimeout The maximum duration for this decision task. The task is considered timed out if it doesn't completed within this duration. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration. Type: String Length Constraints: Maximum length of 8. Required: No taskPriority A task priority that, if set, specifies the priority for this decision task. Valid values are integers that range from Java's Integer.MIN_VALUE (-2147483648) to Integer.MAX_VALUE (2147483647). Higher numbers indicate higher priority. DecisionTaskScheduledEventAttributes API Version 2012-01-25 300 Amazon Simple Workflow Service API Reference For more information about setting task priority, see Setting Task Priority in the Amazon SWF Developer Guide. Type: String Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 301 Amazon Simple Workflow Service API Reference DecisionTaskStartedEventAttributes Provides the details of the DecisionTaskStarted event. Contents scheduledEventId The ID of the DecisionTaskScheduled event that was recorded when this decision task was scheduled. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes identity Identity of the decider making the request. This enables diagnostic tracing when problems arise. The form of this identity is user defined. Type: String Length Constraints: Maximum length of 256. Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 DecisionTaskStartedEventAttributes API Version 2012-01-25 302 Amazon Simple Workflow Service API Reference DecisionTaskTimedOutEventAttributes Provides the details of the DecisionTaskTimedOut event. Contents scheduledEventId The ID of the DecisionTaskScheduled event that was recorded when this decision task was scheduled. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes startedEventId The ID of the DecisionTaskStarted event recorded when this decision task was started. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes timeoutType The type of timeout that expired before the decision task could be completed. Type: String Valid Values: START_TO_CLOSE | SCHEDULE_TO_START Required: Yes See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ DecisionTaskTimedOutEventAttributes API Version 2012-01-25 303 Amazon Simple Workflow Service • AWS SDK for Java V2 • AWS SDK for Ruby V3 API Reference See Also API Version 2012-01-25 304 Amazon Simple Workflow Service API Reference DomainConfiguration Contains the configuration settings of a domain. Contents workflowExecutionRetentionPeriodInDays The retention period for workflow executions in this domain. Type: String Length Constraints: Minimum length of 1. Maximum length of 8. Required: Yes See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 DomainConfiguration API Version 2012-01-25 305 API Reference Amazon Simple Workflow Service DomainInfo Contains general information about a domain. Contents name The name of the domain. This name is unique within the account. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes status The status of the domain: • REGISTERED –
swf-api-063
swf-api.pdf
63
length of 1. Maximum length of 8. Required: Yes See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 DomainConfiguration API Version 2012-01-25 305 API Reference Amazon Simple Workflow Service DomainInfo Contains general information about a domain. Contents name The name of the domain. This name is unique within the account. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes status The status of the domain: • REGISTERED – The domain is properly registered and available. You can use this domain for registering types and creating new workflow executions. • DEPRECATED – The domain was deprecated using DeprecateDomain, but is still in use. You should not create new workflow executions in this domain. Type: String Valid Values: REGISTERED | DEPRECATED Required: Yes arn The ARN of the domain. Type: String Length Constraints: Minimum length of 1. Maximum length of 1600. Required: No description The description of the domain provided through RegisterDomain. DomainInfo API Version 2012-01-25 306 Amazon Simple Workflow Service Type: String Length Constraints: Maximum length of 1024. Required: No See Also API Reference For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 307 Amazon Simple Workflow Service API Reference ExecutionTimeFilter Used to filter the workflow executions in visibility APIs by various time-based rules. Each parameter, if specified, defines a rule that must be satisfied by each returned query result. The parameter values are in the Unix Time format. For example: "oldestDate": 1325376070. Contents oldestDate Specifies the oldest start or close date and time to return. Type: Timestamp Required: Yes latestDate Specifies the latest start or close date and time to return. Type: Timestamp Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 ExecutionTimeFilter API Version 2012-01-25 308 Amazon Simple Workflow Service API Reference ExternalWorkflowExecutionCancelRequestedEventAttributes Provides the details of the ExternalWorkflowExecutionCancelRequested event. Contents initiatedEventId The ID of the RequestCancelExternalWorkflowExecutionInitiated event corresponding to the RequestCancelExternalWorkflowExecution decision to cancel this external workflow execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes workflowExecution The external workflow execution to which the cancellation request was delivered. Type: WorkflowExecution object Required: Yes See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 ExternalWorkflowExecutionCancelRequestedEventAttributes API Version 2012-01-25 309 Amazon Simple Workflow Service API Reference ExternalWorkflowExecutionSignaledEventAttributes Provides the details of the ExternalWorkflowExecutionSignaled event. Contents initiatedEventId The ID of the SignalExternalWorkflowExecutionInitiated event corresponding to the SignalExternalWorkflowExecution decision to request this signal. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes workflowExecution The external workflow execution that the signal was delivered to. Type: WorkflowExecution object Required: Yes See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 ExternalWorkflowExecutionSignaledEventAttributes API Version 2012-01-25 310 Amazon Simple Workflow Service API Reference FailWorkflowExecutionDecisionAttributes Provides the details of the FailWorkflowExecution decision. Access Control You can use IAM policies to control this decision'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. • You cannot use an IAM policy to constrain this action's parameters. 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 Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide. Contents details Details of the failure. Type: String Length Constraints: Maximum length of 32768. Required: No reason A descriptive reason for the failure that may help in diagnostics. Type: String Length Constraints: Maximum length of 256. Required: No FailWorkflowExecutionDecisionAttributes API Version 2012-01-25 311 Amazon Simple Workflow Service See Also API Reference For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS
swf-api-064
swf-api.pdf
64
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. Contents details Details of the failure. Type: String Length Constraints: Maximum length of 32768. Required: No reason A descriptive reason for the failure that may help in diagnostics. Type: String Length Constraints: Maximum length of 256. Required: No FailWorkflowExecutionDecisionAttributes API Version 2012-01-25 311 Amazon Simple Workflow Service See Also API Reference For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 312 Amazon Simple Workflow Service API Reference FailWorkflowExecutionFailedEventAttributes Provides the details of the FailWorkflowExecutionFailed event. Contents cause The cause of the failure. This information is generated by the system and can be useful for diagnostic purposes. Note If cause is set to OPERATION_NOT_PERMITTED, the decision failed because it lacked sufficient permissions. For details and example IAM policies, see Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide. Type: String Valid Values: UNHANDLED_DECISION | OPERATION_NOT_PERMITTED Required: Yes decisionTaskCompletedEventId The ID of the DecisionTaskCompleted event corresponding to the decision task that resulted in the FailWorkflowExecution decision to fail this execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ FailWorkflowExecutionFailedEventAttributes API Version 2012-01-25 313 Amazon Simple Workflow Service • AWS SDK for Java V2 • AWS SDK for Ruby V3 API Reference See Also API Version 2012-01-25 314 Amazon Simple Workflow Service HistoryEvent API Reference Event within a workflow execution. A history event can be one of these types: • ActivityTaskCancelRequested – A RequestCancelActivityTask decision was received by the system. • ActivityTaskCanceled – The activity task was successfully canceled. • ActivityTaskCompleted – An activity worker successfully completed an activity task by calling RespondActivityTaskCompleted. • ActivityTaskFailed – An activity worker failed an activity task by calling RespondActivityTaskFailed. • ActivityTaskScheduled – An activity task was scheduled for execution. • ActivityTaskStarted – The scheduled activity task was dispatched to a worker. • ActivityTaskTimedOut – The activity task timed out. • CancelTimerFailed – Failed to process CancelTimer decision. This happens when the decision isn't configured properly, for example no timer exists with the specified timer Id. • CancelWorkflowExecutionFailed – A request to cancel a workflow execution failed. • ChildWorkflowExecutionCanceled – A child workflow execution, started by this workflow execution, was canceled and closed. • ChildWorkflowExecutionCompleted – A child workflow execution, started by this workflow execution, completed successfully and was closed. • ChildWorkflowExecutionFailed – A child workflow execution, started by this workflow execution, failed to complete successfully and was closed. • ChildWorkflowExecutionStarted – A child workflow execution was successfully started. • ChildWorkflowExecutionTerminated – A child workflow execution, started by this workflow execution, was terminated. • ChildWorkflowExecutionTimedOut – A child workflow execution, started by this workflow execution, timed out and was closed. • CompleteWorkflowExecutionFailed – The workflow execution failed to complete. • ContinueAsNewWorkflowExecutionFailed – The workflow execution failed to complete after being continued as a new workflow execution. • DecisionTaskCompleted – The decider successfully completed a decision task by calling RespondDecisionTaskCompleted. HistoryEvent API Version 2012-01-25 315 Amazon Simple Workflow Service API Reference • DecisionTaskScheduled – A decision task was scheduled for the workflow execution. • DecisionTaskStarted – The decision task was dispatched to a decider. • DecisionTaskTimedOut – The decision task timed out. • ExternalWorkflowExecutionCancelRequested – Request to cancel an external workflow execution was successfully delivered to the target execution. • ExternalWorkflowExecutionSignaled – A signal, requested by this workflow execution, was successfully delivered to the target external workflow execution. • FailWorkflowExecutionFailed – A request to mark a workflow execution as failed, itself failed. • MarkerRecorded – A marker was recorded in the workflow history as the result of a RecordMarker decision. • RecordMarkerFailed – A RecordMarker decision was returned as failed. • RequestCancelActivityTaskFailed – Failed to process RequestCancelActivityTask decision. This happens when the decision isn't configured properly. • RequestCancelExternalWorkflowExecutionFailed – Request to cancel an external workflow execution failed. • RequestCancelExternalWorkflowExecutionInitiated – A request was made to request the cancellation of an external workflow execution. • ScheduleActivityTaskFailed – Failed to process ScheduleActivityTask decision. This happens when the decision isn't configured properly, for example the activity type specified isn't registered. • SignalExternalWorkflowExecutionFailed – The request to signal an external workflow execution failed. • SignalExternalWorkflowExecutionInitiated – A request to signal an external workflow was made. • StartActivityTaskFailed – A scheduled activity task failed to start. • StartChildWorkflowExecutionFailed – Failed to process StartChildWorkflowExecution decision. This happens when the decision isn't configured properly,
swf-api-065
swf-api.pdf
65
RequestCancelExternalWorkflowExecutionFailed – Request to cancel an external workflow execution failed. • RequestCancelExternalWorkflowExecutionInitiated – A request was made to request the cancellation of an external workflow execution. • ScheduleActivityTaskFailed – Failed to process ScheduleActivityTask decision. This happens when the decision isn't configured properly, for example the activity type specified isn't registered. • SignalExternalWorkflowExecutionFailed – The request to signal an external workflow execution failed. • SignalExternalWorkflowExecutionInitiated – A request to signal an external workflow was made. • StartActivityTaskFailed – A scheduled activity task failed to start. • StartChildWorkflowExecutionFailed – Failed to process StartChildWorkflowExecution decision. This happens when the decision isn't configured properly, for example the workflow type specified isn't registered. • StartChildWorkflowExecutionInitiated – A request was made to start a child workflow execution. • StartTimerFailed – Failed to process StartTimer decision. This happens when the decision isn't configured properly, for example a timer already exists with the specified timer Id. HistoryEvent API Version 2012-01-25 316 Amazon Simple Workflow Service API Reference • TimerCanceled – A timer, previously started for this workflow execution, was successfully canceled. • TimerFired – A timer, previously started for this workflow execution, fired. • TimerStarted – A timer was started for the workflow execution due to a StartTimer decision. • WorkflowExecutionCancelRequested – A request to cancel this workflow execution was made. • WorkflowExecutionCanceled – The workflow execution was successfully canceled and closed. • WorkflowExecutionCompleted – The workflow execution was closed due to successful completion. • WorkflowExecutionContinuedAsNew – The workflow execution was closed and a new execution of the same type was created with the same workflowId. • WorkflowExecutionFailed – The workflow execution closed due to a failure. • WorkflowExecutionSignaled – An external signal was received for the workflow execution. • WorkflowExecutionStarted – The workflow execution was started. • WorkflowExecutionTerminated – The workflow execution was terminated. • WorkflowExecutionTimedOut – The workflow execution was closed because a time out was exceeded. Contents eventId The system generated ID of the event. This ID uniquely identifies the event with in the workflow execution history. Type: Long Required: Yes eventTimestamp The date and time when the event occurred. Type: Timestamp Required: Yes Contents API Version 2012-01-25 317 Amazon Simple Workflow Service eventType The type of the history event. Type: String API Reference Valid Values: WorkflowExecutionStarted | WorkflowExecutionCancelRequested | WorkflowExecutionCompleted | CompleteWorkflowExecutionFailed | WorkflowExecutionFailed | FailWorkflowExecutionFailed | WorkflowExecutionTimedOut | WorkflowExecutionCanceled | CancelWorkflowExecutionFailed | WorkflowExecutionContinuedAsNew | ContinueAsNewWorkflowExecutionFailed | WorkflowExecutionTerminated | DecisionTaskScheduled | DecisionTaskStarted | DecisionTaskCompleted | DecisionTaskTimedOut | ActivityTaskScheduled | ScheduleActivityTaskFailed | ActivityTaskStarted | ActivityTaskCompleted | ActivityTaskFailed | ActivityTaskTimedOut | ActivityTaskCanceled | ActivityTaskCancelRequested | RequestCancelActivityTaskFailed | WorkflowExecutionSignaled | MarkerRecorded | RecordMarkerFailed | TimerStarted | StartTimerFailed | TimerFired | TimerCanceled | CancelTimerFailed | StartChildWorkflowExecutionInitiated | StartChildWorkflowExecutionFailed | ChildWorkflowExecutionStarted | ChildWorkflowExecutionCompleted | ChildWorkflowExecutionFailed | ChildWorkflowExecutionTimedOut | ChildWorkflowExecutionCanceled | ChildWorkflowExecutionTerminated | SignalExternalWorkflowExecutionInitiated | SignalExternalWorkflowExecutionFailed | ExternalWorkflowExecutionSignaled | RequestCancelExternalWorkflowExecutionInitiated | RequestCancelExternalWorkflowExecutionFailed | ExternalWorkflowExecutionCancelRequested | LambdaFunctionScheduled | LambdaFunctionStarted | LambdaFunctionCompleted | LambdaFunctionFailed | LambdaFunctionTimedOut | ScheduleLambdaFunctionFailed | StartLambdaFunctionFailed Required: Yes Contents API Version 2012-01-25 318 Amazon Simple Workflow Service API Reference activityTaskCanceledEventAttributes If the event is of type ActivityTaskCanceled then this member is set and provides detailed information about the event. It isn't set for other event types. Type: ActivityTaskCanceledEventAttributes object Required: No activityTaskCancelRequestedEventAttributes If the event is of type ActivityTaskcancelRequested then this member is set and provides detailed information about the event. It isn't set for other event types. Type: ActivityTaskCancelRequestedEventAttributes object Required: No activityTaskCompletedEventAttributes If the event is of type ActivityTaskCompleted then this member is set and provides detailed information about the event. It isn't set for other event types. Type: ActivityTaskCompletedEventAttributes object Required: No activityTaskFailedEventAttributes If the event is of type ActivityTaskFailed then this member is set and provides detailed information about the event. It isn't set for other event types. Type: ActivityTaskFailedEventAttributes object Required: No activityTaskScheduledEventAttributes If the event is of type ActivityTaskScheduled then this member is set and provides detailed information about the event. It isn't set for other event types. Type: ActivityTaskScheduledEventAttributes object Required: No Contents API Version 2012-01-25 319 Amazon Simple Workflow Service API Reference activityTaskStartedEventAttributes If the event is of type ActivityTaskStarted then this member is set and provides detailed information about the event. It isn't set for other event types. Type: ActivityTaskStartedEventAttributes object Required: No activityTaskTimedOutEventAttributes If the event is of type ActivityTaskTimedOut then this member is set and provides detailed information about the event. It isn't set for other event types. Type: ActivityTaskTimedOutEventAttributes object Required: No cancelTimerFailedEventAttributes If the event is of type CancelTimerFailed then this member is set and provides detailed information about the event. It isn't set for other event types. Type: CancelTimerFailedEventAttributes object Required: No cancelWorkflowExecutionFailedEventAttributes If the event is of type CancelWorkflowExecutionFailed then this member is set and provides detailed information about the event. It isn't set for other event types. Type: CancelWorkflowExecutionFailedEventAttributes object Required: No childWorkflowExecutionCanceledEventAttributes If the event is of type ChildWorkflowExecutionCanceled then this
swf-api-066
swf-api.pdf
66
type ActivityTaskTimedOut then this member is set and provides detailed information about the event. It isn't set for other event types. Type: ActivityTaskTimedOutEventAttributes object Required: No cancelTimerFailedEventAttributes If the event is of type CancelTimerFailed then this member is set and provides detailed information about the event. It isn't set for other event types. Type: CancelTimerFailedEventAttributes object Required: No cancelWorkflowExecutionFailedEventAttributes If the event is of type CancelWorkflowExecutionFailed then this member is set and provides detailed information about the event. It isn't set for other event types. Type: CancelWorkflowExecutionFailedEventAttributes object Required: No childWorkflowExecutionCanceledEventAttributes If the event is of type ChildWorkflowExecutionCanceled then this member is set and provides detailed information about the event. It isn't set for other event types. Type: ChildWorkflowExecutionCanceledEventAttributes object Required: No Contents API Version 2012-01-25 320 Amazon Simple Workflow Service API Reference childWorkflowExecutionCompletedEventAttributes If the event is of type ChildWorkflowExecutionCompleted then this member is set and provides detailed information about the event. It isn't set for other event types. Type: ChildWorkflowExecutionCompletedEventAttributes object Required: No childWorkflowExecutionFailedEventAttributes If the event is of type ChildWorkflowExecutionFailed then this member is set and provides detailed information about the event. It isn't set for other event types. Type: ChildWorkflowExecutionFailedEventAttributes object Required: No childWorkflowExecutionStartedEventAttributes If the event is of type ChildWorkflowExecutionStarted then this member is set and provides detailed information about the event. It isn't set for other event types. Type: ChildWorkflowExecutionStartedEventAttributes object Required: No childWorkflowExecutionTerminatedEventAttributes If the event is of type ChildWorkflowExecutionTerminated then this member is set and provides detailed information about the event. It isn't set for other event types. Type: ChildWorkflowExecutionTerminatedEventAttributes object Required: No childWorkflowExecutionTimedOutEventAttributes If the event is of type ChildWorkflowExecutionTimedOut then this member is set and provides detailed information about the event. It isn't set for other event types. Type: ChildWorkflowExecutionTimedOutEventAttributes object Required: No Contents API Version 2012-01-25 321 Amazon Simple Workflow Service API Reference completeWorkflowExecutionFailedEventAttributes If the event is of type CompleteWorkflowExecutionFailed then this member is set and provides detailed information about the event. It isn't set for other event types. Type: CompleteWorkflowExecutionFailedEventAttributes object Required: No continueAsNewWorkflowExecutionFailedEventAttributes If the event is of type ContinueAsNewWorkflowExecutionFailed then this member is set and provides detailed information about the event. It isn't set for other event types. Type: ContinueAsNewWorkflowExecutionFailedEventAttributes object Required: No decisionTaskCompletedEventAttributes If the event is of type DecisionTaskCompleted then this member is set and provides detailed information about the event. It isn't set for other event types. Type: DecisionTaskCompletedEventAttributes object Required: No decisionTaskScheduledEventAttributes If the event is of type DecisionTaskScheduled then this member is set and provides detailed information about the event. It isn't set for other event types. Type: DecisionTaskScheduledEventAttributes object Required: No decisionTaskStartedEventAttributes If the event is of type DecisionTaskStarted then this member is set and provides detailed information about the event. It isn't set for other event types. Type: DecisionTaskStartedEventAttributes object Required: No Contents API Version 2012-01-25 322 Amazon Simple Workflow Service API Reference decisionTaskTimedOutEventAttributes If the event is of type DecisionTaskTimedOut then this member is set and provides detailed information about the event. It isn't set for other event types. Type: DecisionTaskTimedOutEventAttributes object Required: No externalWorkflowExecutionCancelRequestedEventAttributes If the event is of type ExternalWorkflowExecutionCancelRequested then this member is set and provides detailed information about the event. It isn't set for other event types. Type: ExternalWorkflowExecutionCancelRequestedEventAttributes object Required: No externalWorkflowExecutionSignaledEventAttributes If the event is of type ExternalWorkflowExecutionSignaled then this member is set and provides detailed information about the event. It isn't set for other event types. Type: ExternalWorkflowExecutionSignaledEventAttributes object Required: No failWorkflowExecutionFailedEventAttributes If the event is of type FailWorkflowExecutionFailed then this member is set and provides detailed information about the event. It isn't set for other event types. Type: FailWorkflowExecutionFailedEventAttributes object Required: No lambdaFunctionCompletedEventAttributes Provides the details of the LambdaFunctionCompleted event. It isn't set for other event types. Type: LambdaFunctionCompletedEventAttributes object Required: No Contents API Version 2012-01-25 323 Amazon Simple Workflow Service API Reference lambdaFunctionFailedEventAttributes Provides the details of the LambdaFunctionFailed event. It isn't set for other event types. Type: LambdaFunctionFailedEventAttributes object Required: No lambdaFunctionScheduledEventAttributes Provides the details of the LambdaFunctionScheduled event. It isn't set for other event types. Type: LambdaFunctionScheduledEventAttributes object Required: No lambdaFunctionStartedEventAttributes Provides the details of the LambdaFunctionStarted event. It isn't set for other event types. Type: LambdaFunctionStartedEventAttributes object Required: No lambdaFunctionTimedOutEventAttributes Provides the details of the LambdaFunctionTimedOut event. It isn't set for other event types. Type: LambdaFunctionTimedOutEventAttributes object Required: No markerRecordedEventAttributes If the event is of type MarkerRecorded then this member is set and provides detailed information about the event. It isn't set for other event types. Type: MarkerRecordedEventAttributes object Required: No recordMarkerFailedEventAttributes If the event is of type DecisionTaskFailed then this member is set and provides detailed information about the event. It isn't set for other event types. Contents API Version 2012-01-25 324 Amazon Simple Workflow Service API Reference Type: RecordMarkerFailedEventAttributes object Required: No requestCancelActivityTaskFailedEventAttributes If the event is of type RequestCancelActivityTaskFailed then this member
swf-api-067
swf-api.pdf
67
LambdaFunctionTimedOut event. It isn't set for other event types. Type: LambdaFunctionTimedOutEventAttributes object Required: No markerRecordedEventAttributes If the event is of type MarkerRecorded then this member is set and provides detailed information about the event. It isn't set for other event types. Type: MarkerRecordedEventAttributes object Required: No recordMarkerFailedEventAttributes If the event is of type DecisionTaskFailed then this member is set and provides detailed information about the event. It isn't set for other event types. Contents API Version 2012-01-25 324 Amazon Simple Workflow Service API Reference Type: RecordMarkerFailedEventAttributes object Required: No requestCancelActivityTaskFailedEventAttributes If the event is of type RequestCancelActivityTaskFailed then this member is set and provides detailed information about the event. It isn't set for other event types. Type: RequestCancelActivityTaskFailedEventAttributes object Required: No requestCancelExternalWorkflowExecutionFailedEventAttributes If the event is of type RequestCancelExternalWorkflowExecutionFailed then this member is set and provides detailed information about the event. It isn't set for other event types. Type: RequestCancelExternalWorkflowExecutionFailedEventAttributes object Required: No requestCancelExternalWorkflowExecutionInitiatedEventAttributes If the event is of type RequestCancelExternalWorkflowExecutionInitiated then this member is set and provides detailed information about the event. It isn't set for other event types. Type: RequestCancelExternalWorkflowExecutionInitiatedEventAttributes object Required: No scheduleActivityTaskFailedEventAttributes If the event is of type ScheduleActivityTaskFailed then this member is set and provides detailed information about the event. It isn't set for other event types. Type: ScheduleActivityTaskFailedEventAttributes object Required: No scheduleLambdaFunctionFailedEventAttributes Provides the details of the ScheduleLambdaFunctionFailed event. It isn't set for other event types. Contents API Version 2012-01-25 325 Amazon Simple Workflow Service API Reference Type: ScheduleLambdaFunctionFailedEventAttributes object Required: No signalExternalWorkflowExecutionFailedEventAttributes If the event is of type SignalExternalWorkflowExecutionFailed then this member is set and provides detailed information about the event. It isn't set for other event types. Type: SignalExternalWorkflowExecutionFailedEventAttributes object Required: No signalExternalWorkflowExecutionInitiatedEventAttributes If the event is of type SignalExternalWorkflowExecutionInitiated then this member is set and provides detailed information about the event. It isn't set for other event types. Type: SignalExternalWorkflowExecutionInitiatedEventAttributes object Required: No startChildWorkflowExecutionFailedEventAttributes If the event is of type StartChildWorkflowExecutionFailed then this member is set and provides detailed information about the event. It isn't set for other event types. Type: StartChildWorkflowExecutionFailedEventAttributes object Required: No startChildWorkflowExecutionInitiatedEventAttributes If the event is of type StartChildWorkflowExecutionInitiated then this member is set and provides detailed information about the event. It isn't set for other event types. Type: StartChildWorkflowExecutionInitiatedEventAttributes object Required: No startLambdaFunctionFailedEventAttributes Provides the details of the StartLambdaFunctionFailed event. It isn't set for other event types. Type: StartLambdaFunctionFailedEventAttributes object Contents API Version 2012-01-25 326 Amazon Simple Workflow Service Required: No startTimerFailedEventAttributes API Reference If the event is of type StartTimerFailed then this member is set and provides detailed information about the event. It isn't set for other event types. Type: StartTimerFailedEventAttributes object Required: No timerCanceledEventAttributes If the event is of type TimerCanceled then this member is set and provides detailed information about the event. It isn't set for other event types. Type: TimerCanceledEventAttributes object Required: No timerFiredEventAttributes If the event is of type TimerFired then this member is set and provides detailed information about the event. It isn't set for other event types. Type: TimerFiredEventAttributes object Required: No timerStartedEventAttributes If the event is of type TimerStarted then this member is set and provides detailed information about the event. It isn't set for other event types. Type: TimerStartedEventAttributes object Required: No workflowExecutionCanceledEventAttributes If the event is of type WorkflowExecutionCanceled then this member is set and provides detailed information about the event. It isn't set for other event types. Type: WorkflowExecutionCanceledEventAttributes object Required: No Contents API Version 2012-01-25 327 Amazon Simple Workflow Service API Reference workflowExecutionCancelRequestedEventAttributes If the event is of type WorkflowExecutionCancelRequested then this member is set and provides detailed information about the event. It isn't set for other event types. Type: WorkflowExecutionCancelRequestedEventAttributes object Required: No workflowExecutionCompletedEventAttributes If the event is of type WorkflowExecutionCompleted then this member is set and provides detailed information about the event. It isn't set for other event types. Type: WorkflowExecutionCompletedEventAttributes object Required: No workflowExecutionContinuedAsNewEventAttributes If the event is of type WorkflowExecutionContinuedAsNew then this member is set and provides detailed information about the event. It isn't set for other event types. Type: WorkflowExecutionContinuedAsNewEventAttributes object Required: No workflowExecutionFailedEventAttributes If the event is of type WorkflowExecutionFailed then this member is set and provides detailed information about the event. It isn't set for other event types. Type: WorkflowExecutionFailedEventAttributes object Required: No workflowExecutionSignaledEventAttributes If the event is of type WorkflowExecutionSignaled then this member is set and provides detailed information about the event. It isn't set for other event types. Type: WorkflowExecutionSignaledEventAttributes object Required: No Contents API Version 2012-01-25 328 Amazon Simple Workflow Service API Reference workflowExecutionStartedEventAttributes If the event is of type WorkflowExecutionStarted then this member is set and provides detailed information about the event. It isn't set for other event types. Type: WorkflowExecutionStartedEventAttributes object Required: No workflowExecutionTerminatedEventAttributes If the event is of type WorkflowExecutionTerminated then this member is set and provides detailed information about the
swf-api-068
swf-api.pdf
68
types. Type: WorkflowExecutionFailedEventAttributes object Required: No workflowExecutionSignaledEventAttributes If the event is of type WorkflowExecutionSignaled then this member is set and provides detailed information about the event. It isn't set for other event types. Type: WorkflowExecutionSignaledEventAttributes object Required: No Contents API Version 2012-01-25 328 Amazon Simple Workflow Service API Reference workflowExecutionStartedEventAttributes If the event is of type WorkflowExecutionStarted then this member is set and provides detailed information about the event. It isn't set for other event types. Type: WorkflowExecutionStartedEventAttributes object Required: No workflowExecutionTerminatedEventAttributes If the event is of type WorkflowExecutionTerminated then this member is set and provides detailed information about the event. It isn't set for other event types. Type: WorkflowExecutionTerminatedEventAttributes object Required: No workflowExecutionTimedOutEventAttributes If the event is of type WorkflowExecutionTimedOut then this member is set and provides detailed information about the event. It isn't set for other event types. Type: WorkflowExecutionTimedOutEventAttributes object Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 329 Amazon Simple Workflow Service API Reference LambdaFunctionCompletedEventAttributes Provides the details of the LambdaFunctionCompleted event. It isn't set for other event types. Contents scheduledEventId The ID of the LambdaFunctionScheduled event that was recorded when this Lambda task was scheduled. To help diagnose issues, use this information to trace back the chain of events leading up to this event. Type: Long Required: Yes startedEventId The ID of the LambdaFunctionStarted event recorded when this activity task started. To help diagnose issues, use this information to trace back the chain of events leading up to this event. Type: Long Required: Yes result The results of the Lambda task. Type: String Length Constraints: Maximum length of 32768. Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ LambdaFunctionCompletedEventAttributes API Version 2012-01-25 330 Amazon Simple Workflow Service • AWS SDK for Java V2 • AWS SDK for Ruby V3 API Reference See Also API Version 2012-01-25 331 Amazon Simple Workflow Service API Reference LambdaFunctionFailedEventAttributes Provides the details of the LambdaFunctionFailed event. It isn't set for other event types. Contents scheduledEventId The ID of the LambdaFunctionScheduled event that was recorded when this activity task was scheduled. To help diagnose issues, use this information to trace back the chain of events leading up to this event. Type: Long Required: Yes startedEventId The ID of the LambdaFunctionStarted event recorded when this activity task started. To help diagnose issues, use this information to trace back the chain of events leading up to this event. Type: Long Required: Yes details The details of the failure. Type: String Length Constraints: Maximum length of 32768. Required: No reason The reason provided for the failure. Type: String Length Constraints: Maximum length of 256. LambdaFunctionFailedEventAttributes API Version 2012-01-25 332 Amazon Simple Workflow Service Required: No See Also API Reference For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 333 Amazon Simple Workflow Service API Reference LambdaFunctionScheduledEventAttributes Provides the details of the LambdaFunctionScheduled event. It isn't set for other event types. Contents decisionTaskCompletedEventId The ID of the LambdaFunctionCompleted event corresponding to the decision that resulted in scheduling this activity task. To help diagnose issues, use this information to trace back the chain of events leading up to this event. Type: Long Required: Yes id The unique ID of the Lambda task. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes name The name of the Lambda function. Type: String Length Constraints: Minimum length of 1. Maximum length of 64. Required: Yes control Data attached to the event that the decider can use in subsequent workflow tasks. This data isn't sent to the Lambda task. Type: String Length Constraints: Maximum length of 32768. LambdaFunctionScheduledEventAttributes API Version 2012-01-25 334 Amazon Simple Workflow Service Required: No input The input provided to the Lambda task. Type: String API Reference Length Constraints: Minimum length of 0. Maximum length of 32768. Required: No startToCloseTimeout The maximum amount of time a worker can take to process the Lambda task. Type: String Length Constraints: Maximum length of 8. Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 335 Amazon Simple Workflow Service API Reference LambdaFunctionStartedEventAttributes Provides the details of the LambdaFunctionStarted event. It isn't set for other event types. Contents scheduledEventId The
swf-api-069
swf-api.pdf
69
length of 0. Maximum length of 32768. Required: No startToCloseTimeout The maximum amount of time a worker can take to process the Lambda task. Type: String Length Constraints: Maximum length of 8. Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 335 Amazon Simple Workflow Service API Reference LambdaFunctionStartedEventAttributes Provides the details of the LambdaFunctionStarted event. It isn't set for other event types. Contents scheduledEventId The ID of the LambdaFunctionScheduled event that was recorded when this activity task was scheduled. To help diagnose issues, use this information to trace back the chain of events leading up to this event. Type: Long Required: Yes See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 LambdaFunctionStartedEventAttributes API Version 2012-01-25 336 Amazon Simple Workflow Service API Reference LambdaFunctionTimedOutEventAttributes Provides details of the LambdaFunctionTimedOut event. Contents scheduledEventId The ID of the LambdaFunctionScheduled event that was recorded when this activity task was scheduled. To help diagnose issues, use this information to trace back the chain of events leading up to this event. Type: Long Required: Yes startedEventId The ID of the ActivityTaskStarted event that was recorded when this activity task started. To help diagnose issues, use this information to trace back the chain of events leading up to this event. Type: Long Required: Yes timeoutType The type of the timeout that caused this event. Type: String Valid Values: START_TO_CLOSE Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ LambdaFunctionTimedOutEventAttributes API Version 2012-01-25 337 Amazon Simple Workflow Service • AWS SDK for Java V2 • AWS SDK for Ruby V3 API Reference See Also API Version 2012-01-25 338 Amazon Simple Workflow Service API Reference MarkerRecordedEventAttributes Provides the details of the MarkerRecorded event. Contents decisionTaskCompletedEventId The ID of the DecisionTaskCompleted event corresponding to the decision task that resulted in the RecordMarker decision that requested this marker. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes markerName The name of the marker. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes details The details of the marker. Type: String Length Constraints: Maximum length of 32768. Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ MarkerRecordedEventAttributes API Version 2012-01-25 339 Amazon Simple Workflow Service • AWS SDK for Java V2 • AWS SDK for Ruby V3 API Reference See Also API Version 2012-01-25 340 Amazon Simple Workflow Service API Reference RecordMarkerDecisionAttributes Provides the details of the RecordMarker decision. Access Control You can use IAM policies to control this decision'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. • You cannot use an IAM policy to constrain this action's parameters. 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 Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide. Contents markerName The name of the marker. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes details The details of the marker. Type: String Length Constraints: Maximum length of 32768. Required: No RecordMarkerDecisionAttributes API Version 2012-01-25 341 Amazon Simple Workflow Service See Also API Reference For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 342 Amazon Simple Workflow Service API Reference RecordMarkerFailedEventAttributes Provides the details of the RecordMarkerFailed event. Contents cause The cause of the failure. This information is generated by the system and can be useful for diagnostic purposes. Note If cause is set to OPERATION_NOT_PERMITTED, the decision failed because it lacked sufficient permissions. For details and example IAM policies, see Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide. Type: String Valid Values: OPERATION_NOT_PERMITTED Required: Yes decisionTaskCompletedEventId The ID of the DecisionTaskCompleted event corresponding to the decision task
swf-api-070
swf-api.pdf
70
for Ruby V3 See Also API Version 2012-01-25 342 Amazon Simple Workflow Service API Reference RecordMarkerFailedEventAttributes Provides the details of the RecordMarkerFailed event. Contents cause The cause of the failure. This information is generated by the system and can be useful for diagnostic purposes. Note If cause is set to OPERATION_NOT_PERMITTED, the decision failed because it lacked sufficient permissions. For details and example IAM policies, see Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide. Type: String Valid Values: OPERATION_NOT_PERMITTED Required: Yes decisionTaskCompletedEventId The ID of the DecisionTaskCompleted event corresponding to the decision task that resulted in the RecordMarkerFailed decision for this cancellation request. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes markerName The marker's name. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes RecordMarkerFailedEventAttributes API Version 2012-01-25 343 Amazon Simple Workflow Service See Also API Reference For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 344 Amazon Simple Workflow Service API Reference RequestCancelActivityTaskDecisionAttributes Provides the details of the RequestCancelActivityTask decision. Access Control You can use IAM policies to control this decision'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. • You cannot use an IAM policy to constrain this action's parameters. 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 Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide. Contents activityId The activityId of the activity task to be canceled. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 RequestCancelActivityTaskDecisionAttributes API Version 2012-01-25 345 Amazon Simple Workflow Service API Reference RequestCancelActivityTaskFailedEventAttributes Provides the details of the RequestCancelActivityTaskFailed event. Contents activityId The activityId provided in the RequestCancelActivityTask decision that failed. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes cause The cause of the failure. This information is generated by the system and can be useful for diagnostic purposes. Note If cause is set to OPERATION_NOT_PERMITTED, the decision failed because it lacked sufficient permissions. For details and example IAM policies, see Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide. Type: String Valid Values: ACTIVITY_ID_UNKNOWN | OPERATION_NOT_PERMITTED Required: Yes decisionTaskCompletedEventId The ID of the DecisionTaskCompleted event corresponding to the decision task that resulted in the RequestCancelActivityTask decision for this cancellation request. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long RequestCancelActivityTaskFailedEventAttributes API Version 2012-01-25 346 Amazon Simple Workflow Service Required: Yes See Also API Reference For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 347 Amazon Simple Workflow Service API Reference RequestCancelExternalWorkflowExecutionDecisionAttributes Provides the details of the RequestCancelExternalWorkflowExecution decision. Access Control You can use IAM policies to control this decision'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. • You cannot use an IAM policy to constrain this action's parameters. 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 Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide. Contents workflowId The workflowId of the external workflow execution to cancel. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes control The data attached to the event that can be used by the decider in subsequent workflow tasks. Type: String Length Constraints: Maximum length of 32768. Required: No runId The runId of the external workflow execution to cancel. RequestCancelExternalWorkflowExecutionDecisionAttributes API
swf-api-071
swf-api.pdf
71
the action fails. The associated event attribute's 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. Contents workflowId The workflowId of the external workflow execution to cancel. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes control The data attached to the event that can be used by the decider in subsequent workflow tasks. Type: String Length Constraints: Maximum length of 32768. Required: No runId The runId of the external workflow execution to cancel. RequestCancelExternalWorkflowExecutionDecisionAttributes API Version 2012-01-25 348 Amazon Simple Workflow Service Type: String Length Constraints: Maximum length of 64. Required: No See Also API Reference For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 349 Amazon Simple Workflow Service API Reference RequestCancelExternalWorkflowExecutionFailedEventAttributes Provides the details of the RequestCancelExternalWorkflowExecutionFailed event. Contents cause The cause of the failure. This information is generated by the system and can be useful for diagnostic purposes. Note If cause is set to OPERATION_NOT_PERMITTED, the decision failed because it lacked sufficient permissions. For details and example IAM policies, see Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide. Type: String Valid Values: UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION | REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_RATE_EXCEEDED | OPERATION_NOT_PERMITTED Required: Yes decisionTaskCompletedEventId The ID of the DecisionTaskCompleted event corresponding to the decision task that resulted in the RequestCancelExternalWorkflowExecution decision for this cancellation request. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes initiatedEventId The ID of the RequestCancelExternalWorkflowExecutionInitiated event corresponding to the RequestCancelExternalWorkflowExecution decision to cancel this RequestCancelExternalWorkflowExecutionFailedEventAttributes API Version 2012-01-25 350 Amazon Simple Workflow Service API Reference external workflow execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes workflowId The workflowId of the external workflow to which the cancel request was to be delivered. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes control The data attached to the event that the decider can use in subsequent workflow tasks. This data isn't sent to the workflow execution. Type: String Length Constraints: Maximum length of 32768. Required: No runId The runId of the external workflow execution. Type: String Length Constraints: Maximum length of 64. Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ See Also API Version 2012-01-25 351 Amazon Simple Workflow Service • AWS SDK for Java V2 • AWS SDK for Ruby V3 API Reference See Also API Version 2012-01-25 352 Amazon Simple Workflow Service API Reference RequestCancelExternalWorkflowExecutionInitiatedEventAttributes Provides the details of the RequestCancelExternalWorkflowExecutionInitiated event. Contents decisionTaskCompletedEventId The ID of the DecisionTaskCompleted event corresponding to the decision task that resulted in the RequestCancelExternalWorkflowExecution decision for this cancellation request. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes workflowId The workflowId of the external workflow execution to be canceled. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes control Data attached to the event that can be used by the decider in subsequent workflow tasks. Type: String Length Constraints: Maximum length of 32768. Required: No runId The runId of the external workflow execution to be canceled. Type: String Length Constraints: Maximum length of 64. RequestCancelExternalWorkflowExecutionInitiatedEventAttributes API Version 2012-01-25 353 Amazon Simple Workflow Service Required: No See Also API Reference For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 354 Amazon Simple Workflow Service ResourceTag API Reference Tags are key-value pairs that can be associated with Amazon SWF state machines and activities. Tags may only contain unicode letters, digits, whitespace, or these symbols: _ . : / = + - @. Contents key The key of a tag. Type: String Length Constraints: Minimum length of 1. Maximum length of 128. Required: Yes value The value of a tag. Type: String Length Constraints: Maximum length of 256. Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 ResourceTag API Version 2012-01-25 355 Amazon Simple Workflow Service API Reference ScheduleActivityTaskDecisionAttributes Provides the details of the ScheduleActivityTask decision. Access
swf-api-072
swf-api.pdf
72
. : / = + - @. Contents key The key of a tag. Type: String Length Constraints: Minimum length of 1. Maximum length of 128. Required: Yes value The value of a tag. Type: String Length Constraints: Maximum length of 256. Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 ResourceTag API Version 2012-01-25 355 Amazon Simple Workflow Service API Reference ScheduleActivityTaskDecisionAttributes Provides the details of the ScheduleActivityTask decision. Access Control You can use IAM policies to control this decision'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. • activityType.name – String constraint. The key is swf:activityType.name. • activityType.version – String constraint. The key is swf:activityType.version. • taskList – String constraint. The key is swf:taskList.name. 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 Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide. Contents activityId The activityId of the activity task. The specified string 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. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes activityType The type of the activity task to schedule. Type: ActivityType object ScheduleActivityTaskDecisionAttributes API Version 2012-01-25 356 Amazon Simple Workflow Service Required: Yes control API Reference Data attached to the event that can be used by the decider in subsequent workflow tasks. This data isn't sent to the activity. Type: String Length Constraints: Maximum length of 32768. Required: No heartbeatTimeout If set, specifies the maximum time before which a worker processing a task of this type must report progress by calling RecordActivityTaskHeartbeat. If the timeout is exceeded, the activity task is automatically timed out. If the worker subsequently attempts to record a heartbeat or returns a result, it is ignored. This overrides the default heartbeat timeout specified when registering the activity type using RegisterActivityType. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration. Type: String Length Constraints: Maximum length of 8. Required: No input The input provided to the activity task. Type: String Length Constraints: Maximum length of 32768. Required: No scheduleToCloseTimeout The maximum duration for this activity task. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration. Contents API Version 2012-01-25 357 Amazon Simple Workflow Service API Reference Note A schedule-to-close timeout for this activity task must be specified either as a default for the activity type or through this field. If neither this field is set nor a default schedule-to-close timeout was specified at registration time then a fault is returned. Type: String Length Constraints: Maximum length of 8. Required: No scheduleToStartTimeout If set, specifies the maximum duration the activity task can wait to be assigned to a worker. This overrides the default schedule-to-start timeout specified when registering the activity type using RegisterActivityType. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration. Note A schedule-to-start timeout for this activity task must be specified either as a default for the activity type or through this field. If neither this field is set nor a default schedule-to-start timeout was specified at registration time then a fault is returned. Type: String Length Constraints: Maximum length of 8. Required: No startToCloseTimeout If set, specifies the maximum duration a worker may take to process this activity task. This overrides the default start-to-close timeout specified when registering the activity type using RegisterActivityType. Contents API Version 2012-01-25 358 Amazon Simple Workflow Service API Reference The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration. Note A start-to-close timeout for this activity task must be specified either as a default for the activity type or through this field. If neither this field is set nor a default start-to- close timeout was specified at registration time then a fault is returned. Type: String Length Constraints: Maximum length of 8. Required: No taskList If set, specifies the name of the task
swf-api-073
swf-api.pdf
73
type using RegisterActivityType. Contents API Version 2012-01-25 358 Amazon Simple Workflow Service API Reference The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration. Note A start-to-close timeout for this activity task must be specified either as a default for the activity type or through this field. If neither this field is set nor a default start-to- close timeout was specified at registration time then a fault is returned. Type: String Length Constraints: Maximum length of 8. Required: No taskList If set, specifies the name of the task list in which to schedule the activity task. If not specified, the defaultTaskList registered with the activity type is used. Note A task list for this activity task must be specified either as a default for the activity type or through this field. If neither this field is set nor a default task list was specified at registration time then a fault is returned. The specified string 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. Type: TaskList object Required: No taskPriority If set, specifies the priority with which the activity task is to be assigned to a worker. This overrides the defaultTaskPriority specified when registering the activity type using RegisterActivityType. Valid values are integers that range from Java's Integer.MIN_VALUE (-2147483648) to Integer.MAX_VALUE (2147483647). Higher numbers indicate higher priority. Contents API Version 2012-01-25 359 Amazon Simple Workflow Service API Reference For more information about setting task priority, see Setting Task Priority in the Amazon SWF Developer Guide. Type: String Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 360 Amazon Simple Workflow Service API Reference ScheduleActivityTaskFailedEventAttributes Provides the details of the ScheduleActivityTaskFailed event. Contents activityId The activityId provided in the ScheduleActivityTask decision that failed. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes activityType The activity type provided in the ScheduleActivityTask decision that failed. Type: ActivityType object Required: Yes cause The cause of the failure. This information is generated by the system and can be useful for diagnostic purposes. Note If cause is set to OPERATION_NOT_PERMITTED, the decision failed because it lacked sufficient permissions. For details and example IAM policies, see Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide. Type: String Valid Values: ACTIVITY_TYPE_DEPRECATED | ACTIVITY_TYPE_DOES_NOT_EXIST | ACTIVITY_ID_ALREADY_IN_USE | OPEN_ACTIVITIES_LIMIT_EXCEEDED | ACTIVITY_CREATION_RATE_EXCEEDED | DEFAULT_SCHEDULE_TO_CLOSE_TIMEOUT_UNDEFINED | ScheduleActivityTaskFailedEventAttributes API Version 2012-01-25 361 Amazon Simple Workflow Service API Reference DEFAULT_TASK_LIST_UNDEFINED | DEFAULT_SCHEDULE_TO_START_TIMEOUT_UNDEFINED | DEFAULT_START_TO_CLOSE_TIMEOUT_UNDEFINED | DEFAULT_HEARTBEAT_TIMEOUT_UNDEFINED | OPERATION_NOT_PERMITTED Required: Yes decisionTaskCompletedEventId The ID of the DecisionTaskCompleted event corresponding to the decision that resulted in the scheduling of this activity task. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 362 Amazon Simple Workflow Service API Reference ScheduleLambdaFunctionDecisionAttributes Decision attributes specified in scheduleLambdaFunctionDecisionAttributes within the list of decisions decisions passed to RespondDecisionTaskCompleted. Contents id A string that identifies the Lambda function execution in the event history. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes name The name, or ARN, of the Lambda function to schedule. Type: String Length Constraints: Minimum length of 1. Maximum length of 64. Required: Yes control The data attached to the event that the decider can use in subsequent workflow tasks. This data isn't sent to the Lambda task. Type: String Length Constraints: Maximum length of 32768. Required: No input The optional input data to be supplied to the Lambda function. Type: String Length Constraints: Minimum length of 0. Maximum length of 32768. ScheduleLambdaFunctionDecisionAttributes API Version 2012-01-25 363 Amazon Simple Workflow Service Required: No startToCloseTimeout API Reference The timeout value, in seconds, after which the Lambda function is considered to be failed once it has started. This can be any integer from 1-900 (1s-15m). If no value is supplied, then a default value of 300s is assumed. Type: String Length Constraints: Maximum length of 8. Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 364 Amazon Simple Workflow Service API
swf-api-074
swf-api.pdf
74
startToCloseTimeout API Reference The timeout value, in seconds, after which the Lambda function is considered to be failed once it has started. This can be any integer from 1-900 (1s-15m). If no value is supplied, then a default value of 300s is assumed. Type: String Length Constraints: Maximum length of 8. Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 364 Amazon Simple Workflow Service API Reference ScheduleLambdaFunctionFailedEventAttributes Provides the details of the ScheduleLambdaFunctionFailed event. It isn't set for other event types. Contents cause The cause of the failure. To help diagnose issues, use this information to trace back the chain of events leading up to this event. Note If cause is set to OPERATION_NOT_PERMITTED, the decision failed because it lacked sufficient permissions. For details and example IAM policies, see Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide. Type: String Valid Values: ID_ALREADY_IN_USE | OPEN_LAMBDA_FUNCTIONS_LIMIT_EXCEEDED | LAMBDA_FUNCTION_CREATION_RATE_EXCEEDED | LAMBDA_SERVICE_NOT_AVAILABLE_IN_REGION Required: Yes decisionTaskCompletedEventId The ID of the LambdaFunctionCompleted event corresponding to the decision that resulted in scheduling this Lambda task. To help diagnose issues, use this information to trace back the chain of events leading up to this event. Type: Long Required: Yes id The ID provided in the ScheduleLambdaFunction decision that failed. Type: String ScheduleLambdaFunctionFailedEventAttributes API Version 2012-01-25 365 Amazon Simple Workflow Service API Reference Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes name The name of the Lambda function. Type: String Length Constraints: Minimum length of 1. Maximum length of 64. Required: Yes See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 366 Amazon Simple Workflow Service API Reference SignalExternalWorkflowExecutionDecisionAttributes Provides the details of the SignalExternalWorkflowExecution decision. Access Control You can use IAM policies to control this decision'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. • You cannot use an IAM policy to constrain this action's parameters. 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 Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide. Contents signalName The name of the signal.The target workflow execution uses the signal name and input to process the signal. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes workflowId The workflowId of the workflow execution to be signaled. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes control The data attached to the event that can be used by the decider in subsequent decision tasks. SignalExternalWorkflowExecutionDecisionAttributes API Version 2012-01-25 367 Amazon Simple Workflow Service Type: String Length Constraints: Maximum length of 32768. Required: No input API Reference The input data to be provided with the signal. The target workflow execution uses the signal name and input data to process the signal. Type: String Length Constraints: Maximum length of 32768. Required: No runId The runId of the workflow execution to be signaled. Type: String Length Constraints: Maximum length of 64. Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 368 Amazon Simple Workflow Service API Reference SignalExternalWorkflowExecutionFailedEventAttributes Provides the details of the SignalExternalWorkflowExecutionFailed event. Contents cause The cause of the failure. This information is generated by the system and can be useful for diagnostic purposes. Note If cause is set to OPERATION_NOT_PERMITTED, the decision failed because it lacked sufficient permissions. For details and example IAM policies, see Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide. Type: String Valid Values: UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION | SIGNAL_EXTERNAL_WORKFLOW_EXECUTION_RATE_EXCEEDED | OPERATION_NOT_PERMITTED Required: Yes decisionTaskCompletedEventId The ID of the DecisionTaskCompleted event corresponding to the decision task that resulted in the SignalExternalWorkflowExecution decision for this signal. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes initiatedEventId The ID of the SignalExternalWorkflowExecutionInitiated event corresponding to the SignalExternalWorkflowExecution decision to request this signal. This
swf-api-075
swf-api.pdf
75
because it lacked sufficient permissions. For details and example IAM policies, see Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide. Type: String Valid Values: UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION | SIGNAL_EXTERNAL_WORKFLOW_EXECUTION_RATE_EXCEEDED | OPERATION_NOT_PERMITTED Required: Yes decisionTaskCompletedEventId The ID of the DecisionTaskCompleted event corresponding to the decision task that resulted in the SignalExternalWorkflowExecution decision for this signal. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes initiatedEventId The ID of the SignalExternalWorkflowExecutionInitiated event corresponding to the SignalExternalWorkflowExecution decision to request this signal. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. SignalExternalWorkflowExecutionFailedEventAttributes API Version 2012-01-25 369 Amazon Simple Workflow Service API Reference Type: Long Required: Yes workflowId The workflowId of the external workflow execution that the signal was being delivered to. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes control The data attached to the event that the decider can use in subsequent workflow tasks. This data isn't sent to the workflow execution. Type: String Length Constraints: Maximum length of 32768. Required: No runId The runId of the external workflow execution that the signal was being delivered to. Type: String Length Constraints: Maximum length of 64. Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 370 Amazon Simple Workflow Service API Reference See Also API Version 2012-01-25 371 Amazon Simple Workflow Service API Reference SignalExternalWorkflowExecutionInitiatedEventAttributes Provides the details of the SignalExternalWorkflowExecutionInitiated event. Contents decisionTaskCompletedEventId The ID of the DecisionTaskCompleted event corresponding to the decision task that resulted in the SignalExternalWorkflowExecution decision for this signal. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes signalName The name of the signal. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes workflowId The workflowId of the external workflow execution. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes control Data attached to the event that can be used by the decider in subsequent decision tasks. Type: String Length Constraints: Maximum length of 32768. Required: No SignalExternalWorkflowExecutionInitiatedEventAttributes API Version 2012-01-25 372 API Reference Amazon Simple Workflow Service input The input provided to the signal. Type: String Length Constraints: Maximum length of 32768. Required: No runId The runId of the external workflow execution to send the signal to. Type: String Length Constraints: Maximum length of 64. Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 373 Amazon Simple Workflow Service API Reference StartChildWorkflowExecutionDecisionAttributes Provides the details of the StartChildWorkflowExecution decision. Access Control You can use IAM policies to control this decision'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. • tagList.member.N – The key is "swf:tagList.N" where N is the tag number from 0 to 4, inclusive. • taskList – String constraint. The key is swf:taskList.name. • workflowType.name – String constraint. The key is swf:workflowType.name. • workflowType.version – String constraint. The key is swf:workflowType.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 Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide. Contents workflowId The workflowId of the workflow execution. The specified string 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. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes workflowType The type of the workflow execution to be started. StartChildWorkflowExecutionDecisionAttributes API Version 2012-01-25 374 Amazon Simple Workflow Service Type: WorkflowType object Required: Yes childPolicy API Reference If set, specifies the policy to use for the child workflow executions if the workflow execution being started is terminated by calling the TerminateWorkflowExecution action explicitly or due to an expired timeout. This policy overrides the default child policy specified when registering the workflow type using
swf-api-076
swf-api.pdf
76
characters (\u0000-\u001f | \u007f-\u009f). Also, it must not be the literal string arn. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes workflowType The type of the workflow execution to be started. StartChildWorkflowExecutionDecisionAttributes API Version 2012-01-25 374 Amazon Simple Workflow Service Type: WorkflowType object Required: Yes childPolicy API Reference If set, specifies the policy to use for the child workflow executions if the workflow execution being started is terminated by calling the TerminateWorkflowExecution action explicitly or due to an expired timeout. This policy overrides the default child policy specified when registering the workflow type using RegisterWorkflowType. 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. Note A child policy for this workflow execution must be specified either as a default for the workflow type or through this parameter. If neither this parameter is set nor a default child policy was specified at registration time then a fault is returned. Type: String Valid Values: TERMINATE | REQUEST_CANCEL | ABANDON Required: No control The data attached to the event that can be used by the decider in subsequent workflow tasks. This data isn't sent to the child workflow execution. Type: String Length Constraints: Maximum length of 32768. Required: No Contents API Version 2012-01-25 375 Amazon Simple Workflow Service executionStartToCloseTimeout API Reference The total duration for this workflow execution. This overrides the defaultExecutionStartToCloseTimeout specified when registering the workflow type. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration. Note An execution start-to-close timeout for this workflow execution must be specified either as a default for the workflow type or through this parameter. If neither this parameter is set nor a default execution start-to-close timeout was specified at registration time then a fault is returned. Type: String Length Constraints: Maximum length of 8. Required: No input The input to be provided to the workflow execution. Type: String Length Constraints: Maximum length of 32768. Required: No lambdaRole The IAM role attached to the child workflow execution. Type: String Length Constraints: Minimum length of 1. Maximum length of 1600. Required: No Contents API Version 2012-01-25 376 Amazon Simple Workflow Service tagList API Reference The list of tags to associate with the child workflow execution. A maximum of 5 tags can be specified. You can list workflow executions with a specific tag by calling ListOpenWorkflowExecutions or ListClosedWorkflowExecutions and specifying a TagFilter. Type: Array of strings Array Members: Maximum number of 5 items. Length Constraints: Minimum length of 0. Maximum length of 256. Required: No taskList The name of the task list to be used for decision tasks of the child workflow execution. Note A task list for this workflow execution must be specified either as a default for the workflow type or through this parameter. If neither this parameter is set nor a default task list was specified at registration time then a fault is returned. 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. Type: TaskList object Required: No taskPriority A task priority that, if set, specifies the priority for a decision task of this workflow execution. This overrides the defaultTaskPriority specified when registering the workflow type. 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. Contents API Version 2012-01-25 377 Amazon Simple Workflow Service API Reference Type: String Required: No taskStartToCloseTimeout Specifies the maximum duration of decision tasks for this workflow execution. This parameter overrides the defaultTaskStartToCloseTimout specified when registering the workflow type using RegisterWorkflowType. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration. Note A task start-to-close timeout for this workflow execution must be specified either as a default for the workflow type or through this parameter. If neither this parameter is set nor a default task start-to-close timeout was specified at registration time then a fault is returned. Type: String Length Constraints: Maximum length of 8. Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS
swf-api-077
swf-api.pdf
77
or equal to 0. You can use NONE to specify unlimited duration. Note A task start-to-close timeout for this workflow execution must be specified either as a default for the workflow type or through this parameter. If neither this parameter is set nor a default task start-to-close timeout was specified at registration time then a fault is returned. Type: String Length Constraints: Maximum length of 8. Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 378 Amazon Simple Workflow Service API Reference StartChildWorkflowExecutionFailedEventAttributes Provides the details of the StartChildWorkflowExecutionFailed event. Contents cause The cause of the failure. This information is generated by the system and can be useful for diagnostic purposes. Note When cause is set to OPERATION_NOT_PERMITTED, the decision fails because it lacks sufficient permissions. For details and example IAM policies, see Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide. Type: String Valid Values: WORKFLOW_TYPE_DOES_NOT_EXIST | WORKFLOW_TYPE_DEPRECATED | OPEN_CHILDREN_LIMIT_EXCEEDED | OPEN_WORKFLOWS_LIMIT_EXCEEDED | CHILD_CREATION_RATE_EXCEEDED | WORKFLOW_ALREADY_RUNNING | DEFAULT_EXECUTION_START_TO_CLOSE_TIMEOUT_UNDEFINED | DEFAULT_TASK_LIST_UNDEFINED | DEFAULT_TASK_START_TO_CLOSE_TIMEOUT_UNDEFINED | DEFAULT_CHILD_POLICY_UNDEFINED | OPERATION_NOT_PERMITTED Required: Yes decisionTaskCompletedEventId The ID of the DecisionTaskCompleted event corresponding to the decision task that resulted in the StartChildWorkflowExecution Decision to request this child workflow execution. This information can be useful for diagnosing problems by tracing back the chain of events. Type: Long Required: Yes StartChildWorkflowExecutionFailedEventAttributes API Version 2012-01-25 379 Amazon Simple Workflow Service initiatedEventId API Reference When the cause is WORKFLOW_ALREADY_RUNNING, initiatedEventId is the ID of the StartChildWorkflowExecutionInitiated event that corresponds to the StartChildWorkflowExecution Decision to start the workflow execution. You can use this information to diagnose problems by tracing back the chain of events leading up to this event. When the cause isn't WORKFLOW_ALREADY_RUNNING, initiatedEventId is set to 0 because the StartChildWorkflowExecutionInitiated event doesn't exist. Type: Long Required: Yes workflowId The workflowId of the child workflow execution. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes workflowType The workflow type provided in the StartChildWorkflowExecution Decision that failed. Type: WorkflowType object Required: Yes control The data attached to the event that the decider can use in subsequent workflow tasks. This data isn't sent to the child workflow execution. Type: String Length Constraints: Maximum length of 32768. Required: No Contents API Version 2012-01-25 380 Amazon Simple Workflow Service See Also API Reference For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 381 Amazon Simple Workflow Service API Reference StartChildWorkflowExecutionInitiatedEventAttributes Provides the details of the StartChildWorkflowExecutionInitiated event. Contents childPolicy The policy to use for the child workflow executions if this execution gets terminated by explicitly calling the TerminateWorkflowExecution action or due to an expired timeout. 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. Type: String Valid Values: TERMINATE | REQUEST_CANCEL | ABANDON Required: Yes decisionTaskCompletedEventId The ID of the DecisionTaskCompleted event corresponding to the decision task that resulted in the StartChildWorkflowExecution Decision to request this child workflow execution. This information can be useful for diagnosing problems by tracing back the cause of events. Type: Long Required: Yes taskList The name of the task list used for the decision tasks of the child workflow execution. Type: TaskList object Required: Yes StartChildWorkflowExecutionInitiatedEventAttributes API Version 2012-01-25 382 Amazon Simple Workflow Service workflowId API Reference The workflowId of the child workflow execution. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes workflowType The type of the child workflow execution. Type: WorkflowType object Required: Yes control Data attached to the event that can be used by the decider in subsequent decision tasks. This data isn't sent to the activity. Type: String Length Constraints: Maximum length of 32768. Required: No executionStartToCloseTimeout The maximum duration for the child workflow execution. If the workflow execution isn't closed within this duration, it is timed out and force-terminated. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration. Type: String Length Constraints: Maximum length of 8. Required: No input The inputs provided to the child workflow execution. Contents API Version 2012-01-25 383 API Reference Amazon Simple Workflow Service Type: String Length Constraints: Maximum length
swf-api-078
swf-api.pdf
78
tasks. This data isn't sent to the activity. Type: String Length Constraints: Maximum length of 32768. Required: No executionStartToCloseTimeout The maximum duration for the child workflow execution. If the workflow execution isn't closed within this duration, it is timed out and force-terminated. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration. Type: String Length Constraints: Maximum length of 8. Required: No input The inputs provided to the child workflow execution. Contents API Version 2012-01-25 383 API Reference Amazon Simple Workflow Service Type: String Length Constraints: Maximum length of 32768. Required: No lambdaRole The IAM role to attach to the child workflow execution. Type: String Length Constraints: Minimum length of 1. Maximum length of 1600. Required: No tagList The list of tags to associated with the child workflow execution. Type: Array of strings Array Members: Maximum number of 5 items. Length Constraints: Minimum length of 0. Maximum length of 256. Required: No taskPriority The priority assigned for the decision tasks for this workflow execution. 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. Type: String Required: No taskStartToCloseTimeout The maximum duration allowed for the decision tasks for this workflow execution. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration. Contents API Version 2012-01-25 384 Amazon Simple Workflow Service Type: String Length Constraints: Maximum length of 8. Required: No See Also API Reference For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 385 Amazon Simple Workflow Service API Reference StartLambdaFunctionFailedEventAttributes Provides the details of the StartLambdaFunctionFailed event. It isn't set for other event types. Contents cause The cause of the failure. To help diagnose issues, use this information to trace back the chain of events leading up to this event. Note If cause is set to OPERATION_NOT_PERMITTED, the decision failed because the IAM role attached to the execution lacked sufficient permissions. For details and example IAM policies, see Lambda Tasks in the Amazon SWF Developer Guide. Type: String Valid Values: ASSUME_ROLE_FAILED Required: No message A description that can help diagnose the cause of the fault. Type: String Length Constraints: Maximum length of 1728. Required: No scheduledEventId The ID of the ActivityTaskScheduled event that was recorded when this activity task was scheduled. To help diagnose issues, use this information to trace back the chain of events leading up to this event. Type: Long Required: No StartLambdaFunctionFailedEventAttributes API Version 2012-01-25 386 Amazon Simple Workflow Service See Also API Reference For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 387 Amazon Simple Workflow Service API Reference StartTimerDecisionAttributes Provides the details of the StartTimer decision. Access Control You can use IAM policies to control this decision'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. • You cannot use an IAM policy to constrain this action's parameters. 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 Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide. Contents startToFireTimeout The duration to wait before firing the timer. The duration is specified in seconds, an integer greater than or equal to 0. Type: String Length Constraints: Minimum length of 1. Maximum length of 8. Required: Yes timerId The unique ID of the timer. The specified string 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. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. StartTimerDecisionAttributes API Version 2012-01-25 388 Amazon Simple Workflow Service Required: Yes control API Reference The data attached to the event that can be used by the decider in subsequent workflow tasks. Type: String Length Constraints: Maximum length of 32768. Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ •
swf-api-079
swf-api.pdf
79
(colon), / (slash), | (vertical bar), or any control characters (\u0000-\u001f | \u007f-\u009f). Also, it must not be the literal string arn. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. StartTimerDecisionAttributes API Version 2012-01-25 388 Amazon Simple Workflow Service Required: Yes control API Reference The data attached to the event that can be used by the decider in subsequent workflow tasks. Type: String Length Constraints: Maximum length of 32768. Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 389 Amazon Simple Workflow Service API Reference StartTimerFailedEventAttributes Provides the details of the StartTimerFailed event. Contents cause The cause of the failure. This information is generated by the system and can be useful for diagnostic purposes. Note If cause is set to OPERATION_NOT_PERMITTED, the decision failed because it lacked sufficient permissions. For details and example IAM policies, see Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide. Type: String Valid Values: TIMER_ID_ALREADY_IN_USE | OPEN_TIMERS_LIMIT_EXCEEDED | TIMER_CREATION_RATE_EXCEEDED | OPERATION_NOT_PERMITTED Required: Yes decisionTaskCompletedEventId The ID of the DecisionTaskCompleted event corresponding to the decision task that resulted in the StartTimer decision for this activity task. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes timerId The timerId provided in the StartTimer decision that failed. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. StartTimerFailedEventAttributes API Version 2012-01-25 390 Amazon Simple Workflow Service Required: Yes See Also API Reference For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 391 Amazon Simple Workflow Service TagFilter API Reference Used to filter the workflow executions in visibility APIs based on a tag. Contents tag Specifies the tag that must be associated with the execution for it to meet the filter criteria. Tags may only contain unicode letters, digits, whitespace, or these symbols: _ . : / = + - @. Type: String Length Constraints: Minimum length of 0. Maximum length of 256. Required: Yes See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 TagFilter API Version 2012-01-25 392 API Reference Amazon Simple Workflow Service TaskList Represents a task list. Contents name The name of the task list. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 TaskList API Version 2012-01-25 393 Amazon Simple Workflow Service API Reference TimerCanceledEventAttributes Provides the details of the TimerCanceled event. Contents decisionTaskCompletedEventId The ID of the DecisionTaskCompleted event corresponding to the decision task that resulted in the CancelTimer decision to cancel this timer. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes startedEventId The ID of the TimerStarted event that was recorded when this timer was started. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes timerId The unique ID of the timer that was canceled. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ TimerCanceledEventAttributes API Version 2012-01-25 394 Amazon Simple Workflow Service • AWS SDK for Java V2 • AWS SDK for Ruby V3 API Reference See Also API Version 2012-01-25 395 Amazon Simple Workflow Service API Reference TimerFiredEventAttributes Provides the details of the TimerFired event. Contents startedEventId The ID of the TimerStarted event that was recorded when this timer was started. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes timerId The unique ID of the timer that fired. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for
swf-api-080
swf-api.pdf
80
the TimerFired event. Contents startedEventId The ID of the TimerStarted event that was recorded when this timer was started. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes timerId The unique ID of the timer that fired. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 TimerFiredEventAttributes API Version 2012-01-25 396 Amazon Simple Workflow Service API Reference TimerStartedEventAttributes Provides the details of the TimerStarted event. Contents decisionTaskCompletedEventId The ID of the DecisionTaskCompleted event corresponding to the decision task that resulted in the StartTimer decision for this activity task. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes startToFireTimeout The duration of time after which the timer fires. The duration is specified in seconds, an integer greater than or equal to 0. Type: String Length Constraints: Minimum length of 1. Maximum length of 8. Required: Yes timerId The unique ID of the timer that was started. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes control Data attached to the event that can be used by the decider in subsequent workflow tasks. Type: String Length Constraints: Maximum length of 32768. TimerStartedEventAttributes API Version 2012-01-25 397 Amazon Simple Workflow Service Required: No See Also API Reference For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 398 API Reference Amazon Simple Workflow Service WorkflowExecution Represents a workflow execution. Contents runId A system-generated unique identifier for the workflow execution. Type: String Length Constraints: Minimum length of 1. Maximum length of 64. Required: Yes workflowId The user defined identifier associated with the workflow execution. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 WorkflowExecution API Version 2012-01-25 399 Amazon Simple Workflow Service API Reference WorkflowExecutionCanceledEventAttributes Provides the details of the WorkflowExecutionCanceled event. Contents decisionTaskCompletedEventId The ID of the DecisionTaskCompleted event corresponding to the decision task that resulted in the CancelWorkflowExecution decision for this cancellation request. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes details The details of the cancellation. Type: String Length Constraints: Maximum length of 32768. Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 WorkflowExecutionCanceledEventAttributes API Version 2012-01-25 400 Amazon Simple Workflow Service API Reference WorkflowExecutionCancelRequestedEventAttributes Provides the details of the WorkflowExecutionCancelRequested event. Contents cause If set, indicates that the request to cancel the workflow execution was automatically generated, and specifies the cause. This happens if the parent workflow execution times out or is terminated, and the child policy is set to cancel child executions. Type: String Valid Values: CHILD_POLICY_APPLIED Required: No externalInitiatedEventId The ID of the RequestCancelExternalWorkflowExecutionInitiated event corresponding to the RequestCancelExternalWorkflowExecution decision to cancel this workflow execution.The source event with this ID can be found in the history of the source workflow execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: No externalWorkflowExecution The external workflow execution for which the cancellation was requested. Type: WorkflowExecution object Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: WorkflowExecutionCancelRequestedEventAttributes API Version 2012-01-25 401 Amazon Simple Workflow Service • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 API Reference See Also API Version 2012-01-25 402 Amazon Simple Workflow Service API Reference WorkflowExecutionCompletedEventAttributes Provides the details of the WorkflowExecutionCompleted event. Contents decisionTaskCompletedEventId The ID of the DecisionTaskCompleted event corresponding to the decision task that resulted in the CompleteWorkflowExecution decision to complete this execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes result The result produced by the workflow execution upon successful completion. Type: String Length Constraints: Maximum length of 32768. Required: No See
swf-api-081
swf-api.pdf
81
for Java V2 • AWS SDK for Ruby V3 API Reference See Also API Version 2012-01-25 402 Amazon Simple Workflow Service API Reference WorkflowExecutionCompletedEventAttributes Provides the details of the WorkflowExecutionCompleted event. Contents decisionTaskCompletedEventId The ID of the DecisionTaskCompleted event corresponding to the decision task that resulted in the CompleteWorkflowExecution decision to complete this execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes result The result produced by the workflow execution upon successful completion. Type: String Length Constraints: Maximum length of 32768. Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 WorkflowExecutionCompletedEventAttributes API Version 2012-01-25 403 Amazon Simple Workflow Service API Reference WorkflowExecutionConfiguration The configuration settings for a workflow execution including timeout values, tasklist etc. These configuration settings are determined from the defaults specified when registering the workflow type and those specified when starting the workflow execution. Contents childPolicy The policy to use for the child workflow executions if this workflow execution is terminated, by calling the TerminateWorkflowExecution action explicitly or due to an expired timeout. 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. Type: String Valid Values: TERMINATE | REQUEST_CANCEL | ABANDON Required: Yes executionStartToCloseTimeout The total duration for this workflow execution. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration. Type: String Length Constraints: Minimum length of 1. Maximum length of 8. Required: Yes taskList The task list used for the decision tasks generated for this workflow execution. WorkflowExecutionConfiguration API Version 2012-01-25 404 Amazon Simple Workflow Service Type: TaskList object Required: Yes taskStartToCloseTimeout API Reference The maximum duration allowed for decision tasks for this workflow execution. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration. Type: String Length Constraints: Minimum length of 1. Maximum length of 8. Required: Yes lambdaRole The IAM role attached to the child workflow execution. Type: String Length Constraints: Minimum length of 1. Maximum length of 1600. Required: No taskPriority The priority assigned to decision tasks for this workflow execution. 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. Type: String Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: See Also API Version 2012-01-25 405 Amazon Simple Workflow Service • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 API Reference See Also API Version 2012-01-25 406 Amazon Simple Workflow Service API Reference WorkflowExecutionContinuedAsNewEventAttributes Provides the details of the WorkflowExecutionContinuedAsNew event. Contents childPolicy The policy to use for the child workflow executions of the new execution if it is terminated by calling the TerminateWorkflowExecution action explicitly or due to an expired timeout. 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. Type: String Valid Values: TERMINATE | REQUEST_CANCEL | ABANDON Required: Yes decisionTaskCompletedEventId The ID of the DecisionTaskCompleted event corresponding to the decision task that resulted in the ContinueAsNewWorkflowExecution decision that started this execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes newExecutionRunId The runId of the new workflow execution. Type: String Length Constraints: Minimum length of 1. Maximum length of 64. WorkflowExecutionContinuedAsNewEventAttributes API Version 2012-01-25 407 Amazon Simple Workflow Service Required: Yes taskList API Reference The task list to use for the decisions of the new (continued) workflow execution. Type: TaskList object Required: Yes workflowType The workflow type of this execution. Type: WorkflowType object Required: Yes executionStartToCloseTimeout The total duration allowed for the new workflow execution. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify
swf-api-082
swf-api.pdf
82
event. Type: Long Required: Yes newExecutionRunId The runId of the new workflow execution. Type: String Length Constraints: Minimum length of 1. Maximum length of 64. WorkflowExecutionContinuedAsNewEventAttributes API Version 2012-01-25 407 Amazon Simple Workflow Service Required: Yes taskList API Reference The task list to use for the decisions of the new (continued) workflow execution. Type: TaskList object Required: Yes workflowType The workflow type of this execution. Type: WorkflowType object Required: Yes executionStartToCloseTimeout The total duration allowed for the new workflow execution. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration. Type: String Length Constraints: Maximum length of 8. Required: No input The input provided to the new workflow execution. Type: String Length Constraints: Maximum length of 32768. Required: No lambdaRole The IAM role to attach to the new (continued) workflow execution. Type: String Contents API Version 2012-01-25 408 Amazon Simple Workflow Service API Reference Length Constraints: Minimum length of 1. Maximum length of 1600. Required: No tagList The list of tags associated with the new workflow execution. Type: Array of strings Array Members: Maximum number of 5 items. Length Constraints: Minimum length of 0. Maximum length of 256. Required: No taskPriority The priority of the task to use for the decisions of the new (continued) workflow execution. Type: String Required: No taskStartToCloseTimeout The maximum duration of decision tasks for the new workflow execution. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration. Type: String Length Constraints: Maximum length of 8. Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 See Also API Version 2012-01-25 409 Amazon Simple Workflow Service • AWS SDK for Ruby V3 API Reference See Also API Version 2012-01-25 410 Amazon Simple Workflow Service API Reference WorkflowExecutionFailedEventAttributes Provides the details of the WorkflowExecutionFailed event. Contents decisionTaskCompletedEventId The ID of the DecisionTaskCompleted event corresponding to the decision task that resulted in the FailWorkflowExecution decision to fail this execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: Yes details The details of the failure. Type: String Length Constraints: Maximum length of 32768. Required: No reason The descriptive reason provided for the failure. Type: String Length Constraints: Maximum length of 256. Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ WorkflowExecutionFailedEventAttributes API Version 2012-01-25 411 Amazon Simple Workflow Service • AWS SDK for Java V2 • AWS SDK for Ruby V3 API Reference See Also API Version 2012-01-25 412 Amazon Simple Workflow Service API Reference WorkflowExecutionFilter Used to filter the workflow executions in visibility APIs by their workflowId. Contents workflowId The workflowId to pass of match the criteria of this filter. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 WorkflowExecutionFilter API Version 2012-01-25 413 Amazon Simple Workflow Service API Reference WorkflowExecutionInfo Contains information about a workflow execution. Contents execution The workflow execution this information is about. Type: WorkflowExecution object Required: Yes executionStatus The current status of the execution. Type: String Valid Values: OPEN | CLOSED Required: Yes startTimestamp The time when the execution was started. Type: Timestamp Required: Yes workflowType The type of the workflow execution. Type: WorkflowType object Required: Yes cancelRequested Set to true if a cancellation is requested for this workflow execution. Type: Boolean Required: No WorkflowExecutionInfo API Version 2012-01-25 414 Amazon Simple Workflow Service closeStatus API Reference If the execution status is closed then this specifies how the execution was closed: • COMPLETED – the execution was successfully completed. • CANCELED – the execution was canceled.Cancellation allows the implementation to gracefully clean up before the execution is closed. • TERMINATED – the execution was force terminated. • FAILED – the execution failed to complete. • TIMED_OUT – the execution did not complete in the alloted time and was automatically timed out. • CONTINUED_AS_NEW – the execution is logically continued. This means the current execution was completed and a new execution was started to carry on the workflow. Type: String Valid Values: COMPLETED | FAILED | CANCELED | TERMINATED | CONTINUED_AS_NEW | TIMED_OUT Required: No closeTimestamp The time when the workflow execution was closed. Set only if the execution status is CLOSED. Type: Timestamp Required: No parent If this workflow execution is a child of another
swf-api-083
swf-api.pdf
83
terminated. • FAILED – the execution failed to complete. • TIMED_OUT – the execution did not complete in the alloted time and was automatically timed out. • CONTINUED_AS_NEW – the execution is logically continued. This means the current execution was completed and a new execution was started to carry on the workflow. Type: String Valid Values: COMPLETED | FAILED | CANCELED | TERMINATED | CONTINUED_AS_NEW | TIMED_OUT Required: No closeTimestamp The time when the workflow execution was closed. Set only if the execution status is CLOSED. Type: Timestamp Required: No parent If this workflow execution is a child of another execution then contains the workflow execution that started this execution. Type: WorkflowExecution object Required: No tagList The list of tags associated with the workflow execution. Tags can be used to identify and list workflow executions of interest through the visibility APIs. A workflow execution can have a maximum of 5 tags. Contents API Version 2012-01-25 415 Amazon Simple Workflow Service Type: Array of strings API Reference Array Members: Maximum number of 5 items. Length Constraints: Minimum length of 0. Maximum length of 256. Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 416 Amazon Simple Workflow Service API Reference WorkflowExecutionOpenCounts Contains the counts of open tasks, child workflow executions and timers for a workflow execution. Contents openActivityTasks The count of activity tasks whose status is OPEN. Type: Integer Valid Range: Minimum value of 0. Required: Yes openChildWorkflowExecutions The count of child workflow executions whose status is OPEN. Type: Integer Valid Range: Minimum value of 0. Required: Yes openDecisionTasks The count of decision tasks whose status is OPEN. A workflow execution can have at most one open decision task. Type: Integer Valid Range: Minimum value of 0. Maximum value of 1. Required: Yes openTimers The count of timers started by this workflow execution that have not fired yet. Type: Integer Valid Range: Minimum value of 0. WorkflowExecutionOpenCounts API Version 2012-01-25 417 API Reference Amazon Simple Workflow Service Required: Yes openLambdaFunctions The count of Lambda tasks whose status is OPEN. Type: Integer Valid Range: Minimum value of 0. Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 418 Amazon Simple Workflow Service API Reference WorkflowExecutionSignaledEventAttributes Provides the details of the WorkflowExecutionSignaled event. Contents signalName The name of the signal received. The decider can use the signal name and inputs to determine how to the process the signal. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes externalInitiatedEventId The ID of the SignalExternalWorkflowExecutionInitiated event corresponding to the SignalExternalWorkflow decision to signal this workflow execution.The source event with this ID can be found in the history of the source workflow execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. This field is set only if the signal was initiated by another workflow execution. Type: Long Required: No externalWorkflowExecution The workflow execution that sent the signal. This is set only of the signal was sent by another workflow execution. Type: WorkflowExecution object Required: No input The inputs provided with the signal. The decider can use the signal name and inputs to determine how to process the signal. Type: String WorkflowExecutionSignaledEventAttributes API Version 2012-01-25 419 Amazon Simple Workflow Service API Reference Length Constraints: Maximum length of 32768. Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 420 Amazon Simple Workflow Service API Reference WorkflowExecutionStartedEventAttributes Provides details of WorkflowExecutionStarted event. Contents childPolicy The policy to use for the child workflow executions if this workflow execution is terminated, by calling the TerminateWorkflowExecution action explicitly or due to an expired timeout. 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. Type: String Valid Values: TERMINATE | REQUEST_CANCEL | ABANDON Required: Yes taskList The name of the task list for scheduling the decision tasks for this workflow execution. Type: TaskList object Required: Yes workflowType
swf-api-084
swf-api.pdf
84
timeout. 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. Type: String Valid Values: TERMINATE | REQUEST_CANCEL | ABANDON Required: Yes taskList The name of the task list for scheduling the decision tasks for this workflow execution. Type: TaskList object Required: Yes workflowType The workflow type of this execution. Type: WorkflowType object Required: Yes WorkflowExecutionStartedEventAttributes API Version 2012-01-25 421 Amazon Simple Workflow Service continuedExecutionRunId API Reference If this workflow execution was started due to a ContinueAsNewWorkflowExecution decision, then it contains the runId of the previous workflow execution that was closed and continued as this execution. Type: String Length Constraints: Maximum length of 64. Required: No executionStartToCloseTimeout The maximum duration for this workflow execution. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration. Type: String Length Constraints: Maximum length of 8. Required: No input The input provided to the workflow execution. Type: String Length Constraints: Maximum length of 32768. Required: No lambdaRole The IAM role attached to the workflow execution. Type: String Length Constraints: Minimum length of 1. Maximum length of 1600. Required: No Contents API Version 2012-01-25 422 Amazon Simple Workflow Service parentInitiatedEventId API Reference The ID of the StartChildWorkflowExecutionInitiated event corresponding to the StartChildWorkflowExecution Decision to start this workflow execution. The source event with this ID can be found in the history of the source workflow execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. Type: Long Required: No parentWorkflowExecution The source workflow execution that started this workflow execution. The member isn't set if the workflow execution was not started by a workflow. Type: WorkflowExecution object Required: No tagList The list of tags associated with this workflow execution. An execution can have up to 5 tags. Type: Array of strings Array Members: Maximum number of 5 items. Length Constraints: Minimum length of 0. Maximum length of 256. Required: No taskPriority The priority of the decision tasks in the workflow execution. Type: String Required: No taskStartToCloseTimeout The maximum duration of decision tasks for this workflow type. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration. Contents API Version 2012-01-25 423 Amazon Simple Workflow Service Type: String Length Constraints: Maximum length of 8. Required: No See Also API Reference For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 424 Amazon Simple Workflow Service API Reference WorkflowExecutionTerminatedEventAttributes Provides the details of the WorkflowExecutionTerminated event. Contents childPolicy The policy used for the child workflow executions of this workflow execution. 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. Type: String Valid Values: TERMINATE | REQUEST_CANCEL | ABANDON Required: Yes cause If set, indicates that the workflow execution was automatically terminated, and specifies the cause. This happens if the parent workflow execution times out or is terminated and the child policy is set to terminate child executions. Type: String Valid Values: CHILD_POLICY_APPLIED | EVENT_LIMIT_EXCEEDED | OPERATOR_INITIATED Required: No details The details provided for the termination. Type: String WorkflowExecutionTerminatedEventAttributes API Version 2012-01-25 425 Amazon Simple Workflow Service API Reference Length Constraints: Maximum length of 32768. Required: No reason The reason provided for the termination. Type: String Length Constraints: Maximum length of 256. Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 426 Amazon Simple Workflow Service API Reference WorkflowExecutionTimedOutEventAttributes Provides the details of the WorkflowExecutionTimedOut event. Contents childPolicy The policy used for the child workflow executions of this workflow execution. 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
swf-api-085
swf-api.pdf
85
in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 426 Amazon Simple Workflow Service API Reference WorkflowExecutionTimedOutEventAttributes Provides the details of the WorkflowExecutionTimedOut event. Contents childPolicy The policy used for the child workflow executions of this workflow execution. 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. Type: String Valid Values: TERMINATE | REQUEST_CANCEL | ABANDON Required: Yes timeoutType The type of timeout that caused this event. Type: String Valid Values: START_TO_CLOSE Required: Yes See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 WorkflowExecutionTimedOutEventAttributes API Version 2012-01-25 427 Amazon Simple Workflow Service • AWS SDK for Ruby V3 API Reference See Also API Version 2012-01-25 428 API Reference Amazon Simple Workflow Service WorkflowType Represents a workflow type. Contents name The name of the workflow type. Note The combination of workflow type name and version must be unique with in a domain. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes version The version of the workflow type. Note The combination of workflow type name and version must be unique with in a domain. Type: String Length Constraints: Minimum length of 1. Maximum length of 64. Required: Yes See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: WorkflowType API Version 2012-01-25 429 Amazon Simple Workflow Service • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 API Reference See Also API Version 2012-01-25 430 Amazon Simple Workflow Service API Reference WorkflowTypeConfiguration The configuration settings of a workflow type. Contents defaultChildPolicy 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. Type: String Valid Values: TERMINATE | REQUEST_CANCEL | ABANDON Required: No defaultExecutionStartToCloseTimeout The default maximum duration, specified when registering the workflow type, for executions of 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. Type: String Length Constraints: Maximum length of 8. Required: No WorkflowTypeConfiguration API Version 2012-01-25 431 Amazon Simple Workflow Service defaultLambdaRole The default IAM role attached to this workflow type. API Reference Note Executions of this workflow type need IAM roles to invoke Lambda functions. If you don't specify an IAM role when starting 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. Type: String Length Constraints: Minimum length of 1. Maximum length of 1600. Required: No defaultTaskList The default task list, specified when registering the workflow type, for decisions tasks scheduled for workflow executions of this type. This default can be overridden when starting a workflow execution using the StartWorkflowExecution action or the StartChildWorkflowExecution Decision. Type: TaskList object Required: No defaultTaskPriority The default task priority, specified when registering the workflow type, for all decision tasks of this workflow type. This default can be overridden when starting a workflow execution using the StartWorkflowExecution action or the StartChildWorkflowExecution decision. 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. Contents API Version 2012-01-25 432 Amazon Simple Workflow Service API Reference Type: String Required: No defaultTaskStartToCloseTimeout The default maximum duration, specified when registering the workflow type, that a decision task for executions of this workflow type might take before returning completion or failure. If the task doesn'tdo close
swf-api-086
swf-api.pdf
86
default can be overridden when starting a workflow execution using the StartWorkflowExecution action or the StartChildWorkflowExecution decision. 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. Contents API Version 2012-01-25 432 Amazon Simple Workflow Service API Reference Type: String Required: No defaultTaskStartToCloseTimeout The default maximum duration, specified when registering the workflow type, that a decision task for executions of this workflow type might take before returning completion or failure. If the task doesn'tdo close in the specified time then the task is automatically timed out and rescheduled. If the decider eventually reports a completion or failure, it is ignored. 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. Type: String Length Constraints: Maximum length of 8. Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 433 Amazon Simple Workflow Service WorkflowTypeFilter API Reference Used to filter workflow execution query results by type. Each parameter, if specified, defines a rule that must be satisfied by each returned result. Contents name Name of the workflow type. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes version Version of the workflow type. Type: String Length Constraints: Maximum length of 64. Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 WorkflowTypeFilter API Version 2012-01-25 434 API Reference Amazon Simple Workflow Service WorkflowTypeInfo Contains information about a workflow type. Contents creationDate The date when this type was registered. Type: Timestamp Required: Yes status The current status of the workflow type. Type: String Valid Values: REGISTERED | DEPRECATED Required: Yes workflowType The workflow type this information is about. Type: WorkflowType object Required: Yes deprecationDate If the type is in deprecated state, then it is set to the date when the type was deprecated. Type: Timestamp Required: No description The description of the type registered through RegisterWorkflowType. Type: String WorkflowTypeInfo API Version 2012-01-25 435 Amazon Simple Workflow Service API Reference Length Constraints: Maximum length of 1024. Required: No See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: • AWS SDK for C++ • AWS SDK for Java V2 • AWS SDK for Ruby V3 See Also API Version 2012-01-25 436 Amazon Simple Workflow Service API Reference Common Parameters The following list contains the parameters that all actions use for signing Signature Version 4 requests with a query string. Any action-specific parameters are listed in the topic for that action. For more information about Signature Version 4, see Signing AWS API requests in the IAM User Guide. Action The action to be performed. Type: string Required: Yes Version The API version that the request is written for, expressed in the format YYYY-MM-DD. Type: string Required: Yes X-Amz-Algorithm The hash algorithm that you used to create the request signature. Condition: Specify this parameter when you include authentication information in a query string instead of in the HTTP authorization header. Type: string Valid Values: AWS4-HMAC-SHA256 Required: Conditional X-Amz-Credential The credential scope value, which is a string that includes your access key, the date, the region you are targeting, the service you are requesting, and a termination string ("aws4_request"). The value is expressed in the following format: access_key/YYYYMMDD/region/service/ aws4_request. API Version 2012-01-25 437 Amazon Simple Workflow Service API Reference For more information, see Create a signed AWS API request in the IAM User Guide. Condition: Specify this parameter when you include authentication information in a query string instead of in the HTTP authorization header. Type: string Required: Conditional X-Amz-Date The date that is used to create the signature. The format must be ISO 8601 basic format (YYYYMMDD'T'HHMMSS'Z'). For example, the following date time is a valid X-Amz-Date value: 20120325T120000Z. Condition: X-Amz-Date is optional for all requests; it can be used to override the date used for signing requests. If the Date header is specified in the ISO 8601 basic format, X-Amz-Date is not required. When X-Amz-Date is used, it always overrides the value of the Date header. For more information, see Elements of an AWS API request signature in the IAM User Guide. Type: string Required: Conditional X-Amz-Security-Token The temporary security token that was obtained through
swf-api-087
swf-api.pdf
87
the signature. The format must be ISO 8601 basic format (YYYYMMDD'T'HHMMSS'Z'). For example, the following date time is a valid X-Amz-Date value: 20120325T120000Z. Condition: X-Amz-Date is optional for all requests; it can be used to override the date used for signing requests. If the Date header is specified in the ISO 8601 basic format, X-Amz-Date is not required. When X-Amz-Date is used, it always overrides the value of the Date header. For more information, see Elements of an AWS API request signature in the IAM User Guide. Type: string Required: Conditional X-Amz-Security-Token The temporary security token that was obtained through a call to AWS Security Token Service (AWS STS). For a list of services that support temporary security credentials from AWS STS, see AWS services that work with IAM in the IAM User Guide. Condition: If you're using temporary security credentials from AWS STS, you must include the security token. Type: string Required: Conditional X-Amz-Signature Specifies the hex-encoded signature that was calculated from the string to sign and the derived signing key. Condition: Specify this parameter when you include authentication information in a query string instead of in the HTTP authorization header. API Version 2012-01-25 438 Amazon Simple Workflow Service Type: string Required: Conditional X-Amz-SignedHeaders API Reference Specifies all the HTTP headers that were included as part of the canonical request. For more information about specifying signed headers, see Create a signed AWS API request in the IAM User Guide. Condition: Specify this parameter when you include authentication information in a query string instead of in the HTTP authorization header. Type: string Required: Conditional API Version 2012-01-25 439 Amazon Simple Workflow Service API Reference Common Errors This section lists the errors common to the API actions of all AWS services. For errors specific to an API action for this service, see the topic for that API action. AccessDeniedException You do not have sufficient access to perform this action. HTTP Status Code: 400 IncompleteSignature The request signature does not conform to AWS standards. HTTP Status Code: 400 InternalFailure The request processing has failed because of an unknown error, exception or failure. HTTP Status Code: 500 InvalidAction The action or operation requested is invalid. Verify that the action is typed correctly. HTTP Status Code: 400 InvalidClientTokenId The X.509 certificate or AWS access key ID provided does not exist in our records. HTTP Status Code: 403 NotAuthorized You do not have permission to perform this action. HTTP Status Code: 400 OptInRequired The AWS access key ID needs a subscription for the service. HTTP Status Code: 403 API Version 2012-01-25 440 Amazon Simple Workflow Service RequestExpired API Reference The request reached the service more than 15 minutes after the date stamp on the request or more than 15 minutes after the request expiration date (such as for pre-signed URLs), or the date stamp on the request is more than 15 minutes in the future. HTTP Status Code: 400 ServiceUnavailable The request has failed due to a temporary failure of the server. HTTP Status Code: 503 ThrottlingException The request was denied due to request throttling. HTTP Status Code: 400 ValidationError The input fails to satisfy the constraints specified by an AWS service. HTTP Status Code: 400 API Version 2012-01-25 441
swf-dg-001
swf-dg.pdf
1
Developer Guide Amazon Simple Workflow Service API Version 2012-01-25 Copyright © 2025 Amazon Web Services, Inc. and/or its affiliates. All rights reserved. Amazon Simple Workflow Service Developer Guide Amazon Simple Workflow Service: Developer Guide Copyright © 2025 Amazon Web Services, Inc. and/or its affiliates. All rights reserved. Amazon's trademarks and trade dress may not be used in connection with any product or service that is not Amazon's, in any manner that is likely to cause confusion among customers, or in any manner that disparages or discredits Amazon. All other trademarks not owned by Amazon are the property of their respective owners, who may or may not be affiliated with, connected to, or sponsored by Amazon. Amazon Simple Workflow Service Table of Contents Developer Guide What is Amazon SWF? .................................................................................................................... 1 Workflow components .................................................................................................................... 2 Workflow components ................................................................................................................................ 2 Running your workflow ............................................................................................................................... 3 Setting up your development environment ........................................................................................... 4 Develop with AWS SDKs ............................................................................................................................. 5 Consider the AWS Flow Framework ......................................................................................................... 5 Getting started ................................................................................................................................ 6 About the Workflow .................................................................................................................................... 7 Prerequisites .................................................................................................................................................. 7 Tutorial Steps ................................................................................................................................................ 8 Part 1: Using Amazon SWF with the SDK for Ruby .............................................................................. 8 Include the AWS SDK for Ruby ............................................................................................................ 8 Configuring the AWS Session ............................................................................................................... 9 Registering an Amazon SWF Domain ............................................................................................... 10 Next Steps .............................................................................................................................................. 11 Part 2: Implementing the Workflow ...................................................................................................... 11 Designing the Workflow ...................................................................................................................... 12 Setting up our Workflow Code .......................................................................................................... 13 Registering the Workflow ................................................................................................................... 14 Polling for Decisions ............................................................................................................................ 15 Starting the Workflow Execution ...................................................................................................... 18 Next Steps .............................................................................................................................................. 20 Part 3: Implementing the Activities ....................................................................................................... 21 Defining a Basic Activity Type ............................................................................................................ 21 Defining GetContactActivity ............................................................................................................... 23 Defining SubscribeTopicActivity ......................................................................................................... 25 Defining WaitForConfirmationActivity .............................................................................................. 28 Defining SendResultActivity ............................................................................................................... 31 Next Steps .............................................................................................................................................. 32 Part 4: Implementing the Activities Task Poller .................................................................................. 32 Running the Workflow .............................................................................................................................. 35 Where Do I Go from Here? ................................................................................................................. 40 Working in the console ................................................................................................................. 41 API Version 2012-01-25 iii Amazon Simple Workflow Service Developer Guide Registering a domain ................................................................................................................................ 41 Registering workflow types ..................................................................................................................... 42 Registering activity types ......................................................................................................................... 42 Starting a workflow ................................................................................................................................... 43 To start a workflow execution using the console .......................................................................... 43 Managing workflow executions ............................................................................................................... 44 Basic concepts ................................................................................................................................ 47 Creating a workflow .................................................................................................................................. 48 Modeling Your Workflow and Its Activities ..................................................................................... 49 Running workflows .................................................................................................................................... 49 Workflow history ........................................................................................................................................ 50 Object identifiers ........................................................................................................................................ 55 Domains ........................................................................................................................................................ 56 Actors ............................................................................................................................................................ 57 What is an Actor in Amazon SWF? ................................................................................................... 57 Workflow Starters ................................................................................................................................. 58 Deciders ................................................................................................................................................... 58 Activity Workers .................................................................................................................................... 60 Data Exchange Between Actors ......................................................................................................... 60 Tasks .............................................................................................................................................................. 61 Task lists ....................................................................................................................................................... 62 Decision Task Lists ................................................................................................................................ 62 Activity Task Lists ................................................................................................................................. 63 Task Routing .......................................................................................................................................... 63 Workflow execution closure ..................................................................................................................... 64 Workflow execution life cycle .................................................................................................................. 65 Workflow Execution Life Cycle ........................................................................................................... 65 Polling for tasks ......................................................................................................................................... 71 Advanced concepts ........................................................................................................................ 73 Versioning .................................................................................................................................................... 73 Signals ........................................................................................................................................................... 74 Child workflows .......................................................................................................................................... 76 Markers ......................................................................................................................................................... 77 Tags ............................................................................................................................................................... 79 Manage tags ........................................................................................................................................... 79 Tag workflow executions ..................................................................................................................... 80 API Version 2012-01-25 iv Amazon Simple Workflow Service Developer Guide Control access to domains with tags ................................................................................................ 81 Exclusive choice .......................................................................................................................................... 82 Timers ........................................................................................................................................................... 85 Cancelling activity tasks ........................................................................................................................... 85 Security .......................................................................................................................................... 89 Data Protection ........................................................................................................................................... 89 Encryption .............................................................................................................................................. 90 Identity and Access Management ........................................................................................................... 90 Audience .................................................................................................................................................. 92 Authenticating with identities ............................................................................................................ 92 Managing access using policies .......................................................................................................... 96 Access Control ....................................................................................................................................... 98 Policy actions ......................................................................................................................................... 98 Policy resources ..................................................................................................................................... 99 Policy condition keys ......................................................................................................................... 100 ACLs ....................................................................................................................................................... 100 ABAC ...................................................................................................................................................... 101 Temporary credentials ....................................................................................................................... 101 Principal permissions ......................................................................................................................... 102 Service roles ......................................................................................................................................... 102 Service-linked roles ............................................................................................................................ 102 Identity-based policies ...................................................................................................................... 103 Resource-based policies .................................................................................................................... 103 How Amazon Simple Workflow Service works with IAM ........................................................... 104 Identity-based policy examples ....................................................................................................... 105 Basic Principles .................................................................................................................................... 107 Amazon SWF IAM Policies ................................................................................................................ 109 API Summary ....................................................................................................................................... 117 Tag-based Policies .............................................................................................................................. 125 Amazon VPC endpoints ..................................................................................................................... 126 Troubleshooting .................................................................................................................................. 128 Logging and Monitoring ......................................................................................................................... 130 Amazon SWF Metrics for CloudWatch ........................................................................................... 130 Viewing Amazon SWF Metrics ......................................................................................................... 140 Recording to CloudTrail ..................................................................................................................... 144 EventBridge for Amazon SWF ......................................................................................................... 151 API Version 2012-01-25 v Amazon Simple Workflow Service Developer Guide Using AWS User Notifications with Amazon SWF ....................................................................... 160 Compliance Validation ............................................................................................................................ 160 Resilience ................................................................................................................................................... 161 Infrastructure Security ............................................................................................................................ 161 Configuration and Vulnerability Analysis ........................................................................................... 162 Using the AWS CLI ...................................................................................................................... 163 Working with APIs ....................................................................................................................... 165 Making HTTP Requests ........................................................................................................................... 165 HTTP Header Contents ...................................................................................................................... 166 HTTP Body Content ........................................................................................................................... 168 Sample JSON Request and Response ............................................................................................ 168 Calculating the HMAC-SHA Signature ............................................................................................ 169 List of Amazon SWF Actions ................................................................................................................. 172 Actions Related to Activities ............................................................................................................ 172 Actions Related to Deciders ............................................................................................................. 172 Actions Related to Workflow Executions ....................................................................................... 173 Actions Related to Administration .................................................................................................. 173 Visibility Actions ................................................................................................................................. 174 Registering a Domain .............................................................................................................................. 175 See Also ................................................................................................................................................ 176 Setting timeout values ........................................................................................................................... 176 Quotas on Timeout
swf-dg-002
swf-dg.pdf
2
............................................................................................................................ 161 Configuration and Vulnerability Analysis ........................................................................................... 162 Using the AWS CLI ...................................................................................................................... 163 Working with APIs ....................................................................................................................... 165 Making HTTP Requests ........................................................................................................................... 165 HTTP Header Contents ...................................................................................................................... 166 HTTP Body Content ........................................................................................................................... 168 Sample JSON Request and Response ............................................................................................ 168 Calculating the HMAC-SHA Signature ............................................................................................ 169 List of Amazon SWF Actions ................................................................................................................. 172 Actions Related to Activities ............................................................................................................ 172 Actions Related to Deciders ............................................................................................................. 172 Actions Related to Workflow Executions ....................................................................................... 173 Actions Related to Administration .................................................................................................. 173 Visibility Actions ................................................................................................................................. 174 Registering a Domain .............................................................................................................................. 175 See Also ................................................................................................................................................ 176 Setting timeout values ........................................................................................................................... 176 Quotas on Timeout Values ............................................................................................................... 176 Workflow Execution and Decision Task Timeouts ....................................................................... 176 Activity Task Timeouts ...................................................................................................................... 177 See Also ................................................................................................................................................ 178 Registering a Workflow Type ................................................................................................................ 178 See Also ................................................................................................................................................ 178 Registering an Activity Type .................................................................................................................. 178 See Also ................................................................................................................................................ 179 Lambda tasks ............................................................................................................................................ 179 About AWS Lambda ........................................................................................................................... 179 Benefits and limitations of using Lambda tasks .......................................................................... 180 Using Lambda tasks in your workflows ......................................................................................... 180 Developing an Activity Worker ............................................................................................................. 186 Polling for Activity Tasks .................................................................................................................. 186 Performing the Activity Task ........................................................................................................... 187 API Version 2012-01-25 vi Amazon Simple Workflow Service Developer Guide Reporting Activity Task Heartbeats ................................................................................................ 187 Completing or Failing an Activity Task .......................................................................................... 188 Launching Activity Workers .............................................................................................................. 190 Developing deciders ................................................................................................................................ 190 Defining Coordination Logic ............................................................................................................ 191 Polling for Decision Tasks ................................................................................................................. 192 Applying the Coordination Logic .................................................................................................... 194 Responding with Decisions ............................................................................................................... 194 Closing a Workflow Execution ......................................................................................................... 195 Launching Deciders ............................................................................................................................ 197 Starting workflows .................................................................................................................................. 198 Setting task priority ................................................................................................................................ 199 Setting Task Priority for Workflows ............................................................................................... 200 Setting Task Priority for Activities .................................................................................................. 202 Actions that Return Task Priority Information ............................................................................. 203 Handling errors ......................................................................................................................................... 203 Validation Errors ................................................................................................................................. 204 Errors in Enacting Actions or Decisions ......................................................................................... 204 Timeouts ............................................................................................................................................... 204 Errors raised by user code ................................................................................................................ 205 Errors related to closing a workflow execution ........................................................................... 205 Quotas .......................................................................................................................................... 206 General Account Quotas for Amazon SWF ......................................................................................... 206 Quotas on Workflow Executions .......................................................................................................... 207 Quotas on Task Executions .................................................................................................................... 207 Amazon SWF throttling quotas ............................................................................................................ 209 Throttling quotas for all Regions .................................................................................................... 209 Decision quotas for all Regions ....................................................................................................... 211 Workflow-level quotas ...................................................................................................................... 212 Requesting a quota increase ................................................................................................................. 212 Additional resources .................................................................................................................... 213 Timeout Types .......................................................................................................................................... 213 Timeouts in Workflow and Decision Tasks .................................................................................... 213 Timeouts in Activity Tasks ................................................................................................................ 214 Endpoints ................................................................................................................................................... 216 Additional Documentation ..................................................................................................................... 216 API Version 2012-01-25 vii Amazon Simple Workflow Service Developer Guide Amazon Simple Workflow Service API Reference ........................................................................ 216 AWS Flow Framework Documentation .......................................................................................... 217 AWS SDK Documentation ................................................................................................................. 217 AWS CLI Documentation ................................................................................................................... 219 Web Resources .......................................................................................................................................... 219 Amazon SWF Forum .......................................................................................................................... 219 Amazon SWF FAQ ............................................................................................................................... 219 Amazon SWF Videos .......................................................................................................................... 220 Ruby Flow Options .................................................................................................................................. 220 Continue to use the Ruby Flow Framework .................................................................................. 221 Migrate to the Java Flow Framework ............................................................................................ 221 Migrate to Step Functions ................................................................................................................ 221 Use the Amazon SWF API directly .................................................................................................. 222 Document history ........................................................................................................................ 223 API Version 2012-01-25 viii Amazon Simple Workflow Service Developer Guide What is Amazon Simple Workflow Service? With Amazon Simple Workflow Service (Amazon SWF) you can build, run, and scale background jobs that have parallel or sequential steps. You can coordinate work across distributed components and track the state of tasks. In Amazon SWF, a task represents a logical unit of work that is performed by a component of your application. Coordinating tasks across includes managing inter-task dependencies, scheduling, and concurrency in the flow of your application. With Amazon SWF, you can control and coordinate tasks without worrying about underlying complexities, such as tracking progress and maintaining task state. When using Amazon SWF, you implement workers to perform tasks. Workers can run either on cloud infrastructure, such as Amazon Elastic Compute Cloud (Amazon EC2), or on your own premises. You can create tasks that are long-running, or that may fail, time out, or require restarts —or that may complete with varying throughput and latency. Amazon SWF stores tasks and assigns them to workers when they are ready, tracks progress, and maintains state, including details of task completion. To coordinate tasks, you write a program that gets the latest task state from Amazon SWF and uses that state to initiate subsequent tasks. Amazon SWF maintains an application's execution state durably, so your application is resilient to individual component failures. With Amazon SWF, you can build, deploy, scale, and modify application components independently. Other AWS workflow services For most use cases, we recommend considering AWS Step Functions for your workflow and orchestration needs. With Step Functions, you can create workflows, also called state machines, to build distributed applications, automate processes, orchestrate microservices, and create data and machine learning pipelines. In the Step Functions' console or AWS toolkit in VS Code, you can use the graphical Workflow Studio to visualize, edit, test, and debug
swf-dg-003
swf-dg.pdf
3
Amazon SWF maintains an application's execution state durably, so your application is resilient to individual component failures. With Amazon SWF, you can build, deploy, scale, and modify application components independently. Other AWS workflow services For most use cases, we recommend considering AWS Step Functions for your workflow and orchestration needs. With Step Functions, you can create workflows, also called state machines, to build distributed applications, automate processes, orchestrate microservices, and create data and machine learning pipelines. In the Step Functions' console or AWS toolkit in VS Code, you can use the graphical Workflow Studio to visualize, edit, test, and debug your application’s workflow. For more technical information, see the AWS Step Functions Developer Guide. API Version 2012-01-25 1 Amazon Simple Workflow Service Developer Guide Developing workflow components with Amazon SWF Developing distributed applications requires coordinating many components and dealing with latency and unreliability inherent in remote communication. With Amazon Simple Workflow Service (Amazon SWF), you can develop asynchronous and distributed applications by providing a programming model and infrastructure for coordinating distributed components and maintaining their execution state in a reliable way. By relying on Amazon SWF, you are freed to focus on building the aspects of your application that differentiate it. Components of a workflow Components of a workflow The fundamental concept in Amazon SWF is the workflow. A workflow is a set of activities that carry out some objective, together with logic that coordinates the activities. For example, a workflow could receive a customer order and take whatever actions are necessary to fulfill the order. Each workflow runs in a resource called a domain, which controls the workflow's scope. An AWS account can have multiple domains, each of which can contain multiple workflows, but workflows in different domains can't interact. When designing an Amazon SWF workflow, you define each of the required activities. You then register each activity with Amazon SWF as an activity type. You will provide a name, version, and timeout values. For example, a customer may have an expectation that an order will ship within 24 hours. In the process of carrying out the workflow, some activities may need to be performed more than once, perhaps with varying inputs. For example, in a customer-order workflow, you might have an activity that handles purchased items. If the customer purchases multiple items, then this activity would have to run multiple times. Amazon SWF has the concept of an activity task that represents one invocation of an activity. In our example, the processing of each item would be represented by a single activity task. An activity worker is a program that receives activity tasks, performs them, and provides results. The task might actually be performed by a person. For example, a statistical analyst might receive sets of data, analyze the data, and then send back their analysis. Workflow components API Version 2012-01-25 2 Amazon Simple Workflow Service Developer Guide Activity tasks, and the activity workers that perform them, can run synchronously or asynchronously. Workers can run in one location or be distributed across multiple computers, potentially in different geographic regions. Different activity workers can be written in different programming languages and run on different operating systems. For example, one activity worker might be running on a server in Asia, while another might be running on a mobile device in North America. The coordination logic in a workflow is contained in a software program called a decider. A decider schedules activity tasks, provides input to activity workers, processes events that arrive while the workflow is in progress, and ends (or closes) the workflow after the objective has been met. The role of the Amazon SWF service is to function as a reliable central hub through which data is exchanged between the decider, the activity workers, and other relevant entities such as the person administering the workflow. Amazon SWF also maintains the state of each workflow execution, which saves your application from having to store the state in a durable way. The decider directs the workflow by receiving decision tasks from Amazon SWF and responding back to Amazon SWF with decisions. A decision represents an action or set of actions, which are the next steps in the workflow. A typical decision would be to schedule an activity task. Decisions can also be used to delay tasks with timers, request cancellation of in-progress tasks, and to complete workflows. The mechanism by which both the activity workers and the decider receive their tasks (activity tasks and decision tasks respectively) is by polling the Amazon SWF service. Amazon SWF informs the decider of the state of the workflow by including, with each decision task, a copy of the current workflow execution history. The workflow execution history is composed of events, where an event represents a significant change in the state of the workflow execution.
swf-dg-004
swf-dg.pdf
4
would be to schedule an activity task. Decisions can also be used to delay tasks with timers, request cancellation of in-progress tasks, and to complete workflows. The mechanism by which both the activity workers and the decider receive their tasks (activity tasks and decision tasks respectively) is by polling the Amazon SWF service. Amazon SWF informs the decider of the state of the workflow by including, with each decision task, a copy of the current workflow execution history. The workflow execution history is composed of events, where an event represents a significant change in the state of the workflow execution. Examples of events include task completion, task time outs, or the expiration of a timer. The history is a complete, consistent, and authoritative record of the workflow's progress. Amazon SWF access control uses AWS Identity and Access Management (IAM), so you can control access to AWS resources. For example, you can allow a user to access your account, but only to run certain workflows in a particular domain. Running your workflow The following provide an overview of the steps necessary to develop and run a workflow in Amazon SWF: Running your workflow API Version 2012-01-25 3 Amazon Simple Workflow Service Developer Guide 1. Write activity workers to perform the processing steps in your workflow. 2. Write a decider to handle the coordination logic of your workflow. 3. Register your activities and workflow with Amazon SWF. You can do this step programmatically or by using the AWS Management Console. 4. Start your activity workers and decider. These actors can run on any computing device that can access an Amazon SWF endpoint. For example, you could use compute instances in the cloud, such as Amazon Elastic Compute Cloud (Amazon EC2); servers in your data center; or even a mobile device, to host a decider or activity worker. Once started, the decider and activity workers should start polling Amazon SWF for tasks. 5. Start one or more executions of your workflow. You can start workflows programmatically or via the AWS Management Console. Each execution runs independently and you can provide each with its own set of input data. When an execution is started, Amazon SWF schedules the initial decision task. In response, your decider begins generating decisions that initiate activity tasks. Execution continues until your decider makes a decision to close the execution. 6. View workflow executions using the AWS Management Console. You can filter and view complete details of running and completed executions. For example, you can select an open execution to see which tasks have been completed and what their results were. Setting up your development environment You have the option of developing for Amazon SWF in any of the programming languages supported by AWS. For Java developers, the AWS Flow Framework is also available. For more information, see the AWS Flow Framework website, and see AWS Flow Framework for Java Developer Guide. To reduce latency and to store data in a location that meets your requirements, Amazon SWF provides endpoints in different Regions. Each endpoint in Amazon SWF is completely independent. Any domains, workflows, and activities you have registered in one Region will not share data or attributes with those in another Region. Setting up your development environment API Version 2012-01-25 4 Amazon Simple Workflow Service Developer Guide When you register an Amazon SWF domain, workflow, or activity, it exists only within the Region you registered it in. For example, you could register a domain named SWF-Flows-1 in two different Regions, but they will share no data or attributes with each other — each acting as a completely independent domain. For a list of Amazon SWF endpoints, see Regions and Endpoints. Develop with AWS SDKs Amazon SWF is supported by the AWS SDKs for Java, .NET, Node.js, PHP, Python, and Ruby, providing a convenient way to use the Amazon SWF HTTP API in the programming language of your choice. You can develop deciders, activity workers, or workflow starters using the API exposed by these libraries. And, you can use visibility operations through these libraries so you can develop your own Amazon SWF monitoring and reporting tools. To download tools for developing and managing applications on AWS, including SDKs, go to the Developer Center. For detailed information about the Amazon SWF operations in each SDK, refer to the language- specific reference documentation for the SDK. Consider the AWS Flow Framework The AWS Flow Framework is an enhanced SDK for writing distributed, asynchronous programs that run as workflows on Amazon SWF. The framework is available for the Java programming language and provides classes for writing complex distributed programs. With the AWS Flow Framework, you use preconfigured types to map the definition of your workflow directly to methods in your program. The AWS Flow Framework supports standard object-oriented concepts, such as exception-based error
swf-dg-005
swf-dg.pdf
5
the Developer Center. For detailed information about the Amazon SWF operations in each SDK, refer to the language- specific reference documentation for the SDK. Consider the AWS Flow Framework The AWS Flow Framework is an enhanced SDK for writing distributed, asynchronous programs that run as workflows on Amazon SWF. The framework is available for the Java programming language and provides classes for writing complex distributed programs. With the AWS Flow Framework, you use preconfigured types to map the definition of your workflow directly to methods in your program. The AWS Flow Framework supports standard object-oriented concepts, such as exception-based error handling. Programs written with the AWS Flow Framework can be created, run, and debugged entirely within your preferred editor or IDE. For more information, see the AWS Flow Framework website, and see AWS Flow Framework for Java Developer Guide. Develop with AWS SDKs API Version 2012-01-25 5 Amazon Simple Workflow Service Developer Guide Getting started with Amazon SWF You can get started with the following Amazon Simple Workflow Service workflow application which consists of a set of four activities that operate sequentially. The tutorial also covers the following topics: • Setting default and execution-time workflow and activity options. • Polling Amazon SWF for decision and activity tasks. • Passing data between the activities and the workflow with Amazon SWF. • Waiting for human tasks and reporting heartbeats to Amazon SWF from an activity task. • Using Amazon SNS to create a topic, subscribe a user to it, and publish messages to subscribed endpoints. You can use Amazon SWF and Amazon Simple Notification Service (Amazon SNS) together to emulate a "human task" workflow—one in which a human worker is required to perform some action and then communicate with Amazon SWF to launch the next activity in the workflow. Because Amazon SWF is a cloud-based web service, communication with Amazon SWF can originate from anywhere a connection to the Internet is available. In this case, we will use Amazon SNS to communicate with the user by either email, an SMS text message, or both. This tutorial uses the AWS SDK for Ruby to access Amazon SWF and Amazon SNS, but there are many development options available, including the AWS Flow Framework for Ruby, which provides easier coordination and communication with Amazon SWF. Note This tutorial uses the AWS SDK for Ruby, but we recommend that you use the AWS Flow Framework for Java. Topics • About the Workflow • Prerequisites • Tutorial Steps • Subscription Workflow Tutorial Part 1: Using Amazon SWF with the AWS SDK for Ruby API Version 2012-01-25 6 Amazon Simple Workflow Service Developer Guide • Subscription Workflow Tutorial Part 2: Implementing the Workflow • Subscription Workflow Tutorial Part 3: Implementing the Activities • Subscription Workflow Tutorial Part 4: Implementing the Activities Task Poller • Subscription Workflow Tutorial: Running the Workflow About the Workflow The workflow that we will be developing consists of four major steps: 1. Get a subscription address (email or SMS) from the user. 2. Create an SNS topic and subscribe the provided endpoints to the topic. 3. Wait for the user to confirm the subscription. 4. If the user confirms, publish a congratulatory message to the topic. These steps include activities that are completely automated (steps 2 and 4), and others that require the workflow to wait for a human to provide some data to the activity before the workflow can progress (steps 1 and 3). Each step relies on data that is generated by the previous step (you must have an endpoint before subscribing it to a topic, and you must have a topic subscription before you can wait for confirmation, etc.) This tutorial will also cover how to provide activity results upon completion, and how to pass input to a task that is being scheduled. Amazon SWF handles coordination and delivery of information between the activities and the workflow, and vice-versa. We're also using both keyboard input and Amazon SNS to handle communication between Amazon SWF and the human who is providing data to the workflow. In practice, you can use many different techniques to communicate with human users, but Amazon SNS provides a very easy way to use email or text messages to notify the user about events in the workflow. Prerequisites To follow along with this tutorial, you will need the following: • Amazon Web Services account • Ruby interpreter • AWS SDK for Ruby About the Workflow API Version 2012-01-25 7 Amazon Simple Workflow Service Developer Guide If you already have these set up, you're ready to continue. If you don't want to run the example, you can still follow the tutorial—much of the content in this tutorial applies to using Amazon SWF and Amazon SNS regardless of the development option you choose. Tutorial Steps This tutorial is divided into
swf-dg-006
swf-dg.pdf
6
to notify the user about events in the workflow. Prerequisites To follow along with this tutorial, you will need the following: • Amazon Web Services account • Ruby interpreter • AWS SDK for Ruby About the Workflow API Version 2012-01-25 7 Amazon Simple Workflow Service Developer Guide If you already have these set up, you're ready to continue. If you don't want to run the example, you can still follow the tutorial—much of the content in this tutorial applies to using Amazon SWF and Amazon SNS regardless of the development option you choose. Tutorial Steps This tutorial is divided into the following steps: 1. Subscription Workflow Tutorial Part 1: Using Amazon SWF with the AWS SDK for Ruby 2. Subscription Workflow Tutorial Part 2: Implementing the Workflow 3. Subscription Workflow Tutorial Part 3: Implementing the Activities 4. Subscription Workflow Tutorial Part 4: Implementing the Activities Task Poller 5. Subscription Workflow Tutorial: Running the Workflow Subscription Workflow Tutorial Part 1: Using Amazon SWF with the AWS SDK for Ruby Topics • Include the AWS SDK for Ruby • Configuring the AWS Session • Registering an Amazon SWF Domain • Next Steps Include the AWS SDK for Ruby Begin by creating a file called utils.rb. The code in this file will obtain, or create if necessary, the Amazon SWF domain used by both the workflow and activities code and will provide a place to put code that is common to all of our classes. First, we need to include the aws-sdk-v1 library in our code, so that we can use the features provided by the SDK for Ruby. require 'aws-sdk-v1' Tutorial Steps API Version 2012-01-25 8 Amazon Simple Workflow Service Developer Guide This gives us access to the AWS namespace, which provides the ability to set global session-related values, such as your AWS credentials and region, and also provides access to the AWS service APIs. Configuring the AWS Session We'll configure the AWS Session by setting our AWS credentials (which are needed for accessing AWS services) and the AWS region to use. There are a number of ways to set AWS credentials in the AWS SDK for Ruby: by setting them in environment variables (AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY) or by setting them with AWS.config. We'll use the latter method, loading them from a YAML configuration file, called aws-config.txt, that looks like this. --- :access_key_id: REPLACE_WITH_ACCESS_KEY_ID :secret_access_key: REPLACE_WITH_SECRET_ACCESS_KEY Create this file now, replacing the strings beginning with REPLACE_WITH_ with your AWS access key ID and secret access key. For information about your AWS access keys, see How Do I Get Security Credentials? in the Amazon Web Services General Reference. We also need to set the AWS region to use. Because we'll be using the Short Message Service (SMS) to send text messages to the user's phone with Amazon SNS, we need to make sure that we're using region supported by Amazon SNS. See Supported Regions and Countries in the Amazon Simple Notification Service Developer Guide. Note If you don't have access to us-east-1, or don't care about running the demo with SMS messaging enabled, feel free to use any region you wish to. You can remove the SMS functionality from the sample and use email as the sole endpoint to subscribe to the Amazon SNS topic. For more information about sending SMS messages, see Sending and Receiving SMS Notifications Using Amazon SNS in the Amazon Simple Notification Service Developer Guide. We'll now add some code to utils.rb to load the config file, get the user's credentials, then provide both the credentials and region to AWS.config. Configuring the AWS Session API Version 2012-01-25 9 Amazon Simple Workflow Service Developer Guide require 'yaml' # Load the user's credentials from a file, if it exists. begin config_file = File.open('aws-config.txt') { |f| f.read } rescue puts "No config file! Hope you set your AWS credentials in the environment..." end if config_file.nil? options = { } else options = YAML.load(config_file) end # SMS Messaging (which can be used by Amazon SNS) is available only in the # `us-east-1` region. $SMS_REGION = 'us-east-1' options[:region] = $SMS_REGION # Now, set the options AWS.config = options Registering an Amazon SWF Domain To use Amazon SWF, you need to set up a domain: a named entity that will hold your workflows and activities. You can have many Amazon SWF domains registered, but they must all have unique names within your AWS account, and workflows can't interact across domains: All of the workflows and activities for your application must be in the same domain to interact with one another. Because we'll be using the same domain throughout our application, we'll create a function in utils.rb called init_domain, that will retrieve the Amazon SWF domain named SWFSampleDomain. Once you have registered a domain, you can reuse it for many workflow executions. However, it is an
swf-dg-007
swf-dg.pdf
7
a named entity that will hold your workflows and activities. You can have many Amazon SWF domains registered, but they must all have unique names within your AWS account, and workflows can't interact across domains: All of the workflows and activities for your application must be in the same domain to interact with one another. Because we'll be using the same domain throughout our application, we'll create a function in utils.rb called init_domain, that will retrieve the Amazon SWF domain named SWFSampleDomain. Once you have registered a domain, you can reuse it for many workflow executions. However, it is an error to try to register a domain that already exists, so our code will first check to see if the domain exists, and will use the existing domain if it can be found. If the domain can't be found, we'll create it. To work with Amazon SWF domains in the SDK for Ruby, use AWS::SimpleWorkflow.domains, which returns a DomainCollection that can be used to both enumerate and register domains: Registering an Amazon SWF Domain API Version 2012-01-25 10 Amazon Simple Workflow Service Developer Guide • To check to see if a domain is already registered, you can look at the list provided by AWS::Simpleworkflow.domains.registered. • To register a new domain, use AWS::Simpleworkflow.domains.register. Here is the code for init_domain in utils.rb. # Registers the domain that the workflow will run in. def init_domain domain_name = 'SWFSampleDomain' domain = nil swf = AWS::SimpleWorkflow.new # First, check to see if the domain already exists and is registered. swf.domains.registered.each do | d | if(d.name == domain_name) domain = d break end end if domain.nil? # Register the domain for one day. domain = swf.domains.create( domain_name, 1, { :description => "#{domain_name} domain" }) end return domain end Next Steps Next, you will create the workflow and starter code in Subscription Workflow Tutorial Part 2: Implementing the Workflow. Subscription Workflow Tutorial Part 2: Implementing the Workflow Up until now, our code has been pretty generic. This is the part where we begin to really define what our workflow does, and what activities we'll need to implement it. Next Steps API Version 2012-01-25 11 Developer Guide Amazon Simple Workflow Service Topics • Designing the Workflow • Setting up our Workflow Code • Registering the Workflow • Polling for Decisions • Starting the Workflow Execution • Next Steps Designing the Workflow If you recall, the initial idea for this workflow consisted of the following steps: 1. Get a subscription address (email or SMS) from the user. 2. Create an SNS topic and subscribe the provided endpoints to the topic. 3. Wait for the user to confirm the subscription. 4. If the user confirms, publish a congratulatory message to the topic. We can think of each step in our workflow as an activity that it must perform. Our workflow is responsible for scheduling each activity at the appropriate time, and coordinating data transfer between activities. For this workflow, we'll create a separate activity for each of these steps, naming them descriptively: 1. get_contact_activity 2. subscribe_topic_activity 3. wait_for_confirmation_activity 4. send_result_activity These activities will be executed in order, and data from each step will be used in the subsequent step. We could design our application so that all of the code exists in one source file, but this runs contrary to the way that Amazon SWF was designed. It is designed for workflows that can span the entire Internet in scope, so let's at least break the application up into two separate executables: Designing the Workflow API Version 2012-01-25 12 Amazon Simple Workflow Service Developer Guide • swf_sns_workflow.rb - Contains the workflow and workflow starter. • swf_sns_activities.rb - Contains the activities and activities starter. The workflow and activity implementations can be run in separate windows, separate computers, or even different parts of the world. Because Amazon SWF is keeping track of the details of your workflows and activities, your workflow can coordinate scheduling and data transfer of your activities no matter where they are running. Setting up our Workflow Code We'll begin by creating a file called swf_sns_workflow.rb. In this file, declare a class called SampleWorkflow. Here is the class declaration and its constructor, the initialize method. require_relative 'utils.rb' # SampleWorkflow - the main workflow for the SWF/SNS Sample # # See the file called `README.md` for a description of what this file does. class SampleWorkflow attr_accessor :name def initialize(workflowId) # the domain to look for decision tasks in. @domain = init_domain # the task list is used to poll for decision tasks. @workflowId = workflowId # The list of activities to run, in order. These name/version hashes can be # passed directly to AWS::SimpleWorkflow::DecisionTask#schedule_activity_task. @activity_list = [ { :name => 'get_contact_activity', :version => 'v1' }, { :name => 'subscribe_topic_activity', :version => 'v1' }, { :name => 'wait_for_confirmation_activity', :version => 'v1'
swf-dg-008
swf-dg.pdf
8
- the main workflow for the SWF/SNS Sample # # See the file called `README.md` for a description of what this file does. class SampleWorkflow attr_accessor :name def initialize(workflowId) # the domain to look for decision tasks in. @domain = init_domain # the task list is used to poll for decision tasks. @workflowId = workflowId # The list of activities to run, in order. These name/version hashes can be # passed directly to AWS::SimpleWorkflow::DecisionTask#schedule_activity_task. @activity_list = [ { :name => 'get_contact_activity', :version => 'v1' }, { :name => 'subscribe_topic_activity', :version => 'v1' }, { :name => 'wait_for_confirmation_activity', :version => 'v1' }, { :name => 'send_result_activity', :version => 'v1' }, ].reverse! # reverse the order... we're treating this like a stack. register_workflow end Setting up our Workflow Code API Version 2012-01-25 13 Amazon Simple Workflow Service Developer Guide As you can see, we are keeping the following class instance data: • domain - The domain name retrieved from init_domain in utils.rb. • workflowId - The task list passed in to initialize. • activity_list - The activity list, which has the names and versions of the activities we'll run. The domain name, activity name, and activity version are enough for Amazon SWF to positively identify an activity type, so that is all of the data we need to keep about our activities in order to schedule them. The task list will be used by the workflow's decider code to poll for decision tasks and schedule activities. At the end of this function, we call a method we haven't yet defined: register_workflow. We'll define this method next. Registering the Workflow To use a workflow type, we must first register it. Like an activity type, a workflow type is identified by its domain, name, and version. Also, like both domains and activity types, you can't re-register an existing workflow type. If you need to change anything about a workflow type, you must provide it with a new version, which essentially creates a new type. Here is the code for register_workflow, which is used to either retrieve the existing workflow type we registered on a previous run or to register the workflow if it has not yet been registered. # Registers the workflow def register_workflow workflow_name = 'swf-sns-workflow' @workflow_type = nil # a default value... workflow_version = '1' # Check to see if this workflow type already exists. If so, use it. @domain.workflow_types.each do | a | if (a.name == workflow_name) && (a.version == workflow_version) @workflow_type = a end end Registering the Workflow API Version 2012-01-25 14 Amazon Simple Workflow Service Developer Guide if @workflow_type.nil? options = { :default_child_policy => :terminate, :default_task_start_to_close_timeout => 3600, :default_execution_start_to_close_timeout => 24 * 3600 } puts "registering workflow: #{workflow_name}, #{workflow_version}, #{options.inspect}" @workflow_type = @domain.workflow_types.register(workflow_name, workflow_version, options) end puts "** registered workflow: #{workflow_name}" end First, we check to see if the workflow name and version is already registered by iterating through the domain's workflow_types collection. If we find a match, we'll use the workflow type that was already registered. If we don't find a match, then a new workflow type is registered (by calling register on the same workflow_types collection that we were searching for the workflow in) with the name 'swf-sns- workflow', version '1', and the following options. options = { :default_child_policy => :terminate, :default_task_start_to_close_timeout => 3600, :default_execution_start_to_close_timeout => 24 * 3600 } Options passed in during registration are used to set default behavior for our workflow type, so we don't need to set these values every time we start a new workflow execution. Here, we just set some timeout values: the maximum time it can take from the time a task starts to when it closes (one hour), and the maximum time it can take for the workflow execution to complete (24 hours). If either of these times are exceeded, the task or workflow will timeout. For more information about timeout values, see Amazon SWF Timeout Types . Polling for Decisions At the heart of every workflow execution there is a decider. The decider's responsibility is for managing the execution of the workflow itself. The decider receives decision tasks and responds to Polling for Decisions API Version 2012-01-25 15 Amazon Simple Workflow Service Developer Guide them, either by scheduling new activities, cancelling and restarting activities, or by setting the state of the workflow execution as complete, cancelled, or failed. The decider uses the workflow execution's task list name to receive decision tasks to respond to. To poll for decision tasks, call poll on the domain's decision_tasks collection to loop over available decision tasks. You can then check for new events in the decision task by iterating over its new_events collection. The returned events are AWS::SimpleWorkflow::HistoryEvent objects, and you can get the type of the event by using the returned event's event_type member. For a list and description of history
swf-dg-009
swf-dg.pdf
9
new activities, cancelling and restarting activities, or by setting the state of the workflow execution as complete, cancelled, or failed. The decider uses the workflow execution's task list name to receive decision tasks to respond to. To poll for decision tasks, call poll on the domain's decision_tasks collection to loop over available decision tasks. You can then check for new events in the decision task by iterating over its new_events collection. The returned events are AWS::SimpleWorkflow::HistoryEvent objects, and you can get the type of the event by using the returned event's event_type member. For a list and description of history event types, see HistoryEvent in the Amazon Simple Workflow Service API Reference. Here is the beginning of the decision task poller's logic. A new method in our workflow class called poll_for_decisions. def poll_for_decisions # first, poll for decision tasks... @domain.decision_tasks.poll(@workflowId) do | task | task.new_events.each do | event | case event.event_type We'll now branch the execution of our decider based on the event_type that is received. The first one we are likely to receive is WorkflowExecutionStarted. When this event is received, it means that Amazon SWF is signaling to your decider that it should begin the workflow execution. We'll begin by scheduling the first activity by calling schedule_activity_task on the task we received while polling. We'll pass it the first activity we declared in our activity list, which, because we reversed the list so we can use it like a stack, occupies the last position on the list. The "activities" we defined are just maps consisting of a name and version number, but this is all that Amazon SWF needs to identify the activity for scheduling, assuming that the activity has already been registered. when 'WorkflowExecutionStarted' # schedule the last activity on the (reversed, remember?) list to # begin the workflow. puts "** scheduling activity task: #{@activity_list.last[:name]}" task.schedule_activity_task( @activity_list.last, { :workflowId => "#{@workflowId}-activities" } ) Polling for Decisions API Version 2012-01-25 16 Amazon Simple Workflow Service Developer Guide When we schedule an activity, Amazon SWF sends an activity task to the activity task list that we pass in while scheduling it, signaling the task to begin. We'll deal with activity tasks in Subscription Workflow Tutorial Part 3: Implementing the Activities, but it is worth noting that we don't execute the task here. We only tell Amazon SWF that it should be scheduled. The next activity that we'll need to address is the ActivityTaskCompleted event, which occurs when Amazon SWF has received an activity completed response from an activity task. when 'ActivityTaskCompleted' # we are running the activities in strict sequential order, and # using the results of the previous activity as input for the next # activity. last_activity = @activity_list.pop if(@activity_list.empty?) puts "!! All activities complete! Sending complete_workflow_execution..." task.complete_workflow_execution return true; else # schedule the next activity, passing any results from the # previous activity. Results will be received in the activity # task. puts "** scheduling activity task: #{@activity_list.last[:name]}" if event.attributes.has_key?('result') task.schedule_activity_task( @activity_list.last, { :input => event.attributes[:result], :workflowId => "#{@workflowId}-activities" } ) else task.schedule_activity_task( @activity_list.last, { :workflowId => "#{@workflowId}-activities" } ) end end Because we are executing our tasks in a linear fashion, and only one activity is executing at once, we'll take this opportunity to pop the completed task from the activity_list stack. If this results in an empty list, then we know that our workflow is complete. In this case, we signal to Amazon SWF that our workflow is complete by calling complete_workflow_execution on the task. In the event that the list still has entries, we'll schedule the next activity on the list (again, in the last position). This time, however, we'll look to see if the previous activity returned any result data to Amazon SWF upon completion, which is provided to the workflow in the event's attributes, in Polling for Decisions API Version 2012-01-25 17 Amazon Simple Workflow Service Developer Guide the optional result key. If the activity generated a result, we'll pass it as the input option to the next scheduled activity, along with the activity task list. By retrieving the result values of completed activities, and by setting the input values of scheduled activities, we can pass data from one activity to the next, or we can use data from an activity to change behavior in our decider based on the results from an activity. For the purposes of this tutorial, these two event types are the most important in defining the behavior of our workflow. However, an activity can generate events other than ActivityTaskCompleted. We'll wrap up our decider code by providing demonstration handler code for the ActivityTaskTimedOut and ActivityTaskFailed events, and for the WorkflowExecutionCompleted event, which will be generated when Amazon SWF processes the complete_workflow_execution call that we make when we run out of activities to run. when 'ActivityTaskTimedOut' puts "!! Failing
swf-dg-010
swf-dg.pdf
10
or we can use data from an activity to change behavior in our decider based on the results from an activity. For the purposes of this tutorial, these two event types are the most important in defining the behavior of our workflow. However, an activity can generate events other than ActivityTaskCompleted. We'll wrap up our decider code by providing demonstration handler code for the ActivityTaskTimedOut and ActivityTaskFailed events, and for the WorkflowExecutionCompleted event, which will be generated when Amazon SWF processes the complete_workflow_execution call that we make when we run out of activities to run. when 'ActivityTaskTimedOut' puts "!! Failing workflow execution! (timed out activity)" task.fail_workflow_execution return false when 'ActivityTaskFailed' puts "!! Failing workflow execution! (failed activity)" task.fail_workflow_execution return false when 'WorkflowExecutionCompleted' puts "## Yesss, workflow execution completed!" task.workflow_execution.terminate return false end end end end Starting the Workflow Execution Before any decision tasks will be generated for the workflow to poll for, we need to start the workflow execution. To start the workflow execution, call start_execution on your registered workflow type (AWS::SimpleWorkflow::WorkflowType). We'll define a small wrapper around this to make use of the workflow_type instance member that we retrieved in the class constructor. Starting the Workflow Execution API Version 2012-01-25 18 Amazon Simple Workflow Service Developer Guide def start_execution workflow_execution = @workflow_type.start_execution( { :workflowId => @workflowId } ) poll_for_decisions end end Once the workflow is executing, decision events will begin to appear on the workflow's task list, which is passed as a workflow execution option in start_execution. Unlike options that are provided when the workflow type is registered, options that are passed to start_execution are not considered to be part of the workflow type. You are free to change these per workflow execution without changing the workflow's version. Because we'd like the workflow to begin executing when we run the file, add some code that instantiates the class and then calls the start_execution method that we just defined. if __FILE__ == $0 require 'securerandom' # Use a different task list name every time we start a new workflow execution. # # This avoids issues if our pollers re-start before SWF considers them closed, # causing the pollers to get events from previously-run executions. workflowId = SecureRandom.uuid # Let the user start the activity worker first... puts "" puts "Amazon SWF Example" puts "------------------" puts "" puts "Start the activity worker, preferably in a separate command-line window, with" puts "the following command:" puts "" puts "> ruby swf_sns_activities.rb #{workflowId}-activities" puts "" puts "You can copy & paste it if you like, just don't copy the '>' character." puts "" puts "Press return when you're ready..." i = gets Starting the Workflow Execution API Version 2012-01-25 19 Amazon Simple Workflow Service Developer Guide # Now, start the workflow. puts "Starting workflow execution." sample_workflow = SampleWorkflow.new(workflowId) sample_workflow.start_execution end To avoid any task list naming conflicts, we'll use SecureRandom.uuid to generate a random UUID that we can use as the task list name, guaranteeing that a different task list name is used for each workflow execution. Note Task lists are used to record events about a workflow execution, so if you use the same task list for multiple executions of the same workflow type, you might get events that were generated during a previous execution, especially if you are running them in near succession to each other, which is often the case when trying out new code or running tests. To avoid the issue of having to deal with artifacts from previous executions, we can use a new task list for each execution, specifying it when we begin the workflow execution. There is also a bit of code here to provide instructions for the person running it (probably you), and to provide the "activity" version of the task list. The decider uses this task list name to schedule activities for the workflow, and the activities implementation will listen for activity events on this task list name to know when to begin the scheduled activities and to provide updates about the activity execution. The code also waits for the user to start running the activities starter before it starts the workflow execution, so the activities starter will be ready to respond when activity tasks begin appearing on the provided task list. Next Steps You have implemented the work flow. Next, you will define the activities and an activities starter, in Subscription Workflow Tutorial Part 3: Implementing the Activities. Next Steps API Version 2012-01-25 20 Amazon Simple Workflow Service Developer Guide Subscription Workflow Tutorial Part 3: Implementing the Activities We'll now implement each of the activities in our workflow, beginning with a base class that provides some common features for the activity code. Topics • Defining a Basic Activity Type • Defining GetContactActivity • Defining SubscribeTopicActivity • Defining WaitForConfirmationActivity • Defining SendResultActivity • Next Steps
swf-dg-011
swf-dg.pdf
11
begin appearing on the provided task list. Next Steps You have implemented the work flow. Next, you will define the activities and an activities starter, in Subscription Workflow Tutorial Part 3: Implementing the Activities. Next Steps API Version 2012-01-25 20 Amazon Simple Workflow Service Developer Guide Subscription Workflow Tutorial Part 3: Implementing the Activities We'll now implement each of the activities in our workflow, beginning with a base class that provides some common features for the activity code. Topics • Defining a Basic Activity Type • Defining GetContactActivity • Defining SubscribeTopicActivity • Defining WaitForConfirmationActivity • Defining SendResultActivity • Next Steps Defining a Basic Activity Type When designing the workflow, we identified the following activities: • get_contact_activity • subscribe_topic_activity • wait_for_confirmation_activity • send_result_activity We'll implement each of these activities now. Because our activities will share some features, let's do a little groundwork and create some common code they can share. We'll call it BasicActivity, and define it in a new file called basic_activity.rb. As with the other source files, we'll include utils.rb to access the init_domain function to set up the sample domain. require_relative 'utils.rb' Next, we'll declare the basic activity class and some common data that we'll be interested in for each activity. We'll save the activity's AWS::SimpleWorkflow::ActivityType instance, name, and results in attributes of the class. Part 3: Implementing the Activities API Version 2012-01-25 21 Amazon Simple Workflow Service Developer Guide class BasicActivity attr_accessor :activity_type attr_accessor :name attr_accessor :results These attributes access instance data that's defined in the class' initialize method, which takes an activity name, and an optional version and map of options to be used when registering the activity with Amazon SWF. def initialize(name, version = 'v1', options = nil) @activity_type = nil @name = name @results = nil # get the domain to use for activity tasks. @domain = init_domain # Check to see if this activity type already exists. @domain.activity_types.each do | a | if (a.name == @name) && (a.version == version) @activity_type = a end end if @activity_type.nil? # If no options were specified, use some reasonable defaults. if options.nil? options = { # All timeouts are in seconds. :default_task_heartbeat_timeout => 900, :default_task_schedule_to_start_timeout => 120, :default_task_schedule_to_close_timeout => 3800, :default_task_start_to_close_timeout => 3600 } end @activity_type = @domain.activity_types.register(@name, version, options) end end As with workflow type registration, if an activity type is already registered, we can retrieve it by looking at the domain's activity_types collection. If the activity can't be found, it will be registered. Defining a Basic Activity Type API Version 2012-01-25 22 Amazon Simple Workflow Service Developer Guide Also, as with workflow types, you can set default options that are stored with your activity type when you register it. The last thing our basic activity gets is a consistent way to run it. We'll define a do_activity method that takes an activity task. As shown, we can use the passed-in activity task to receive data via its input instance attribute. def do_activity(task) @results = task.input # may be nil return true end end That wraps up the BasicActivity class. Now we'll use it to make defining our activities simple and consistent. Defining GetContactActivity The first activity that is run during a workflow execution is get_contact_activity, which retrieves the user's Amazon SNS topic subscription information. Create a new file called get_contact_activity.rb, and require both yaml, which we'll use to prepare a string for passing to Amazon SWF, and basic_activity.rb, which we'll use as the basis for this GetContactActivity class. require 'yaml' require_relative 'basic_activity.rb' # **GetContactActivity** provides a prompt for the user to enter contact # information. When the user successfully enters contact information, the # activity is complete. class GetContactActivity < BasicActivity Because we put the activity registration code in BasicActivity, the initialize method for GetContactActivity is pretty simple. We simply call the base class constructor with the activity name, get_contact_activity. This is all that is required to register our activity. # initialize the activity def initialize super('get_contact_activity') Defining GetContactActivity API Version 2012-01-25 23 Amazon Simple Workflow Service end Developer Guide We'll now define the do_activity method, which prompts for the user's email and/or phone number. def do_activity(task) puts "" puts "Please enter either an email address or SMS message (mobile phone) number to" puts "receive SNS notifications. You can also enter both to use both address types." puts "" puts "If you enter a phone number, it must be able to receive SMS messages, and must" puts "be 11 digits (such as 12065550101 to represent the number 1-206-555-0101)." input_confirmed = false while !input_confirmed puts "" print "Email: " email = $stdin.gets.strip print "Phone: " phone = $stdin.gets.strip puts "" if (email == '') && (phone == '') print "You provided no subscription information. Quit? (y/n)" confirmation = $stdin.gets.strip.downcase if confirmation == 'y' return false end else puts "You entered:" puts " email: #{email}" puts
swf-dg-012
swf-dg.pdf
12
"receive SNS notifications. You can also enter both to use both address types." puts "" puts "If you enter a phone number, it must be able to receive SMS messages, and must" puts "be 11 digits (such as 12065550101 to represent the number 1-206-555-0101)." input_confirmed = false while !input_confirmed puts "" print "Email: " email = $stdin.gets.strip print "Phone: " phone = $stdin.gets.strip puts "" if (email == '') && (phone == '') print "You provided no subscription information. Quit? (y/n)" confirmation = $stdin.gets.strip.downcase if confirmation == 'y' return false end else puts "You entered:" puts " email: #{email}" puts " phone: #{phone}" print "\nIs this correct? (y/n): " confirmation = $stdin.gets.strip.downcase if confirmation == 'y' input_confirmed = true end end Defining GetContactActivity API Version 2012-01-25 24 Amazon Simple Workflow Service end Developer Guide # make sure that @results is a single string. YAML makes this easy. @results = { :email => email, :sms => phone }.to_yaml return true end end At the end of do_activity, we take the email and phone number retrieved from the user, place it in a map and then use to_yaml to convert the entire map to a YAML string. There's an important reason for this: any results that you pass to Amazon SWF when you complete an activity must be string data only. Ruby's ability to easily convert objects to YAML strings and then back again into objects is, thankfully, well-suited for this purpose. That's the end of the get_contact_activity implementation. This data will be used next in the subscribe_topic_activity implementation. Defining SubscribeTopicActivity We'll now delve into Amazon SNS and create an activity that uses the information generated by get_contact_activity to subscribe the user to an Amazon SNS topic. Create a new file called subscribe_topic_activity.rb, add the same requirements that we used for get_contact_activity, declare your class, and provide its initialize method. require 'yaml' require_relative 'basic_activity.rb' # **SubscribeTopicActivity** sends an SMS / email message to the user, asking for # confirmation. When this action has been taken, the activity is complete. class SubscribeTopicActivity < BasicActivity def initialize super('subscribe_topic_activity') end Now that we have the code in place to get the activity set up and registered, we will add some code to create an Amazon SNS topic. To do so, we'll use the AWS::SNS::Client object's create_topic method. Add the create_topic method to your class, which takes a passed-in Amazon SNS client object. Defining SubscribeTopicActivity API Version 2012-01-25 25 Amazon Simple Workflow Service Developer Guide def create_topic(sns_client) topic_arn = sns_client.create_topic(:name => 'SWF_Sample_Topic')[:topic_arn] if topic_arn != nil # For an SMS notification, setting `DisplayName` is *required*. Note that # only the *first 10 characters* of the DisplayName will be shown on the # SMS message sent to the user, so choose your DisplayName wisely! sns_client.set_topic_attributes( { :topic_arn => topic_arn, :attribute_name => 'DisplayName', :attribute_value => 'SWFSample' } ) else @results = { :reason => "Couldn't create SNS topic", :detail => "" }.to_yaml return nil end return topic_arn end Once we have the topic's Amazon Resource Name (ARN), we can use it with the Amazon SNS client's set_topic_attributes method to set the topic's DisplayName, which is required for sending SMS messages with Amazon SNS. Lastly, we'll define the do_activity method. We'll start by collecting any data that was passed via the input option when the activity was scheduled. As previously mentioned, this must be passed as a string, which we created using to_yaml. When retrieving it, we'll use YAML.load to turn the data into Ruby objects. Here's the beginning of do_activity, in which we retrieve the input data. def do_activity(task) activity_data = { :topic_arn => nil, :email => { :endpoint => nil, :subscription_arn => nil }, :sms => { :endpoint => nil, :subscription_arn => nil }, } if task.input != nil input = YAML.load(task.input) activity_data[:email][:endpoint] = input[:email] activity_data[:sms][:endpoint] = input[:sms] Defining SubscribeTopicActivity API Version 2012-01-25 26 Amazon Simple Workflow Service else Developer Guide @results = { :reason => "Didn't receive any input!", :detail => "" }.to_yaml puts(" #{@results.inspect}") return false end # Create an SNS client. This is used to interact with the service. Set the # region to $SMS_REGION, which is a region that supports SMS notifications # (defined in the file `utils.rb`). sns_client = AWS::SNS::Client.new( :config => AWS.config.with(:region => $SMS_REGION)) If we didn't receive any input, there isn't much to do, so we'll just fail the activity. Assuming that everything is fine, however, we'll continue filling in our do_activity method, get an Amazon SNS client with the AWS SDK for Ruby, and pass it to our create_topic method to create the Amazon SNS topic. # Create the topic and get the ARN activity_data[:topic_arn] = create_topic(sns_client) if activity_data[:topic_arn].nil? return false end There are a couple of things worth noting here: • We use AWS.config.with to set the region for our Amazon SNS client. Because we want to send
swf-dg-013
swf-dg.pdf
13
AWS.config.with(:region => $SMS_REGION)) If we didn't receive any input, there isn't much to do, so we'll just fail the activity. Assuming that everything is fine, however, we'll continue filling in our do_activity method, get an Amazon SNS client with the AWS SDK for Ruby, and pass it to our create_topic method to create the Amazon SNS topic. # Create the topic and get the ARN activity_data[:topic_arn] = create_topic(sns_client) if activity_data[:topic_arn].nil? return false end There are a couple of things worth noting here: • We use AWS.config.with to set the region for our Amazon SNS client. Because we want to send SMS messages, we use the SMS-enabled region that we declared in utils.rb. • We save the topic's ARN in our activity_data map. This is part of the data that will be passed to the next activity in our workflow. Finally, this activity subscribes the user to the Amazon SNS topic, using the passed-in endpoints (email and SMS). We don't require the user to enter both endpoints, but we do need at least one. # Subscribe the user to the topic, using either or both endpoints. [:email, :sms].each do | x | ep = activity_data[x][:endpoint] # don't try to subscribe an empty endpoint if (ep != nil && ep != "") response = sns_client.subscribe( { Defining SubscribeTopicActivity API Version 2012-01-25 27 Amazon Simple Workflow Service Developer Guide :topic_arn => activity_data[:topic_arn], :protocol => x.to_s, :endpoint => ep } ) activity_data[x][:subscription_arn] = response[:subscription_arn] end end AWS::SNS::Client.subscribe takes the topic ARN, the protocol (which, cleverly, we disguised as the activity_data map key for the corresponding endpoint). Finally, we re-package the information for the next activity in YAML format, so that we can send it back to Amazon SWF. # if at least one subscription arn is set, consider this a success. if (activity_data[:email][:subscription_arn] != nil) or (activity_data[:sms] [:subscription_arn] != nil) @results = activity_data.to_yaml else @results = { :reason => "Couldn't subscribe to SNS topic", :detail => "" }.to_yaml puts(" #{@results.inspect}") return false end return true end end That completes the implementation of the subscribe_topic_activity. Next, we'll define wait_for_confirmation_activity. Defining WaitForConfirmationActivity Once a user is subscribed to an Amazon SNS topic, he or she will still need to confirm the subscription request. In this case, we'll be waiting for the user to confirm by either email or an SMS message. The activity that waits for the user to confirm the subscription is called wait_for_confirmation_activity, and we'll define it here. To begin, create a new file called wait_for_confirmation_activity.rb and set it up as we've set up the previous activities. require 'yaml' require_relative 'basic_activity.rb' Defining WaitForConfirmationActivity API Version 2012-01-25 28 Amazon Simple Workflow Service Developer Guide # **WaitForConfirmationActivity** waits for the user to confirm the SNS # subscription. When this action has been taken, the activity is complete. It # might also time out... class WaitForConfirmationActivity < BasicActivity # Initialize the class def initialize super('wait_for_confirmation_activity') end Next, we'll begin defining the do_activity method and retrieve any input data into a local variable called subscription_data. def do_activity(task) if task.input.nil? @results = { :reason => "Didn't receive any input!", :detail => "" }.to_yaml return false end subscription_data = YAML.load(task.input) Now that we have the topic ARN, we can retrieve the topic by creating a new instance of AWS::SNS::Topic and pass it the ARN. topic = AWS::SNS::Topic.new(subscription_data[:topic_arn]) if topic.nil? @results = { :reason => "Couldn't get SWF topic ARN", :detail => "Topic ARN: #{topic.arn}" }.to_yaml return false end Now, we'll check the topic to see if the user has confirmed the subscription using one of the endpoints. We'll only require that one endpoint has been confirmed to consider the activity a success. An Amazon SNS topic maintains a list of the subscriptions for that topic, and we can check whether or not the user has confirmed a particular subscription by checking to see if the subscription's ARN is set to anything other than PendingConfirmation. Defining WaitForConfirmationActivity API Version 2012-01-25 29 Amazon Simple Workflow Service Developer Guide # loop until we get some indication that a subscription was confirmed. subscription_confirmed = false while(!subscription_confirmed) topic.subscriptions.each do | sub | if subscription_data[sub.protocol.to_sym][:endpoint] == sub.endpoint # this is one of the endpoints we're interested in. Is it subscribed? if sub.arn != 'PendingConfirmation' subscription_data[sub.protocol.to_sym][:subscription_arn] = sub.arn puts "Topic subscription confirmed for (#{sub.protocol}: #{sub.endpoint})" @results = subscription_data.to_yaml return true else puts "Topic subscription still pending for (#{sub.protocol}: #{sub.endpoint})" end end end If we get an ARN for the subscription, we'll save it in the activity's result data, convert it to YAML, and return true from do_activity, which signals that the activity completed successfully. Because waiting for a subscription to be confirmed might take a while, we'll occasionally call record_heartbeat on the activity task. This signals to Amazon SWF that the activity is still processing, and can also be used to provide updates about the progress of
swf-dg-014
swf-dg.pdf
14
sub.arn puts "Topic subscription confirmed for (#{sub.protocol}: #{sub.endpoint})" @results = subscription_data.to_yaml return true else puts "Topic subscription still pending for (#{sub.protocol}: #{sub.endpoint})" end end end If we get an ARN for the subscription, we'll save it in the activity's result data, convert it to YAML, and return true from do_activity, which signals that the activity completed successfully. Because waiting for a subscription to be confirmed might take a while, we'll occasionally call record_heartbeat on the activity task. This signals to Amazon SWF that the activity is still processing, and can also be used to provide updates about the progress of the activity (if you are doing something, like processing files, that you can report progress for). task.record_heartbeat!( { :details => "#{topic.num_subscriptions_confirmed} confirmed, #{topic.num_subscriptions_pending} pending" }) # sleep a bit. sleep(4.0) end This ends our while loop. If we somehow get out of the while loop without success, we'll report failure and finish the do_activity method. if (subscription_confirmed == false) @results = { :reason => "No subscriptions could be confirmed", Defining WaitForConfirmationActivity API Version 2012-01-25 30 Amazon Simple Workflow Service Developer Guide :detail => "#{topic.num_subscriptions_confirmed} confirmed, #{topic.num_subscriptions_pending} pending" }.to_yaml return false end end end That ends the implementation of wait_for_confirmation_activity. We have only one more activity to define: send_result_activity. Defining SendResultActivity If the workflow has progressed this far, we've successfully subscribed the user to an Amazon SNS topic and the user has confirmed the subscription. Our last activity, send_result_activity, sends the user a confirmation of the successful topic subscription, using the topic that the user subscribed to and the endpoint that the user confirmed the subscription with. Create a new file called send_result_activity.rb and set it up as we've set up all the activities so far. require 'yaml' require_relative 'basic_activity.rb' # **SendResultActivity** sends the result of the activity to the screen, and, if # the user successfully registered using SNS, to the user using the SNS contact # information collected. class SendResultActivity < BasicActivity def initialize super('send_result_activity') end Our do_activity method begins similarly, as well, getting the input data from the workflow, converting it from YAML, and then using the topic ARN to create an AWS::SNS::Topic instance. def do_activity(task) if task.input.nil? @results = { :reason => "Didn't receive any input!", :detail => "" } return false end Defining SendResultActivity API Version 2012-01-25 31 Amazon Simple Workflow Service Developer Guide input = YAML.load(task.input) # get the topic, so we publish a message to it. topic = AWS::SNS::Topic.new(input[:topic_arn]) if topic.nil? @results = { :reason => "Couldn't get SWF topic", :detail => "Topic ARN: #{topic.arn}" } return false end Once we have the topic, we'll publish a message to it (and echo it to the screen, as well). @results = "Thanks, you've successfully confirmed registration, and your workflow is complete!" # send the message via SNS, and also print it on the screen. topic.publish(@results) puts(@results) return true end end Publishing to an Amazon SNS topic sends the message that you supply to all of the subscribed and confirmed endpoints that exist for that topic. So, if the user confirmed with both an email and an SMS number, he or she will receive two confirmation messages, one at each endpoint. Next Steps This completes the implementation of send_result_activity. Now, you will tie all these activities together in an activity application that handles the activity tasks and can launch activities in response, in Subscription Workflow Tutorial Part 4: Implementing the Activities Task Poller. Subscription Workflow Tutorial Part 4: Implementing the Activities Task Poller In Amazon SWF, activity tasks for a running workflow execution appear on the activity task list, which is provided when you schedule an activity in the workflow. Next Steps API Version 2012-01-25 32 Amazon Simple Workflow Service Developer Guide We'll implement a basic activity poller to handle these tasks for our workflow, and use it to launch our activities when Amazon SWF places a task on the activity task list to start the activity. To begin, create a new file called swf_sns_activities.rb. We'll use it to: • Instantiate the activity classes that we created. • Register each activity with Amazon SWF. • Poll for activities and call do_activity for each activity when its name appears on the activity task list. In swf_sns_activities.rb, add the following statements to require each of the activity classes we defined. require_relative 'get_contact_activity.rb' require_relative 'subscribe_topic_activity.rb' require_relative 'wait_for_confirmation_activity.rb' require_relative 'send_result_activity.rb' Now, we'll create the class and provide some initialization code. class ActivitiesPoller def initialize(domain, workflowId) @domain = domain @workflowId = workflowId @activities = {} # These are the activities we'll run activity_list = [ GetContactActivity, SubscribeTopicActivity, WaitForConfirmationActivity, SendResultActivity ] activity_list.each do | activity_class | activity_obj = activity_class.new puts "** initialized and registered activity: #{activity_obj.name}" # add it to the hash @activities[activity_obj.name.to_sym] = activity_obj end Part 4: Implementing the Activities Task Poller API Version 2012-01-25 33 Amazon Simple Workflow Service end
swf-dg-015
swf-dg.pdf
15
the following statements to require each of the activity classes we defined. require_relative 'get_contact_activity.rb' require_relative 'subscribe_topic_activity.rb' require_relative 'wait_for_confirmation_activity.rb' require_relative 'send_result_activity.rb' Now, we'll create the class and provide some initialization code. class ActivitiesPoller def initialize(domain, workflowId) @domain = domain @workflowId = workflowId @activities = {} # These are the activities we'll run activity_list = [ GetContactActivity, SubscribeTopicActivity, WaitForConfirmationActivity, SendResultActivity ] activity_list.each do | activity_class | activity_obj = activity_class.new puts "** initialized and registered activity: #{activity_obj.name}" # add it to the hash @activities[activity_obj.name.to_sym] = activity_obj end Part 4: Implementing the Activities Task Poller API Version 2012-01-25 33 Amazon Simple Workflow Service end Developer Guide In addition to saving the passed in domain and task list, this code instantiates each of the activity classes we created. Because each class registers its associated activity (refer to basic_activity.rb if you need to review that code), this is enough to let Amazon SWF know about all of the activities we'll be running. For each activity instantiated, we store it on a map using the activity name (such as get_contact_activity) as the key, so we can easily look these up in the activity poller code, which we'll define next. Create a new method called poll_for_activities and call poll on the activity_tasks held by the domain to get activity tasks. def poll_for_activities @domain.activity_tasks.poll(@workflowId) do | task | activity_name = task.activity_type.name We can get the activity name from the task's activity_type member. Next, we'll use the activity name associated with this task to look up the class to run do_activity on, passing it the task (which includes any input data that should be transferred to the activity). # find the task on the activities list, and run it. if @activities.key?(activity_name.to_sym) activity = @activities[activity_name.to_sym] puts "** Starting activity task: #{activity_name}" if activity.do_activity(task) puts "++ Activity task completed: #{activity_name}" task.complete!({ :result => activity.results }) # if this is the final activity, stop polling. if activity_name == 'send_result_activity' return true end else puts "-- Activity task failed: #{activity_name}" task.fail!( { :reason => activity.results[:reason], :details => activity.results[:detail] } ) end else puts "couldn't find key in @activities list: #{activity_name}" puts "contents: #{@activities.keys}" Part 4: Implementing the Activities Task Poller API Version 2012-01-25 34 Amazon Simple Workflow Service Developer Guide end end end end The code just waits for do_activity to complete, and then calls either complete! or fail! on the task based on the return code. Note This code exits from the poller once the final activity has been launched, because it has completed its mission and has launched all of the activities. In your own Amazon SWF code, if your activities might be run again, you may want to keep the activity poller running indefinitely. That's the end of the code for our ActivitiesPoller class, but we'll add a little more code at the end of the file to allow the user to run it from the command-line. if __FILE__ == $0 if ARGV.count < 1 puts "You must supply a task-list name to use!" exit end poller = ActivitiesPoller.new(init_domain, ARGV[0]) poller.poll_for_activities puts "All done!" end If the user runs the file from the command line (passing it an activity task list as the first argument), this code will instantiate the poller class and start it polling for activities. Once the poller completes (after it has launched the final activity), we just print a message and exit. That's it for the activities poller. All that's left for you to do is to run the code and see how it works, in Subscription Workflow Tutorial: Running the Workflow. Subscription Workflow Tutorial: Running the Workflow Now that you've completed the implementation of your workflow, activities, and the workflow and activity pollers, you're ready to run the workflow. Running the Workflow API Version 2012-01-25 35 Amazon Simple Workflow Service Developer Guide If you haven't done so already, you'll need to provide your AWS access keys in the aws- config.txt file, like in Configuring the AWS Session in Part 1 of the tutorial. Now, go to your command line and change to the directory where the tutorial source files are located. You should have the following files: . |-- aws-config.txt |-- basic_activity.rb |-- get_contact_activity.rb |-- send_result_activity.rb |-- subscribe_topic_activity.rb |-- swf_sns_activities.rb |-- swf_sns_workflow.rb |-- utils.rb `-- wait_for_confirmation_activity.rb Now, start the workflow with the following command. ruby swf_sns_workflow.rb This will begin the workflow, and should print out a message with a line that you can copy and paste into a separate command-line window (or even on another computer, if you've copied the tutorial source files onto it). Amazon SWF Example ------------------ Start the activity worker, preferably in a separate command-line window, with the following command: > ruby swf_sns_activities.rb 87097e76-7c0c-41c7-817b-92527bb0ea85-activities You can copy & paste it if you like, just don't copy the '>' character. Press return when you're ready... The workflow code will wait patiently for you to
swf-dg-016
swf-dg.pdf
16
Now, start the workflow with the following command. ruby swf_sns_workflow.rb This will begin the workflow, and should print out a message with a line that you can copy and paste into a separate command-line window (or even on another computer, if you've copied the tutorial source files onto it). Amazon SWF Example ------------------ Start the activity worker, preferably in a separate command-line window, with the following command: > ruby swf_sns_activities.rb 87097e76-7c0c-41c7-817b-92527bb0ea85-activities You can copy & paste it if you like, just don't copy the '>' character. Press return when you're ready... The workflow code will wait patiently for you to start the activity poller in a separate window. Open a new command-line window, change to the directory where the source files are located again, and then use the command provided by the swf_sns_workflow.rb file to start the Running the Workflow API Version 2012-01-25 36 Amazon Simple Workflow Service Developer Guide activity poller. For example, if you received the preceding output, you would type (or paste) the following. ruby swf_sns_activities.rb 87097e76-7c0c-41c7-817b-92527bb0ea85-activities Once you begin running your activity poller, it will start to output information about activities registration. ** initialized and registered activity: get_contact_activity ** initialized and registered activity: subscribe_topic_activity ** initialized and registered activity: wait_for_confirmation_activity ** initialized and registered activity: send_result_activity You can now return to your original command-line window, and press return to start your workflow execution. It will register the workflow and schedule the first activity. Starting workflow execution. ** registered workflow: swf-sns-workflow ** scheduling activity task: get_contact_activity Go back to the other window, where your activity poller is running. The result of the first running activity is displayed, providing a prompt for you to enter your email or SMS phone number. Enter either, or both, of these pieces of data, and then confirm your text entry. activity task received: <AWS::SimpleWorkflow::ActivityTask> ** Starting activity task: get_contact_activity Please enter either an email address or SMS message (mobile phone) number to receive Amazon SNS notifications. You can also enter both to use both address types. If you enter a phone number, it must be able to receive SMS messages, and must be 11 digits (such as 12065550101 to represent the number 1-206-555-0101). Email: [email protected] Phone: 12065550101 You entered: email: [email protected] phone: 12065550101 Is this correct? (y/n): y Running the Workflow API Version 2012-01-25 37 Amazon Simple Workflow Service Developer Guide Note The phone number provided is fictitious, and is used only for illustrative purposes. Use your own phone number and email address here! Soon after entering this information, you should receive an email or text message from Amazon SNS, asking you to confirm your topic subscription. If you entered an SMS number, you will see something like the following appear on your phone. If you reply to this message with YES, you'll get the response that we provided in send_result_activity. While all of this was happening, did you see what was happening in your command-line window? Both the workflow and activity pollers have been hard at work. Running the Workflow API Version 2012-01-25 38 Amazon Simple Workflow Service Developer Guide Here's the output from the workflow poller. ** scheduling activity task: subscribe_topic_activity ** scheduling activity task: wait_for_confirmation_activity ** scheduling activity task: send_result_activity !! All activities complete! Sending complete_workflow_execution... Here's the output from the activity poller, which was happening at the same time in another command-line window. ++ Activity task completed: get_contact_activity ** Starting activity task: subscribe_topic_activity ++ Activity task completed: subscribe_topic_activity ** Starting activity task: wait_for_confirmation_activity Topic subscription still pending for (email: [email protected]) Topic subscription confirmed for (sms: 12065550101) ++ Activity task completed: wait_for_confirmation_activity ** Starting activity task: send_result_activity Thanks, you've successfully confirmed registration, and your workflow is complete! ++ Activity task completed: send_result_activity All done! Congratulations, your workflow is complete, and so is this tutorial! You may want to re-run the workflow again to see how timeouts work, or to enter different data. Just remember that once you subscribe to a topic, you're still subscribed until you unsubscribe. Re- running the workflow before unsubscribing to topics will probably result in automatic success, because the wait_for_confirmation_activity will see that your subscription is already confirmed. To unsubscribe from the Amazon SNS topic • Respond in the negative (send STOP) to the text message. • Choose the unsubscribe link that you received in your email. You're now ready to re-subscribe to the topic again. Running the Workflow API Version 2012-01-25 39 Amazon Simple Workflow Service Developer Guide Where Do I Go from Here? This tutorial has covered a lot of ground, but there's still much more you can learn about the AWS SDK for Ruby, Amazon SWF, or Amazon SNS. For more information and many more examples, see the official documentation for each: • AWS SDK for Ruby Documentation • Amazon Simple Notification Service Documentation • Amazon Simple Workflow Service Documentation Where Do
swf-dg-017
swf-dg.pdf
17
message. • Choose the unsubscribe link that you received in your email. You're now ready to re-subscribe to the topic again. Running the Workflow API Version 2012-01-25 39 Amazon Simple Workflow Service Developer Guide Where Do I Go from Here? This tutorial has covered a lot of ground, but there's still much more you can learn about the AWS SDK for Ruby, Amazon SWF, or Amazon SNS. For more information and many more examples, see the official documentation for each: • AWS SDK for Ruby Documentation • Amazon Simple Notification Service Documentation • Amazon Simple Workflow Service Documentation Where Do I Go from Here? API Version 2012-01-25 40 Amazon Simple Workflow Service Developer Guide Working in the Amazon SWF console The Amazon SWF console provides options to configure, initiate, and manage workflow executions. With the Amazon SWF console, you can: • Register workflow domains. • Register workflow types, and activity types. • Start, view, signal, cancel, terminate, and restart workflow executions. Registering a domain Workflows run in an AWS resource called a domain, which controls the workflow's scope. An AWS account can have multiple domains, each of which can contain multiple workflows, but workflows in different domains can't interact. Domain registration is the only functionality initially available in the console. After at least one domain is registered, you can perform the following actions for the domain: • Register workflow and activity types. • Initiate workflow executions. • Cancel, terminate, and send signals to running workflow executions. • Restart closed workflow executions. You can also perform domain management actions, such as deprecating and undeprecating domains. After you deprecate a domain, you can't use it to create new workflow executions or register new workflows. Deprecating a domain also deprecates all the activity and workflows registered in the domain. Executions that were started before the domain was deprecated continue to run. After undeprecating a previously deprecated domain, you can resume using the domain to register workflow types and start new workflow executions. For more information about these domain management actions, see DeprecateDomain and UndeprecateDomain. Registering a domain API Version 2012-01-25 41 Amazon Simple Workflow Service Developer Guide Registering workflow types You can register workflow types in the Amazon SWF console after you have registered at least one domain. A workflow type is a set of activity types that carry out an objective and contain the logic that coordinates the activities. Workflow types coordinate and manage the execution of activities that can be run asynchronously across multiple computing devices and feature both sequential and parallel processing methods. To register an Amazon SWF workflow type using the console 1. Open the domain in which you want to register a workflow. 2. Choose Register, and then choose Register Workflow. 3. On the Register Workflow page, enter the Workflow name and Workflow version. Optionally, you can also specify a Default task list that will be used to schedule decision tasks for executions of this workflow. 4. (Optional) Choose Advanced options to specify the following details for your workflow: • Default Task priority – The default task priority to assign to the workflow. • Default Execution start to close timeout – The default maximum duration for executions of this workflow. • Default Task start to close timeout – The default maximum duration of decision tasks for this workflow. • Default Child policy – The default policy to use for the child workflow executions. • Default Lambda role – The default IAM role attached to this workflow. 5. Choose Register workflow. Registering activity types Activities are tasks which you want your workflow type to coordinate and execute (for example: verify customer's order, charge credit card etc.). The order in which activities are performed is determined by the workflow type's coordination logic. You can register activity types after at least one domain is registered. Registering workflow types API Version 2012-01-25 42 Amazon Simple Workflow Service Developer Guide To register an Amazon SWF activity type using the console 1. Open the domain in which you want to register an activity. 2. Choose Register, and then choose Register Activity. 3. On the Register activity page, enter the Activity name and Activity version. Optionally, you can also specify a Default task list that will be used to schedule tasks of this activity. 4. (Optional) Choose Advanced options to specify the following details for your activity: • Default Task priority – The default task priority to assign to the activity. • Default task schedule to start timeout – The default maximum duration that a task of this activity can wait before being assigned to a worker. • Default Task start to close timeout – The default maximum duration that a worker can take to process tasks of this activity. • Default task schedule to close timeout – The default maximum duration for a task
swf-dg-018
swf-dg.pdf
18
will be used to schedule tasks of this activity. 4. (Optional) Choose Advanced options to specify the following details for your activity: • Default Task priority – The default task priority to assign to the activity. • Default task schedule to start timeout – The default maximum duration that a task of this activity can wait before being assigned to a worker. • Default Task start to close timeout – The default maximum duration that a worker can take to process tasks of this activity. • Default task schedule to close timeout – The default maximum duration for a task of this activity. • Default task heartbeat timeout – The default maximum time before which a worker processing a task of this type must report progress by calling RecordActivityTaskHeartbeat. 5. Choose Register activity. Starting a workflow You can start a workflow execution from the Amazon SWF console. You cannot start a workflow execution until you have registered at least one workflow. To start a workflow execution using the console 1. Open the Amazon SWF console, and in the left navigation pane, choose Domains. 2. Below the domain name, choose Workflows. 3. On the Workflows page, choose the workflow that you want to execute. 4. Choose Start execution. 5. On the Start execution page, enter the Workflow name and Execution ID to identify your execution by a name. Optionally, you can also specify a Task list that will be used for the decision tasks generated for this workflow execution. 6. (Optional) Choose Advanced options to specify the following details for your workflow execution: Starting a workflow API Version 2012-01-25 43 Amazon Simple Workflow Service Developer Guide • Task priority – The task priority to use for this workflow execution. • Execution start to close timeout – The total duration for this workflow execution. • Task start to close timeout – The maximum duration of decision tasks for this workflow execution. • Child policy – The policy to use for the child workflow executions of this workflow execution if it is terminated, by calling the TerminateWorkflowExecution action explicitly or due to an expired timeout. • Lambda role – The IAM role to attach to this workflow execution. 7. Choose Start execution. Managing workflow executions You can filter your workflow executions by name, status, ID, and tag. You can send signals with inputs into active workflow executions. If you need to cancel or terminate a workflow, you can use the Try-cancel option. Cancelling is preferable over terminating a workflow execution because canceling gives the workflow an opportunity to perform any clean-up tasks and then close properly. In the console, you can manage the workflow executions that are currently running and/or closed. To manage your workflow executions 1. Open a domain to manage its workflow executions. 2. Choose Find Execution. 3. On the Workflow executions page, choose Filter executions by property, and then under Properties choose one of the following filters: Choose To apply this filter Workflow Choose this filter to list executions of a specific workflow. For example, to view executions of the fiction-books-order- workflow , do the following: 1. Choose Workflow. 2. Under Operators, choose Equals. Managing workflow executions API Version 2012-01-25 44 Amazon Simple Workflow Service Developer Guide Choose To apply this filter 3. Under Workflows, choose fiction-books-order-workflow. 4. (Optional) Choose Clear filters to remove the filter and start a new search for executions. Status Choose this filter to list executions with a specific status. For example, to view executions with the status Failed, do the following : 1. Choose Status. 2. Under Operators, choose Equals. 3. Under Statuses, choose Failed. 4. (Optional) Choose Clear filters to remove the filter and start a new search for executions. Execution ID Choose this filter to view a workflow execution based on its ID. For example, to view the execution with ID fiction-books-orde r-category1 , do the following: 1. Choose Execution ID. 2. Under Operators, choose Equals. 3. Under Execution IDs, choose fiction-books-order-category1. 4. (Optional) Choose Clear filters to remove the filter and start a new search for executions. Tag Choose this filter to list executions with a specific tag. For example, to view executions with the status purchaseOrder , do the following: 1. Choose Tag. 2. Under Operators, choose Equals. 3. Under Tag, choose purchaseOrder. 4. (Optional) Choose Clear filters to remove the filter and start a new search for executions. Managing workflow executions API Version 2012-01-25 45 Amazon Simple Workflow Service Developer Guide 4. (Optional) After applying the required filter to list workflow executions, you can perform the following operations to an Active execution: • Signal – Use this option to send a running workflow execution additional data. To do this: 1. Choose the execution to which you want to send additional data. 2. Choose Signal, and then specify the data in
swf-dg-019
swf-dg.pdf
19
Choose Tag. 2. Under Operators, choose Equals. 3. Under Tag, choose purchaseOrder. 4. (Optional) Choose Clear filters to remove the filter and start a new search for executions. Managing workflow executions API Version 2012-01-25 45 Amazon Simple Workflow Service Developer Guide 4. (Optional) After applying the required filter to list workflow executions, you can perform the following operations to an Active execution: • Signal – Use this option to send a running workflow execution additional data. To do this: 1. Choose the execution to which you want to send additional data. 2. Choose Signal, and then specify the data in the Signal execution dialog box. 3. Choose Signal. • Try-cancel – Use this option to try to cancel a workflow execution. It is preferable to cancel a workflow execution rather than terminate it. Canceling provides the workflow execution an opportunity to perform any clean-up tasks and then close properly. 1. Choose the execution which you want to cancel. 2. Choose Try-cancel. • Terminate – Use this option to terminate a workflow execution. Note that it is preferable to cancel a workflow execution rather than terminate it. 1. Choose the execution which you want to terminate. 2. For Child policy, make sure Terminate is selected. 3. (Optional) Specify the Reason and Details for terminating the execution. 4. Choose Terminate. 5. (Optional) Re-run – Use this option to re-run a closed workflow execution. 1. In the list of workflow executions, select the closed execution to re-run. When you select a closed execution, the Re-run button becomes enabled. Choose Re-run. 2. On the Re-run execution page, specify the details for workflow execution as mentioned in Starting a workflow. Managing workflow executions API Version 2012-01-25 46 Amazon Simple Workflow Service Developer Guide Basic workflow concepts in Amazon SWF Note The concepts in this chapter provide an overview of the Amazon Simple Workflow Service and describe its major features. If you are looking for examples, see Working with Amazon SWF APIs. Using the Amazon Simple Workflow Service (Amazon SWF), you can implement distributed, asynchronous applications as workflows. Workflows coordinate and manage the execution of activities that can be run asynchronously across multiple computing devices and that can feature both sequential and parallel processing. When designing a workflow, you analyze your application to identify its component tasks. In Amazon SWF, these tasks are represented by activities. The order in which activities are performed is determined by the workflow's coordination logic. Example workflow for an e-commerce application The following figure shows an e-commerce order-processing workflow involving both people and automated processes: The e-commerce application workflow starts when a customer places an order, and includes four tasks: API Version 2012-01-25 47 Amazon Simple Workflow Service 1. Verify the order. 2. If the order is valid, charge the customer. 3. If the payment is made, ship the order. 4. If the order is shipped, save the order details. Developer Guide The tasks in this workflow are sequential: an order must be verified before a credit card can be charged; a credit card must be charged successfully before an order can be shipped; and an order must be shipped before it can be recorded. Even so, because Amazon SWF supports distributed processes, these tasks can be carried out in different locations. If the tasks are programmatic in nature, they can also be written in different programming languages or using different tools. In addition to sequential processing of tasks, Amazon SWF also supports workflows with parallel processing of tasks. Parallel tasks are performed at the same time, and may be carried out independently by different applications or human workers. Your workflow makes decisions about how to proceed once one or more of the parallel tasks have been completed. Additional concepts • Creating a workflow in Amazon SWF • Running workflows in Amazon SWF • Workflow history in Amazon SWF • Object identifiers in Amazon SWF • Domains in Amazon SWF • Actors in Amazon SWF • Tasks in Amazon SWF • Task lists in Amazon SWF • Workflow execution closure in Amazon SWF • Life cycle of a Amazon SWF workflow • Polling for tasks in Amazon SWF Creating a workflow in Amazon SWF Creating a basic sequential workflow involves the following stages. Creating a workflow API Version 2012-01-25 48 Amazon Simple Workflow Service Developer Guide • Modeling a workflow, registering its type, and registering its activity types • Developing and launching activity workers that perform activity tasks • Developing and launching deciders that use the workflow history to determine what to do next • Developing and launching workflow starters, that is, applications that start workflow executions Modeling Your Workflow and Its Activities To use Amazon SWF, model the logical steps in your application as activities. An activity represents a single logical step or task in your workflow. For example, authorizing
swf-dg-020
swf-dg.pdf
20
following stages. Creating a workflow API Version 2012-01-25 48 Amazon Simple Workflow Service Developer Guide • Modeling a workflow, registering its type, and registering its activity types • Developing and launching activity workers that perform activity tasks • Developing and launching deciders that use the workflow history to determine what to do next • Developing and launching workflow starters, that is, applications that start workflow executions Modeling Your Workflow and Its Activities To use Amazon SWF, model the logical steps in your application as activities. An activity represents a single logical step or task in your workflow. For example, authorizing a credit card is an activity that involves providing a credit card number and other information, and receiving an approval code or a message that the card was declined. In addition to defining activities, you also need to define the coordination logic that handles decision points. For example, the coordination logic might schedule a different follow-up activity depending on whether the credit card was approved or declined. The following figure shows an example of a sequential customer order workflow with four activities (Verify Order, Charge Credit Card, Ship Order, and Record Completion). Running workflows in Amazon SWF After the coordination logic and the activities have been designed, you register these components as workflow and activity types with Amazon SWF. During registration, you specify a name, a version, and default configuration values for each type. Modeling Your Workflow and Its Activities API Version 2012-01-25 49 Amazon Simple Workflow Service Developer Guide Only registered workflow and activity types can be used with Amazon SWF. In the e- commerce example, you would register the CustomerOrder workflow type and the VerifyOrder, ChargeCreditCard, ShipOrder, and RecordCompletion activity types. After registering your workflow type, you can run it as often you like. A workflow execution is a running instance of a workflow. A workflow execution can be started by any process or application, even another workflow execution. In the e-commerce example, a new workflow execution is started with each customer order. The type of application that initiates the workflow depends on how the customer places the order. The workflow could be initiated by a web site or mobile application or by a customer service representative using an internal company application. With Amazon SWF, you can associate an identifier—called a workflowId—with your workflow executions, so you can integrate your existing business identifiers into your workflow. In the e- commerce example, each workflow execution might be identified using the customer invoice number. In addition to the identifier that you provide, Amazon SWF associates a unique system-generated identifier—a runId—with each workflow execution. Amazon SWF allows only one workflow execution with this identifier to run at any given time; although you can have multiple workflows executions of the same workflow type, each workflow execution has a distinct runId. Workflow history in Amazon SWF Amazon SWF records the progress of every workflow execution in the workflow history - a detailed, complete, and consistent record of every event that occurred since the workflow execution started. An event represents a discrete change in your workflow execution's state, such as a new activity being scheduled or a running activity being completed. The workflow history contains every event that causes the execution state of the workflow execution to change, such as scheduled and completed activities, task timeouts, and signals. Operations that don't change the state of the workflow execution don't typically appear in the workflow history. For example, the workflow history doesn't show poll attempts or the use of visibility operations. The workflow history has several key benefits: Workflow history API Version 2012-01-25 50 Amazon Simple Workflow Service Developer Guide • Applications can be stateless, because all information about a workflow execution is stored in its workflow history. • For each workflow execution, the history provides a record of which activities were scheduled, their current status, and their results. The workflow execution uses this information to determine next steps. • The history provides a detailed audit trail that you can use to monitor running workflow executions and verify completed workflow executions. The following is a conceptual view of the e-commerce workflow history: Invoice0001 Start Workflow Execution Schedule Verify Order Start Verify Order Activity Complete Verify Order Activity Schedule Charge Credit Card Start Charge Credit Card Activity Complete Charge Credit Card Activity Schedule Ship Order Start Ship Order Activity In the preceding example, the order is waiting to ship. In the following example, the order is complete. Because the workflow history is cumulative, the newer events are appended: Invoice0001 Start Workflow Execution Schedule Verify Order Start Verify Order Activity Complete Verify Order Activity Schedule Charge Credit Card Start Charge Credit Card Activity Complete Charge Credit Card Activity Workflow history API Version 2012-01-25 51 Amazon Simple Workflow Service Schedule Ship Order Start Ship Order Activity Complete Ship
swf-dg-021
swf-dg.pdf
21
Order Activity Schedule Charge Credit Card Start Charge Credit Card Activity Complete Charge Credit Card Activity Schedule Ship Order Start Ship Order Activity In the preceding example, the order is waiting to ship. In the following example, the order is complete. Because the workflow history is cumulative, the newer events are appended: Invoice0001 Start Workflow Execution Schedule Verify Order Start Verify Order Activity Complete Verify Order Activity Schedule Charge Credit Card Start Charge Credit Card Activity Complete Charge Credit Card Activity Workflow history API Version 2012-01-25 51 Amazon Simple Workflow Service Schedule Ship Order Start Ship Order Activity Complete Ship Order Activity Schedule Record Order Completion Start Record Order Completion Activity Complete Record Order Completion Activity Close Workflow Developer Guide Programmatically, the events in the workflow execution history are represented as JavaScript Object Notation (JSON) objects. The history itself is a JSON array of these objects. Each event has the following: • A type, such as WorkflowExecutionStarted or ActivityTaskCompleted • A timestamp in Unix time format • An ID that uniquely identifies the event In addition, each type of event has a distinct set of descriptive attributes that are appropriate to that type. For example, the ActivityTaskCompleted event has attributes that contain the IDs for the events that correspond to the time that the activity task was scheduled and when it was started, as well as an attribute that holds result data. You can obtain a copy of the current state of the workflow execution history by using the GetWorkflowExecutionHistory action. In addition, as part of the interaction between Amazon SWF and the decider for your workflow, the decider periodically receives copies of the history. Below is a section of an example workflow execution history in JSON format. [ { "eventId": 11, "eventTimestamp": 1326671603.102, "eventType": "WorkflowExecutionTimedOut", "workflowExecutionTimedOutEventAttributes": { "childPolicy": "TERMINATE", "timeoutType": "START_TO_CLOSE" } }, { "decisionTaskScheduledEventAttributes": { "startToCloseTimeout": "600", Workflow history API Version 2012-01-25 52 Amazon Simple Workflow Service Developer Guide "taskList": { "name": "specialTaskList" } }, "eventId": 10, "eventTimestamp": 1326670566.124, "eventType": "DecisionTaskScheduled" }, { "activityTaskTimedOutEventAttributes": { "details": "Waiting for confirmation", "scheduledEventId": 8, "startedEventId": 0, "timeoutType": "SCHEDULE_TO_START" }, "eventId": 9, "eventTimestamp": 1326670566.124, "eventType": "ActivityTaskTimedOut" }, { "activityTaskScheduledEventAttributes": { "activityId": "verification-27", "activityType": { "name": "activityVerify", "version": "1.0" }, "control": "digital music", "decisionTaskCompletedEventId": 7, "heartbeatTimeout": "120", "input": "5634-0056-4367-0923,12/12,437", "scheduleToCloseTimeout": "900", "scheduleToStartTimeout": "300", "startToCloseTimeout": "600", "taskList": { "name": "specialTaskList" } }, "eventId": 8, "eventTimestamp": 1326670266.115, "eventType": "ActivityTaskScheduled" }, { "decisionTaskCompletedEventAttributes": { "executionContext": "Black Friday", "scheduledEventId": 5, "startedEventId": 6 }, Workflow history API Version 2012-01-25 53 Amazon Simple Workflow Service "eventId": 7, "eventTimestamp": 1326670266.103, "eventType": "DecisionTaskCompleted" }, { "decisionTaskStartedEventAttributes": { "identity": "Decider01", "scheduledEventId": 5 }, "eventId": 6, "eventTimestamp": 1326670161.497, "eventType": "DecisionTaskStarted" }, { "decisionTaskScheduledEventAttributes": { "startToCloseTimeout": "600", "taskList": { "name": "specialTaskList" } }, "eventId": 5, "eventTimestamp": 1326668752.66, "eventType": "DecisionTaskScheduled" }, { "decisionTaskTimedOutEventAttributes": { "scheduledEventId": 2, "startedEventId": 3, "timeoutType": "START_TO_CLOSE" }, "eventId": 4, "eventTimestamp": 1326668752.66, "eventType": "DecisionTaskTimedOut" }, { "decisionTaskStartedEventAttributes": { "identity": "Decider01", "scheduledEventId": 2 }, "eventId": 3, "eventTimestamp": 1326668152.648, "eventType": "DecisionTaskStarted" }, { "decisionTaskScheduledEventAttributes": { "startToCloseTimeout": "600", "taskList": { "name": "specialTaskList" } Workflow history Developer Guide API Version 2012-01-25 54 Amazon Simple Workflow Service }, "eventId": 2, "eventTimestamp": 1326668003.094, "eventType": "DecisionTaskScheduled" } ] Developer Guide For a detailed list of the different types of events that can appear in the workflow execution history, see the HistoryEvent data type in the Amazon Simple Workflow Service API Reference. Amazon SWF stores the complete history of all workflow executions for a configurable number of days after the execution closes. This period, which is known as the workflow history retention period, is specified when you register a Domain for your workflow. Domains are discussed in greater detail later in this section. Object identifiers in Amazon SWF The following list describes how Amazon SWF objects, such as workflow executions, are uniquely identified. • Workflow Type – A registered workflow type is identified by its domain, name, and version. Workflow types are specified in the call to RegisterWorkflowType. • Activity Type – A registered activity type is identified by its domain, name, and version. Activity types are specified in the call to RegisterActivityType. • Decision Tasks and Activity Tasks – Each decision task and activity task is identified by a unique task token. The task token is generated by Amazon SWF and is returned with other information about the task in the response from PollForDecisionTask or PollForActivityTask. Although the token is most commonly used by the process that received the task, that process could pass the token to another process, which could then report the completion or failure of the task. • Workflow Execution – A single execution of a workflow is identified by the domain, workflow ID, and run ID. The first two are parameters that are passed to StartWorkflowExecution. The run ID is returned by StartWorkflowExecution. Object identifiers API Version 2012-01-25 55 Amazon Simple Workflow Service Developer Guide
swf-dg-022
swf-dg.pdf
22
SWF and is returned with other information about the task in the response from PollForDecisionTask or PollForActivityTask. Although the token is most commonly used by the process that received the task, that process could pass the token to another process, which could then report the completion or failure of the task. • Workflow Execution – A single execution of a workflow is identified by the domain, workflow ID, and run ID. The first two are parameters that are passed to StartWorkflowExecution. The run ID is returned by StartWorkflowExecution. Object identifiers API Version 2012-01-25 55 Amazon Simple Workflow Service Developer Guide Domains in Amazon SWF Workflows run in an AWS resource called a domain which provide a way of scoping Amazon SWF resources within your AWS account. All the components of a workflow, such as the workflow type and activity types, must be specified to be in a domain. An AWS account can have multiple domains, each of which can contain multiple workflows, but workflows in different domains can't interact. When setting up a new workflow, before you set up any of the other workflow components you need to register a domain if you have not already done so. When you register a domain, you specify a workflow history retention period. The retention period is the length of time that Amazon SWF will continue to retain information about the workflow execution after the workflow execution is complete. Domain registration is the only functionality initially available in the console. After at least one domain is registered, you can perform the following actions for the domain: • Register workflow and activity types. • Initiate workflow executions. • Cancel, terminate, and send signals to running workflow executions. • Restart closed workflow executions. You can also perform domain management actions, such as deprecating and undeprecating domains. After you deprecate a domain, you can't use it to create new workflow executions or register new workflows. Deprecating a domain also deprecates all the activity and workflows registered in the domain. Executions that were started before the domain was deprecated continue to run. After undeprecating a previously deprecated domain, you can resume using the domain to register workflow types and start new workflow executions. For more information about these domain management actions, see DeprecateDomain and UndeprecateDomain. Domains API Version 2012-01-25 56 Amazon Simple Workflow Service Developer Guide Actors in Amazon SWF Topics • What is an Actor in Amazon SWF? • Workflow Starters • Deciders • Activity Workers • Data Exchange Between Actors What is an Actor in Amazon SWF? In the course of its operations, Amazon SWF interacts with a number of different types of programmatic actors. Actors can be workflow starters, deciders, or activity workers. These actors communicate with Amazon SWF through its API. You can develop these actors in any programming language. The following diagram shows the Amazon SWF architecture, including Amazon SWF and its actors. Actors API Version 2012-01-25 57 Amazon Simple Workflow Service Developer Guide Workflow Starters A workflow starter is any application that can initiate workflow executions. In the e-commerce example, one workflow starter could be the website at which the customer places an order. Another workflow starter could be a mobile application or system used by a customer service representative to place the order on behalf of the customer. Deciders A decider is an implementation of a workflow's coordination logic. Deciders control the flow of activity tasks in a workflow execution. Whenever a change occurs during a workflow execution, such as the completion of a task, a decision task including the entire workflow history will be passed to a decider. When the decider receives the decision task from Amazon SWF, it analyzes the Workflow Starters API Version 2012-01-25 58 Amazon Simple Workflow Service Developer Guide workflow execution history to determine the next appropriate steps in the workflow execution. The decider communicates these steps back to Amazon SWF using decisions. A decision is an Amazon SWF data type that can represent various next actions. For a list of the possible decisions, go to Decision in the Amazon Simple Workflow Service API Reference. Here is an example of a decision in JSON format, the format in which it is transmitted to Amazon SWF. This decision schedules a new activity task. { "decisionType" : "ScheduleActivityTask", "scheduleActivityTaskDecisionAttributes" : { "activityType" : { "name" : "activityVerify", "version" : "1.0" }, "activityId" : "verification-27", "control" : "digital music", "input" : "5634-0056-4367-0923,12/12,437", "scheduleToCloseTimeout" : "900", "taskList" : { "name": "specialTaskList" }, "scheduleToStartTimeout" : "300", "startToCloseTimeout" : "600", "heartbeatTimeout" : "120" } } A decider receives a decision task when the workflow execution starts and each time a state change occurs in the workflow execution. Deciders continue to move the workflow execution forward by receiving decision tasks and responding to Amazon SWF with more decisions until the decider determines
swf-dg-023
swf-dg.pdf
23
This decision schedules a new activity task. { "decisionType" : "ScheduleActivityTask", "scheduleActivityTaskDecisionAttributes" : { "activityType" : { "name" : "activityVerify", "version" : "1.0" }, "activityId" : "verification-27", "control" : "digital music", "input" : "5634-0056-4367-0923,12/12,437", "scheduleToCloseTimeout" : "900", "taskList" : { "name": "specialTaskList" }, "scheduleToStartTimeout" : "300", "startToCloseTimeout" : "600", "heartbeatTimeout" : "120" } } A decider receives a decision task when the workflow execution starts and each time a state change occurs in the workflow execution. Deciders continue to move the workflow execution forward by receiving decision tasks and responding to Amazon SWF with more decisions until the decider determines that the workflow execution is complete. It then responds with a decision to close the workflow execution. After the workflow execution closes, Amazon SWF will not schedule additional tasks for that execution. In the e-commerce example, the decider determines if each step was performed correctly, and then either schedules the next step or manages any error conditions. A decider represents a single computer process or thread. Multiple deciders can process tasks for the same workflow type. Deciders API Version 2012-01-25 59 Amazon Simple Workflow Service Activity Workers Developer Guide An activity worker is a process or thread that performs the activity tasks that are part of your workflow. The activity task represents one of the tasks that you identified in your application. To use an activity task in your workflow, you must register it using either the Amazon SWF console or the RegisterActivityType action. Each activity worker polls Amazon SWF for new tasks that are appropriate for that activity worker to perform; certain tasks can be performed only by certain activity workers. After receiving a task, the activity worker processes the task to completion and then reports to Amazon SWF that the task was completed and provides the result. The activity worker then polls for a new task. The activity workers associated with a workflow execution continue in this way, processing tasks until the workflow execution itself is complete. In the e-commerce example, activity workers are independent processes and applications used by people, such as credit card processors and warehouse employees, that perform individual steps in the process. An activity worker represents a single computer process (or thread). Multiple activity workers can process tasks of the same activity type. Data Exchange Between Actors Input data can be provided to a workflow execution when it is started. Similarly, input data can be provided to activity workers when they schedule activity tasks. When an activity task is complete, the activity worker can return results to Amazon SWF. Similarly, a decider can report the results of a workflow execution when the execution is complete. Each actor can send data to, and receive data from, Amazon SWF through strings, the form of which is user-defined. Depending on the size and sensitivity of the data, you can pass data directly or pass a pointer to data stored on another system or service (such as Amazon S3 or DynamoDB). Both the data passed directly and the pointers to other data stores are recorded in the workflow execution history; however, Amazon SWF doesn't copy or cache any of the data from external stores as part of the history. Because Amazon SWF maintains the complete execution state of each workflow execution, including the inputs and the results of tasks, all actors can be stateless. As a result, workflow processing is highly scalable. As the load on your system grows, you can simply add more actors to increase capacity. Activity Workers API Version 2012-01-25 60 Amazon Simple Workflow Service Developer Guide Tasks in Amazon SWF Amazon SWF interacts with activity workers and deciders by providing them with work assignments known as tasks. There are three types of tasks in Amazon SWF: • Activity task – An Activity task tells an activity worker to perform its function, such as to check inventory or charge a credit card. The activity task contains all the information that the activity worker needs to perform its function. • Lambda task – A Lambda task is similar to an Activity task, but executes a Lambda function instead of a traditional Amazon SWF activity. For more information about how to define a Lambda task, see AWS Lambda tasks in Amazon SWF. • Decision task – A Decision task tells a decider that the state of the workflow execution has changed so that the decider can determine the next activity that needs to be performed. The decision task contains the current workflow history. Amazon SWF schedules a decision task when the workflow starts and whenever the state of the workflow changes, such as when an activity task completes. Each decision task contains a paginated view of the entire workflow execution history. The decider analyzes the workflow execution history and responds back to Amazon SWF with a set
swf-dg-024
swf-dg.pdf
24
Lambda tasks in Amazon SWF. • Decision task – A Decision task tells a decider that the state of the workflow execution has changed so that the decider can determine the next activity that needs to be performed. The decision task contains the current workflow history. Amazon SWF schedules a decision task when the workflow starts and whenever the state of the workflow changes, such as when an activity task completes. Each decision task contains a paginated view of the entire workflow execution history. The decider analyzes the workflow execution history and responds back to Amazon SWF with a set of decisions that specify what should occur next in the workflow execution. Essentially, every decision task gives the decider an opportunity to assess the workflow and provide direction back to Amazon SWF. To ensure that no conflicting decisions are processed, Amazon SWF assigns each decision task to exactly one decider and allows only one decision task at a time to be active in a workflow execution. The following table shows the relationship between the different constructs related to workflows and deciders. Logical Design Registered As Performed By Receives & Performs Generates Workflow Workflow Type Decider Decision Tasks Decisions When an activity worker has completed the activity task, it reports to Amazon SWF that the task was completed, and it includes any relevant results that were generated. Amazon SWF updates the Tasks API Version 2012-01-25 61 Amazon Simple Workflow Service Developer Guide workflow execution history with an event that indicates the task completed and then schedules a decision task to transmit the updated history to the decider. Amazon SWF assigns each activity task to exactly one activity worker. Once the task is assigned, no other activity worker can claim or perform that task. The following table shows the relationship between the different constructs related to activities. Logical Design Registered As Performed By Receives & Performs Generates Activity Activity Type Activity Worker Activity Tasks Results Data Task lists in Amazon SWF Task lists provide a way of organizing the various tasks associated with a workflow. You can think of task lists as similar to dynamic queues. When a task is scheduled in Amazon SWF, you can specify a queue (task list) to put it in. Similarly, when you poll Amazon SWF for a task you say which queue (task list) to get the task from. Task lists provide a flexible mechanism to route tasks to workers as your use case necessitates. Task lists are dynamic in that you don't need to register a task list or explicitly create it through an action: simply scheduling a task creates the task list if it doesn't already exist. There are separate lists for activity tasks and decision tasks. A task is always scheduled on only one task list; tasks are not shared across lists. Furthermore, like activities and workflows, task lists are scoped to a particular AWS region and Amazon SWF domain. Topics • Decision Task Lists • Activity Task Lists • Task Routing Decision Task Lists Each workflow execution is associated with a specific decision task list. When a workflow type is registered (RegisterWorkflowType action), you can specify a default task list for Task lists API Version 2012-01-25 62 Amazon Simple Workflow Service Developer Guide executions of that workflow type. When the workflow starter initiates the workflow execution (StartWorkflowExecution action), it has the option of specifying a different task list for that workflow execution. When a decider polls for a new decision task (PollForDecisionTask action), the decider specifies a decision task list to draw from. A single decider could serve multiple workflow executions by calling PollForDecisionTask multiple times, using a different task list in each call, where each task list is specific to a particular workflow execution. Alternatively, the decider could poll a single decision task list that provides decision tasks for multiple workflow executions. You could also have multiple deciders serving a single workflow execution by having all of them poll the task list for that workflow execution. Activity Task Lists A single activity task list can contain tasks of different activity types. Tasks are scheduled on the task list in order. Amazon SWF returns the tasks from the list in order on a best effort basis. Under some circumstances, the tasks may not come off the list in order. When an activity type is registered (RegisterActivityType action), you can specify a default task list for that activity type. By default, activity tasks of this type will be scheduled on the specified task list; however, when the decider schedules an activity task (ScheduleActivityTask decision), the decider can optionally specify a different task list on which to schedule the task. If the decider doesn't specify a task list, the default task list is used. As a result, you can place activity tasks on specific
swf-dg-025
swf-dg.pdf
25
a best effort basis. Under some circumstances, the tasks may not come off the list in order. When an activity type is registered (RegisterActivityType action), you can specify a default task list for that activity type. By default, activity tasks of this type will be scheduled on the specified task list; however, when the decider schedules an activity task (ScheduleActivityTask decision), the decider can optionally specify a different task list on which to schedule the task. If the decider doesn't specify a task list, the default task list is used. As a result, you can place activity tasks on specific task lists according to attributes of the task. For example, you could place all instances of an activity task for a given credit card type on a particular task list. Task Routing When an activity worker polls for a new task (PollForActivityTask action), it can specify an activity task list to draw from. If it does, the activity worker will accept tasks only from that list. In this way, you can ensure that certain tasks get assigned only to particular activity workers. For example, you might create a task list that holds tasks that require the use of a high-performance computer. Only activity workers running on the appropriate hardware would poll that task list. Another example would be to create a task list for a particular geographic region. You could then ensure that only workers deployed in that region would pick up those tasks. Or you could create a task list for high- priority orders and always check that list first. Activity Task Lists API Version 2012-01-25 63 Amazon Simple Workflow Service Developer Guide Assigning particular tasks to particular activity workers in this way is called task routing. Task routing is optional; if you don't specify a task list when scheduling an activity task, the task is automatically placed on the default task list. Workflow execution closure in Amazon SWF Once you start a workflow execution, it is open. An open workflow execution could be closed as completed, canceled, failed, or timed out. It could also be continued as a new execution, or it could be terminated. A workflow execution could be closed by the decider, by the person administering the workflow, or by Amazon SWF. If the decider determines that the activities of the workflow have finished, it should close the workflow execution as completed by using the RespondDecisionTaskCompleted action and pass the CompleteWorkflowExecution decision. Alternatively, a decider might close the workflow execution as canceled or failed. In order to cancel the execution, the decider should use the RespondDecisionTaskCompleted action and pass the CancelWorkflowExecution decision. A decider should fail the workflow execution if it enters a state outside the realm of normal completion. In order to fail the execution, the decider should use the RespondDecisionTaskCompleted action and pass the FailWorkflowExecution decision. Amazon SWF monitors workflow executions to ensure that they don't exceed any user-specified timeout settings. If a workflow execution times out, Amazon SWF automatically closes it. For more information about timeout values, see the Amazon SWF Timeout Types section. A decider might also close the execution and logically continue it as a new execution using the RespondDecisionTaskCompleted action and passing the ContinueAsNewWorkflowExecution decision. This is a useful strategy for long-running workflow executions for which the history may grow too large over time. Finally, you could terminate workflow executions directly from the Amazon SWF console or programmatically by using the TerminateWorkflowExecution API. Termination forces closure of the workflow execution. Cancellation is preferred over termination, because your deciders can manage closure of the workflow execution. Amazon SWF terminates a workflow execution if the execution exceeds certain service-defined limits. Amazon SWF terminates a child workflow if the parent workflow has terminated and the applicable child policy indicates that the child workflow should also be terminated. Workflow execution closure API Version 2012-01-25 64 Amazon Simple Workflow Service Developer Guide Life cycle of a Amazon SWF workflow From the start of a workflow execution to its completion, Amazon SWF interacts with actors by assigning them appropriate tasks, either activity tasks or decision tasks. The following diagram shows the life cycle of an order-processing workflow execution from the perspective of components that act on it. Workflow Execution Life Cycle The following table explains each task in the preceding image. Description Action, Decision, or Event StartWorkflowExecution action. WorkflowExecutionStarted event and DecisionTaskSchedu led event. 1. The workflow starter calls the appropriate Amazon SWF action to start the workflow execution for an order, providing the order information. 2. Amazon SWF receives the start workflow execution request and then schedules the first decision task. Workflow execution life cycle API Version 2012-01-25 65 Amazon Simple Workflow Service Developer Guide Description Action, Decision, or Event PollForDecisionTask action. RespondDecisionTas kCompleted action and ScheduleActivityTask decision. ActivityTaskScheduled event PollForActivityTask action and RespondActivityTas kCompleted
swf-dg-026
swf-dg.pdf
26
it. Workflow Execution Life Cycle The following table explains each task in the preceding image. Description Action, Decision, or Event StartWorkflowExecution action. WorkflowExecutionStarted event and DecisionTaskSchedu led event. 1. The workflow starter calls the appropriate Amazon SWF action to start the workflow execution for an order, providing the order information. 2. Amazon SWF receives the start workflow execution request and then schedules the first decision task. Workflow execution life cycle API Version 2012-01-25 65 Amazon Simple Workflow Service Developer Guide Description Action, Decision, or Event PollForDecisionTask action. RespondDecisionTas kCompleted action and ScheduleActivityTask decision. ActivityTaskScheduled event PollForActivityTask action and RespondActivityTas kCompleted action. 3. The decider receives the task from Amazon SWF, reviews the history, applies the coordination logic to determine that no previous activities occurred, makes a decision to schedule the Verify Order activity with the information the activity worker needs to process the task, and returns the decision to Amazon SWF. 4. Amazon SWF receives the decision, schedules the Verify Order activity task, and waits for the activity task to complete or time out. 5. An activity worker that can perform the Verify Order activity receives the task, performs it, and returns the results to Amazon SWF. Workflow Execution Life Cycle API Version 2012-01-25 66 Amazon Simple Workflow Service Developer Guide Description Action, Decision, or Event ActivityTaskCompleted led event. event and DecisionTaskSchedu PollForDecisionTask action. RespondDecisionTas kCompleted action with ScheduleActivityTask decision. DecisionTaskCompleted led event. event and ActivityTaskSchedu 6. Amazon SWF receives the results of the Verify Order activity, adds them to the workflow history, and schedules a decision task. 7. The decider receives the task from Amazon SWF, reviews the history, applies the coordinat ion logic, makes a decision to schedule a ChargeCreditCard activity task with the information the activity worker needs to process the task, and returns the decision to Amazon SWF. 8. Amazon SWF receives the decision, schedules the ChargeCreditCard activity task, and waits for it to complete or time out. Workflow Execution Life Cycle API Version 2012-01-25 67 Amazon Simple Workflow Service Developer Guide Description Action, Decision, or Event 9. An activity worker that can perform the PollForActivityTask and RespondActivityTaskComplete d action. ActivityTaskCompleted led event. event and DecisionTaskSchedu PollForDecisionTask action. RespondDecisionTas decision. with ScheduleActivityTask kCompleted ChargeCreditCard activity receives the task, performs it, and returns the results to Amazon SWF. 10. Amazon SWF receives the results of the ChargeCre ditCard activity task, adds them to the workflow history, and schedules a decision task. 11. The decider receives the task from Amazon SWF, reviews the history, applies the coordination logic, makes a decision to schedule a ShipOrder activity task with the information the activity worker needs to perform the task, and returns the decision to Amazon SWF. Workflow Execution Life Cycle API Version 2012-01-25 68 Amazon Simple Workflow Service Developer Guide Description Action, Decision, or Event DecisionTaskCompleted led event. event and ActivityTaskSchedu PollForActivityTask action and RespondActivityTas kCompleted action. ActivityTaskCompleted led event. event and DecisionTaskSchedu 12. Amazon SWF receives the decision, schedules a ShipOrder activity task, and waits for it to complete or time out. 13. An activity worker that can perform the ShipOrder activity receives the task, performs it, and returns the results to Amazon SWF. 14. Amazon SWF receives the results of the ShipOrder activity task, adds them to the workflow history, and schedules a decision task. Workflow Execution Life Cycle API Version 2012-01-25 69 Amazon Simple Workflow Service Developer Guide Description Action, Decision, or Event PollForDecisionTask action. RespondDecisionTas kCompleted action with ScheduleActivityTask decision. 15. The decider receives the task from Amazon SWF, reviews the history, applies the coordinat ion logic, makes a decision to schedule a RecordCompletion activity task with the information the activity worker needs to perform the task, and returns the decision to Amazon SWF. 16. Amazon SWF receives the DecisionTaskCompleted led event. event and ActivityTaskSchedu decision, schedules a RecordCompletion activity task, and waits for it to complete or time out. 17. An activity worker that can perform the RecordCompletion activity receives the task, performs it, and returns the results to Amazon SWF. PollForActivityTask action and RespondActivityTas kCompleted action. Workflow Execution Life Cycle API Version 2012-01-25 70 Amazon Simple Workflow Service Developer Guide Description Action, Decision, or Event ActivityTaskCompleted led event. event and DecisionTaskSchedu PollForDecisionTask action. RespondDecisionTas action with CompleteWorkflowExecution kCompleted decision. WorkflowExecutionCompleted event. 18. Amazon SWF receives the results of the RecordCom pletion activity task, adds them to the workflow history, and schedules a decision task. 19. The decider receives the task from Amazon SWF, reviews the history, applies the coordinat ion logic, makes a decision to close the workflow execution and returns the decision along with any results to Amazon SWF. 20. Amazon SWF closes the workflow execution and archives the history for future reference. Polling for tasks in Amazon SWF Deciders and activity workers communicate with Amazon SWF using long polling. The decider
swf-dg-027
swf-dg.pdf
27
RespondDecisionTas action with CompleteWorkflowExecution kCompleted decision. WorkflowExecutionCompleted event. 18. Amazon SWF receives the results of the RecordCom pletion activity task, adds them to the workflow history, and schedules a decision task. 19. The decider receives the task from Amazon SWF, reviews the history, applies the coordinat ion logic, makes a decision to close the workflow execution and returns the decision along with any results to Amazon SWF. 20. Amazon SWF closes the workflow execution and archives the history for future reference. Polling for tasks in Amazon SWF Deciders and activity workers communicate with Amazon SWF using long polling. The decider or activity worker periodically initiates communication with Amazon SWF, notifying Amazon SWF of its availability to accept a task, and then specifies a task list to get tasks from. Polling for tasks API Version 2012-01-25 71 Amazon Simple Workflow Service Developer Guide If a task is available on the specified task list, Amazon SWF returns it immediately in the response. If no task is available, Amazon SWF holds the TCP connection open for up to 60 seconds so that, if a task becomes available during that time, it can be returned in the same connection. If no task becomes available within 60 seconds, it returns an empty response and closes the connection. (An empty response is a Task structure in which the value of taskToken is an empty string.) If this happens, the decider or activity worker should poll again. Long polling works well for high-volume task processing. Deciders and activity workers can manage their own capacity, and it is easy to use when the deciders and activity workers are behind a firewall. For more information, see Polling for Decision Tasks and Polling for Activity Tasks. Polling for tasks API Version 2012-01-25 72 Amazon Simple Workflow Service Developer Guide Advanced workflow concepts in Amazon SWF The e-commerce example in the ??? section represents a simplified workflow scenario. In reality, you are likely to want your workflow to do concurrent tasks (send an order confirmation email while authorizing a credit card), record major events (all items are packed), update the order with changes (add or remove an item), and make other more advanced decisions as part of your workflow execution. This section describes advanced workflow concepts that you can use to construct your workflows. Advanced concepts • Versioning • Signals • Child workflows in Amazon SWF • Markers in Amazon SWF • Tags in Amazon SWF • Implementing exclusive choice with Amazon SWF • Timers in Amazon SWF • Cancelling activity tasks in Amazon SWF Versioning Business needs often require you to have different implementations or variations of the same workflow or activity running simultaneously. For example, you might want to test a new implementation of a workflow while another one is in production. You might also want to run two different implementations with two different feature sets, such as a basic and premium implementation. Versioning enables you to run multiple implementations of workflows and activities concurrently, for any purpose that meets your requirements. Workflow and activity types have a version associated with them which is specified at registration time. Version is a free-form string and you can choose your own versioning scheme. In order to create a new version of a registered type, you should register it with the same name and a different version. Task lists in Amazon SWF , described earlier, can further help you to implement versioning. Consider a situation in which you have long-running workflow executions of a given type already in progress, and circumstances require that you revise the workflow, such as to add a new feature. You could implement the new feature by creating new versions of activity types and workers, and a new Versioning API Version 2012-01-25 73 Amazon Simple Workflow Service Developer Guide decider. Then you could launch executions of the new workflow version using a different set of task lists. This way, you could have executions of workflows of different versions running simultaneously without affecting each other. Signals Signals enable you to inject information into a running workflow execution. In some scenarios, you might want to add information to a running workflow execution to let it know that something has changed or to inform it of an external event. Any process can send a signal to an open workflow execution. For example, one workflow execution might signal another. Note An attempt to send a signal to a workflow execution that isn't open results in SignalWorkflowExecution failing with UnknownResourceFault. To use signals, define the signal name and data to be passed to the signal—if any. Then, program the decider to recognize the signal event (WorkflowExecutionSignaled) in the history and process it appropriately. When a process wants to signal a workflow execution, it makes a call to Amazon SWF (using the SignalWorkflowExecution action
swf-dg-028
swf-dg.pdf
28
or to inform it of an external event. Any process can send a signal to an open workflow execution. For example, one workflow execution might signal another. Note An attempt to send a signal to a workflow execution that isn't open results in SignalWorkflowExecution failing with UnknownResourceFault. To use signals, define the signal name and data to be passed to the signal—if any. Then, program the decider to recognize the signal event (WorkflowExecutionSignaled) in the history and process it appropriately. When a process wants to signal a workflow execution, it makes a call to Amazon SWF (using the SignalWorkflowExecution action or, in the case of a decider, using the SignalExternalWorkflowExecution decision) that specifies the identifier for the target workflow execution, the signal name, and the signal data. Amazon SWF then receives the signal, records it in the history of the target workflow execution, and schedules a decision task for it. When the decider receives the decision task, it also receives the signal inside the workflow execution history. The decider can then take appropriate actions based on the signal and its data. Sometimes you might want to wait for a signal. For example, a user could cancel an order by sending a signal, but only within one hour of placing the order. Amazon SWF doesn't have a primitive to enable a decider to wait for a signal from the service. Pause functionality needs to be implemented in the decider itself. In order to pause, the decider should start a timer, using the StartTimer decision, which specifies the duration for which the decider will wait for the signal while continuing to poll for decision tasks. When the decider receives a decision task, it should check the history to see if either the signal has been received or the timer has fired. If the signal has been received, then the decider should cancel the timer. However, if instead, the timer has fired, then it means that the signal did not arrive within the specified time. To summarize, in order to wait for a specific signal, do the following. Signals API Version 2012-01-25 74 Amazon Simple Workflow Service Developer Guide 1. Create a timer for the amount of time the decider should wait. 2. When a decision task is received, check the history to see if the signal has arrived or if the timer has fired. 3. If a signal has arrived, cancel the timer using a CancelTimer decision and process the signal. Depending on the timing, the history may contain both TimerFired and WorkflowExecutionSignaled events. In such cases, you can rely on the relative order of the events in the history to determine which occurred first. 4. If the timer has fired, before a signal is received, then the decider has timed out waiting for the signal. You can fail the execution or do whatever other logic is appropriate to your use case. For cases in which a workflow should be canceled—for example, the order itself was canceled by the customer—the RequestCancelWorkflowExecution action should be used rather than sending a signal to the workflow. Some applications for signals include the following: • Pausing workflow executions from progressing until a signal is received (e.g., waiting for an inventory shipment). • Providing information to a workflow execution that might affect the logic of how deciders make decisions. This is useful for workflows affected by external events (e.g., trying to finish the sale of a stock after the market closes). • Updating a workflow execution when you anticipate that changes might occur (e.g., changing order quantities after an order is placed and before it ships). In the following example, the workflow execution is sent a signal to cancel an order. https://swf.us-east-1.amazonaws.com SignalWorkflowExecution {"domain": "867530901", "workflowId": "20110927-T-1", "runId": "f5ebbac6-941c-4342-ad69-dfd2f8be6689", "signalName": "CancelOrder", "input": "order 3553"} If the workflow execution receives the signal, Amazon SWF returns a successful HTTP response similar to the following. Amazon SWF will generate a decision task to inform the decider to process the signal. Signals API Version 2012-01-25 75 Amazon Simple Workflow Service Developer Guide HTTP/1.1 200 OK Content-Length: 0 Content-Type: application/json x-amzn-RequestId: bf78ae15-3f0c-11e1-9914-a356b6ea8bdf Child workflows in Amazon SWF Complicated workflows can be broken into smaller, more manageable, and potentially reusable components by using child workflows. A child workflow is a workflow execution that is initiated by another (parent) workflow execution. To initiate a child workflow, the decider for the parent workflow uses the StartChildWorkflowExecution decision. Input data specified with this decision is made available to the child workflow through its history. The attributes for the StartChildWorkflowExecution decision also specify the child policy, that is, how Amazon SWF should handle the situation in which the parent workflow execution terminates before the child workflow execution. There are three possible values: • TERMINATE: Amazon SWF will terminate the child executions. • REQUEST_CANCEL: Amazon SWF will attempt
swf-dg-029
swf-dg.pdf
29
child workflows. A child workflow is a workflow execution that is initiated by another (parent) workflow execution. To initiate a child workflow, the decider for the parent workflow uses the StartChildWorkflowExecution decision. Input data specified with this decision is made available to the child workflow through its history. The attributes for the StartChildWorkflowExecution decision also specify the child policy, that is, how Amazon SWF should handle the situation in which the parent workflow execution terminates before the child workflow execution. There are three possible values: • TERMINATE: Amazon SWF will terminate the child executions. • REQUEST_CANCEL: Amazon SWF will attempt to cancel the child execution by placing a WorkflowExecutionCancelRequested event in the child's workflow execution history. • ABANDON: Amazon SWF will take no action; the child executions will continue to run. After the child workflow execution starts, it runs like a regular execution. When it completes, Amazon SWF records the completion, along with its results, in the parent workflow execution's workflow history. Examples of child workflows include the following: • Credit card processing child workflow used by workflows in different websites • Email child workflow that verifies the customer email address, checks the opt-out list, sends the email, and verifies that it didn't bounce or fail. • Database storage and retrieval child workflow that combines connection, setup, transaction, and verification. • Source code compilation child workflow that combines building, packaging, and verification. In the e-commerce example, you might want to make the Charge Credit Card activity a child workflow. To do this, you could register a new Verify Customer workflow, register the Verify Child workflows API Version 2012-01-25 76 Amazon Simple Workflow Service Developer Guide Customer Address and Check Fraud DB activities, and define coordination logic for the tasks. Then, a decider in the Customer Order workflow can initiate a Verify Customer child workflow by scheduling the StartChildWorkflowExecution decision that specifies this workflow type. The following figure shows a customer order workflow that includes a new Verify Customer child workflow, which checks the customer address, checks the fraud database, and charges the credit card. Multiple workflows could create child workflow executions using the same workflow type. For example, the Verify Customer child workflow could also be used in other parts of an organization. The events for a child workflow are contained in its own workflow history and are not included in the parent's workflow history. Because child workflows are simply workflow executions that are initiated by a decider, they could also be started as normal stand-alone workflow executions. Markers in Amazon SWF At times, you might want to record information in the workflow history of a workflow execution that is specific to your use case. Markers enable you to record information in the workflow execution history that you can use for any custom or scenario-specific purpose. To use markers, a decider uses the RecordMarker decision, names the marker, attaches desired data to the decision, and notifies Amazon SWF using the RespondDecisionTaskCompleted action. Amazon SWF receives the request, records the marker in the workflow history, and enacts any Markers API Version 2012-01-25 77 Amazon Simple Workflow Service Developer Guide other decisions in the request. From that point on, deciders can see the marker in the workflow history and use it in any way that you program. Recording a marker doesn't, by itself, initiate a decision task. To prevent the workflow execution from becoming stuck, something must occur that continues the execution of the workflow. For example, this might include the decider scheduling another activity task, the workflow execution receiving a signal, or a previously scheduled activity task completing. Examples of markers include the following: • A counter that counts the number of loops in a recursive workflow. • Progress of the workflow execution based on the results of activities. • Information summarized from earlier workflow history events. In the e-commerce example, you might add an activity that checks the inventory every day and increments the count in a marker each time. Then, you could add decision logic that emails the customer or notifies a manager when the count exceeds five, without having to review the entire history. In the following example, the decider completes a decision task and responds with a RespondDecisionTaskCompleted action that contains a RecordMarker decision. https://swf.us-east-1.amazonaws.com RespondDecisionTaskCompleted { "taskToken":"12342e17-80f6-FAKE-TASK-TOKEN32f0223", "decisions":[{ "decisionType":"RecordMarker", "recordMarkerDecisionAttributes":{ "markerName":"customer elected special shipping offer" } }, ] } If Amazon SWF successfully records the marker, it returns a successful HTTP response similar to the following. HTTP/1.1 200 OK Markers API Version 2012-01-25 78 Amazon Simple Workflow Service Content-Length: 0 Content-Type: application/json x-amzn-RequestId: 6c0373ce-074c-11e1-9083-8318c48dee96 Developer Guide Tags in Amazon SWF Amazon SWF supports tagging a workflow execution. This is especially useful when you have many resources. Amazon SWF supports tagging a workflow execution with up to five tags. Each tag is a free-form string and may
swf-dg-030
swf-dg.pdf
30
RespondDecisionTaskCompleted action that contains a RecordMarker decision. https://swf.us-east-1.amazonaws.com RespondDecisionTaskCompleted { "taskToken":"12342e17-80f6-FAKE-TASK-TOKEN32f0223", "decisions":[{ "decisionType":"RecordMarker", "recordMarkerDecisionAttributes":{ "markerName":"customer elected special shipping offer" } }, ] } If Amazon SWF successfully records the marker, it returns a successful HTTP response similar to the following. HTTP/1.1 200 OK Markers API Version 2012-01-25 78 Amazon Simple Workflow Service Content-Length: 0 Content-Type: application/json x-amzn-RequestId: 6c0373ce-074c-11e1-9083-8318c48dee96 Developer Guide Tags in Amazon SWF Amazon SWF supports tagging a workflow execution. This is especially useful when you have many resources. Amazon SWF supports tagging a workflow execution with up to five tags. Each tag is a free-form string and may be up to 256 characters in length. If you want to use tags, you must assign them when you start a workflow execution. You can't add tags to a workflow execution after it has been started, nor may you edit or remove tags that have been assigned to a workflow execution. IAM supports controlling access to Amazon SWF domains based on tags. To control access based on tags, provide information about your tags in the condition element of an IAM policy. Manage tags Manage Amazon Simple Workflow Service tags using the AWS SDKs or by interacting directly with the Amazon SWF API. Using the API you can add tags when registering a domain, list tags for an existing domain, and add or delete tags for an existing domain. Note There is a limit of 50 tags per resource. See General Account Quotas for Amazon SWF • RegisterDomain • ListTagsForResource • TagResource • UntagResource For more information see Working with Amazon SWF APIs, and Amazon Simple Workflow Service API Reference. Tags API Version 2012-01-25 79 Amazon Simple Workflow Service Developer Guide Tag workflow executions With Amazon SWF, you can associate tags with workflow executions and then query for workflow executions based on these tags. You can filter the listi when you use the visibility operations. By carefully selecting the tags you assign to an execution, you can use them to provide meaningful listings. For example, suppose you run several fulfillment centers. With tags, you could list the processes occurring in a specific fulfillment center. Or, if a customer is converting different types of media files, tags could indicate different processes when converting video, audio, and image files. You can associate up to five tags with a workflow execution when you start the execution using the StartWorkflowExecution action, StartChildWorkflowExecution decision, or ContinueAsNewWorkflowExecution decision. When you use visibility actions to list or count workflow executions, you can filter results based on your tags. To use tagging 1. Devise a tagging strategy. Think about your business requirements and create a list of tags that are meaningful to you. Determine which executions will get which tags. Even though an execution can be assigned a maximum of five tags, your tag library can have any number of tags. Because each tag can be any string value up to 256 characters in length, a tag can 2. 3. describe almost any business concept. Tag an execution with up to five tags when you create it. List or count the executions that are tagged with a particular tag by specifying the tagFilter parameter with the ListOpenWorkflowExecutions, ListClosedWorkflowExecutions, CountOpenWorkflowExecutions, and CountClosedWorkflowExecutions actions. The action will filter the executions based on the tags specified. When you associate a tag with a workflow execution, it is permanently associated with that execution, and can't be removed. You can specify only one tag in the tagFilter parameter with ListWorkflowExecutions. Also, tag matching is case sensitive, and only exact matches return results. Assume you have already set up two executions that are tagged as follows. Tag workflow executions API Version 2012-01-25 80 Amazon Simple Workflow Service Developer Guide Execution Name Assigned Tags Execution-One Execution-Two Consumer, 2011-February Wholesale, 2011-March You can filter the list of executions returned by ListOpenWorkflowExecutions on the Consumer tag. The oldestDate and latestDate values are specified as Unix Time values. https://swf.us-east-1.amazonaws.com RespondDecisionTaskCompleted { "domain":"867530901", "startTimeFilter":{ "oldestDate":1262332800, "latestDate":1325348400 }, "tagFilter":{ "tag":"Consumer" } } Control access to domains with tags You can control access to Amazon Simple Workflow Service domains by referencing tags associated with Amazon SWF domains in IAM. For instance, you could restrict domains that include a tag where the key is environment and the value is production: { "Version": "2012-10-17", "Statement": [ { "Effect": "Deny", "Action": "swf:*", "Resource": "arn:aws:swf:*:123456789012:/domain/*", "Condition": { "StringEquals": {"aws:ResourceTag/environment": "production"} } } ] Control access to domains with tags API Version 2012-01-25 81 Amazon Simple Workflow Service } Developer Guide This policy will Deny the access to any domain that has been tagged as environment/ production. For more information, see: • Controlling Access Using IAM Tags • Tag-based Policies Implementing exclusive choice with Amazon SWF In some scenarios, you might want to schedule a different set of activities based on the outcome of a previous activity.
swf-dg-031
swf-dg.pdf
31
is environment and the value is production: { "Version": "2012-10-17", "Statement": [ { "Effect": "Deny", "Action": "swf:*", "Resource": "arn:aws:swf:*:123456789012:/domain/*", "Condition": { "StringEquals": {"aws:ResourceTag/environment": "production"} } } ] Control access to domains with tags API Version 2012-01-25 81 Amazon Simple Workflow Service } Developer Guide This policy will Deny the access to any domain that has been tagged as environment/ production. For more information, see: • Controlling Access Using IAM Tags • Tag-based Policies Implementing exclusive choice with Amazon SWF In some scenarios, you might want to schedule a different set of activities based on the outcome of a previous activity. With the exclusive choice pattern, you can create flexible workflows that meet the complex requirements of your application. Amazon SWF does not have a specific exclusive choice action. To implement exclusive choice, you must write your decider logic to make decisions based on the results of a previous activity. Some applications for exclusive choice include the following: • Performing cleanup activities if the results of a previous activity were unsuccessful • Scheduling different activities based on whether the customer purchased a basic or advanced plan • Performing different customer authentication activities based on the customer's ordering history In the e-commerce example, you might use exclusive choice to either ship or cancel an order based on the outcome of charging the credit card. In the following figure, the decider schedules the Ship Order and Record Completion activity tasks if the credit card is successfully charged. Otherwise, it schedules the Cancel Order and Email Customer activity tasks. The decider schedules the ShipOrder activity if the credit card is successfully charged. Otherwise, the decider schedules the CancelOrder activity. Exclusive choice API Version 2012-01-25 82 Amazon Simple Workflow Service Developer Guide In this case, program the decider to interpret the history and determine whether the credit card was successfully charged. To do this, you might have logic similar to the following IF lastEvent = "WorkflowExecutionStarted" addToDecisions ScheduleActivityTask(ActivityType = "VerifyOrderActivity") ELSIF lastEvent = "ActivityTaskCompleted" AND ActivityType = "VerifyOrderActivity" addToDecisions ScheduleActivityTask(ActivityType = "ChargeCreditCardActivity") #Successful Credit Card Charge Activities ELSIF lastEvent = "ActivityTaskCompleted" AND ActivityType = "ChargeCreditCardActivity" addToDecisions ScheduleActivityTask(ActivityType = "ShipOrderActivity") ELSIF lastEvent = "ActivityTaskCompleted" AND ActivityType = "ShipOrderActivity" addToDecisions ScheduleActivityTask(ActivityType = "RecordOrderCompletionActivity") ELSIF lastEvent = "ActivityTaskCompleted" AND ActivityType = "RecordOrderCompletionActivity" addToDecisions CompleteWorkflowExecution #Unsuccessful Credit Card Charge Activities ELSIF lastEvent = "ActivityTaskFailed" AND ActivityType = "ChargeCreditCardActivity" addToDecisions ScheduleActivityTask(ActivityType = "CancelOrderActivity") ELSIF lastEvent = "ActivityTaskCompleted" AND ActivityType = "CancelOrderActivity" addToDecisions ScheduleActivityTask(ActivityType = "EmailCustomerActivity") ELSIF lastEvent = "ActivityTaskCompleted" AND ActivityType = "EmailCustomerActivity" addToDecisions CompleteWorkflowExecution ENDIF If the credit card was successfully charged, the decider should respond with RespondDecisionTaskCompleted to schedule the ShipOrder activity. https://swf.us-east-1.amazonaws.com RespondDecisionTaskCompleted Exclusive choice API Version 2012-01-25 83 Developer Guide Amazon Simple Workflow Service { "taskToken": "12342e17-80f6-FAKE-TASK-TOKEN32f0223", "decisions":[ { "decisionType":"ScheduleActivityTask", "scheduleActivityTaskDecisionAttributes":{ "control":"OPTIONAL_DATA_FOR_DECIDER", "activityType":{ "name":"ShipOrder", "version":"2.4" }, "activityId":"3e2e6e55-e7c4-fee-deed-aa815722b7be", "scheduleToCloseTimeout":"3600", "taskList":{ "name":"SHIPPING" }, "scheduleToStartTimeout":"600", "startToCloseTimeout":"3600", "heartbeatTimeout":"300", "input": "123 Main Street, Anytown, United States" } } ] } If the credit card was not successfully charged, the decider should respond with RespondDecisionTaskCompleted to schedule the CancelOrder activity. https://swf.us-east-1.amazonaws.com RespondDecisionTaskCompleted { "taskToken": "12342e17-80f6-FAKE-TASK-TOKEN32f0223", "decisions":[ { "decisionType":"ScheduleActivityTask", "scheduleActivityTaskDecisionAttributes":{ "control":"OPTIONAL_DATA_FOR_DECIDER", "activityType":{ "name":"CancelOrder", "version":"2.4" }, "activityId":"3e2e6e55-e7c4-fee-deed-aa815722b7be", "scheduleToCloseTimeout":"3600", Exclusive choice API Version 2012-01-25 84 Amazon Simple Workflow Service Developer Guide "taskList":{ "name":"CANCELLATIONS" }, "scheduleToStartTimeout":"600", "startToCloseTimeout":"3600", "heartbeatTimeout":"300", "input": "Out of Stock" } } ] } If Amazon SWF is able to validate the data in the RespondDecisionTaskCompleted action, Amazon SWF returns a successful HTTP response similar to the following. HTTP/1.1 200 OK Content-Length: 11 Content-Type: application/json x-amzn-RequestId: 93cec6f7-0747-11e1-b533-79b402604df1 Timers in Amazon SWF With a timer, you can notify your decider when a certain amount of time has elapsed. When responding to a decision task, the decider has the option to respond with a StartTimer decision. This decision specifies an amount of time after which the timer should fire. After the specified time has elapsed, Amazon SWF will add a TimerFired event to the workflow execution history and schedule a decision task. The decider can then use this information to inform further decisions. One common application for a timer is to delay the execution of an activity task. For example, a customer might want to take delayed delivery of an item. Cancelling activity tasks in Amazon SWF Activity task cancellation informs the decider to end activities that no longer need to be performed. Amazon SWF uses a cooperative cancellation mechanism and doesn't forcibly interrupt running activity tasks. You must program your activity workers to handle cancellation requests. The decider can decide to cancel an activity task while it is processing a decision task. To cancel an activity task, the decider uses the RespondDecisionTaskCompleted action with the RequestCancelActivityTask decision. Timers API Version 2012-01-25 85 Amazon Simple Workflow Service Developer Guide If the activity task has not yet been acquired by an activity worker, the service will cancel the task. Note that there is a potential race condition
swf-dg-032
swf-dg.pdf
32
that no longer need to be performed. Amazon SWF uses a cooperative cancellation mechanism and doesn't forcibly interrupt running activity tasks. You must program your activity workers to handle cancellation requests. The decider can decide to cancel an activity task while it is processing a decision task. To cancel an activity task, the decider uses the RespondDecisionTaskCompleted action with the RequestCancelActivityTask decision. Timers API Version 2012-01-25 85 Amazon Simple Workflow Service Developer Guide If the activity task has not yet been acquired by an activity worker, the service will cancel the task. Note that there is a potential race condition in that an activity worker could acquire the task at any time. If the task has already been assigned to an activity worker, then the activity worker will be requested to cancel the task. In this example, the workflow execution is sent a signal to cancel the order. https://swf.us-east-1.amazonaws.com SignalWorkflowExecution {"domain": "867530901", "workflowId": "20110927-T-1", "runId": "9ba33198-4b18-4792-9c15-7181fb3a8852", "signalName": "CancelOrder", "input": "order 3553"} If the workflow execution receives the signal, Amazon SWF returns a successful HTTP response similar to the following. Amazon SWF will generate a decision task to inform the decider to process the signal. HTTP/1.1 200 OK Content-Length: 0 Content-Type: application/json x-amzn-RequestId: 6c0373ce-074c-11e1-9083-8318c48dee96 When the decider processes the decision task and sees the signal in the history, the decider attempts to cancel the outstanding activity that has the ShipOrderActivity0001 activity ID. The activity ID is provided in the workflow history from the schedule activity task event. https://swf.us-east-1.amazonaws.com RespondDecisionTaskCompleted { "taskToken":"12342e17-80f6-FAKE-TASK-TOKEN32f0223", "decisions":[{ "decisionType":"RequestCancelActivityTask", "RequestCancelActivityTaskDecisionAttributes":{ "ActivityID":"ShipOrderActivity0001" } } ] } Cancelling activity tasks API Version 2012-01-25 86 Amazon Simple Workflow Service Developer Guide If Amazon SWF successfully receives the cancellation request, it returns a successful HTTP response similar to the following: HTTP/1.1 200 OK Content-Length: 0 Content-Type: application/json x-amzn-RequestId: 6c0373ce-074c-11e1-9083-8318c48dee96 The cancellation attempt is recorded in the history as the ActivityTaskCancelRequested event. If the task is successfully canceled—as indicated by an ActivityTaskCanceled event—program your decider to take the appropriate steps that should follow task cancellation such as closing the workflow execution. If the activity task could not be canceled—for example, if the task completes, fails, or times out instead of canceling—your decider should accept the results of the activity or perform any cleanup or mitigation necessitated by your use case. If the activity task has already been acquired by an activity worker, then the request to cancel is transmitted through the task-heartbeat mechanism. Activity workers can periodically use RecordActivityTaskHeartbeat to report to Amazon SWF that the task is still in progress. Note that activity workers are not required to heartbeat, although it is recommended for long- running tasks. Task cancellation requires periodic heartbeat to be recorded; if the worker doesn't heartbeat, the task can't be canceled. If the decider requests a cancellation of the task, Amazon SWF sets the value of the cancelRequest object to true. The cancelRequest object is part of the ActivityTaskStatus object which is returned by the service in response to RecordActivityTaskHeartbeat. Amazon SWF doesn't prevent the successful completion of an activity task whose cancellation has been requested; it is up to the activity to determine how to handle the cancellation request. Depending on your requirements, program the activity worker to either cancel the activity task or ignore the cancellation request. If you want the activity worker to indicate that the work for the activity task was canceled, program it to respond with a RespondActivityTaskCanceled. If you want the activity worker to complete the task, program it to respond with a standard RespondActivityTaskCompleted. Cancelling activity tasks API Version 2012-01-25 87 Amazon Simple Workflow Service Developer Guide When Amazon SWF receives the RespondActivityTaskCompleted or RespondActivityTaskCanceled request, it updates the workflow execution history and schedules a decision task to inform the decider. Program the decider to process the decision task and return any additional decisions. If the activity task is successfully canceled, program the decider to perform the tasks needed to continue or close the workflow execution. If the activity task isn't successfully canceled, program the decider to accept the results, ignore the results, or schedule any required cleanup. Cancelling activity tasks API Version 2012-01-25 88 Amazon Simple Workflow Service Developer Guide Security in Amazon Simple Workflow Service This section provides information about Amazon Simple Workflow Service security and authentication. Topics • Data protection in Amazon Simple Workflow Service • Identity and Access Management in Amazon Simple Workflow Service • Logging and Monitoring • Compliance Validation for Amazon Simple Workflow Service • Resilience in Amazon Simple Workflow Service • Infrastructure Security in Amazon Simple Workflow Service • Configuration and Vulnerability Analysis in Amazon Simple Workflow Service Amazon SWF uses IAM to control access to other AWS services and resources. For an overview of how IAM works, see Overview of Access Management in the IAM User Guide. For an overview of security
swf-dg-033
swf-dg.pdf
33
information about Amazon Simple Workflow Service security and authentication. Topics • Data protection in Amazon Simple Workflow Service • Identity and Access Management in Amazon Simple Workflow Service • Logging and Monitoring • Compliance Validation for Amazon Simple Workflow Service • Resilience in Amazon Simple Workflow Service • Infrastructure Security in Amazon Simple Workflow Service • Configuration and Vulnerability Analysis in Amazon Simple Workflow Service Amazon SWF uses IAM to control access to other AWS services and resources. For an overview of how IAM works, see Overview of Access Management in the IAM User Guide. For an overview of security credentials, see AWS Security Credentials in the Amazon Web Services General Reference. Data protection in Amazon Simple Workflow Service The AWS shared responsibility model applies to data protection in Amazon Simple Workflow Service. As described in this model, AWS is responsible for protecting the global infrastructure that runs all of the AWS Cloud. You are responsible for maintaining control over your content that is hosted on this infrastructure. You are also responsible for the security configuration and management tasks for the AWS services that you use. For more information about data privacy, see the Data Privacy FAQ. For information about data protection in Europe, see the AWS Shared Responsibility Model and GDPR blog post on the AWS Security Blog. For data protection purposes, we recommend that you protect AWS account credentials and set up individual users with AWS IAM Identity Center or AWS Identity and Access Management (IAM). That way, each user is given only the permissions necessary to fulfill their job duties. We also recommend that you secure your data in the following ways: • Use multi-factor authentication (MFA) with each account. • Use SSL/TLS to communicate with AWS resources. We require TLS 1.2 and recommend TLS 1.3. Data Protection API Version 2012-01-25 89 Amazon Simple Workflow Service Developer Guide • Set up API and user activity logging with AWS CloudTrail. For information about using CloudTrail trails to capture AWS activities, see Working with CloudTrail trails in the AWS CloudTrail User Guide. • Use AWS encryption solutions, along with all default security controls within AWS services. • Use advanced managed security services such as Amazon Macie, which assists in discovering and securing sensitive data that is stored in Amazon S3. • If you require FIPS 140-3 validated cryptographic modules when accessing AWS through a command line interface or an API, use a FIPS endpoint. For more information about the available FIPS endpoints, see Federal Information Processing Standard (FIPS) 140-3. We strongly recommend that you never put confidential or sensitive information, such as your customers' email addresses, into tags or free-form text fields such as a Name field. This includes when you work with Amazon SWF or other AWS services using the console, API, AWS CLI, or AWS SDKs. Any data that you enter into tags or free-form text fields used for names may be used for billing or diagnostic logs. If you provide a URL to an external server, we strongly recommend that you do not include credentials information in the URL to validate your request to that server. Encryption in Amazon Simple Workflow Service Encryption at rest Amazon SWF always encrypts your data at rest. Data in Amazon Simple Workflow Service is encrypted at rest using transparent server-side encryption. This helps reduce the operational burden and complexity involved in protecting sensitive data. With encryption at rest, you can build security-sensitive applications that meet encryption compliance and regulatory requirements Encryption in transit All data that passes between Amazon SWF and other services is encrypted using Transport Layer Security (TLS). Identity and Access Management in Amazon Simple Workflow Service Access to Amazon SWF requires credentials that AWS can use to authenticate your requests. These credentials must have permissions to access AWS resources, such as retrieving event data from Encryption API Version 2012-01-25 90 Amazon Simple Workflow Service Developer Guide other AWS resources.. The following sections provide details on how you can use AWS Identity and Access Management (IAM) and Amazon SWF to help secure your resources by controlling access to them. AWS Identity and Access Management (IAM) is an AWS service that helps an administrator securely control access to AWS resources. IAM administrators control who can be authenticated (signed in) and authorized (have permissions) to use Amazon SWF resources. IAM is an AWS service that you can use with no additional charge. Topics • Audience • Authenticating with identities • Managing access using policies • Access Control • Policy actions for Amazon SWF • Policy resources for Amazon SWF • Policy condition keys for Amazon SWF • ACLs in Amazon SWF • ABAC with Amazon SWF • Using temporary credentials with Amazon SWF • Cross-service principal permissions for Amazon SWF • Service roles for Amazon SWF • Service-linked roles for
swf-dg-034
swf-dg.pdf
34
resources. IAM administrators control who can be authenticated (signed in) and authorized (have permissions) to use Amazon SWF resources. IAM is an AWS service that you can use with no additional charge. Topics • Audience • Authenticating with identities • Managing access using policies • Access Control • Policy actions for Amazon SWF • Policy resources for Amazon SWF • Policy condition keys for Amazon SWF • ACLs in Amazon SWF • ABAC with Amazon SWF • Using temporary credentials with Amazon SWF • Cross-service principal permissions for Amazon SWF • Service roles for Amazon SWF • Service-linked roles for Amazon SWF • Identity-based policies for Amazon SWF • Resource-based policies within Amazon SWF • How Amazon Simple Workflow Service works with IAM • Identity-based policy examples for Amazon Simple Workflow Service • Basic Principles • Amazon SWF IAM Policies • API Summary • Tag-based Policies • Amazon VPC endpoints for Amazon SWF • Troubleshooting Amazon Simple Workflow Service identity and access Identity and Access Management API Version 2012-01-25 91 Amazon Simple Workflow Service Audience Developer Guide How you use AWS Identity and Access Management (IAM) differs, depending on the work that you do in Amazon SWF. Service user – If you use the Amazon SWF service to do your job, then your administrator provides you with the credentials and permissions that you need. As you use more Amazon SWF features to do your work, you might need additional permissions. Understanding how access is managed can help you request the right permissions from your administrator. If you cannot access a feature in Amazon SWF, see Troubleshooting Amazon Simple Workflow Service identity and access. Service administrator – If you're in charge of Amazon SWF resources at your company, you probably have full access to Amazon SWF. It's your job to determine which Amazon SWF features and resources your service users should access. You must then submit requests to your IAM administrator to change the permissions of your service users. Review the information on this page to understand the basic concepts of IAM. To learn more about how your company can use IAM with Amazon SWF, see How Amazon Simple Workflow Service works with IAM. IAM administrator – If you're an IAM administrator, you might want to learn details about how you can write policies to manage access to Amazon SWF. To view example Amazon SWF identity-based policies that you can use in IAM, see Identity-based policy examples for Amazon Simple Workflow Service. Authenticating with identities Authentication is how you sign in to AWS using your identity credentials. You must be authenticated (signed in to AWS) as the AWS account root user, as an IAM user, or by assuming an IAM role. You can sign in to AWS as a federated identity by using credentials provided through an identity source. AWS IAM Identity Center (IAM Identity Center) users, your company's single sign-on authentication, and your Google or Facebook credentials are examples of federated identities. When you sign in as a federated identity, your administrator previously set up identity federation using IAM roles. When you access AWS by using federation, you are indirectly assuming a role. Depending on the type of user you are, you can sign in to the AWS Management Console or the AWS access portal. For more information about signing in to AWS, see How to sign in to your AWS account in the AWS Sign-In User Guide. Audience API Version 2012-01-25 92 Amazon Simple Workflow Service Developer Guide If you access AWS programmatically, AWS provides a software development kit (SDK) and a command line interface (CLI) to cryptographically sign your requests by using your credentials. If you don't use AWS tools, you must sign requests yourself. For more information about using the recommended method to sign requests yourself, see AWS Signature Version 4 for API requests in the IAM User Guide. Regardless of the authentication method that you use, you might be required to provide additional security information. For example, AWS recommends that you use multi-factor authentication (MFA) to increase the security of your account. To learn more, see Multi-factor authentication in the AWS IAM Identity Center User Guide and AWS Multi-factor authentication in IAM in the IAM User Guide. AWS account root user When you create an AWS account, you begin with one sign-in identity that has complete access to all AWS services and resources in the account. This identity is called the AWS account root user and is accessed by signing in with the email address and password that you used to create the account. We strongly recommend that you don't use the root user for your everyday tasks. Safeguard your root user credentials and use them to perform the tasks that only the root user can perform. For the complete list of tasks that require you
swf-dg-035
swf-dg.pdf
35
Guide. AWS account root user When you create an AWS account, you begin with one sign-in identity that has complete access to all AWS services and resources in the account. This identity is called the AWS account root user and is accessed by signing in with the email address and password that you used to create the account. We strongly recommend that you don't use the root user for your everyday tasks. Safeguard your root user credentials and use them to perform the tasks that only the root user can perform. For the complete list of tasks that require you to sign in as the root user, see Tasks that require root user credentials in the IAM User Guide. Federated identity As a best practice, require human users, including users that require administrator access, to use federation with an identity provider to access AWS services by using temporary credentials. A federated identity is a user from your enterprise user directory, a web identity provider, the AWS Directory Service, the Identity Center directory, or any user that accesses AWS services by using credentials provided through an identity source. When federated identities access AWS accounts, they assume roles, and the roles provide temporary credentials. For centralized access management, we recommend that you use AWS IAM Identity Center. You can create users and groups in IAM Identity Center, or you can connect and synchronize to a set of users and groups in your own identity source for use across all your AWS accounts and applications. For information about IAM Identity Center, see What is IAM Identity Center? in the AWS IAM Identity Center User Guide. Authenticating with identities API Version 2012-01-25 93 Amazon Simple Workflow Service IAM users and groups Developer Guide An IAM user is an identity within your AWS account that has specific permissions for a single person or application. Where possible, we recommend relying on temporary credentials instead of creating IAM users who have long-term credentials such as passwords and access keys. However, if you have specific use cases that require long-term credentials with IAM users, we recommend that you rotate access keys. For more information, see Rotate access keys regularly for use cases that require long- term credentials in the IAM User Guide. An IAM group is an identity that specifies a collection of IAM users. You can't sign in as a group. You can use groups to specify permissions for multiple users at a time. Groups make permissions easier to manage for large sets of users. For example, you could have a group named IAMAdmins and give that group permissions to administer IAM resources. Users are different from roles. A user is uniquely associated with one person or application, but a role is intended to be assumable by anyone who needs it. Users have permanent long-term credentials, but roles provide temporary credentials. To learn more, see Use cases for IAM users in the IAM User Guide. IAM roles An IAM role is an identity within your AWS account that has specific permissions. It is similar to an IAM user, but is not associated with a specific person. To temporarily assume an IAM role in the AWS Management Console, you can switch from a user to an IAM role (console). You can assume a role by calling an AWS CLI or AWS API operation or by using a custom URL. For more information about methods for using roles, see Methods to assume a role in the IAM User Guide. IAM roles with temporary credentials are useful in the following situations: • Federated user access – To assign permissions to a federated identity, you create a role and define permissions for the role. When a federated identity authenticates, the identity is associated with the role and is granted the permissions that are defined by the role. For information about roles for federation, see Create a role for a third-party identity provider (federation) in the IAM User Guide. If you use IAM Identity Center, you configure a permission set. To control what your identities can access after they authenticate, IAM Identity Center correlates the permission set to a role in IAM. For information about permissions sets, see Permission sets in the AWS IAM Identity Center User Guide. • Temporary IAM user permissions – An IAM user or role can assume an IAM role to temporarily take on different permissions for a specific task. Authenticating with identities API Version 2012-01-25 94 Amazon Simple Workflow Service Developer Guide • Cross-account access – You can use an IAM role to allow someone (a trusted principal) in a different account to access resources in your account. Roles are the primary way to grant cross- account access. However, with some AWS services, you can attach a policy directly to a resource (instead of using a role
swf-dg-036
swf-dg.pdf
36
AWS IAM Identity Center User Guide. • Temporary IAM user permissions – An IAM user or role can assume an IAM role to temporarily take on different permissions for a specific task. Authenticating with identities API Version 2012-01-25 94 Amazon Simple Workflow Service Developer Guide • Cross-account access – You can use an IAM role to allow someone (a trusted principal) in a different account to access resources in your account. Roles are the primary way to grant cross- account access. However, with some AWS services, you can attach a policy directly to a resource (instead of using a role as a proxy). To learn the difference between roles and resource-based policies for cross-account access, see Cross account resource access in IAM in the IAM User Guide. • Cross-service access – Some AWS services use features in other AWS services. For example, when you make a call in a service, it's common for that service to run applications in Amazon EC2 or store objects in Amazon S3. A service might do this using the calling principal's permissions, using a service role, or using a service-linked role. • Forward access sessions (FAS) – When you use an IAM user or role to perform actions in AWS, you are considered a principal. When you use some services, you might perform an action that then initiates another action in a different service. FAS uses the permissions of the principal calling an AWS service, combined with the requesting AWS service to make requests to downstream services. FAS requests are only made when a service receives a request that requires interactions with other AWS services or resources to complete. In this case, you must have permissions to perform both actions. For policy details when making FAS requests, see Forward access sessions. • Service role – A service role is an IAM role that a service assumes to perform actions on your behalf. An IAM administrator can create, modify, and delete a service role from within IAM. For more information, see Create a role to delegate permissions to an AWS service in the IAM User Guide. • Service-linked role – A service-linked role is a type of service role that is linked to an AWS service. The service can assume the role to perform an action on your behalf. Service-linked roles appear in your AWS account and are owned by the service. An IAM administrator can view, but not edit the permissions for service-linked roles. • Applications running on Amazon EC2 – You can use an IAM role to manage temporary credentials for applications that are running on an EC2 instance and making AWS CLI or AWS API requests. This is preferable to storing access keys within the EC2 instance. To assign an AWS role to an EC2 instance and make it available to all of its applications, you create an instance profile that is attached to the instance. An instance profile contains the role and enables programs that are running on the EC2 instance to get temporary credentials. For more information, see Use an IAM role to grant permissions to applications running on Amazon EC2 instances in the IAM User Guide. Authenticating with identities API Version 2012-01-25 95 Amazon Simple Workflow Service Developer Guide Managing access using policies You control access in AWS by creating policies and attaching them to AWS identities or resources. A policy is an object in AWS that, when associated with an identity or resource, defines their permissions. AWS evaluates these policies when a principal (user, root user, or role session) makes a request. Permissions in the policies determine whether the request is allowed or denied. Most policies are stored in AWS as JSON documents. For more information about the structure and contents of JSON policy documents, see Overview of JSON policies in the IAM User Guide. Administrators can use AWS JSON policies to specify who has access to what. That is, which principal can perform actions on what resources, and under what conditions. By default, users and roles have no permissions. To grant users permission to perform actions on the resources that they need, an IAM administrator can create IAM policies. The administrator can then add the IAM policies to roles, and users can assume the roles. IAM policies define permissions for an action regardless of the method that you use to perform the operation. For example, suppose that you have a policy that allows the iam:GetRole action. A user with that policy can get role information from the AWS Management Console, the AWS CLI, or the AWS API. Identity-based policies Identity-based policies are JSON permissions policy documents that you can attach to an identity, such as an IAM user, group of users, or role. These policies control what actions users and roles can perform, on which resources, and under
swf-dg-037
swf-dg.pdf
37
roles, and users can assume the roles. IAM policies define permissions for an action regardless of the method that you use to perform the operation. For example, suppose that you have a policy that allows the iam:GetRole action. A user with that policy can get role information from the AWS Management Console, the AWS CLI, or the AWS API. Identity-based policies Identity-based policies are JSON permissions policy documents that you can attach to an identity, such as an IAM user, group of users, or role. These policies control what actions users and roles can perform, on which resources, and under what conditions. To learn how to create an identity-based policy, see Define custom IAM permissions with customer managed policies in the IAM User Guide. Identity-based policies can be further categorized as inline policies or managed policies. Inline policies are embedded directly into a single user, group, or role. Managed policies are standalone policies that you can attach to multiple users, groups, and roles in your AWS account. Managed policies include AWS managed policies and customer managed policies. To learn how to choose between a managed policy or an inline policy, see Choose between managed policies and inline policies in the IAM User Guide. Resource-based policies Resource-based policies are JSON policy documents that you attach to a resource. Examples of resource-based policies are IAM role trust policies and Amazon S3 bucket policies. In services that support resource-based policies, service administrators can use them to control access to a specific Managing access using policies API Version 2012-01-25 96 Amazon Simple Workflow Service Developer Guide resource. For the resource where the policy is attached, the policy defines what actions a specified principal can perform on that resource and under what conditions. You must specify a principal in a resource-based policy. Principals can include accounts, users, roles, federated users, or AWS services. Resource-based policies are inline policies that are located in that service. You can't use AWS managed policies from IAM in a resource-based policy. Access control lists (ACLs) Access control lists (ACLs) control which principals (account members, users, or roles) have permissions to access a resource. ACLs are similar to resource-based policies, although they do not use the JSON policy document format. Amazon S3, AWS WAF, and Amazon VPC are examples of services that support ACLs. To learn more about ACLs, see Access control list (ACL) overview in the Amazon Simple Storage Service Developer Guide. Other policy types AWS supports additional, less-common policy types. These policy types can set the maximum permissions granted to you by the more common policy types. • Permissions boundaries – A permissions boundary is an advanced feature in which you set the maximum permissions that an identity-based policy can grant to an IAM entity (IAM user or role). You can set a permissions boundary for an entity. The resulting permissions are the intersection of an entity's identity-based policies and its permissions boundaries. Resource-based policies that specify the user or role in the Principal field are not limited by the permissions boundary. An explicit deny in any of these policies overrides the allow. For more information about permissions boundaries, see Permissions boundaries for IAM entities in the IAM User Guide. • Service control policies (SCPs) – SCPs are JSON policies that specify the maximum permissions for an organization or organizational unit (OU) in AWS Organizations. AWS Organizations is a service for grouping and centrally managing multiple AWS accounts that your business owns. If you enable all features in an organization, then you can apply service control policies (SCPs) to any or all of your accounts. The SCP limits permissions for entities in member accounts, including each AWS account root user. For more information about Organizations and SCPs, see Service control policies in the AWS Organizations User Guide. • Resource control policies (RCPs) – RCPs are JSON policies that you can use to set the maximum available permissions for resources in your accounts without updating the IAM policies attached Managing access using policies API Version 2012-01-25 97 Amazon Simple Workflow Service Developer Guide to each resource that you own. The RCP limits permissions for resources in member accounts and can impact the effective permissions for identities, including the AWS account root user, regardless of whether they belong to your organization. For more information about Organizations and RCPs, including a list of AWS services that support RCPs, see Resource control policies (RCPs) in the AWS Organizations User Guide. • Session policies – Session policies are advanced policies that you pass as a parameter when you programmatically create a temporary session for a role or federated user. The resulting session's permissions are the intersection of the user or role's identity-based policies and the session policies. Permissions can also come from a resource-based policy. An explicit deny in any of these policies overrides
swf-dg-038
swf-dg.pdf
38
root user, regardless of whether they belong to your organization. For more information about Organizations and RCPs, including a list of AWS services that support RCPs, see Resource control policies (RCPs) in the AWS Organizations User Guide. • Session policies – Session policies are advanced policies that you pass as a parameter when you programmatically create a temporary session for a role or federated user. The resulting session's permissions are the intersection of the user or role's identity-based policies and the session policies. Permissions can also come from a resource-based policy. An explicit deny in any of these policies overrides the allow. For more information, see Session policies in the IAM User Guide. Multiple policy types When multiple types of policies apply to a request, the resulting permissions are more complicated to understand. To learn how AWS determines whether to allow a request when multiple policy types are involved, see Policy evaluation logic in the IAM User Guide. Access Control You can have valid credentials to authenticate your requests, but unless you have permissions you cannot create or access Amazon SWF resources. For example, you must have permissions to invoke AWS Lambda, Amazon Simple Notification Service (Amazon SNS), and Amazon Simple Queue Service (Amazon SQS) targets associated with your Amazon SWF rules. The following sections describe how to manage permissions for Amazon SWF. We recommend that you read the overview first. • Basic Principles • Amazon SWF IAM Policies • Amazon SWF Policy Examples Policy actions for Amazon SWF Supports policy actions: Yes Administrators can use AWS JSON policies to specify who has access to what. That is, which principal can perform actions on what resources, and under what conditions. Access Control API Version 2012-01-25 98 Amazon Simple Workflow Service Developer Guide The Action element of a JSON policy describes the actions that you can use to allow or deny access in a policy. Policy actions usually have the same name as the associated AWS API operation. There are some exceptions, such as permission-only actions that don't have a matching API operation. There are also some operations that require multiple actions in a policy. These additional actions are called dependent actions. Include actions in a policy to grant permissions to perform the associated operation. To see a list of Amazon SWF actions, see Resources Defined by Amazon Simple Workflow Service in the Service Authorization Reference. Policy actions in Amazon SWF use the following prefix before the action: swf To specify multiple actions in a single statement, separate them with commas. "Action": [ "swf:action1", "swf:action2" ] To view examples of Amazon SWF identity-based policies, see Identity-based policy examples for Amazon Simple Workflow Service. Policy resources for Amazon SWF Supports policy resources: Yes Administrators can use AWS JSON policies to specify who has access to what. That is, which principal can perform actions on what resources, and under what conditions. The Resource JSON policy element specifies the object or objects to which the action applies. Statements must include either a Resource or a NotResource element. As a best practice, specify a resource using its Amazon Resource Name (ARN). You can do this for actions that support a specific resource type, known as resource-level permissions. For actions that don't support resource-level permissions, such as listing operations, use a wildcard (*) to indicate that the statement applies to all resources. "Resource": "*" Policy resources API Version 2012-01-25 99 Amazon Simple Workflow Service Developer Guide To see a list of Amazon SWF resource types and their ARNs, see Actions Defined by Amazon Simple Workflow Service in the Service Authorization Reference. To learn with which actions you can specify the ARN of each resource, see Resources Defined by Amazon Simple Workflow Service. To view examples of Amazon SWF identity-based policies, see Identity-based policy examples for Amazon Simple Workflow Service. Policy condition keys for Amazon SWF Supports service-specific policy condition keys: Yes Administrators can use AWS JSON policies to specify who has access to what. That is, which principal can perform actions on what resources, and under what conditions. The Condition element (or Condition block) lets you specify conditions in which a statement is in effect. The Condition element is optional. You can create conditional expressions that use condition operators, such as equals or less than, to match the condition in the policy with values in the request. If you specify multiple Condition elements in a statement, or multiple keys in a single Condition element, AWS evaluates them using a logical AND operation. If you specify multiple values for a single condition key, AWS evaluates the condition using a logical OR operation. All of the conditions must be met before the statement's permissions are granted. You can also use placeholder variables when you specify conditions. For example, you can grant an IAM user permission to access a
swf-dg-039
swf-dg.pdf
39
use condition operators, such as equals or less than, to match the condition in the policy with values in the request. If you specify multiple Condition elements in a statement, or multiple keys in a single Condition element, AWS evaluates them using a logical AND operation. If you specify multiple values for a single condition key, AWS evaluates the condition using a logical OR operation. All of the conditions must be met before the statement's permissions are granted. You can also use placeholder variables when you specify conditions. For example, you can grant an IAM user permission to access a resource only if it is tagged with their IAM user name. For more information, see IAM policy elements: variables and tags in the IAM User Guide. AWS supports global condition keys and service-specific condition keys. To see all AWS global condition keys, see AWS global condition context keys in the IAM User Guide. To see a list of Amazon SWF condition keys, see Condition Keys for Amazon Simple Workflow Service in the Service Authorization Reference. To learn with which actions and resources you can use a condition key, see Resources Defined by Amazon Simple Workflow Service. To view examples of Amazon SWF identity-based policies, see Identity-based policy examples for Amazon Simple Workflow Service. ACLs in Amazon SWF Supports ACLs: No Policy condition keys API Version 2012-01-25 100 Amazon Simple Workflow Service Developer Guide Access control lists (ACLs) control which principals (account members, users, or roles) have permissions to access a resource. ACLs are similar to resource-based policies, although they do not use the JSON policy document format. ABAC with Amazon SWF Supports ABAC (tags in policies): Partial Attribute-based access control (ABAC) is an authorization strategy that defines permissions based on attributes. In AWS, these attributes are called tags. You can attach tags to IAM entities (users or roles) and to many AWS resources. Tagging entities and resources is the first step of ABAC. Then you design ABAC policies to allow operations when the principal's tag matches the tag on the resource that they are trying to access. ABAC is helpful in environments that are growing rapidly and helps with situations where policy management becomes cumbersome. To control access based on tags, you provide tag information in the condition element of a policy using the aws:ResourceTag/key-name, aws:RequestTag/key-name, or aws:TagKeys condition keys. If a service supports all three condition keys for every resource type, then the value is Yes for the service. If a service supports all three condition keys for only some resource types, then the value is Partial. For more information about ABAC, see Define permissions with ABAC authorization in the IAM User Guide. To view a tutorial with steps for setting up ABAC, see Use attribute-based access control (ABAC) in the IAM User Guide. Using temporary credentials with Amazon SWF Supports temporary credentials: Yes Some AWS services don't work when you sign in using temporary credentials. For additional information, including which AWS services work with temporary credentials, see AWS services that work with IAM in the IAM User Guide. You are using temporary credentials if you sign in to the AWS Management Console using any method except a user name and password. For example, when you access AWS using your company's single sign-on (SSO) link, that process automatically creates temporary credentials. You also automatically create temporary credentials when you sign in to the console as a user and then ABAC API Version 2012-01-25 101 Amazon Simple Workflow Service Developer Guide switch roles. For more information about switching roles, see Switch from a user to an IAM role (console) in the IAM User Guide. You can manually create temporary credentials using the AWS CLI or AWS API. You can then use those temporary credentials to access AWS. AWS recommends that you dynamically generate temporary credentials instead of using long-term access keys. For more information, see Temporary security credentials in IAM. Cross-service principal permissions for Amazon SWF Supports forward access sessions (FAS): Yes When you use an IAM user or role to perform actions in AWS, you are considered a principal. When you use some services, you might perform an action that then initiates another action in a different service. FAS uses the permissions of the principal calling an AWS service, combined with the requesting AWS service to make requests to downstream services. FAS requests are only made when a service receives a request that requires interactions with other AWS services or resources to complete. In this case, you must have permissions to perform both actions. For policy details when making FAS requests, see Forward access sessions. Service roles for Amazon SWF Supports service roles: Yes A service role is an IAM role that a service assumes to perform actions on your behalf. An IAM administrator can create, modify, and delete
swf-dg-040
swf-dg.pdf
40
uses the permissions of the principal calling an AWS service, combined with the requesting AWS service to make requests to downstream services. FAS requests are only made when a service receives a request that requires interactions with other AWS services or resources to complete. In this case, you must have permissions to perform both actions. For policy details when making FAS requests, see Forward access sessions. Service roles for Amazon SWF Supports service roles: Yes A service role is an IAM role that a service assumes to perform actions on your behalf. An IAM administrator can create, modify, and delete a service role from within IAM. For more information, see Create a role to delegate permissions to an AWS service in the IAM User Guide. Warning Changing the permissions for a service role might break Amazon SWF functionality. Edit service roles only when Amazon SWF provides guidance to do so. Service-linked roles for Amazon SWF Supports service-linked roles: No A service-linked role is a type of service role that is linked to an AWS service. The service can assume the role to perform an action on your behalf. Service-linked roles appear in your AWS Principal permissions API Version 2012-01-25 102 Amazon Simple Workflow Service Developer Guide account and are owned by the service. An IAM administrator can view, but not edit the permissions for service-linked roles. For details about creating or managing service-linked roles, see AWS services that work with IAM. Find a service in the table that includes a Yes in the Service-linked role column. Choose the Yes link to view the service-linked role documentation for that service. Identity-based policies for Amazon SWF Supports identity-based policies: Yes Identity-based policies are JSON permissions policy documents that you can attach to an identity, such as an IAM user, group of users, or role. These policies control what actions users and roles can perform, on which resources, and under what conditions. To learn how to create an identity-based policy, see Define custom IAM permissions with customer managed policies in the IAM User Guide. With IAM identity-based policies, you can specify allowed or denied actions and resources as well as the conditions under which actions are allowed or denied. You can't specify the principal in an identity-based policy because it applies to the user or role to which it is attached. To learn about all of the elements that you can use in a JSON policy, see IAM JSON policy elements reference in the IAM User Guide. Identity-based policy examples for Amazon SWF To view examples of Amazon SWF identity-based policies, see Identity-based policy examples for Amazon Simple Workflow Service. Resource-based policies within Amazon SWF Supports resource-based policies: No Resource-based policies are JSON policy documents that you attach to a resource. Examples of resource-based policies are IAM role trust policies and Amazon S3 bucket policies. In services that support resource-based policies, service administrators can use them to control access to a specific resource. For the resource where the policy is attached, the policy defines what actions a specified principal can perform on that resource and under what conditions. You must specify a principal in a resource-based policy. Principals can include accounts, users, roles, federated users, or AWS services. To enable cross-account access, you can specify an entire account or IAM entities in another account as the principal in a resource-based policy. Adding a cross-account principal to a resource- Identity-based policies API Version 2012-01-25 103 Amazon Simple Workflow Service Developer Guide based policy is only half of establishing the trust relationship. When the principal and the resource are in different AWS accounts, an IAM administrator in the trusted account must also grant the principal entity (user or role) permission to access the resource. They grant permission by attaching an identity-based policy to the entity. However, if a resource-based policy grants access to a principal in the same account, no additional identity-based policy is required. For more information, see Cross account resource access in IAM in the IAM User Guide. How Amazon Simple Workflow Service works with IAM Before you use IAM to manage access to Amazon SWF, learn what IAM features are available to use with Amazon SWF. IAM features you can use with Amazon Simple Workflow Service IAM feature Amazon SWF support Identity-based policies Resource-based policies Policy actions Policy resources Policy condition keys (service-specific) ACLs Yes No Yes Yes Yes No ABAC (tags in policies) Partial Temporary credentials Principal permissions Service roles Service-linked roles Yes Yes Yes No To get a high-level view of how Amazon SWF and other AWS services work with most IAM features, see AWS services that work with IAM in the IAM User Guide. How Amazon Simple Workflow Service works with IAM API Version 2012-01-25 104 Amazon Simple Workflow Service Developer Guide Identity-based policy examples for Amazon Simple Workflow
swf-dg-041
swf-dg.pdf
41
Amazon Simple Workflow Service IAM feature Amazon SWF support Identity-based policies Resource-based policies Policy actions Policy resources Policy condition keys (service-specific) ACLs Yes No Yes Yes Yes No ABAC (tags in policies) Partial Temporary credentials Principal permissions Service roles Service-linked roles Yes Yes Yes No To get a high-level view of how Amazon SWF and other AWS services work with most IAM features, see AWS services that work with IAM in the IAM User Guide. How Amazon Simple Workflow Service works with IAM API Version 2012-01-25 104 Amazon Simple Workflow Service Developer Guide Identity-based policy examples for Amazon Simple Workflow Service By default, users and roles don't have permission to create or modify Amazon SWF resources. They also can't perform tasks by using the AWS Management Console, AWS Command Line Interface (AWS CLI), or AWS API. To grant users permission to perform actions on the resources that they need, an IAM administrator can create IAM policies. The administrator can then add the IAM policies to roles, and users can assume the roles. To learn how to create an IAM identity-based policy by using these example JSON policy documents, see Create IAM policies (console) in the IAM User Guide. For details about actions and resource types defined by Amazon SWF, including the format of the ARNs for each of the resource types, see Actions, Resources, and Condition Keys for Amazon Simple Workflow Service in the Service Authorization Reference. Topics • Policy best practices • Using the Amazon SWF console • Allow users to view their own permissions Policy best practices Identity-based policies determine whether someone can create, access, or delete Amazon SWF resources in your account. These actions can incur costs for your AWS account. When you create or edit identity-based policies, follow these guidelines and recommendations: • Get started with AWS managed policies and move toward least-privilege permissions – To get started granting permissions to your users and workloads, use the AWS managed policies that grant permissions for many common use cases. They are available in your AWS account. We recommend that you reduce permissions further by defining AWS customer managed policies that are specific to your use cases. For more information, see AWS managed policies or AWS managed policies for job functions in the IAM User Guide. • Apply least-privilege permissions – When you set permissions with IAM policies, grant only the permissions required to perform a task. You do this by defining the actions that can be taken on specific resources under specific conditions, also known as least-privilege permissions. For more information about using IAM to apply permissions, see Policies and permissions in IAM in the IAM User Guide. Identity-based policy examples API Version 2012-01-25 105 Amazon Simple Workflow Service Developer Guide • Use conditions in IAM policies to further restrict access – You can add a condition to your policies to limit access to actions and resources. For example, you can write a policy condition to specify that all requests must be sent using SSL. You can also use conditions to grant access to service actions if they are used through a specific AWS service, such as AWS CloudFormation. For more information, see IAM JSON policy elements: Condition in the IAM User Guide. • Use IAM Access Analyzer to validate your IAM policies to ensure secure and functional permissions – IAM Access Analyzer validates new and existing policies so that the policies adhere to the IAM policy language (JSON) and IAM best practices. IAM Access Analyzer provides more than 100 policy checks and actionable recommendations to help you author secure and functional policies. For more information, see Validate policies with IAM Access Analyzer in the IAM User Guide. • Require multi-factor authentication (MFA) – If you have a scenario that requires IAM users or a root user in your AWS account, turn on MFA for additional security. To require MFA when API operations are called, add MFA conditions to your policies. For more information, see Secure API access with MFA in the IAM User Guide. For more information about best practices in IAM, see Security best practices in IAM in the IAM User Guide. Using the Amazon SWF console To access the Amazon Simple Workflow Service console, you must have a minimum set of permissions. These permissions must allow you to list and view details about the Amazon SWF resources in your AWS account. If you create an identity-based policy that is more restrictive than the minimum required permissions, the console won't function as intended for entities (users or roles) with that policy. You don't need to allow minimum console permissions for users that are making calls only to the AWS CLI or the AWS API. Instead, allow access to only the actions that match the API operation that they're trying to perform. To ensure that users
swf-dg-042
swf-dg.pdf
42
you must have a minimum set of permissions. These permissions must allow you to list and view details about the Amazon SWF resources in your AWS account. If you create an identity-based policy that is more restrictive than the minimum required permissions, the console won't function as intended for entities (users or roles) with that policy. You don't need to allow minimum console permissions for users that are making calls only to the AWS CLI or the AWS API. Instead, allow access to only the actions that match the API operation that they're trying to perform. To ensure that users and roles can still use the Amazon SWF console, also attach the Amazon SWF ConsoleAccess or ReadOnly AWS managed policy to the entities. For more information, see Adding permissions to a user in the IAM User Guide. Identity-based policy examples API Version 2012-01-25 106 Amazon Simple Workflow Service Developer Guide Allow users to view their own permissions This example shows how you might create a policy that allows IAM users to view the inline and managed policies that are attached to their user identity. This policy includes permissions to complete this action on the console or programmatically using the AWS CLI or AWS API. { "Version": "2012-10-17", "Statement": [ { "Sid": "ViewOwnUserInfo", "Effect": "Allow", "Action": [ "iam:GetUserPolicy", "iam:ListGroupsForUser", "iam:ListAttachedUserPolicies", "iam:ListUserPolicies", "iam:GetUser" ], "Resource": ["arn:aws:iam::*:user/${aws:username}"] }, { "Sid": "NavigateInConsole", "Effect": "Allow", "Action": [ "iam:GetGroupPolicy", "iam:GetPolicyVersion", "iam:GetPolicy", "iam:ListAttachedGroupPolicies", "iam:ListGroupPolicies", "iam:ListPolicyVersions", "iam:ListPolicies", "iam:ListUsers" ], "Resource": "*" } ] } Basic Principles Amazon SWF access control is based primarily on two types of permissions: Basic Principles API Version 2012-01-25 107 Amazon Simple Workflow Service Developer Guide • Resource permissions: Which Amazon SWF resources a user can access. You can express resource permissions only for domains. • API permissions: Which Amazon SWF actions a user can call. The simplest approach is to grant full account access—call any Amazon SWF action in any domain —or deny access entirely. However, IAM supports a more granular approach to access control that is often more useful. For example, you could: • Allow a user to call any Amazon SWF action without restrictions, but only in a specified domain. You could use such a policy to allow workflow applications that are under development to use any action, but only a "sandbox" domain. • Allow a user to access any domain, but constrain how they use the API. You could use such a policy to allow an "auditor" application to call the API in any domain, but allow only read access. • Allow a user to call only a limited set of actions in certain domains. You could use such a policy to allow a workflow starter to call only the StartWorkflowExecution action in a specified domain. Amazon SWF access control is based on the following principles: • Access control decisions are based only on IAM policies; all policy auditing and manipulation is done through IAM. • The access control model uses a deny-by-default policy; any access that isn't explicitly allowed is denied. • You control access to Amazon SWF resources by attaching appropriate IAM policies to the workflow's actors. • Resource permissions can be expressed only for domains. • You can further constrain the usage of some actions by applying conditions to one or more parameters. • If you grant permission to use RespondDecisionTaskCompleted, you can express permissions for the list of decisions included in that action. Each of the decisions has one or more parameters, much like a regular API call. To allow for policies to be as readable as possible, you can express permissions on decisions as if they were actual API calls, including applying conditions to some parameters. These types of permissions are called pseudo API permissions. Basic Principles API Version 2012-01-25 108 Amazon Simple Workflow Service Developer Guide For a summary of which regular and pseudo API parameters can be constrained by using conditions, see API Summary. Amazon SWF IAM Policies An IAM policy contains one or more Statement elements, each of which contains a set of elements that define the policy. For a complete list of elements and a general discussion of how to construct policies, see The Access Policy Language. Amazon SWF access control is based on the following elements: Effect (Required) The effect of the statement: deny or allow. Note You must explicitly allow access; IAM denies access by default. Resource (Required) The resource—an entity in an AWS service that a user can interact with—that the statement applies to. You can express resource permissions only for domains. For example, a policy can allow access to only certain domains in your account. To express permissions for a domain, set Resource to the domain's Amazon Resource Name (ARN), which has the format "arn:aws:swf:Region:AccountID:/domain/DomainName". Region is the AWS region, AccountID is the account ID with no
swf-dg-043
swf-dg.pdf
43
is based on the following elements: Effect (Required) The effect of the statement: deny or allow. Note You must explicitly allow access; IAM denies access by default. Resource (Required) The resource—an entity in an AWS service that a user can interact with—that the statement applies to. You can express resource permissions only for domains. For example, a policy can allow access to only certain domains in your account. To express permissions for a domain, set Resource to the domain's Amazon Resource Name (ARN), which has the format "arn:aws:swf:Region:AccountID:/domain/DomainName". Region is the AWS region, AccountID is the account ID with no dashes, and DomainName is the domain name. Action (Required) The action that the statement applies to, which you refer to by using the following format: serviceId:action. For Amazon SWF, set serviceID to swf. For example, swf:StartWorkflowExecution refers to the StartWorkflowExecution action, and is used to control which users are allowed to start workflows. If you grant permission to use RespondDecisionTaskCompleted, you can also control access to the included list of decisions by using Action to express permissions for the pseudo API. Because IAM denies access by default, a decider's decision must be explicitly allowed or it will not be accepted. You can use a * value to allow all decisions. Amazon SWF IAM Policies API Version 2012-01-25 109 Amazon Simple Workflow Service Condition Developer Guide (Optional) Expresses a constraint on one or more of an action's parameters, which restricts the allowed values. Amazon SWF actions often have a wide scope, which you can reduce by using IAM conditions. For example, to limit which task lists the PollForActivityTask action is allowed to access, you include a Condition and use the swf:taskList.name key to specify the allowable lists. You can express constraints for the following entities. • The workflow type. The name and version have separate keys. • The activity type. The name and version have separate keys. • Task lists. • Tags. You can specify multiple tags for some actions. In that case, each tag has a separate key. Note For Amazon SWF, the values are all strings so you constrain a parameter by using a string operator such as StringEquals, which restricts the parameter to a specified string. However, the regular string comparison operators such as StringEquals require all requests to include the parameter. If you don't include the parameter explicitly, and there is no default value such as the default task list provided during type registration, access will be denied. It is often useful to treat conditions as optional, so that you can call an action without necessarily including the associated parameter. For example, you might want to allow a decider to specify a set of RespondDecisionTaskCompleted decisions, but also allow it to specify only one of them for any particular call. In that case, you constrain the appropriate parameters by using a StringEqualsIfExists operator, which allows access if the parameter satisfies the condition, but doesn't deny access if the parameter is absent. For a complete list of constrainable parameters and the associated keys, see API Summary. The following section provides examples of how to construct Amazon SWF policies. For details, see String Conditions. Amazon SWF IAM Policies API Version 2012-01-25 110 Amazon Simple Workflow Service Developer Guide Amazon SWF Policy Examples A workflow consists of multiple actors—activities, deciders, and so on. You can control access for each actor by attaching an appropriate IAM policy. This section provides some examples. The following shows the simplest case: { "Version": "2012-10-17", "Statement" : [ { "Effect" : "Allow", "Action" : "swf:*", "Resource" : "arn:aws:swf:*:123456789012:/domain/*" } ] } If you attach this policy to an actor, it has full account access across all regions. You can use wildcards to have a single value represent multiple resources, actions, or regions. • The first wildcard (*) in the Resource value indicates that the resource permissions apply to all regions. To restrict permissions to a single region, replace the wildcard with the appropriate region string, such as us-east-1. • The second wildcard (*) in the Resource value allows the actor to access any of the account's domains in the specified regions. • The wildcard (*) in the Action value allows the actor to call any Amazon SWF action. For details on how to use wildcards, see Element Descriptions The following sections show examples of policies that grant permissions in a more granular way. Domain Permissions If you want to restrict a department's workflows to a particular domain, you can use something like: { "Version": "2012-10-17", "Statement": [ { "Effect" : "Allow", "Action" : "swf:*", Amazon SWF IAM Policies API Version 2012-01-25 111 Amazon Simple Workflow Service Developer Guide "Resource" : "arn:aws:swf:*:123456789012:/domain/department1" } ] } If you attach this policy to an actor, it can call any action, but only for the department1 domain. If you
swf-dg-044
swf-dg.pdf
44
Amazon SWF action. For details on how to use wildcards, see Element Descriptions The following sections show examples of policies that grant permissions in a more granular way. Domain Permissions If you want to restrict a department's workflows to a particular domain, you can use something like: { "Version": "2012-10-17", "Statement": [ { "Effect" : "Allow", "Action" : "swf:*", Amazon SWF IAM Policies API Version 2012-01-25 111 Amazon Simple Workflow Service Developer Guide "Resource" : "arn:aws:swf:*:123456789012:/domain/department1" } ] } If you attach this policy to an actor, it can call any action, but only for the department1 domain. If you want an actor to have access to more than one domain, you can express permission for each domain separately, as follows: { "Version": "2012-10-17", "Statement": [ { "Effect" : "Allow", "Action" : "swf:*", "Resource" : "arn:aws:swf:*:123456789012:/domain/department1" }, { "Effect" : "Allow", "Action" : "swf:*", "Resource" : "arn:aws:swf:*:123456789012:/domain/department2" } ] } If you attach this policy to an actor, it can use any Amazon SWF action in the department1 and department2 domains. You can also sometimes use wildcards to represent multiple domains. API Permissions and Constraints You control which actions an actor can use with the Action element. Optionally, you can constrain the action's allowable parameter values by using a Condition element. If you want to restrict an actor to only certain actions, you can use something like the following: { "Version": "2012-10-17", "Statement": [ { "Effect" : "Allow", "Action" : "swf:StartWorkflowExecution", "Resource" : "arn:aws:swf:*:123456789012:/domain/department2" } ] Amazon SWF IAM Policies API Version 2012-01-25 112 Amazon Simple Workflow Service } Developer Guide If you attach this policy to an actor, it can call StartWorkflowExecution to start workflows in the department2 domain. It can't use any other actions or start workflows in any other domains. You can further restrict which workflows an actor can start by constraining one or more of the StartWorkflowExecution parameter values, as follows: { "Version": "2012-10-17", "Statement": [ { "Effect" : "Allow", "Action" : "swf:StartWorkflowExecution", "Resource" : "arn:aws:swf:*:123456789012:/domain/department1", "Condition" : { "StringEquals" : { "swf:workflowType.name" : "workflow1", "swf:workflowType.version" : "version2" } } } ] } This policy constrains the StartWorkflowExecution action's name and version parameters. If you attach the policy to an actor, it can run only version2 of workflow1 in the department1 domain and both parameters must be included in the request. You can constrain a parameter without requiring it to be included in a request by using a StringEqualsIfExists operator, as follows: { "Version": "2012-10-17", "Statement" : [ { "Effect" : "Allow", "Action" : "swf:StartWorkflowExecution", "Resource" : "arn:aws:swf:*:123456789012:/domain/some_domain", "Condition" : { "StringEqualsIfExists" : { "swf:taskList.name" : "task_list_name" } } Amazon SWF IAM Policies API Version 2012-01-25 113 Amazon Simple Workflow Service } ] } Developer Guide This policy allows an actor to optionally specify a task list when starting a workflow execution. You can constrain a list of tags for some actions. In that case, each tag has a separate key, so you use swf:tagList.member.0 to constrain the first tag in the list, swf:tagList.member.1 to constrain the second tag in the list, and so on, up to a maximum of 5. However, you must be careful how you constrain tag lists. For instance, here is an example of a policy that is not recommended: { "Version": "2012-10-17", "Statement" : [ { "Effect" : "Allow", "Action" : "swf:StartWorkflowExecution", "Resource" : "arn:aws:swf:*:123456789012:/domain/some_domain", "Condition" : { "StringEqualsIfExists" : { "swf:tagList.member.0" : "some_ok_tag", "another_ok_tag" } } } ] } This policy allows you to optionally specify either some_ok_tag or another_ok_tag. However, this policy constrains only the first element of the tag list. The list could have additional elements with arbitrary values that would all be allowed because this policy doesn't apply any conditions to swf:tagList.member.1, swf:tagList.member.2, and so on . One way to address this issue is to disallow the use of tag lists. The following policy ensures that only some_ok_tag or another_ok_tag are allowed by requiring the list to have only one element. { "Version": "2012-10-17", "Statement" : [ { "Effect" : "Allow", "Action" : "swf:StartWorkflowExecution", "Resource" : "arn:aws:swf:*:123456789012:/domain/some_domain", "Condition" : { Amazon SWF IAM Policies API Version 2012-01-25 114 Amazon Simple Workflow Service Developer Guide "StringEqualsIfExists" : { "swf:tagList.member.0" : "some_ok_tag", "another_ok_tag" }, "Null" : { "swf:tagList.member.1" : "true" } } } ] } Pseudo API Permissions and Constraints If you want to restrict the decisions available to RespondDecisionTaskCompleted, you must first allow the actor to call RespondDecisionTaskCompleted. You can then express permissions for the appropriate pseudo API members by using the same syntax as for the regular API, as follows: { "Version": "2012-10-17", "Statement" : [ { "Resource" : "arn:aws:swf:*:123456789012:/domain/*", "Action" : "swf:RespondDecisionTaskCompleted", "Effect" : "Allow" }, { "Resource" : "*", "Action" : "swf:ScheduleActivityTask", "Effect" : "Allow", "Condition" : { "StringEquals" : { "swf:activityType.name" : "SomeActivityType" } } } ] } If you attach this policy to
swf-dg-045
swf-dg.pdf
45
"true" } } } ] } Pseudo API Permissions and Constraints If you want to restrict the decisions available to RespondDecisionTaskCompleted, you must first allow the actor to call RespondDecisionTaskCompleted. You can then express permissions for the appropriate pseudo API members by using the same syntax as for the regular API, as follows: { "Version": "2012-10-17", "Statement" : [ { "Resource" : "arn:aws:swf:*:123456789012:/domain/*", "Action" : "swf:RespondDecisionTaskCompleted", "Effect" : "Allow" }, { "Resource" : "*", "Action" : "swf:ScheduleActivityTask", "Effect" : "Allow", "Condition" : { "StringEquals" : { "swf:activityType.name" : "SomeActivityType" } } } ] } If you attach this policy to an actor, the first Statement element allows the actor to call RespondDecisionTaskCompleted. The second element allows the actor to use the ScheduleActivityTask decision to direct Amazon SWF to schedule an activity task. To allow all decisions, replace "swf:ScheduleActivityTask" with "swf:*". You can use Condition operators to constrain parameters just as with the regular API. The StringEquals operator in this Condition allows RespondDecisionTaskCompleted to schedule an activity task for the SomeActivityType activity, and it must schedule that task. If Amazon SWF IAM Policies API Version 2012-01-25 115 Amazon Simple Workflow Service Developer Guide you want to allow RespondDecisionTaskCompleted to use a parameter value but not require it to do so, you can instead use the StringEqualsIfExists operator. AWS managed policy: SimpleWorkflowFullAccess You can attach the SimpleWorkflowFullAccess policy to your IAM identities. This policy provides full access to the Amazon SWF configuration service. Permission details This policy includes the following permissions. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "swf:*" ], "Resource": "*" } ] } Service Model Limitations on IAM Policies You must consider service model constraints when creating IAM policies. It is possible to create a syntactically valid IAM policy that represents an invalid Amazon SWF request; a request that is allowed in terms of access control can still fail because it is an invalid request. For instance, the following policy for ListOpenWorkflowExecutions is not recommended: { "Version": "2012-10-17", "Statement" : [ { "Effect" : "Allow", "Action" : "swf:ListOpenWorkflowExecutions", "Resource" : "arn:aws:swf:*:123456789012:/domain/domain_name", "Condition" : { Amazon SWF IAM Policies API Version 2012-01-25 116 Amazon Simple Workflow Service Developer Guide "StringEquals" : { "swf:typeFilter.name" : "workflow_name", "swf:typeFilter.version" : "workflow_version", "swf:tagFilter.tag" : "some_tag" } } } ] } The Amazon SWF service model doesn't allow the typeFilter and tagFilter parameters to be used in the same ListOpenWorkflowExecutions request. The policy therefore allows calls that the service will reject—by throwing ValidationException—as an invalid request. API Summary This section briefly describes how you can use IAM policies to control how an actor can use each API and pseudo API to access Amazon SWF resources. • For all actions except RegisterDomain and ListDomains, you can allow or deny access to any or all of an account's domains by expressing permissions for the domain resource. • You can allow or deny permission for any member of the regular API and, if you grant permission to call RespondDecisionTaskCompleted, any member of the pseudo API. • You can use a Condition to constrain some parameters' allowable values. The following sections list the parameters that can be constrained for each member of the regular and pseudo API and provide the associated key, and note any limitations on how you can control domain access. Regular API This section lists the regular API members, and briefly describes the parameters that can be constrained and the associated keys. It also notes any limitations on how you can control domain access. CountClosedWorkflowExecutions • tagFilter.tag – String constraint. The key is swf:tagFilter.tag • typeFilter.name – String constraint. The key is swf:typeFilter.name. API Summary API Version 2012-01-25 117 Amazon Simple Workflow Service Developer Guide • typeFilter.version – String constraint. The key is swf:typeFilter.version. Note CountClosedWorkflowExecutions requires typeFilter and tagFilter to be mutually exclusive. CountOpenWorkflowExecutions • tagFilter.tag – String constraint. The key is swf:tagFilter.tag • typeFilter.name – String constraint. The key is swf:typeFilter.name. • typeFilter.version – String constraint. The key is swf:typeFilter.version. Note CountOpenWorkflowExecutions requires typeFilter and tagFilter to be mutually exclusive. CountPendingActivityTasks • taskList.name – String constraint. The key is swf:taskList.name. CountPendingDecisionTasks • taskList.name – String constraint. The key is swf:taskList.name. DeleteActivityType • activityType.name – String constraint. The key is swf:activityType.name. • activityType.version – String constraint. The key is swf:activityType.version. DeprecateActivityType • activityType.name – String constraint. The key is swf:activityType.name. API Summary API Version 2012-01-25 118 Amazon Simple Workflow Service Developer Guide • activityType.version – String constraint. The key is swf:activityType.version. DeprecateDomain • You can't constrain this action's parameters. DeleteWorkflowType • workflowType.name – String constraint. The key is swf:workflowType.name. • workflowType.version – String constraint. The key is swf:workflowType.version. DeprecateWorkflowType • workflowType.name – String constraint. The key is swf:workflowType.name. • workflowType.version – String constraint. The key is swf:workflowType.version. DescribeActivityType • activityType.name – String constraint. The key is swf:activityType.name. • activityType.version – String constraint. The