fnspec

package
v1.0.0 Latest Latest
Warning

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

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

Documentation

Overview

Package fnspec provides a function spec for lambdafy.

Index

Constants

View Source
const RoleGenerate = "generate"

RoleGenerate is a special role name that indicates the role should be generated.

Variables

This section is empty.

Functions

This section is empty.

Types

type EFSMount

type EFSMount struct {
	ARN  string `yaml:"arn"`  // ARN of the EFS filesystem endpoint.
	Path string `yaml:"path"` // Path to mount the EFS filesystem at.
}

EFSMount represents an AWS Elastic Filesystem mount.

type RolePolicy

type RolePolicy struct {
	Effect   string   `yaml:"effect" json:"Effect"`
	Action   []string `yaml:"action" json:"Action"`
	Resource []string `yaml:"resource" json:"Resource"`
}

RolePolicy represents a policy for a lambda function's IAM role.

type SQSTrigger

type SQSTrigger struct {
	ARN         string `yaml:"arn"`
	BatchSize   *int32 `yaml:"batch_size,omitempty"`
	BatchWindow *int32 `yaml:"batch_window,omitempty"`
	Concurrency *int32 `yaml:"concurrency,omitempty"`
}

SQSTrigger represents an SQS trigger for a lambda function.

type Spec

type Spec struct {
	Name                  string            `yaml:"name"`
	Description           string            `yaml:"description,omitempty"`
	Image                 string            `yaml:"image"`
	Role                  string            `yaml:"role"`
	RoleExtraPolicy       []*RolePolicy     `yaml:"role_extra_policy,omitempty"`
	CreateRepo            *bool             `yaml:"create_repo,omitempty"`
	RepoName              string            `yaml:"repo_name,omitempty"`
	Env                   map[string]string `yaml:"env,omitempty"`
	Entrypoint            []string          `yaml:"entrypoint,omitempty"`
	Command               []string          `yaml:"command,omitempty"`
	WorkDir               *string           `yaml:"workdir,omitempty"`
	Memory                *int32            `yaml:"memory,omitempty"`
	Timeout               *int32            `yaml:"timeout,omitempty"`
	Tags                  map[string]string `yaml:"tags,omitempty"`
	VPCSecurityGroupIds   []string          `yaml:"vpc_security_group_ids,omitempty"`
	VPCSubnetIds          []string          `yaml:"vpc_subnet_ids,omitempty"`
	EFSMounts             []*EFSMount       `yaml:"efs_mounts,omitempty"`
	TempSize              *int32            `yaml:"temp_size,omitempty"`
	CORS                  bool              `yaml:"cors,omitempty"`
	SQSTriggers           []*SQSTrigger     `yaml:"sqs_triggers,omitempty"`
	CronTriggers          map[string]string `yaml:"cron,omitempty"`
	AllowedAccountRegions []string          `yaml:"allowed_account_regions,omitempty"`
	// contains filtered or unexported fields
}

Spec is the specification of a lambda function.

func Load

func Load(r io.Reader, vars map[string]string) (*Spec, error)

Load loads the spec from the given reader.

func (*Spec) IsAccountRegionAllowed

func (a *Spec) IsAccountRegionAllowed(account, region string) bool

IsAccountRegionAllowed returns true if the given account and region are allowed by the spec.

func (*Spec) MakeAndPush

func (a *Spec) MakeAndPush() bool

MakeAndPush returns true if the image should be built and pushed to ECR.

func (*Spec) Save

func (a *Spec) Save(w io.Writer) error

Save saves the spec to the given writer.

Jump to

Keyboard shortcuts

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