frontier

package module
v0.1.19 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: MIT Imports: 7 Imported by: 0

README

status PkgGoDev

frontier

frontier is a deployment tool for Amazon CloudFront Functions.

The concept is heavily inspired by Lambroll.

Synopsis

Simply run as below:

frontier deploy

frontier deploy does:

  • create or update function
  • publish the function by default
    • you can stop this behavior by using --publish=false

frontier deploy does not:

  • compile your function code implicitly
  • or anything else
Function Config (function.yml)

The function config is almost same as CreateFunction or UpdateFunction's input except of Code.

---

name: your-edge-function
config:
  comment: this is edge function
  runtime: cloudfront-js-1.0
code:
  path: ./path/to/fn.js

fn.js:

function handler(event) {
  var response = event.response,
    origin = event.request.headers.origin;
  response.headers["access-control-allow-origin"] = {
    value: origin.value,
  };
  return response;
}

Installation

go install github.com/aereal/frontier@latest

License

See LICENSE file.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CloudFrontClient

type CloudFrontClient interface {
	CreateFunction(ctx context.Context, params *cloudfront.CreateFunctionInput, optFns ...func(*cloudfront.Options)) (*cloudfront.CreateFunctionOutput, error)
	GetFunction(ctx context.Context, params *cloudfront.GetFunctionInput, optFns ...func(*cloudfront.Options)) (*cloudfront.GetFunctionOutput, error)
	PublishFunction(ctx context.Context, params *cloudfront.PublishFunctionInput, optFns ...func(*cloudfront.Options)) (*cloudfront.PublishFunctionOutput, error)
	UpdateFunction(ctx context.Context, params *cloudfront.UpdateFunctionInput, optFns ...func(*cloudfront.Options)) (*cloudfront.UpdateFunctionOutput, error)
}

type Deployer

type Deployer struct {
	// contains filtered or unexported fields
}

func NewDeployer

func NewDeployer(client CloudFrontClient, logger *zap.Logger) *Deployer

func (*Deployer) Deploy

func (d *Deployer) Deploy(ctx context.Context, configPath string, publish bool) error

type Function

type Function struct {
	Name   string
	Code   *FunctionCode
	Config *FunctionConfig
}

type FunctionCode added in v0.1.1

type FunctionCode struct {
	Path string
}

type FunctionConfig

type FunctionConfig struct {
	Comment string
	Runtime types.FunctionRuntime
}

Directories

Path Synopsis
cmd
internal
cli

Jump to

Keyboard shortcuts

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