AWS Step Functions

2019/12/04 - AWS Step Functions - 4 updated api methods

Changes  This release of the AWS Step Functions SDK introduces support for Express Workflows.

CreateStateMachine (updated) Link ¶
Changes (request)
{'loggingConfiguration': {'destinations': [{'cloudWatchLogsLogGroup': {'logGroupArn': 'string'}}],
                          'includeExecutionData': 'boolean',
                          'level': 'ALL | ERROR | FATAL | OFF'},
 'type': 'STANDARD | EXPRESS'}

Creates a state machine. A state machine consists of a collection of states that can do work ( Task states), determine to which states to transition next ( Choice states), stop an execution with an error ( Fail states), and so on. State machines are specified using a JSON-based, structured language.

Note

This operation is eventually consistent. The results are best effort and may not reflect very recent updates and changes.

Note

CreateStateMachine is an idempotent API. Subsequent requests won’t create a duplicate resource if it was already created. CreateStateMachine 's idempotency check is based on the state machine name and definition . If a following request has a different roleArn or tags , Step Functions will ignore these differences and treat it as an idempotent request of the previous. In this case, roleArn and tags will not be updated, even if they are different.

See also: AWS API Documentation

Request Syntax

client.create_state_machine(
    name='string',
    definition='string',
    roleArn='string',
    type='STANDARD'|'EXPRESS',
    loggingConfiguration={
        'level': 'ALL'|'ERROR'|'FATAL'|'OFF',
        'includeExecutionData': True|False,
        'destinations': [
            {
                'cloudWatchLogsLogGroup': {
                    'logGroupArn': 'string'
                }
            },
        ]
    },
    tags=[
        {
            'key': 'string',
            'value': 'string'
        },
    ]
)
type name

string

param name

[REQUIRED]

The name of the state machine.

A name must not contain:

  • white space

  • brackets < > { } [ ]

  • wildcard characters ? *

  • special characters " # % \ ^ | ~ ` $ & , ; : /

  • control characters ( U+0000-001F , U+007F-009F )

type definition

string

param definition

[REQUIRED]

The Amazon States Language definition of the state machine. See Amazon States Language.

type roleArn

string

param roleArn

[REQUIRED]

The Amazon Resource Name (ARN) of the IAM role to use for this state machine.

type type

string

param type

Determines whether a Standard or Express state machine is created. If not set, Standard is created.

type loggingConfiguration

dict

param loggingConfiguration

Defines what execution history events are logged and where they are logged.

  • level (string) --

    Defines which category of execution history events are logged.

  • includeExecutionData (boolean) --

    Determines whether execution history data is included in your log. When set to FALSE , data is excluded.

  • destinations (list) --

    An object that describes where your execution history events will be logged. Limited to size 1. Required, if your log level is not set to OFF .

    • (dict) --

      • cloudWatchLogsLogGroup (dict) --

        An object describing a CloudWatch log group. For more information, see AWS::Logs::LogGroup in the AWS CloudFormation User Guide.

        • logGroupArn (string) --

          The ARN of the the CloudWatch log group to which you want your logs emitted to. The ARN must end with :*

type tags

list

param tags

Tags to be added when creating a state machine.

An array of key-value pairs. For more information, see Using Cost Allocation Tags in the AWS Billing and Cost Management User Guide , and Controlling Access Using IAM Tags.

Tags may only contain Unicode letters, digits, white space, or these symbols: _ . : / = + - @ .

  • (dict) --

    Tags are key-value pairs that can be associated with Step Functions state machines and activities.

    An array of key-value pairs. For more information, see Using Cost Allocation Tags in the AWS Billing and Cost Management User Guide , and Controlling Access Using IAM Tags.

    Tags may only contain Unicode letters, digits, white space, or these symbols: _ . : / = + - @ .

    • key (string) --

      The key of a tag.

    • value (string) --

      The value of a tag.

rtype

dict

returns

Response Syntax

