lambda

package
v0.49.4-rc0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// RequestRetryTime represents the number of times calling to AWS resource control.
	RequestRetryTime = 3
	// RetryIntervalDuration represents duration time between retry.
	RetryIntervalDuration = 1 * time.Minute
)
View Source
const (
	VersionV1Beta1       = "pipecd.dev/v1beta1"
	FunctionManifestKind = "LambdaFunction"
)
View Source
const (
	LabelManagedBy   string = "pipecd-dev-managed-by"  // Always be piped.
	LabelPiped       string = "pipecd-dev-piped"       // The id of piped handling this application.
	LabelApplication string = "pipecd-dev-application" // The application this resource belongs to.
	LabelCommitHash  string = "pipecd-dev-commit-hash" // Hash value of the deployed commit.
	ManagedByPiped   string = "piped"
)

Variables

View Source
var ErrNotFound = errors.New("lambda resource not found")

ErrNotFound lambda resource occurred.

Functions

func DecideRevisionName

func DecideRevisionName(fm FunctionManifest, commit string) (string, error)

DecideRevisionName returns revision name to apply.

func FindArtifactVersions

func FindArtifactVersions(fm FunctionManifest) ([]*model.ArtifactVersion, error)

FindArtifactVersions parses artifact versions from function.yaml.

func FindImageTag

func FindImageTag(fm FunctionManifest) (string, error)

FindImageTag parses image tag from given LambdaFunction manifest.

func MakeFunctionResourceState added in v0.49.0

func MakeFunctionResourceState(fc *types.FunctionConfiguration) *model.LambdaResourceState

MakeFunctionResourceState creates LambdaResourceState of a Function.

Types

type Architecture added in v0.44.0

type Architecture struct {
	Name string `json:"name"`
}

type Client

type Client interface {
	IsFunctionExist(ctx context.Context, name string) (bool, error)
	CreateFunction(ctx context.Context, fm FunctionManifest) error
	CreateFunctionFromSource(ctx context.Context, fm FunctionManifest, zip io.Reader) error
	UpdateFunction(ctx context.Context, fm FunctionManifest) error
	UpdateFunctionFromSource(ctx context.Context, fm FunctionManifest, zip io.Reader) error
	PublishFunction(ctx context.Context, fm FunctionManifest) (version string, err error)
	ListFunctions(ctx context.Context) ([]types.FunctionConfiguration, error)
	GetFunction(ctx context.Context, functionName string) (*lambda.GetFunctionOutput, error)
	GetTrafficConfig(ctx context.Context, fm FunctionManifest) (routingTrafficCfg RoutingTrafficConfig, err error)
	CreateTrafficConfig(ctx context.Context, fm FunctionManifest, version string) error
	UpdateTrafficConfig(ctx context.Context, fm FunctionManifest, routingTraffic RoutingTrafficConfig) error
}

Client is wrapper of AWS client.

type DiffRenderOptions added in v0.49.0

type DiffRenderOptions struct {
	// If true, use "diff" command to render.
	UseDiffCommand bool
}

type DiffResult added in v0.49.0

type DiffResult struct {
	Diff *diff.Result
	Old  FunctionManifest
	New  FunctionManifest
}

func Diff added in v0.49.0

func Diff(old, new FunctionManifest, opts ...diff.Option) (*DiffResult, error)

func (*DiffResult) NoChange added in v0.49.0

func (d *DiffResult) NoChange() bool

func (*DiffResult) Render added in v0.49.0

func (d *DiffResult) Render(opt DiffRenderOptions) string

type EphemeralStorage added in v0.45.4

type EphemeralStorage struct {
	Size int32 `json:"size,omitempty"`
}

type FunctionManifest

type FunctionManifest struct {
	Kind       string               `json:"kind"`
	APIVersion string               `json:"apiVersion,omitempty"`
	Spec       FunctionManifestSpec `json:"spec"`
}

func LoadFunctionManifest

func LoadFunctionManifest(appDir, functionManifestFilename string) (FunctionManifest, error)

LoadFunctionManifest returns FunctionManifest object from a given Function config manifest file.

type FunctionManifestCache added in v0.49.0

type FunctionManifestCache struct {
	AppID  string
	Cache  cache.Cache
	Logger *zap.Logger
}

func (FunctionManifestCache) Get added in v0.49.0

func (FunctionManifestCache) Put added in v0.49.0

func (c FunctionManifestCache) Put(commit string, sm FunctionManifest)

type FunctionManifestSpec

type FunctionManifestSpec struct {
	Name             string            `json:"name"`
	Role             string            `json:"role"`
	ImageURI         string            `json:"image"`
	S3Bucket         string            `json:"s3Bucket"`
	S3Key            string            `json:"s3Key"`
	S3ObjectVersion  string            `json:"s3ObjectVersion"`
	SourceCode       SourceCode        `json:"source"`
	Handler          string            `json:"handler"`
	Architectures    []Architecture    `json:"architectures,omitempty"`
	EphemeralStorage *EphemeralStorage `json:"ephemeralStorage,omitempty"`
	Runtime          string            `json:"runtime"`
	Memory           int32             `json:"memory"`
	Timeout          int32             `json:"timeout"`
	Tags             map[string]string `json:"tags,omitempty"`
	Environments     map[string]string `json:"environments,omitempty"`
	VPCConfig        *VPCConfig        `json:"vpcConfig,omitempty"`
	// A list of function layers used in the function.
	// Specify each layer by its ARN including the version.
	// You can use layers only with Lambda functions deployed as a .zip file archive. Layers are ignored for a container image.
	// See https://docs.aws.amazon.com/lambda/latest/dg/chapter-layers.html.
	Layers []string `json:"layers,omitempty"`
}

FunctionManifestSpec contains configuration for LambdaFunction.

type Registry

type Registry interface {
	Client(name string, cfg *config.PlatformProviderLambdaConfig, logger *zap.Logger) (Client, error)
}

Registry holds a pool of aws client wrappers.

func DefaultRegistry

func DefaultRegistry() Registry

DefaultRegistry returns a pool of aws clients and a mutex associated with it.

type RoutingTrafficConfig

type RoutingTrafficConfig map[TrafficConfigKeyName]VersionTraffic

RoutingTrafficConfig presents a map of primary and secondary version traffic for lambda function alias.

func (*RoutingTrafficConfig) Decode

func (c *RoutingTrafficConfig) Decode(data []byte) error

func (*RoutingTrafficConfig) Encode

func (c *RoutingTrafficConfig) Encode() (string, error)

type SourceCode

type SourceCode struct {
	Git  string `json:"git"`
	Ref  string `json:"ref"`
	Path string `json:"path"`
}

type TrafficConfigKeyName

type TrafficConfigKeyName string

TrafficConfigKeyName represents key for lambda service config map.

const (
	// TrafficPrimaryVersionKeyName represents the key points to primary version config on traffic routing map.
	TrafficPrimaryVersionKeyName TrafficConfigKeyName = "primary"
	// TrafficSecondaryVersionKeyName represents the key points to primary version config on traffic routing map.
	TrafficSecondaryVersionKeyName TrafficConfigKeyName = "secondary"
)

type VPCConfig added in v0.45.0

type VPCConfig struct {
	SecurityGroupIDs []string `json:"securityGroupIds,omitempty"`
	SubnetIDs        []string `json:"subnetIds,omitempty"`
}

type VersionTraffic

type VersionTraffic struct {
	Version string  `json:"version"`
	Percent float64 `json:"percent"`
}

VersionTraffic presents the version, and the percent of traffic that's routed to it.

Jump to

Keyboard shortcuts

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