Skip to content
This repository has been archived by the owner on Jan 14, 2020. It is now read-only.

Latest commit

 

History

History
56 lines (42 loc) · 1.65 KB

File metadata and controls

56 lines (42 loc) · 1.65 KB

AWS CodePipeline Events

Back to Home Go Doc AWS Doc

This package allows to write AWS Lambda functions and add them as action in your pipelines to customize the way they work.

Quick Hands-On

For step by step instructions on how to author your AWS Lambda function code in Go, see eawsy/aws-lambda-go-shim.

go get -u -d github.com/eawsy/aws-lambda-go-event/...
package main

import (
	"log"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/codepipeline"
	"github.com/eawsy/aws-lambda-go-core/service/lambda/runtime"
	"github.com/eawsy/aws-lambda-go-event/service/lambda/runtime/event/codepipelineevt"
)

func Handle(evt *codepipelineevt.Event, ctx *runtime.Context) (interface{}, error) {
	log.Println(evt)
	sess, err := session.NewSession()
	if err != nil {
		return nil, err
	}
	svc := codepipeline.New(sess)
	_, err = svc.PutJobSuccessResult(&codepipeline.PutJobSuccessResultInput{
		JobId: aws.String(evt.Job.ID),
	})
	return nil, err
}