{
    'stateMachineArn': 'string',
    'creationDate': datetime(2015, 1, 1)
}

Response Structure

  • (dict) --

    • stateMachineArn (string) --

      The Amazon Resource Name (ARN) that identifies the created state machine.

    • creationDate (datetime) --

      The date the state machine is created.

DescribeStateMachine (updated) Link ¶
Changes (response)
{'loggingConfiguration': {'destinations': [{'cloudWatchLogsLogGroup': {'logGroupArn': 'string'}}],
                          'includeExecutionData': 'boolean',
                          'level': 'ALL | ERROR | FATAL | OFF'},
 'type': 'STANDARD | EXPRESS'}

Describes a state machine.

Note

This operation is eventually consistent. The results are best effort and may not reflect very recent updates and changes.

See also: AWS API Documentation

Request Syntax

client.describe_state_machine(
    stateMachineArn='string'
)
type stateMachineArn

string

param stateMachineArn

[REQUIRED]

The Amazon Resource Name (ARN) of the state machine to describe.

rtype

dict

returns

Response Syntax

{
    'stateMachineArn': 'string',
    'name': 'string',
    'status': 'ACTIVE'|'DELETING',
    'definition': 'string',
    'roleArn': 'string',
    'type': 'STANDARD'|'EXPRESS',
    'creationDate': datetime(2015, 1, 1),
    'loggingConfiguration': {
        'level': 'ALL'|'ERROR'|'FATAL'|'OFF',
        'includeExecutionData': True|False,
        'destinations': [
            {
                'cloudWatchLogsLogGroup': {
                    'logGroupArn': 'string'
                }
            },
        ]
    }
}

Response Structure

  • (dict) --

    • stateMachineArn (string) --

      The Amazon Resource Name (ARN) that identifies the state machine.

    • name (string) --

      The name of the state machine.

      A name must not contain:

      • white space

      • brackets < > { } [ ]

      • wildcard characters ? *

      • special characters " # % \ ^ | ~ ` $ & , ; : /

      • control characters ( U+0000-001F , U+007F-009F )

    • status (string) --

      The current status of the state machine.

    • definition (string) --

      The Amazon States Language definition of the state machine. See Amazon States Language.

    • roleArn (string) --

      The Amazon Resource Name (ARN) of the IAM role used when creating this state machine. (The IAM role maintains security by granting Step Functions access to AWS resources.)

    • type (string) --

    • creationDate (datetime) --

      The date the state machine is created.

    • loggingConfiguration (dict) --

      • level (string) --

        Defines which category of execution history events are logged.

      • includeExecutionData (boolean) --

        Determines whether execution history data is included in your log. When set to FALSE , data is excluded.

      • destinations (list) --

        An object that describes where your execution history events will be logged. Limited to size 1. Required, if your log level is not set to OFF .

        • (dict) --

          • cloudWatchLogsLogGroup (dict) --

            An object describing a CloudWatch log group. For more information, see AWS::Logs::LogGroup in the AWS CloudFormation User Guide.

            • logGroupArn (string) --

              The ARN of the the CloudWatch log group to which you want your logs emitted to. The ARN must end with :*

ListStateMachines (updated) Link ¶
Changes (response)
{'stateMachines': {'type': 'STANDARD | EXPRESS'}}

Lists the existing state machines.

If nextToken is returned, there are more results available. The value of nextToken is a unique pagination token for each page. Make the call again using the returned token to retrieve the next page. Keep all other arguments unchanged. Each pagination token expires after 24 hours. Using an expired pagination token will return an HTTP 400 InvalidToken error.

Note

This operation is eventually consistent. The results are best effort and may not reflect very recent updates and changes.

See also: AWS API Documentation

Request Syntax

client.list_state_machines(
    maxResults=123,
    nextToken='string'
)
type maxResults

integer

param maxResults

