decorator

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// OutputDashboardURL is the keyname used in the CloudFormation Output
	// that stores the CloudWatch Dashboard URL
	// @enum OutputKey
	OutputDashboardURL = "CloudWatchDashboardURL"
)

Variables

View Source
var LogAggregatorAssumePolicyDocument = sparta.ArbitraryJSONObject{
	"Version": "2012-10-17",
	"Statement": []sparta.ArbitraryJSONObject{
		{
			"Action": []string{"sts:AssumeRole"},
			"Effect": "Allow",
			"Principal": sparta.ArbitraryJSONObject{
				"Service": []string{
					"logs.us-west-2.amazonaws.com",
				},
			},
		},
	},
}

LogAggregatorAssumePolicyDocument is the document for LogSubscription filters

Functions

func CodeDeployServiceUpdateDecorator

func CodeDeployServiceUpdateDecorator(updateType string,
	lambdaFuncs []*sparta.LambdaAWSInfo,
	preHook *sparta.LambdaAWSInfo,
	postHook *sparta.LambdaAWSInfo) sparta.ServiceDecoratorHookFunc

CodeDeployServiceUpdateDecorator is a service level decorator that attaches the CodeDeploy safe update to an upgrade operation. Ref: https://github.com/awslabs/serverless-application-model/blob/master/docs/safe_lambda_deployments.rst

func DashboardDecorator

func DashboardDecorator(lambdaAWSInfo []*sparta.LambdaAWSInfo,
	timeSeriesPeriod int) sparta.ServiceDecoratorHookFunc

DashboardDecorator returns a ServiceDecoratorHook function that can be attached the workflow to create a dashboard

func PublishAttOutputDecorator

func PublishAttOutputDecorator(keyName string, description string, fieldName string) sparta.TemplateDecoratorHookFunc

PublishAttOutputDecorator returns an TemplateDecoratorHookFunc that publishes an Att value for a given Lambda

func PublishRefOutputDecorator

func PublishRefOutputDecorator(keyName string, description string) sparta.TemplateDecoratorHookFunc

PublishRefOutputDecorator returns an TemplateDecoratorHookFunc that publishes the Ref value for a given lambda

Types

type DashboardTemplateData

type DashboardTemplateData struct {
	// The list of lambda functions
	LambdaFunctions []*LambdaTemplateData
	// SpartaVersion is the Sparta library used to provision this service
	SpartaVersion string
	// SpartaGitHash is the commit hash of this version of the library
	SpartaGitHash    string
	TimeSeriesPeriod int
	Extents          widgetExtents
}

DashboardTemplateData is the object supplied to the dashboard template to generate the resulting dashboard

type LambdaTemplateData

type LambdaTemplateData struct {
	LambdaAWSInfo *sparta.LambdaAWSInfo
	ResourceName  string
}

LambdaTemplateData is the mapping of Sparta public LambdaAWSInfo together with the CloudFormationResource name this resource uses

type LogAggregatorDecorator

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

LogAggregatorDecorator is the decorator that satisfies both the ServiceDecoratorHandler and TemplateDecoratorHandler interfaces. It ensures that each lambda function has a CloudWatch logs subscription that forwards to a Kinesis stream. That stream is then subscribed to by the relay lambda function. Only log statements of level info or higher are published to Kinesis.

func NewLogAggregatorDecorator

func NewLogAggregatorDecorator(
	kinesisResource *gocf.KinesisStream,
	kinesisMapping *sparta.EventSourceMapping,
	relay *sparta.LambdaAWSInfo) *LogAggregatorDecorator

NewLogAggregatorDecorator returns a ServiceDecoratorHook that registers a Kinesis stream lambda log aggregator

func (*LogAggregatorDecorator) DecorateService

func (lad *LogAggregatorDecorator) DecorateService(context map[string]interface{},
	serviceName string,
	template *gocf.Template,
	S3Bucket string,
	buildID string,
	awsSession *session.Session,
	noop bool,
	logger *logrus.Logger) error

DecorateService annotates the service with the Kinesis hook

func (*LogAggregatorDecorator) DecorateTemplate

func (lad *LogAggregatorDecorator) DecorateTemplate(serviceName string,
	lambdaResourceName string,
	lambdaResource gocf.LambdaFunction,
	resourceMetadata map[string]interface{},
	S3Bucket string,
	S3Key string,
	buildID string,
	template *gocf.Template,
	context map[string]interface{},
	logger *logrus.Logger) error

DecorateTemplate annotates the lambda with the log forwarding sink info

func (*LogAggregatorDecorator) KinesisLogicalResourceName

func (lad *LogAggregatorDecorator) KinesisLogicalResourceName() string

KinesisLogicalResourceName returns the name of the Kinesis stream that will be provisioned by this Decorator

Jump to

Keyboard shortcuts

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