aws-lambda-go: github.com/aws/aws-lambda-go/cfn Index | Files

package cfn

import "github.com/aws/aws-lambda-go/cfn"

Index

Package Files

event.go response.go wrap.go

type CustomResourceFunction Uses

type CustomResourceFunction func(context.Context, Event) (physicalResourceID string, data map[string]interface{}, err error)

CustomResourceFunction is a representation of the customer's Custom Resource function. LambdaWrap will take the returned values and turn them into a response to be sent to CloudFormation.

type CustomResourceLambdaFunction Uses

type CustomResourceLambdaFunction func(context.Context, Event) (reason string, err error)

CustomResourceLambdaFunction is a standard form Lambda for a Custom Resource.

func LambdaWrap Uses

func LambdaWrap(lambdaFunction CustomResourceFunction) (fn CustomResourceLambdaFunction)

LambdaWrap returns a CustomResourceLambdaFunction which is something lambda.Start() will understand. The purpose of doing this is so that Response Handling boiler plate is taken away from the customer and it makes writing a Custom Resource simpler.

func myLambda(ctx context.Context, event cfn.Event) (physicalResourceID string, data map[string]interface{}, err error) {
	physicalResourceID = "arn:...."
	return
}

func main() {
	lambda.Start(cfn.LambdaWrap(myLambda))
}

type Event Uses

type Event struct {
    RequestType           RequestType            `json:"RequestType"`
    RequestID             string                 `json:"RequestId"`
    ResponseURL           string                 `json:"ResponseURL"`
    ResourceType          string                 `json:"ResourceType"`
    PhysicalResourceID    string                 `json:"PhysicalResourceId,omitempty"`
    LogicalResourceID     string                 `json:"LogicalResourceId"`
    StackID               string                 `json:"StackId"`
    ResourceProperties    map[string]interface{} `json:"ResourceProperties"`
    OldResourceProperties map[string]interface{} `json:"OldResourceProperties,omitempty"`
}

Event is a representation of a Custom Resource request

type RequestType Uses

type RequestType string

RequestType represents the types of requests that come from a CloudFormation stack being run

const (
    RequestCreate RequestType = "Create"
    RequestUpdate RequestType = "Update"
    RequestDelete RequestType = "Delete"
)

type Response Uses

type Response struct {
    Status             StatusType             `json:"Status"`
    RequestID          string                 `json:"RequestId"`
    LogicalResourceID  string                 `json:"LogicalResourceId"`
    StackID            string                 `json:"StackId"`
    PhysicalResourceID string                 `json:"PhysicalResourceId"`
    Reason             string                 `json:"Reason,omitempty"`
    NoEcho             bool                   `json:"NoEcho,omitempty"`
    Data               map[string]interface{} `json:"Data,omitempty"`
    // contains filtered or unexported fields
}

Response is a representation of a Custom Resource response expected by CloudFormation.

func NewResponse Uses

func NewResponse(r *Event) *Response

NewResponse creates a Response with the relevant verbatim copied data from a Event

func (*Response) Send Uses

func (r *Response) Send() error

Send will send the Response to the given URL using the default HTTP client

type SNSCustomResourceLambdaFunction Uses

type SNSCustomResourceLambdaFunction func(context.Context, events.SNSEvent) (reason string, err error)

SNSCustomResourceLambdaFunction is a standard form Lambda for a Custom Resource that is triggered via a SNS topic.

func LambdaWrapSNS Uses

func LambdaWrapSNS(lambdaFunction CustomResourceFunction) SNSCustomResourceLambdaFunction

LambdaWrapSNS wraps a Lambda handler with support for SNS-based custom resources. Usage and purpose otherwise same as LambdaWrap().

type StatusType Uses

type StatusType string

StatusType represents a CloudFormation response status

const (
    StatusSuccess StatusType = "SUCCESS"
    StatusFailed  StatusType = "FAILED"
)

Package cfn imports 10 packages (graph) and is imported by 1 packages. Updated 2019-12-06. Refresh now. Tools for package owners.