Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
borgoat committed Apr 12, 2021
1 parent 43df86d commit 9366bbb
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
65 changes: 65 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Lambda Builders Go

[![Go Reference](https://pkg.go.dev/badge/github.com/borgoat/lambda-builders-go.svg)](https://pkg.go.dev/github.com/borgoat/lambda-builders-go)
[![Go Report Card](https://goreportcard.com/badge/github.com/borgoat/lambda-builders-go)](https://goreportcard.com/report/github.com/borgoat/lambda-builders-go)
[![GitHub license](https://img.shields.io/github/license/borgoat/lambda-builders-go?color=yellow)](https://github.com/borgoat/lambda-builders-go/blob/development/LICENSE)

Go wrapper for [AWS Lambda Builders](https://github.com/aws/aws-lambda-builders),
using its JSON-RPC API.

> Lambda Builders is a Python library to compile, build and package AWS Lambda functions for several runtimes & frameworks.
## Getting Started

First, the lambda-builders executable is required:

```shell
$ pip install --user aws-lambda-builders
```

Now, download this module:

```shell
$ go get -u github.com/borgoat/lambda-builders-go
```

Here is an example how to use this library:

```go
package main

import lambdabuilders "github.com/borgoat/lambda-builders-go"

func main() {
// Client executes lambda-builders and uses JSON-RPC to communicate with it
client, err := lambdabuilders.NewClient()
if err != nil {
panic(err)
}

// Here we create a new builder for a Lambda written in Go, using Go Modules
// Other workflows may be found in the aws-lambda-builders Python library:
// https://github.com/aws/aws-lambda-builders/tree/develop/aws_lambda_builders/workflows
b, err := client.NewBuilder("go", "modules", "")
if err != nil {
panic(err)
}

// Finally we actually call LambdaBuilders.build
// Check out how to configure it from the Python library:
// https://github.com/aws/aws-lambda-builders/blob/165f92f35753d87e4abe1115fd2399826b371e1f/aws_lambda_builders/builder.py#L56-L67
err = b.Build(
"/path/to/source",
"/path/to/compile",
"/path/to/scratchdir",
"/path/to/source/go.mod",
lambdabuilders.WithRuntime("go1.x"),
lambdabuilders.WithOptions(map[string]interface{}{
"artifact_executable_name": "my-handler",
}),
)
if err != nil {
panic(err)
}
}
```
2 changes: 2 additions & 0 deletions params.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ type ParamsCapability struct {
ApplicationFramework string `json:"application_framework"`
}

// ParamsProtocolVersion defines the versions of the JSON-RPC API exposed by lambda-builders
type ParamsProtocolVersion string

const (
// ProtocolVersion03 is the only one we support as of today
ProtocolVersion03 ParamsProtocolVersion = "0.3"
)

0 comments on commit 9366bbb

Please sign in to comment.