|
| 1 | +# Step Functions code examples for the SDK for Swift |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +Shows how to use the AWS SDK for Swift to work with AWS Step Functions. |
| 6 | + |
| 7 | +<!--custom.overview.start--> |
| 8 | +<!--custom.overview.end--> |
| 9 | + |
| 10 | +_Step Functions makes it easy to coordinate the components of distributed applications as a series of steps in a visual workflow._ |
| 11 | + |
| 12 | +## ⚠ Important |
| 13 | + |
| 14 | +* Running this code might result in charges to your AWS account. For more details, see [AWS Pricing](https://aws.amazon.com/pricing/) and [Free Tier](https://aws.amazon.com/free/). |
| 15 | +* Running the tests might result in charges to your AWS account. |
| 16 | +* We recommend that you grant your code least privilege. At most, grant only the minimum permissions required to perform the task. For more information, see [Grant least privilege](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#grant-least-privilege). |
| 17 | +* This code is not tested in every AWS Region. For more information, see [AWS Regional Services](https://aws.amazon.com/about-aws/global-infrastructure/regional-product-services). |
| 18 | + |
| 19 | +<!--custom.important.start--> |
| 20 | +<!--custom.important.end--> |
| 21 | + |
| 22 | +## Code examples |
| 23 | + |
| 24 | +### Prerequisites |
| 25 | + |
| 26 | +For prerequisites, see the [README](../../README.md#Prerequisites) in the `swift` folder. |
| 27 | + |
| 28 | + |
| 29 | +<!--custom.prerequisites.start--> |
| 30 | +<!--custom.prerequisites.end--> |
| 31 | + |
| 32 | +### Basics |
| 33 | + |
| 34 | +Code examples that show you how to perform the essential operations within a service. |
| 35 | + |
| 36 | +- [Learn the basics](scenario/Sources/entry.swift) |
| 37 | + |
| 38 | + |
| 39 | +### Single actions |
| 40 | + |
| 41 | +Code excerpts that show you how to call individual service functions. |
| 42 | + |
| 43 | +- [CreateActivity](scenario/Sources/Activity.swift#L42) |
| 44 | +- [CreateStateMachine](scenario/Sources/StateMachine.swift#L133) |
| 45 | +- [DeleteActivity](scenario/Sources/Activity.swift#L102) |
| 46 | +- [DeleteStateMachine](scenario/Sources/StateMachine.swift#L308) |
| 47 | +- [DescribeExecution](scenario/Sources/StateMachine.swift#L263) |
| 48 | +- [DescribeStateMachine](scenario/Sources/StateMachine.swift#L180) |
| 49 | +- [GetActivityTask](scenario/Sources/StateMachine.swift#L228) |
| 50 | +- [ListActivities](scenario/Sources/Activity.swift#L42) |
| 51 | +- [ListStateMachines](scenario/Sources/StateMachine.swift#L105) |
| 52 | +- [SendTaskSuccess](scenario/Sources/Activity.swift#L115) |
| 53 | +- [StartExecution](scenario/Sources/StateMachine.swift#L205) |
| 54 | + |
| 55 | + |
| 56 | +<!--custom.examples.start--> |
| 57 | +<!--custom.examples.end--> |
| 58 | + |
| 59 | +## Run the examples |
| 60 | + |
| 61 | +### Instructions |
| 62 | + |
| 63 | +To build any of these examples from a terminal window, navigate into its |
| 64 | +directory, then use the following command: |
| 65 | + |
| 66 | +``` |
| 67 | +$ swift build |
| 68 | +``` |
| 69 | + |
| 70 | +To build one of these examples in Xcode, navigate to the example's directory |
| 71 | +(such as the `ListUsers` directory, to build that example). Then type `xed.` |
| 72 | +to open the example directory in Xcode. You can then use standard Xcode build |
| 73 | +and run commands. |
| 74 | + |
| 75 | +<!--custom.instructions.start--> |
| 76 | +<!--custom.instructions.end--> |
| 77 | + |
| 78 | + |
| 79 | +#### Learn the basics |
| 80 | + |
| 81 | +This example shows you how to do the following: |
| 82 | + |
| 83 | +- Create an activity. |
| 84 | +- Create a state machine from an Amazon States Language definition that contains the previously created activity as a step. |
| 85 | +- Run the state machine and respond to the activity with user input. |
| 86 | +- Get the final status and output after the run completes, then clean up resources. |
| 87 | + |
| 88 | +<!--custom.basic_prereqs.sfn_Scenario_GetStartedStateMachines.start--> |
| 89 | +<!--custom.basic_prereqs.sfn_Scenario_GetStartedStateMachines.end--> |
| 90 | + |
| 91 | + |
| 92 | +<!--custom.basics.sfn_Scenario_GetStartedStateMachines.start--> |
| 93 | +<!--custom.basics.sfn_Scenario_GetStartedStateMachines.end--> |
| 94 | + |
| 95 | + |
| 96 | +### Tests |
| 97 | + |
| 98 | +⚠ Running tests might result in charges to your AWS account. |
| 99 | + |
| 100 | + |
| 101 | +To find instructions for running these tests, see the [README](../../README.md#Tests) |
| 102 | +in the `swift` folder. |
| 103 | + |
| 104 | + |
| 105 | + |
| 106 | +<!--custom.tests.start--> |
| 107 | +<!--custom.tests.end--> |
| 108 | + |
| 109 | +## Additional resources |
| 110 | + |
| 111 | +- [Step Functions Developer Guide](https://docs.aws.amazon.com/step-functions/latest/dg/welcome.html) |
| 112 | +- [Step Functions API Reference](https://docs.aws.amazon.com/step-functions/latest/apireference/Welcome.html) |
| 113 | +- [SDK for Swift Step Functions reference](https://sdk.amazonaws.com/swift/api/awssfn/latest/documentation/awssfn) |
| 114 | + |
| 115 | +<!--custom.resources.start--> |
| 116 | +<!--custom.resources.end--> |
| 117 | + |
| 118 | +--- |
| 119 | + |
| 120 | +Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 121 | + |
| 122 | +SPDX-License-Identifier: Apache-2.0 |
0 commit comments