diff --git a/docs/README.md b/docs/README.md
index 99dd565dd..37917e9e6 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -79,7 +79,7 @@ The Serverless Framework allows you to deploy auto-scaling, pay-per-execution, e
S3
Schedule
SNS
- Alexa
+ Alexa Skill
diff --git a/docs/providers/aws/events/alexa.md b/docs/providers/aws/events/alexa-skill.md
similarity index 54%
rename from docs/providers/aws/events/alexa.md
rename to docs/providers/aws/events/alexa-skill.md
index 0dcecba24..a856510e3 100644
--- a/docs/providers/aws/events/alexa.md
+++ b/docs/providers/aws/events/alexa-skill.md
@@ -1,25 +1,25 @@
-### [Read this on the main serverless docs site](https://www.serverless.com/framework/docs/providers/aws/events/alexa)
+### [Read this on the main serverless docs site](https://www.serverless.com/framework/docs/providers/aws/events/alexa-skill)
-# Alexa
+# Alexa Skill
## Event definition
This will enable your Lambda function to be called by an Alexa skill kit.
-```yaml
+```yml
functions:
mySkill:
handler: mySkill.handler
events:
- - alexa: true
+ - alexaSkill: true
```
diff --git a/docs/providers/aws/guide/resources.md b/docs/providers/aws/guide/resources.md
index b84aed570..49a9d0a66 100644
--- a/docs/providers/aws/guide/resources.md
+++ b/docs/providers/aws/guide/resources.md
@@ -71,7 +71,7 @@ We're also using the term `normalizedName` or similar terms in this guide. This
|Lambda::Function | {normalizedFunctionName}LambdaFunction | HelloLambdaFunction |
|Lambda::Version | {normalizedFunctionName}LambdaVersion{sha256} | HelloLambdaVersionr3pgoTvv1xT4E4NiCL6JG02fl6vIyi7OS1aW0FwAI |
|Logs::LogGroup | {normalizedFunctionName}LogGroup | HelloLogGroup |
-|Lambda::Permission | - **Schedule**: {normalizedFunctionName}LambdaPermissionEventsRuleSchedule{index}
- **S3**: {normalizedFunctionName}LambdaPermission{normalizedBucketName}S3
- **APIG**: {normalizedFunctionName}LambdaPermissionApiGateway
- **SNS**: {normalizedFunctionName}LambdaPermission{normalizedTopicName}SNS
- **Alexa**: {normalizedFunctionName}LambdaPermissionAlexa
| - **Schedule**: HelloLambdaPermissionEventsRuleSchedule1
- **S3**: HelloLambdaPermissionBucketS3
- **APIG**: HelloLambdaPermissionApiGateway
- **SNS**: HelloLambdaPermissionTopicSNS
- **Alexa**: HelloLambdaPermissionAlexa
|
+|Lambda::Permission | - **Schedule**: {normalizedFunctionName}LambdaPermissionEventsRuleSchedule{index}
- **S3**: {normalizedFunctionName}LambdaPermission{normalizedBucketName}S3
- **APIG**: {normalizedFunctionName}LambdaPermissionApiGateway
- **SNS**: {normalizedFunctionName}LambdaPermission{normalizedTopicName}SNS
- **Alexa Skill**: {normalizedFunctionName}LambdaPermissionAlexaSkill
| - **Schedule**: HelloLambdaPermissionEventsRuleSchedule1
- **S3**: HelloLambdaPermissionBucketS3
- **APIG**: HelloLambdaPermissionApiGateway
- **SNS**: HelloLambdaPermissionTopicSNS
- **Alexa Skill**: HelloLambdaPermissionAlexaSkill
|
|Events::Rule | {normalizedFuntionName}EventsRuleSchedule{SequentialID} | HelloEventsRuleSchedule1 |
|ApiGateway::RestApi | ApiGatewayRestApi | ApiGatewayRestApi |
|ApiGateway::Resource | ApiGatewayResource{normalizedPath} | ApiGatewayResourceUsers |
diff --git a/lib/plugins/Plugins.json b/lib/plugins/Plugins.json
index 8d373d54a..46d186f87 100644
--- a/lib/plugins/Plugins.json
+++ b/lib/plugins/Plugins.json
@@ -27,7 +27,7 @@
"./aws/deploy/compile/events/apiGateway/index.js",
"./aws/deploy/compile/events/sns/index.js",
"./aws/deploy/compile/events/stream/index.js",
- "./aws/deploy/compile/events/alexa/index.js",
+ "./aws/deploy/compile/events/alexaSkill/index.js",
"./aws/deployFunction/index.js",
"./aws/deployList/index.js",
"./aws/invokeLocal/index.js"
diff --git a/lib/plugins/aws/deploy/compile/events/alexa/index.test.js b/lib/plugins/aws/deploy/compile/events/alexa/index.test.js
deleted file mode 100644
index 9b22770fd..000000000
--- a/lib/plugins/aws/deploy/compile/events/alexa/index.test.js
+++ /dev/null
@@ -1,105 +0,0 @@
-'use strict';
-
-const expect = require('chai').expect;
-const AwsProvider = require('../../../../provider/awsProvider');
-const AwsCompileAlexaEvents = require('./index');
-const Serverless = require('../../../../../../Serverless');
-
-describe('AwsCompileAlexaEvents', () => {
- let serverless;
- let awsCompileAlexaEvents;
-
- beforeEach(() => {
- serverless = new Serverless();
- serverless.service.provider.compiledCloudFormationTemplate = { Resources: {} };
- serverless.setProvider('aws', new AwsProvider(serverless));
- awsCompileAlexaEvents = new AwsCompileAlexaEvents(serverless);
- });
-
- describe('#constructor()', () => {
- it('should set the provider variable to an instance of AwsProvider', () =>
- expect(awsCompileAlexaEvents.provider).to.be.instanceof(AwsProvider));
-
- it('should should hook into the "deploy:compileEvents" hook', () =>
- expect(awsCompileAlexaEvents.hooks['deploy:compileEvents']).to.not.equal(undefined));
- });
-
- describe('#compileAlexaEvents()', () => {
- it('should throw an error if alexa event type is not a boolean', () => {
- awsCompileAlexaEvents.serverless.service.functions = {
- first: {
- events: [
- {
- alexa: 42,
- },
- ],
- },
- };
-
- expect(() => awsCompileAlexaEvents.compileAlexaEvents()).to.throw(Error);
- });
-
- it('should create corresponding resources when event is given with value "true"', () => {
- awsCompileAlexaEvents.serverless.service.functions = {
- first: {
- events: [
- {
- alexa: true,
- },
- ],
- },
- };
-
- awsCompileAlexaEvents.compileAlexaEvents();
-
- expect(awsCompileAlexaEvents.serverless.service
- .provider.compiledCloudFormationTemplate.Resources
- .FirstLambdaPermissionAlexa.Type
- ).to.equal('AWS::Lambda::Permission');
- expect(awsCompileAlexaEvents.serverless.service
- .provider.compiledCloudFormationTemplate.Resources
- .FirstLambdaPermissionAlexa.Properties.FunctionName
- ).to.deep.equal({ 'Fn::GetAtt': ['FirstLambdaFunction', 'Arn'] });
- expect(awsCompileAlexaEvents.serverless.service
- .provider.compiledCloudFormationTemplate.Resources
- .FirstLambdaPermissionAlexa.Properties.Action
- ).to.equal('lambda:InvokeFunction');
- expect(awsCompileAlexaEvents.serverless.service
- .provider.compiledCloudFormationTemplate.Resources
- .FirstLambdaPermissionAlexa.Properties.Principal
- ).to.equal('alexa-appkit.amazon.com');
- });
-
- it('should not create corresponding resources when event is given with value "false"', () => {
- awsCompileAlexaEvents.serverless.service.functions = {
- first: {
- events: [
- {
- alexa: false,
- },
- ],
- },
- };
-
- awsCompileAlexaEvents.compileAlexaEvents();
-
- expect(
- awsCompileAlexaEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources
- ).to.deep.equal({});
- });
-
- it('should not create corresponding resources when alexa event is not given', () => {
- awsCompileAlexaEvents.serverless.service.functions = {
- first: {
- events: [],
- },
- };
-
- awsCompileAlexaEvents.compileAlexaEvents();
-
- expect(
- awsCompileAlexaEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources
- ).to.deep.equal({});
- });
- });
-});
diff --git a/lib/plugins/aws/deploy/compile/events/alexa/index.js b/lib/plugins/aws/deploy/compile/events/alexaSkill/index.js
similarity index 76%
rename from lib/plugins/aws/deploy/compile/events/alexa/index.js
rename to lib/plugins/aws/deploy/compile/events/alexaSkill/index.js
index 7915b93cf..a3fcfa13f 100644
--- a/lib/plugins/aws/deploy/compile/events/alexa/index.js
+++ b/lib/plugins/aws/deploy/compile/events/alexaSkill/index.js
@@ -2,24 +2,24 @@
const _ = require('lodash');
-class AwsCompileAlexaEvents {
+class AwsCompileAlexaSkillEvents {
constructor(serverless) {
this.serverless = serverless;
this.provider = this.serverless.getProvider('aws');
this.hooks = {
- 'deploy:compileEvents': this.compileAlexaEvents.bind(this),
+ 'deploy:compileEvents': this.compileAlexaSkillEvents.bind(this),
};
}
- compileAlexaEvents() {
+ compileAlexaSkillEvents() {
this.serverless.service.getAllFunctions().forEach((functionName) => {
const functionObj = this.serverless.service.getFunction(functionName);
if (functionObj.events) {
functionObj.events.forEach(event => {
- if (event.alexa) {
- if (typeof event.alexa === 'boolean' && event.alexa) {
+ if (event.alexaSkill) {
+ if (typeof event.alexaSkill === 'boolean' && event.alexaSkill) {
const lambdaLogicalId = this.provider.naming
.getLambdaLogicalId(functionName);
@@ -38,7 +38,7 @@ class AwsCompileAlexaEvents {
};
const lambdaPermissionLogicalId = this.provider.naming
- .getLambdaAlexaPermissionLogicalId(functionName);
+ .getLambdaAlexaSkillPermissionLogicalId(functionName);
const permissionCloudForamtionResource = {
[lambdaPermissionLogicalId]: permissionTemplate,
@@ -48,8 +48,8 @@ class AwsCompileAlexaEvents {
permissionCloudForamtionResource);
} else {
const errorMessage = [
- `Alexa event of function "${functionName}" is not a boolean.`,
- ' The correct syntax is: alexa: true.',
+ `Alexa Skill event of function "${functionName}" is not a boolean.`,
+ ' The correct syntax is: alexaSkill: true.',
' Please check the docs for more info.',
].join('');
throw new this.serverless.classes.Error(errorMessage);
@@ -61,4 +61,4 @@ class AwsCompileAlexaEvents {
}
}
-module.exports = AwsCompileAlexaEvents;
+module.exports = AwsCompileAlexaSkillEvents;
diff --git a/lib/plugins/aws/deploy/compile/events/alexaSkill/index.test.js b/lib/plugins/aws/deploy/compile/events/alexaSkill/index.test.js
new file mode 100644
index 000000000..d25ffe630
--- /dev/null
+++ b/lib/plugins/aws/deploy/compile/events/alexaSkill/index.test.js
@@ -0,0 +1,107 @@
+'use strict';
+
+const expect = require('chai').expect;
+const AwsProvider = require('../../../../provider/awsProvider');
+const AwsCompileAlexaSkillEvents = require('./index');
+const Serverless = require('../../../../../../Serverless');
+
+describe('AwsCompileAlexaSkillEvents', () => {
+ let serverless;
+ let awsCompileAlexaSkillEvents;
+
+ beforeEach(() => {
+ serverless = new Serverless();
+ serverless.service.provider.compiledCloudFormationTemplate = { Resources: {} };
+ serverless.setProvider('aws', new AwsProvider(serverless));
+ awsCompileAlexaSkillEvents = new AwsCompileAlexaSkillEvents(serverless);
+ });
+
+ describe('#constructor()', () => {
+ it('should set the provider variable to an instance of AwsProvider', () =>
+ expect(awsCompileAlexaSkillEvents.provider).to.be.instanceof(AwsProvider));
+
+ it('should should hook into the "deploy:compileEvents" hook', () =>
+ expect(awsCompileAlexaSkillEvents.hooks['deploy:compileEvents']).to.not.equal(undefined));
+ });
+
+ describe('#compileAlexaSkillEvents()', () => {
+ it('should throw an error if alexaSkill event type is not a boolean', () => {
+ awsCompileAlexaSkillEvents.serverless.service.functions = {
+ first: {
+ events: [
+ {
+ alexaSkill: 42,
+ },
+ ],
+ },
+ };
+
+ expect(() => awsCompileAlexaSkillEvents.compileAlexaSkillEvents()).to.throw(Error);
+ });
+
+ it('should create corresponding resources when event is given with value "true"', () => {
+ awsCompileAlexaSkillEvents.serverless.service.functions = {
+ first: {
+ events: [
+ {
+ alexaSkill: true,
+ },
+ ],
+ },
+ };
+
+ awsCompileAlexaSkillEvents.compileAlexaSkillEvents();
+
+ expect(awsCompileAlexaSkillEvents.serverless.service
+ .provider.compiledCloudFormationTemplate.Resources
+ .FirstLambdaPermissionAlexaSkill.Type
+ ).to.equal('AWS::Lambda::Permission');
+ expect(awsCompileAlexaSkillEvents.serverless.service
+ .provider.compiledCloudFormationTemplate.Resources
+ .FirstLambdaPermissionAlexaSkill.Properties.FunctionName
+ ).to.deep.equal({ 'Fn::GetAtt': ['FirstLambdaFunction', 'Arn'] });
+ expect(awsCompileAlexaSkillEvents.serverless.service
+ .provider.compiledCloudFormationTemplate.Resources
+ .FirstLambdaPermissionAlexaSkill.Properties.Action
+ ).to.equal('lambda:InvokeFunction');
+ expect(awsCompileAlexaSkillEvents.serverless.service
+ .provider.compiledCloudFormationTemplate.Resources
+ .FirstLambdaPermissionAlexaSkill.Properties.Principal
+ ).to.equal('alexa-appkit.amazon.com');
+ });
+
+ it('should not create corresponding resources when event is given with value "false"', () => {
+ awsCompileAlexaSkillEvents.serverless.service.functions = {
+ first: {
+ events: [
+ {
+ alexaSkill: false,
+ },
+ ],
+ },
+ };
+
+ awsCompileAlexaSkillEvents.compileAlexaSkillEvents();
+
+ expect(
+ awsCompileAlexaSkillEvents.serverless.service.provider
+ .compiledCloudFormationTemplate.Resources
+ ).to.deep.equal({});
+ });
+
+ it('should not create corresponding resources when alexaSkill event is not given', () => {
+ awsCompileAlexaSkillEvents.serverless.service.functions = {
+ first: {
+ events: [],
+ },
+ };
+
+ awsCompileAlexaSkillEvents.compileAlexaSkillEvents();
+
+ expect(
+ awsCompileAlexaSkillEvents.serverless.service.provider
+ .compiledCloudFormationTemplate.Resources
+ ).to.deep.equal({});
+ });
+ });
+});
diff --git a/lib/plugins/aws/lib/naming.js b/lib/plugins/aws/lib/naming.js
index e8c060eca..6cc5d7a70 100644
--- a/lib/plugins/aws/lib/naming.js
+++ b/lib/plugins/aws/lib/naming.js
@@ -227,7 +227,7 @@ module.exports = {
getLambdaApiGatewayPermissionLogicalId(functionName) {
return `${this.getNormalizedFunctionName(functionName)}LambdaPermissionApiGateway`;
},
- getLambdaAlexaPermissionLogicalId(functionName) {
- return `${this.getNormalizedFunctionName(functionName)}LambdaPermissionAlexa`;
+ getLambdaAlexaSkillPermissionLogicalId(functionName) {
+ return `${this.getNormalizedFunctionName(functionName)}LambdaPermissionAlexaSkill`;
},
};
diff --git a/lib/plugins/aws/lib/naming.test.js b/lib/plugins/aws/lib/naming.test.js
index 32a72c8c5..eeb2bf668 100644
--- a/lib/plugins/aws/lib/naming.test.js
+++ b/lib/plugins/aws/lib/naming.test.js
@@ -430,11 +430,11 @@ describe('#naming()', () => {
});
});
- describe('#getLambdaAlexaPermissionLogicalId()', () => {
+ describe('#getLambdaAlexaSkillPermissionLogicalId()', () => {
it('should normalize the function name and append the standard suffix',
() => {
- expect(sdk.naming.getLambdaAlexaPermissionLogicalId('functionName'))
- .to.equal('FunctionNameLambdaPermissionAlexa');
+ expect(sdk.naming.getLambdaAlexaSkillPermissionLogicalId('functionName'))
+ .to.equal('FunctionNameLambdaPermissionAlexaSkill');
});
});
});
diff --git a/lib/plugins/create/templates/aws-java-gradle/serverless.yml b/lib/plugins/create/templates/aws-java-gradle/serverless.yml
index 8cff3fae0..086e4e896 100644
--- a/lib/plugins/create/templates/aws-java-gradle/serverless.yml
+++ b/lib/plugins/create/templates/aws-java-gradle/serverless.yml
@@ -63,7 +63,7 @@ functions:
# - schedule: rate(10 minutes)
# - sns: greeter-topic
# - stream: arn:aws:dynamodb:region:XXXXXX:table/foo/stream/1970-01-01T00:00:00.000
-# - alexa: true
+# - alexaSkill: true
# Define function environment variables here
# environment:
diff --git a/lib/plugins/create/templates/aws-java-maven/serverless.yml b/lib/plugins/create/templates/aws-java-maven/serverless.yml
index f49a7029e..29c96545e 100644
--- a/lib/plugins/create/templates/aws-java-maven/serverless.yml
+++ b/lib/plugins/create/templates/aws-java-maven/serverless.yml
@@ -63,7 +63,7 @@ functions:
# - schedule: rate(10 minutes)
# - sns: greeter-topic
# - stream: arn:aws:dynamodb:region:XXXXXX:table/foo/stream/1970-01-01T00:00:00.000
-# - alexa: true
+# - alexaSkill: true
# Define function environment variables here
# environment:
diff --git a/lib/plugins/create/templates/aws-nodejs/serverless.yml b/lib/plugins/create/templates/aws-nodejs/serverless.yml
index 2b66c22cf..98409689f 100644
--- a/lib/plugins/create/templates/aws-nodejs/serverless.yml
+++ b/lib/plugins/create/templates/aws-nodejs/serverless.yml
@@ -68,7 +68,7 @@ functions:
# - schedule: rate(10 minutes)
# - sns: greeter-topic
# - stream: arn:aws:dynamodb:region:XXXXXX:table/foo/stream/1970-01-01T00:00:00.000
-# - alexa: true
+# - alexaSkill: true
# Define function environment variables here
# environment:
diff --git a/lib/plugins/create/templates/aws-python/serverless.yml b/lib/plugins/create/templates/aws-python/serverless.yml
index 5d444c808..11b88ff93 100644
--- a/lib/plugins/create/templates/aws-python/serverless.yml
+++ b/lib/plugins/create/templates/aws-python/serverless.yml
@@ -68,7 +68,7 @@ functions:
# - schedule: rate(10 minutes)
# - sns: greeter-topic
# - stream: arn:aws:dynamodb:region:XXXXXX:table/foo/stream/1970-01-01T00:00:00.000
-# - alexa: true
+# - alexaSkill: true
# Define function environment variables here
# environment:
diff --git a/lib/plugins/create/templates/aws-scala-sbt/serverless.yml b/lib/plugins/create/templates/aws-scala-sbt/serverless.yml
index c0ca02788..6d7640905 100644
--- a/lib/plugins/create/templates/aws-scala-sbt/serverless.yml
+++ b/lib/plugins/create/templates/aws-scala-sbt/serverless.yml
@@ -63,7 +63,7 @@ functions:
# - schedule: rate(10 minutes)
# - sns: greeter-topic
# - stream: arn:aws:dynamodb:region:XXXXXX:table/foo/stream/1970-01-01T00:00:00.000
-# - alexa: true
+# - alexaSkill: true
# Define function environment variables here
# environment: