From 544383f0422dcf4cf272c6240292805097e35670 Mon Sep 17 00:00:00 2001 From: Michael Graybeal Date: Thu, 7 Feb 2019 18:47:40 -0700 Subject: [PATCH 1/2] made us a team folder --- mld/README.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 mld/README.md diff --git a/mld/README.md b/mld/README.md new file mode 100644 index 0000000..c104447 --- /dev/null +++ b/mld/README.md @@ -0,0 +1 @@ +# Team Michael-Landon-Dallin From af8cf8137525924266b4117884b6becc93e69d3d Mon Sep 17 00:00:00 2001 From: Michael Graybeal Date: Thu, 7 Feb 2019 21:31:47 -0700 Subject: [PATCH 2/2] our app --- cannons/.gitignore | 6 +++ cannons/handler.js | 53 +++++++++++++++++++ cannons/package-lock.json | 26 ++++++++++ cannons/package.json | 16 ++++++ cannons/serverless.yml | 103 +++++++++++++++++++++++++++++++++++++ mld/.gitignore | 6 +++ mld/handler.js | 14 +++++ mld/package.json | 11 ++++ mld/serverless.yml | 104 ++++++++++++++++++++++++++++++++++++++ 9 files changed, 339 insertions(+) create mode 100644 cannons/.gitignore create mode 100644 cannons/handler.js create mode 100644 cannons/package-lock.json create mode 100644 cannons/package.json create mode 100644 cannons/serverless.yml create mode 100644 mld/.gitignore create mode 100644 mld/handler.js create mode 100644 mld/package.json create mode 100644 mld/serverless.yml diff --git a/cannons/.gitignore b/cannons/.gitignore new file mode 100644 index 0000000..2b48c8b --- /dev/null +++ b/cannons/.gitignore @@ -0,0 +1,6 @@ +# package directories +node_modules +jspm_packages + +# Serverless directories +.serverless \ No newline at end of file diff --git a/cannons/handler.js b/cannons/handler.js new file mode 100644 index 0000000..582cc5a --- /dev/null +++ b/cannons/handler.js @@ -0,0 +1,53 @@ +'use strict' +const Alexa = require('ask-sdk-core') +const skillBuilder = Alexa.SkillBuilders.custom() + +const LaunchRequestHandler = { + canHandle(handlerInput) { + console.log( + 'can log:', + handlerInput.requestEnvelope.request.type === 'LaunchRequest', + handlerInput.requestEnvelope.request.type + ) + return handlerInput.requestEnvelope.request.type === 'LaunchRequest' + }, + handle(handlerInput) { + const speechText = 'Loading the cannons' + console.log('fool!', JSON.stringify(handlerInput, null, 2)) + if (supportsDisplay(handlerInput)) { + return handlerInput.responseBuilder + .speak(speechText) + .addVideoAppLaunchDirective( + 'https://s3.us-east-2.amazonaws.com/cannonfire/tripleGunsNoWords.mp4' + ) + .getResponse() + } + return ( + handlerInput.responseBuilder + .speak(speechText) + // .addVideoAppLaunchDirective( + // 'https://s3.us-east-2.amazonaws.com/cannonfire/tripleGunsNoWords.mp4' + // ) + .getResponse() + ) + } +} +function supportsDisplay(handlerInput) { + var hasDisplay = + handlerInput.requestEnvelope.context && + handlerInput.requestEnvelope.context.System && + handlerInput.requestEnvelope.context.System.device && + handlerInput.requestEnvelope.context.System.device.supportedInterfaces && + handlerInput.requestEnvelope.context.System.device.supportedInterfaces + .Display + + console.log( + 'Supported Interfaces are' + + JSON.stringify( + handlerInput.requestEnvelope.context.System.device.supportedInterfaces + ) + ) + return hasDisplay +} + +exports.fire = skillBuilder.addRequestHandlers(LaunchRequestHandler).lambda() diff --git a/cannons/package-lock.json b/cannons/package-lock.json new file mode 100644 index 0000000..42081eb --- /dev/null +++ b/cannons/package-lock.json @@ -0,0 +1,26 @@ +{ + "name": "cannons", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "ask-sdk-core": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/ask-sdk-core/-/ask-sdk-core-2.3.0.tgz", + "integrity": "sha512-aSc/xaY0lHZu8pmkYPR1ms72WPH73aggo7uL/k0dut6AhP3CmdU3Y9ui7IOAvRJnha0cToQ8TYU0jLEOH6MMNw==", + "requires": { + "ask-sdk-runtime": "^2.2.0" + } + }, + "ask-sdk-model": { + "version": "1.11.2", + "resolved": "https://registry.npmjs.org/ask-sdk-model/-/ask-sdk-model-1.11.2.tgz", + "integrity": "sha512-nxXvf3NRfKbsKVegHrYqDaCn0EMylSuPKXn7SsMmgRJyi5HrxVycb1X/moQVoBJ06ZwGtvbhcI4AhtcWDbZFnw==" + }, + "ask-sdk-runtime": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/ask-sdk-runtime/-/ask-sdk-runtime-2.2.0.tgz", + "integrity": "sha512-pYqTizpk+13l7sU/bdyIZKRptyR7fP05T8OdY0/tpD8WQaCyIvPigIEHjYcXN0Yz23FkKECbIRvfXN9OQ7Ka5w==" + } + } +} diff --git a/cannons/package.json b/cannons/package.json new file mode 100644 index 0000000..85cb0fb --- /dev/null +++ b/cannons/package.json @@ -0,0 +1,16 @@ +{ + "name": "cannons", + "version": "1.0.0", + "description": "", + "main": "handler.js", + "dependencies": { + "ask-sdk-core": "^2.3.0", + "ask-sdk-model": "^1.11.2" + }, + "devDependencies": {}, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC" +} diff --git a/cannons/serverless.yml b/cannons/serverless.yml new file mode 100644 index 0000000..74d2e31 --- /dev/null +++ b/cannons/serverless.yml @@ -0,0 +1,103 @@ +# Welcome to Serverless! +# +# This file is the main config file for your service. +# It's very minimal at this point and uses default values. +# You can always add more config options for more control. +# We've included some commented out config examples here. +# Just uncomment any of them to get that config option. +# +# For full config options, check the docs: +# docs.serverless.com +# +# Happy Coding! + +service: cannons # NOTE: update this with your service name + +# You can pin your service to only deploy with a specific Serverless version +# Check out our docs for more details +# frameworkVersion: "=X.X.X" + +provider: + name: aws + runtime: nodejs8.10 + +# you can overwrite defaults here +# stage: dev +# region: us-east-1 + +# you can add statements to the Lambda function's IAM Role here +# iamRoleStatements: +# - Effect: "Allow" +# Action: +# - "s3:ListBucket" +# Resource: { "Fn::Join" : ["", ["arn:aws:s3:::", { "Ref" : "ServerlessDeploymentBucket" } ] ] } +# - Effect: "Allow" +# Action: +# - "s3:PutObject" +# Resource: +# Fn::Join: +# - "" +# - - "arn:aws:s3:::" +# - "Ref" : "ServerlessDeploymentBucket" +# - "/*" + +# you can define service wide environment variables here +# environment: +# variable1: value1 + +# you can add packaging information here +#package: +# include: +# - include-me.js +# - include-me-dir/** +# exclude: +# - exclude-me.js +# - exclude-me-dir/** + +functions: + fire: + handler: handler.fire +# The following are a few example events you can configure +# NOTE: Please make sure to change your handler code to work with those events +# Check the event documentation for details +# events: +# - http: +# path: users/create +# method: get +# - s3: ${env:BUCKET} +# - schedule: rate(10 minutes) +# - sns: greeter-topic +# - stream: arn:aws:dynamodb:region:XXXXXX:table/foo/stream/1970-01-01T00:00:00.000 +# - alexaSkill: amzn1.ask.skill.xx-xx-xx-xx +# - alexaSmartHome: amzn1.ask.skill.xx-xx-xx-xx +# - iot: +# sql: "SELECT * FROM 'some_topic'" +# - cloudwatchEvent: +# event: +# source: +# - "aws.ec2" +# detail-type: +# - "EC2 Instance State-change Notification" +# detail: +# state: +# - pending +# - cloudwatchLog: '/aws/lambda/hello' +# - cognitoUserPool: +# pool: MyUserPool +# trigger: PreSignUp + +# Define function environment variables here +# environment: +# variable2: value2 + +# you can add CloudFormation resource templates here +#resources: +# Resources: +# NewResource: +# Type: AWS::S3::Bucket +# Properties: +# BucketName: my-new-bucket +# Outputs: +# NewOutput: +# Description: "Description for the output" +# Value: "Some output value" diff --git a/mld/.gitignore b/mld/.gitignore new file mode 100644 index 0000000..2b48c8b --- /dev/null +++ b/mld/.gitignore @@ -0,0 +1,6 @@ +# package directories +node_modules +jspm_packages + +# Serverless directories +.serverless \ No newline at end of file diff --git a/mld/handler.js b/mld/handler.js new file mode 100644 index 0000000..ed6be6c --- /dev/null +++ b/mld/handler.js @@ -0,0 +1,14 @@ +'use strict'; + +module.exports.hello = async (event, context) => { + return { + statusCode: 200, + body: JSON.stringify({ + message: 'Go Serverless v1.0! Your function executed successfully!', + input: event, + }), + }; + + // Use this code if you don't use the http event with the LAMBDA-PROXY integration + // return { message: 'Go Serverless v1.0! Your function executed successfully!', event }; +}; diff --git a/mld/package.json b/mld/package.json new file mode 100644 index 0000000..c4d0ef1 --- /dev/null +++ b/mld/package.json @@ -0,0 +1,11 @@ +{ + "name": "torpedoes", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC" +} diff --git a/mld/serverless.yml b/mld/serverless.yml new file mode 100644 index 0000000..789903d --- /dev/null +++ b/mld/serverless.yml @@ -0,0 +1,104 @@ +# Welcome to Serverless! +# +# This file is the main config file for your service. +# It's very minimal at this point and uses default values. +# You can always add more config options for more control. +# We've included some commented out config examples here. +# Just uncomment any of them to get that config option. +# +# For full config options, check the docs: +# docs.serverless.com +# +# Happy Coding! + +service: aws-nodejs # NOTE: update this with your service name + +# You can pin your service to only deploy with a specific Serverless version +# Check out our docs for more details +# frameworkVersion: "=X.X.X" + +provider: + name: aws + runtime: nodejs8.10 + +# you can overwrite defaults here +# stage: dev +# region: us-east-1 + +# you can add statements to the Lambda function's IAM Role here +# iamRoleStatements: +# - Effect: "Allow" +# Action: +# - "s3:ListBucket" +# Resource: { "Fn::Join" : ["", ["arn:aws:s3:::", { "Ref" : "ServerlessDeploymentBucket" } ] ] } +# - Effect: "Allow" +# Action: +# - "s3:PutObject" +# Resource: +# Fn::Join: +# - "" +# - - "arn:aws:s3:::" +# - "Ref" : "ServerlessDeploymentBucket" +# - "/*" + +# you can define service wide environment variables here +# environment: +# variable1: value1 + +# you can add packaging information here +#package: +# include: +# - include-me.js +# - include-me-dir/** +# exclude: +# - exclude-me.js +# - exclude-me-dir/** + +functions: + hello: + handler: handler.hello + +# The following are a few example events you can configure +# NOTE: Please make sure to change your handler code to work with those events +# Check the event documentation for details +# events: +# - http: +# path: users/create +# method: get +# - s3: ${env:BUCKET} +# - schedule: rate(10 minutes) +# - sns: greeter-topic +# - stream: arn:aws:dynamodb:region:XXXXXX:table/foo/stream/1970-01-01T00:00:00.000 +# - alexaSkill: amzn1.ask.skill.xx-xx-xx-xx +# - alexaSmartHome: amzn1.ask.skill.xx-xx-xx-xx +# - iot: +# sql: "SELECT * FROM 'some_topic'" +# - cloudwatchEvent: +# event: +# source: +# - "aws.ec2" +# detail-type: +# - "EC2 Instance State-change Notification" +# detail: +# state: +# - pending +# - cloudwatchLog: '/aws/lambda/hello' +# - cognitoUserPool: +# pool: MyUserPool +# trigger: PreSignUp + +# Define function environment variables here +# environment: +# variable2: value2 + +# you can add CloudFormation resource templates here +#resources: +# Resources: +# NewResource: +# Type: AWS::S3::Bucket +# Properties: +# BucketName: my-new-bucket +# Outputs: +# NewOutput: +# Description: "Description for the output" +# Value: "Some output value"