The maximum number of results that are returned per call. You can use nextToken to obtain further pages of results. The default is 100 and the maximum allowed page size is 1000. A value of 0 uses the default.

This is only an upper limit. The actual number of results returned per call might be fewer than the specified maximum.

type nextToken

string

param nextToken

If nextToken is returned, there are more results available. The value of nextToken is a unique pagination token for each page. Make the call again using the returned token to retrieve the next page. Keep all other arguments unchanged. Each pagination token expires after 24 hours. Using an expired pagination token will return an HTTP 400 InvalidToken error.

rtype

dict

returns

Response Syntax

{
    'stateMachines': [
        {
            'stateMachineArn': 'string',
            'name': 'string',
            'type': 'STANDARD'|'EXPRESS',
            'creationDate': datetime(2015, 1, 1)
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • stateMachines (list) --

      • (dict) --

        Contains details about the state machine.

        • stateMachineArn (string) --

          The Amazon Resource Name (ARN) that identifies the state machine.

        • name (string) --

          The name of the state machine.

          A name must not contain:

          • white space

          • brackets < > { } [ ]

          • wildcard characters ? *

          • special characters " # % \ ^ | ~ ` $ & , ; : /

          • control characters ( U+0000-001F , U+007F-009F )

        • type (string) --

        • creationDate (datetime) --

          The date the state machine is created.

    • nextToken (string) --

      If nextToken is returned, there are more results available. The value of nextToken is a unique pagination token for each page. Make the call again using the returned token to retrieve the next page. Keep all other arguments unchanged. Each pagination token expires after 24 hours. Using an expired pagination token will return an HTTP 400 InvalidToken error.

UpdateStateMachine (updated) Link ¶
Changes (request)
{'loggingConfiguration': {'destinations': [{'cloudWatchLogsLogGroup': {'logGroupArn': 'string'}}],
                          'includeExecutionData': 'boolean',
                          'level': 'ALL | ERROR | FATAL | OFF'}}

Updates an existing state machine by modifying its definition and/or roleArn . Running executions will continue to use the previous definition and roleArn . You must include at least one of definition or roleArn or you will receive a MissingRequiredParameter error.

Note

All StartExecution calls within a few seconds will use the updated definition and roleArn . Executions started immediately after calling UpdateStateMachine may use the previous state machine definition and roleArn .

See also: AWS API Documentation

Request Syntax

client.update_state_machine(
    stateMachineArn='string',
    definition='string',
    roleArn='string',
    loggingConfiguration={
        'level': 'ALL'|'ERROR'|'FATAL'|'OFF',
        'includeExecutionData': True|False,
        'destinations': [
            {
                'cloudWatchLogsLogGroup': {
                    'logGroupArn': 'string'
                }
            },
        ]
    }
)
type stateMachineArn

string

param stateMachineArn

[REQUIRED]

The Amazon Resource Name (ARN) of the state machine.

type definition

string

param definition

The Amazon States Language definition of the state machine. See Amazon States Language.

type roleArn

string

param roleArn

The Amazon Resource Name (ARN) of the IAM role of the state machine.

type loggingConfiguration

dict

param loggingConfiguration
  • level (string) --

    Defines which category of execution history events are logged.

  • includeExecutionData (boolean) --

    Determines whether execution history data is included in your log. When set to FALSE , data is excluded.

  • destinations (list) --

    An object that describes where your execution history events will be logged. Limited to size 1. Required, if your log level is not set to OFF .

    • (dict) --

      • cloudWatchLogsLogGroup (dict) --

        An object describing a CloudWatch log group. For more information, see AWS::Logs::LogGroup in the AWS CloudFormation User Guide.

        • logGroupArn (string) --

          The ARN of the the CloudWatch log group to which you want your logs emitted to. The ARN must end with :*

rtype

dict

returns

Response Syntax

{
    'updateDate': datetime(2015, 1, 1)
}

Response Structure

  • (dict) --

    • updateDate (datetime) --

      The date and time the state machine was updated.