获取所有状态机的名称和ARN

时间:2017-12-21 03:06:40

标签: java amazon-web-services aws-step-functions

我想围绕我们目前拥有的步骤功能创建一些指标。我能够使用python制作该列表但由于某种原因,我们仅限于在我们公司使用java。

我想

列出在给定帐户的当前区域中定义的所有状态机。在python我能够使用

实现这一目标
stepFunction = boto3.client('stepfunctions', region_name='eu-west-1')
stepFunction.list_state_machines()

然后,我想列出给定状态机的所有Tasks并获得一些指标。

在Java中,我无法找到能够为我提供所有状态机的API参考。我正在查看http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/index.html?com/amazonaws/services/stepfunctions/model/ListStateMachinesRequest.html API,但没有任何帮助。

1 个答案:

答案 0 :(得分:0)

要获取库中每个状态机的活动任务,您需要使用describeStateMachine调用。遵循这种模式(请原谅伪代码):

state_machines = list_state_machines()
for each (state machine arn : state_machines) 
  sm = describe_statemachine(state_machine_arn)
  /*parse through the definition here and use regex pattern on the arns*/
  activityarns = sm.getDefinition().find(/regex/)

  metrics.add(sm.arn, activityarns)
endforeach

希望这有帮助!

相关问题