aws-lowcode-lambda-go

command module
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 1, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

README

aws-lowcode-lambda-go

Creating a config file

# config.yaml
TemplateFormatVersion: 2024-01-31
Description: lowcode-lambda configuration

Resources:
  Request:
    AllowedMethods:
    - GET
    - POST
    - PUT

  Database:
    TableName: users
    Keys:
      email:
        Operator: "="
      order:
        Operator: "="
    Filter: "#age > :age"
    FilterValues:
      age: "5"
    ProjectionCols:
    - email
    - username
    - age
  
  Response:
    DataStruct: '[{"username": "", "age": ""}]'

Building a lowcode lambda function

// main.go
package main

import (
    "os"
    "fmt"

    "github.com/raywall/aws-lowcode-lambda-go/config"
	"github.com/raywall/aws-lowcode-lambda-go/server/clients/dynamodb"
	"github.com/raywall/aws-lowcode-lambda-go/server/handlers"
)

func init() {
    conf := &config.Global

	data, err := os.ReadFile(os.Getenv("CONFIG_SAMPLE"))
	if err != nil {
		log.Fatalf("failed reading lowcode role file: %v", err)
	}

	err = conf.Load(data)
	if err != nil {
		log.Fatalf("failed loading settings: %v", err)
	}

    // create a handler for integration between an api gateway and a dynamodb table
	handlers.Client, err = dynamodb.NewDynamoDBClient(conf)
	if err != nil {
		log.Fatalf("failed starting a dynamodb client: %v", err)
	}
}

func main() {
    // make the handler available for remote procedure call by aws lambda
    lambda.Start(handlers.HandleLambdaEvent)
}

Testing your function locally with SAM


# building your project
sam build

# running your function
sam local start-api

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
This package provides the configuration you need to specify in order to use the low-code lambda project.
This package provides the configuration you need to specify in order to use the low-code lambda project.
server
clients/dynamodb
This Go package provides ready-to-use handlers designed for quick and easy usage without the need for extensive code writing, often referred to as 'low-code.' These handlers are constructed based on the origin of the request being made to the Lambda function.
This Go package provides ready-to-use handlers designed for quick and easy usage without the need for extensive code writing, often referred to as 'low-code.' These handlers are constructed based on the origin of the request being made to the Lambda function.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL