aws

package module
v2.4.3 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2023 License: BSD-3-Clause Imports: 15 Imported by: 1

README

go-webhookd-aws

Go package to implement the whosonfirst/go-webhookd interfaces for dispatching webhooks originating from GitHub to AWS services.

Documentation

Go Reference

Before you begin please read the go-webhookd documentation for an overview of concepts and principles.

Usage

import (
	_ "github.com/go-webhookd-aws/v2"
)

Dispatchers

Lambda

The Lambda dispatcher will send messages to an Amazon Web Services (ASW) Lambda function. It is defined as a URI string in the form of:

lambda://{FUNCTION}?dsn={DSN}&invocation_type={INVOCATION_TYPE}
Properties
Name Value Description Required
dsn string A valid aaronland/go-aws-session DSN string. yes
function string The name of your Lambda function. yes
invocation_type string A valid AWS Lambda Invocation Type string. no
halt_on_message string An optional regular expression that will be compared to the commit message; if it matches the transformer will return an error with code webhookd.HaltEvent no
halt_on_author string An optional regular expression that will be compared to the commit author; if it matches the transformer will return an error with code webhookd.HaltEvent no

Important

whosonfirst/go-webhookd-aws/v2 and higher is backwards incompatible with whosonfirst/go-webhookd-aws "v1". Importantly the ability to run a webhookd server as an AWS Lambda has been merged back in to whosonfirst/go-webhookd/v2 (and higher). This package only manages AWS specific dispatchers now.

See also

Documentation

Overview

package aws implements the `whosonfirst/go-webhookd` interfaces for dispatching webhooks originating from GitHub to AWS services.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLambdaDispatcher

func NewLambdaDispatcher(ctx context.Context, uri string) (webhookd.WebhookDispatcher, error)

NewLambdaDispatcher returns a new `LambdaDispatcher` instance configured by 'uri' in the form of:

lambda://{FUNCTION_NAME}?{PARAMETERS}

Where {PARAMETERS} are: * `dsn=` A valid `aaronland/go-aws-session` string used to create an AWS session instance. * `invocation_type=` The name of AWS Lambda invocation type. Valid options are: RequestResponse, Event, DryRun. * `?halt_on_message` An optional regular expression that will be compared to the commit message; if it matches the transformer will return an error with code `webhookd.HaltEvent` * `?halt_on_author` An optional regular expression that will be compared to the commit author; if it matches the transformer will return an error with code `webhookd.HaltEvent`

Types

type LambdaDispatcher

type LambdaDispatcher struct {
	webhookd.WebhookDispatcher
	// LambdaFunction is the name of the Lambda function to invoke.
	LambdaFunction string
	// LambdaService is `aws-sdk-go/service/lambda.Lambda` instance use to invoke a Lambda function.
	LambdaService *lambda.Lambda
	// contains filtered or unexported fields
}

LambdaDispatcher implements the `webhookd.WebhookDispatcher` interface for dispatching messages to an AWS Lambda function.

func (*LambdaDispatcher) Dispatch

func (d *LambdaDispatcher) Dispatch(ctx context.Context, body []byte) *webhookd.WebhookError

Dispatch() relays 'body' as base64-endoded JSON string to the AWS Lambda function defined when 'd' was instantiated.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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