AWSSDK を使用して Step Functions ステートマシンを記述する - AWSSDK コードサンプル

AWSDocAWS SDKGitHub サンプルリポジトリには、さらに多くの SDK サンプルがあります

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

AWSSDK を使用して Step Functions ステートマシンを記述する

次のコード例は、Step Functions ステートマシンを記述する方法を示しています。

.NET
AWS SDK for .NET
注記

他にもありますGitHub。用例一覧を検索し、AWS コード例リポジトリでの設定と実行の方法を確認してください。

/// <summary> /// Retrieve information about the specified Step Functions state machine. /// </summary> /// <param name="StateMachineArn">The Amazon Resource Name (ARN) of the /// Step Functions state machine to retrieve.</param> /// <returns>Information about the specified Step Functions state machine.</returns> public async Task<DescribeStateMachineResponse> DescribeStateMachineAsync(string StateMachineArn) { var response = await _amazonStepFunctions.DescribeStateMachineAsync(new DescribeStateMachineRequest { StateMachineArn = StateMachineArn }); return response; }
  • API の詳細については、AWS SDK for .NETAPI DescribeStateMachineリファレンスのを参照してください

Java
SDK for Java 2.x
注記

他にもありますGitHub。用例一覧を検索し、AWS コード例リポジトリでの設定と実行の方法を確認してください。

public static void describeStateMachine(SfnClient sfnClient, String stateMachineArn) { try { DescribeStateMachineRequest stateMachineRequest = DescribeStateMachineRequest.builder() .stateMachineArn(stateMachineArn) .build(); DescribeStateMachineResponse response = sfnClient.describeStateMachine(stateMachineRequest); System.out.println("The name of the State machine is "+ response.name()); System.out.println("The status of the State machine is "+ response.status()); System.out.println("The ARN value of the State machine is "+ response.stateMachineArn()); System.out.println("The role ARN value is "+ response.roleArn()); } catch (SfnException e) { System.err.println(e.getMessage()); } }
  • API の詳細については、AWS SDK for Java 2.xAPI DescribeStateMachineリファレンスのを参照してください

Kotlin
SDK for Kotlin
注記

これはプレビューリリースの機能に関するプレリリースドキュメントです。このドキュメントは変更される可能性があります。

注記

他にもありますGitHub。用例一覧を検索し、AWS コード例リポジトリでの設定と実行の方法を確認してください。

suspend fun describeStateMachine(stateMachineArnVal: String?) { val stateMachineRequest = DescribeStateMachineRequest { stateMachineArn = stateMachineArnVal } SfnClient { region = "us-east-1" }.use { sfnClient -> val response = sfnClient.describeStateMachine(stateMachineRequest) println("The name of the State machine is ${response.name}") println("The status of the State machine is ${response.status}") println("The ARN value of the State machine is ${response.stateMachineArn}") println("The role ARN value is ${response.roleArn}") } }
  • API の詳細については、「AWSSDK for Kotlin API リファレンス」の「API リファレンス」を参照してくださいDescribeStateMachine

Python
SDK for Python (Boto3)
注記

他にもありますGitHub。用例一覧を検索し、AWS コード例リポジトリでの設定と実行の方法を確認してください。

class StateMachine: """Encapsulates Step Functions state machine actions.""" def __init__(self, stepfunctions_client): """ :param stepfunctions_client: A Boto3 Step Functions client. """ self.stepfunctions_client = stepfunctions_client def describe(self, state_machine_arn): """ Get data about a state machine. :param state_machine_arn: The ARN of the state machine to look up. :return: The retrieved state machine data. """ try: response = self.stepfunctions_client.describe_state_machine( stateMachineArn=state_machine_arn) except ClientError as err: logger.error( "Couldn't describe state machine %s. Here's why: %s: %s", state_machine_arn, err.response['Error']['Code'], err.response['Error']['Message']) raise else: return response
  • API の詳細については、「AWSSDK for Python (Boto3) API リファレンス」を参照してくださいDescribeStateMachine