2023-02-22 04:14:45 -08:00
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
# snippet-start:[python.example_code.sfn.Hello]
import boto3
2023-10-18 10:35:05 -07:00
2023-02-22 04:14:45 -08:00
def hello_stepfunctions ( stepfunctions_client ) :
"""
Use the AWS SDK for Python (Boto3) to create an AWS Step Functions client and list
the state machines in your account. This list might be empty if you haven ' t created
any state machines.
This example uses the default settings specified in your shared credentials
and config files.
:param stepfunctions_client: A Boto3 Step Functions Client object.
"""
print ( " Hello, Step Functions! Let ' s list up to 10 of your state machines: " )
state_machines = stepfunctions_client . list_state_machines ( maxResults = 10 )
2023-10-18 10:35:05 -07:00
for sm in state_machines [ " stateMachines " ] :
2023-02-22 04:14:45 -08:00
print ( f " \t { sm [ ' name ' ] } : { sm [ ' stateMachineArn ' ] } " )
2023-10-18 10:35:05 -07:00
if __name__ == " __main__ " :
hello_stepfunctions ( boto3 . client ( " stepfunctions " ) )
2023-02-22 04:14:45 -08:00
# snippet-end:[python.example_code.sfn.Hello]