This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate lambda_runtime as lambda; | |
extern crate alexa_sdk; | |
use lambda::{lambda, Context, error::HandlerError}; | |
use alexa_sdk::{Request,Response}; | |
use alexa_sdk::request::{IntentType, Locale}; | |
use std::error::Error; | |
fn handle_help(_req: &Request) -> Result<Response,HandlerError> { | |
Ok(Response::new_simple("hello", "to say hello, tell me: say hello to someone")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/sh | |
cargo build --release --target x86_64-unknown-linux-musl | |
zip -j rust.zip ./target/x86_64-unknown-linux-musl/release/bootstrap |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "hello_alexa" | |
version = "0.1.0" | |
authors = ["Arien Malec <[email protected]>"] | |
[dependencies] | |
alexa_sdk = "^0.1" | |
lambda_runtime = "^0.1" | |
[[bin]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"github.com/arienmalec/alexa-go" | |
"github.com/aws/aws-lambda-go/lambda" | |
) | |
// DispatchIntents dispatches each intent to the right handler | |
func DispatchIntents(request alexa.Request) alexa.Response { | |
var response alexa.Response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"github.com/aws/aws-lambda-go/lambda" | |
) | |
// Response contains the message for the world | |
type Response struct { | |
Version string `json:"version"` | |
Body ResBody `json:"response"` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
rm -rf deploy | |
mkdir deploy | |
GOOS=linux go build -o ./deploy/hello | |
pushd deploy | |
zip hello.zip hello | |
popd | |
aws cloudformation package \ | |
--template-file hello.yaml \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWSTemplateFormatVersion: '2010-09-09' | |
Transform: AWS::Serverless-2016-10-31 | |
Resources: | |
HelloLambda: | |
Type: AWS::Serverless::Function | |
Properties: | |
Handler: hello | |
Runtime: go1.x | |
CodeUri: ./deploy/hello.zip | |
Environment: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"github.com/aws/aws-lambda-go/lambda" | |
) | |
// Response contains the message for the world | |
type Response struct { | |
Message string | |
} |