- Notifications
You must be signed in to change notification settings - Fork 5.8k
Add AWS Step Functions Java V2 Examples #1615
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| System.exit(1); | ||
| } | ||
| | ||
| String jsonFile = args[0]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the most interesting part of this example is what exactly is in the JSON file. Instead of an argument, can it be created in the code? It can be as simple as the one in the Getting Started docs:
{ "Comment": "A Hello World example of the Amazon States Language using Pass states", "StartAt": "Hello", "States": { "Hello": { "Type": "Pass", "Result": "Hello", "Next": "World" }, "World": { "Type": "Pass", "Result": "World", "End": true } } }There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I referenced clearly where the user can get a JSON file for use with this example.
| } | ||
| | ||
| // snippet-start:[stepfunctions.java2.list_activities.main] | ||
| public static void getActivites(SfnClient sfnClient) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we change the method name to listActivities? GET and LIST operations have different expected behaviors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
| </dependency> | ||
| <dependency> | ||
| <groupId>software.amazon.awssdk</groupId> | ||
| <artifactId>transcribe</artifactId> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused dependency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
| | ||
| - **jsonFileSM** – A JSON file that represents the Amazon States Language definition of the state machine and used in the **CreateStateMachine** test. | ||
| | ||
| - **roleARN** – The Amazon Resource Name (ARN) of the IAM role to use for this state machine and used in the **CreateStateMachine** test. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IAM ->AWS Identity and Access Management (IAM)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
| " CreateStateMachine <jsonFile> <roleARN> <stateMachineName>\n\n" + | ||
| "Where:\n" + | ||
| " jsonFile - A JSON file that represents the Amazon States Language definition of the state machine.\n\n" + | ||
| " roleARN - The Amazon Resource Name (ARN) of the IAM role to use for this state machine.\n" + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IAM -> AWS Identity and Access Management (IAM)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
| @@ -0,0 +1,79 @@ | |||
| # AWS Step Functions Java code examples | |||
| | |||
| This README discusses how to run and test the Java code examples for AWS Step Functions. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AWS Step Functions -> Step Functions
(subsequent use)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep first occurrence AWS Step Functions
| | ||
| This README discusses how to run and test the Java code examples for AWS Step Functions. | ||
| | ||
| ## Running the AWS Step Functions Java files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AWS Step Functions -> Step Functions
(subsequent use)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
| see [Get started with the AWS SDK for Java 2.x](https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/get-started.html). | ||
| | ||
| | ||
| ## Testing the AWS Step Functions Java files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AWS Step Functions -> Step Functions
(subsequent use)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
| | ||
| ## Testing the AWS Step Functions Java files | ||
| | ||
| You can test the Java code examples for AWS Step Functions by running a test file named **StepFunctionsTest**. This file uses JUnit 5 to run the JUnit tests and is located in the **src/test/java** folder. For more information, see [https://junit.org/junit5/](https://junit.org/junit5/). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AWS Step Functions -> Step Functions
(subsequent use)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
| **WARNING**: _Running these JUnit tests manipulates real Amazon resources and may incur charges on your account._ | ||
| | ||
| ### Properties file | ||
| Before running the AWS Step Functions JUnit tests, you must define values in the **config.properties** file located in the **resources** folder. This file contains values that are required to run the JUnit tests. For example, you define an alarm name for various tests. If you do not define all values, the JUnit tests fail. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AWS Step Functions -> Step Functions
(subsequent use)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
| | ||
| DynamoDbTable<Work> workTable = enhancedClient.table("Work", TableSchema.fromBean(Work.class)); | ||
| | ||
| //Get the WOrk object |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//Get the WOrk -> // Get the work
- add period.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
| return; | ||
| } | ||
| | ||
| //load a properties file from class path, inside static method |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//load -> // Load
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
| public class StepFunctionsTest { | ||
| | ||
| private static SfnClient sfnClient; | ||
| private static String stateMachineArn = ""; // gets dynamically set in a test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// gets dynamically set in a test-> // Gets dynamically set in a test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
| .partitionValue(id) | ||
| .build(); | ||
| | ||
| // Get the item by using the key |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add period.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
| | ||
| private static SfnClient sfnClient; | ||
| private static String stateMachineArn = ""; // gets dynamically set in a test | ||
| private static String exeArn = ""; // gets dynamically set in a test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// gets dynamically set in a test-> // Gets dynamically set in a test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
| return ""; | ||
| } | ||
| | ||
| // Update the archive column by using the Enhanced Client |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- add period.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
Checklist:
The submitter has added unit tests for all code paths, run all of them, and they all pass.
The submitter has run a linter on the code, and all of the submitter's team's minimum rules pass.
The submitter has added the team's minimum usage documentation to the code.
The submitter has had the code reviewed, and the submitter has incorporated any and all resulting review comments.
The submitter has had their Editor edit all comments and strings, and the submitter has incorporated any and all resulting edits.
The submitter has added all of the submitter's team's related API reporting metadata - metadata.yaml.
The PR has been tested to ensure there are no TAG issues.