serverless-step-functions
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -10,2 +10,3 @@ 'use strict'; | ||
this.functionArns = {}; | ||
const region = this.options.region || 'us-east-1'; | ||
@@ -26,2 +27,19 @@ this.iamPolicyStatement = `{ | ||
this.assumeRolePolicyDocument = `{ | ||
"Version": "2012-10-17", | ||
"Statement": [ | ||
{ | ||
"Effect": "Allow", | ||
"Principal": { | ||
"Service": "states.${region}.amazonaws.com" | ||
}, | ||
"Action": "sts:AssumeRole" | ||
} | ||
] | ||
} | ||
`; | ||
this.iamRoleName = `serverless-step-functions-executerole-${region}`; | ||
this.iamPolicyName = `serverless-step-functions-executepolicy-${region}`; | ||
this.serverless.cli.log(`Start to deploy ${this.options.state} step function...`); | ||
@@ -44,3 +62,3 @@ BbPromise.bind(this) | ||
{ | ||
RoleName: 'StatesExecutionRole-us-east-1', | ||
RoleName: this.iamRoleName, | ||
}, | ||
@@ -80,3 +98,3 @@ this.options.stage, | ||
{ | ||
AssumeRolePolicyDocument: this.iamPolicyStatement, | ||
AssumeRolePolicyDocument: this.assumeRolePolicyDocument, | ||
RoleName: this.iamRoleName, | ||
@@ -88,4 +106,22 @@ }, | ||
this.iamRoleArn = result.Role.Arn; | ||
return BbPromise.resolve(); | ||
}); | ||
return this.provider.request('IAM', | ||
'createPolicy', | ||
{ | ||
PolicyDocument: this.iamPolicyStatement, | ||
PolicyName: this.iamPolicyName, | ||
}, | ||
this.options.stage, | ||
this.options.region) | ||
}) | ||
.then((result) => { | ||
return this.provider.request('IAM', | ||
'attachRolePolicy', | ||
{ | ||
PolicyArn: result.Policy.Arn, | ||
RoleName: this.iamRoleName, | ||
}, | ||
this.options.stage, | ||
this.options.region) | ||
}) | ||
.then(() => BbPromise.resolve()); | ||
}, | ||
@@ -92,0 +128,0 @@ |
{ | ||
"name": "serverless-step-functions", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "The module is AWS Step Functions plugin for Serverless Framework", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -37,4 +37,7 @@ [![serverless](http://public.serverless.com/badges/v3.svg)](http://www.serverless.com) [![Build Status](https://travis-ci.org/horike37/serverless-step-functions.svg?branch=master)](https://travis-ci.org/horike37/serverless-step-functions) | ||
## Usage | ||
## Command | ||
### deploy | ||
- --state or -t The name of the step function in your service that you want to deploy. Required. | ||
- --stage or -s The stage in your service you want to deploy your step function. | ||
- --region or -r The region in your stage that you want to deploy your step function. | ||
``` | ||
@@ -45,2 +48,6 @@ $ sls deploy stepf --state <stepfunctionname> | ||
### invoke | ||
- --state or -t The name of the step function in your service that you want to invoke. Required. | ||
- --stage or -s The stage in your service you want to invoke your step function. | ||
- --region or -r The region in your stage that you want to invoke your step function. | ||
- --data or -d String data to be passed as an event to your step function. | ||
``` | ||
@@ -51,4 +58,7 @@ $ sls invoke stepf --state <stepfunctionname> --data '{"foo":"bar"}' | ||
### remove | ||
- --state or -t The name of the step function in your service that you want to remove. Required. | ||
- --stage or -s The stage in your service you want to invoke your step remove. | ||
- --region or -r The region in your stage that you want to invoke your step remove. | ||
``` | ||
$ sls remove stepf --state <stepfunctionname> | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13461
358
62