@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
246 lines • 9.49 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.StateMachine = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides a Step Function State Machine resource
*
* ## Example Usage
*
* ### Basic (Standard Workflow)
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* // ...
* const sfnStateMachine = new aws.sfn.StateMachine("sfn_state_machine", {
* name: "my-state-machine",
* roleArn: iamForSfn.arn,
* definition: `{
* "Comment": "A Hello World example of the Amazon States Language using an AWS Lambda Function",
* "StartAt": "HelloWorld",
* "States": {
* "HelloWorld": {
* "Type": "Task",
* "Resource": "${lambda.arn}",
* "End": true
* }
* }
* }
* `,
* });
* ```
*
* ### Basic (Express Workflow)
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* // ...
* const sfnStateMachine = new aws.sfn.StateMachine("sfn_state_machine", {
* name: "my-state-machine",
* roleArn: iamForSfn.arn,
* type: "EXPRESS",
* definition: `{
* "Comment": "A Hello World example of the Amazon States Language using an AWS Lambda Function",
* "StartAt": "HelloWorld",
* "States": {
* "HelloWorld": {
* "Type": "Task",
* "Resource": "${lambda.arn}",
* "End": true
* }
* }
* }
* `,
* });
* ```
*
* ### Publish (Publish SFN version)
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* // ...
* const sfnStateMachine = new aws.sfn.StateMachine("sfn_state_machine", {
* name: "my-state-machine",
* roleArn: iamForSfn.arn,
* publish: true,
* type: "EXPRESS",
* definition: `{
* "Comment": "A Hello World example of the Amazon States Language using an AWS Lambda Function",
* "StartAt": "HelloWorld",
* "States": {
* "HelloWorld": {
* "Type": "Task",
* "Resource": "${lambda.arn}",
* "End": true
* }
* }
* }
* `,
* });
* ```
*
* ### Logging
*
* > *NOTE:* See the [AWS Step Functions Developer Guide](https://docs.aws.amazon.com/step-functions/latest/dg/welcome.html) for more information about enabling Step Function logging.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* // ...
* const sfnStateMachine = new aws.sfn.StateMachine("sfn_state_machine", {
* name: "my-state-machine",
* roleArn: iamForSfn.arn,
* definition: `{
* "Comment": "A Hello World example of the Amazon States Language using an AWS Lambda Function",
* "StartAt": "HelloWorld",
* "States": {
* "HelloWorld": {
* "Type": "Task",
* "Resource": "${lambda.arn}",
* "End": true
* }
* }
* }
* `,
* loggingConfiguration: {
* logDestination: `${logGroupForSfn.arn}:*`,
* includeExecutionData: true,
* level: "ERROR",
* },
* });
* ```
*
* ### Encryption
*
* > *NOTE:* See the section [Data at rest encyption](https://docs.aws.amazon.com/step-functions/latest/dg/encryption-at-rest.html) in the [AWS Step Functions Developer Guide](https://docs.aws.amazon.com/step-functions/latest/dg/welcome.html) for more information about enabling encryption of data using a customer-managed key for Step Functions State Machines data.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* // ...
* const sfnStateMachine = new aws.sfn.StateMachine("sfn_state_machine", {
* name: "my-state-machine",
* roleArn: iamForSfn.arn,
* definition: `{
* "Comment": "A Hello World example of the Amazon States Language using an AWS Lambda Function",
* "StartAt": "HelloWorld",
* "States": {
* "HelloWorld": {
* "Type": "Task",
* "Resource": "${lambda.arn}",
* "End": true
* }
* }
* }
* `,
* encryptionConfiguration: {
* kmsKeyId: kmsKeyForSfn.arn,
* type: "CUSTOMER_MANAGED_KMS_KEY",
* kmsDataKeyReusePeriodSeconds: 900,
* },
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import State Machines using the `arn`. For example:
*
* ```sh
* $ pulumi import aws:sfn/stateMachine:StateMachine foo arn:aws:states:eu-west-1:123456789098:stateMachine:bar
* ```
*/
class StateMachine extends pulumi.CustomResource {
/**
* Get an existing StateMachine resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name, id, state, opts) {
return new StateMachine(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of StateMachine. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === StateMachine.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["arn"] = state ? state.arn : undefined;
resourceInputs["creationDate"] = state ? state.creationDate : undefined;
resourceInputs["definition"] = state ? state.definition : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["encryptionConfiguration"] = state ? state.encryptionConfiguration : undefined;
resourceInputs["loggingConfiguration"] = state ? state.loggingConfiguration : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["namePrefix"] = state ? state.namePrefix : undefined;
resourceInputs["publish"] = state ? state.publish : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["revisionId"] = state ? state.revisionId : undefined;
resourceInputs["roleArn"] = state ? state.roleArn : undefined;
resourceInputs["stateMachineVersionArn"] = state ? state.stateMachineVersionArn : undefined;
resourceInputs["status"] = state ? state.status : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["tagsAll"] = state ? state.tagsAll : undefined;
resourceInputs["tracingConfiguration"] = state ? state.tracingConfiguration : undefined;
resourceInputs["type"] = state ? state.type : undefined;
resourceInputs["versionDescription"] = state ? state.versionDescription : undefined;
}
else {
const args = argsOrState;
if ((!args || args.definition === undefined) && !opts.urn) {
throw new Error("Missing required property 'definition'");
}
if ((!args || args.roleArn === undefined) && !opts.urn) {
throw new Error("Missing required property 'roleArn'");
}
resourceInputs["definition"] = args ? args.definition : undefined;
resourceInputs["encryptionConfiguration"] = args ? args.encryptionConfiguration : undefined;
resourceInputs["loggingConfiguration"] = args ? args.loggingConfiguration : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["namePrefix"] = args ? args.namePrefix : undefined;
resourceInputs["publish"] = args ? args.publish : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["roleArn"] = args ? args.roleArn : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["tracingConfiguration"] = args ? args.tracingConfiguration : undefined;
resourceInputs["type"] = args ? args.type : undefined;
resourceInputs["arn"] = undefined /*out*/;
resourceInputs["creationDate"] = undefined /*out*/;
resourceInputs["description"] = undefined /*out*/;
resourceInputs["revisionId"] = undefined /*out*/;
resourceInputs["stateMachineVersionArn"] = undefined /*out*/;
resourceInputs["status"] = undefined /*out*/;
resourceInputs["tagsAll"] = undefined /*out*/;
resourceInputs["versionDescription"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(StateMachine.__pulumiType, name, resourceInputs, opts);
}
}
exports.StateMachine = StateMachine;
/** @internal */
StateMachine.__pulumiType = 'aws:sfn/stateMachine:StateMachine';
//# sourceMappingURL=stateMachine.js.map