lambdaweb

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 46 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Lambdaweb

Parity grade: B · SDK aws-sdk-go-v2/service/lambdaweb@v1.2.5 · last audited 2026-11-01 (ea845bb63)

Coverage

Metric Value
PARITY entries audited 20 (20 ok)
Feature families 2 (1 ok, 1 partial)
Known gaps 3
Structural gaps (can't be emulated) 1
Deferred items 0
Resource leaks clean
Known gaps
  • Execution role, key and code access: when an environment starts the execution role must exist and its trust policy must allow lambda.amazonaws.com (502 Platform.CannotAssumeRole); a revision kmsKeyArn must exist, be enabled and be a symmetric encryption key (ValidationException at creation, 502 Platform.KMSDecryptionError at launch), and under --enforce-iam its key policy must allow lambda.amazonaws.com kms:Decrypt (AccessDeniedException at creation, 502 at launch), its S3 bucket policy must allow lambda.amazonaws.com s3:GetObject (AccessDeniedException; a revision that loses access or whose object version is deleted becomes Failed at the next verification), a MultiRegion/PerRegion key needs a usable replica in every target Region (else that Region fails replication) and the execution role needs logs:CreateLogStream and logs:PutLogEvents on the log group (else no log event is delivered). Not modelled: the caller's own kms:GenerateDataKey/kms:Decrypt and s3:GetObject permission checks (the emulator's IAM enforcement does not cover lambdaweb operations), encrypting environment variables and code with the key, egressNetworkConnectorArn existence and networking (no emulated service models Lambda network connectors; services/lambda has no NetworkConnector operations), cross-account and cross-Region bucket semantics (one S3 backend serves every Region) and the 512 MB code limit at creation (enforced only when the package is extracted).
  • Logs: not modelled are the totalCpuTimeMs field of platform.spinDownReport (CPU consumed during shutdown, web-functions-logging-system-log-schema; StopAndRemoveWithin in pkgs/container stops the container before any post-SIGTERM stats read is possible, so the shutdown delta is not read) and the CPU and memory fields whenever the container runtime cannot report stats (docker and podman can; the Kubernetes runtime cannot).
  • Request path is full-duplex: the proxy forwards the request body while the application may already be responding, whereas Lambda forwards the full request body before it delivers the response (web-functions-troubleshooting, HTTP request failures).
Structural gaps

These do not block an A grade — no implementation could produce real data here because the underlying data source cannot exist in an emulator.

  • The *.on.aws endpoint domains are not resolvable and have no TLS: reach an endpoint with the emulator port and a Host header (curl -H 'Host: ' http://localhost:4566/) or the ..lambda-web..localhost form. The nodejs24.x runtime image is pulled from the runtime registry (LAMBDAWEB_RUNTIME_IMAGE).

More

Documentation

Index

Constants

View Source
const (
	EngineStub   = "stub"
	EngineDocker = "docker"
)

Engine modes for the web function data plane.

View Source
const ServicePrincipal = "lambda.amazonaws.com"

ServicePrincipal is the service principal an execution role's trust policy must allow.

Variables

View Source
var (
	ErrBucketNotFound     = errors.New("bucket not found")
	ErrBucketNotVersioned = errors.New("bucket versioning is not enabled")
	ErrObjectNotFound     = errors.New("object not found")
)

Sentinel errors a CodeStore returns.

View Source
var ErrAccessDenied = errors.New("access denied")

ErrAccessDenied maps to AccessDeniedException.

View Source
var ErrCodeUnavailable = errors.New("code package unavailable")

ErrCodeUnavailable is returned when a revision's code package cannot be read.

View Source
var ErrNoSnapshot = errors.New("backend does not support restore")

ErrNoSnapshot is returned when a backend does not support snapshot/restore.

View Source
var ErrQuotaExceeded = errors.New("quota exceeded")

ErrQuotaExceeded maps to ServiceQuotaExceededException.

View Source
var ErrRuntimeUnavailable = errors.New("container runtime unavailable")

ErrRuntimeUnavailable is returned when the container runtime is unreachable or the sandbox image cannot be had.

Functions

func FunctionARNOf

func FunctionARNOf(resourceARN string) (string, bool)

FunctionARNOf returns the web function ARN that owns a function, revision or endpoint ARN.

func IsEndpointHost

func IsEndpointHost(host string) bool

IsEndpointHost reports whether host names a web function endpoint domain (<id>.<shard>.lambda-web.<region>.on.aws, <id>.lambda-web.global.on.aws, or the same under .localhost).

func RegionOf

func RegionOf(resourceARN string) (string, bool)

RegionOf returns the Region of a web function, revision or endpoint ARN.

Types

type AccountSettings

type AccountSettings struct {
	MaxEndpointsPerFunction int32
	MaxRevisionsPerFunction int32
	MaxTotalArmVCpus        int32
	MaxTotalRateLimit       int32
	FunctionCount           int32
}

AccountSettings reports the Region's quotas and usage.

type CodeStore

type CodeStore interface {
	// ResolveObject returns the object version a revision pins: versionID when given, else the current version.
	ResolveObject(ctx context.Context, bucket, key, versionID string) (string, error)
	// GetObject returns the package bytes of one object version.
	GetObject(ctx context.Context, bucket, key, versionID string) ([]byte, error)
}

CodeStore reads deployment packages from versioned S3 buckets.

type ConfigProvider

type ConfigProvider interface {
	GetLambdaWebSettings() Settings
}

ConfigProvider supplies Lambda Web Functions settings from the application config.

type CreateFunctionInput

type CreateFunctionInput struct {
	Revision *RevisionInput
	Endpoint *EndpointInput
	Tags     map[string]string
	Name     string
}

CreateFunctionInput is CreateWebFunction's request.

type CreatedFunction

type CreatedFunction struct {
	Function *Function
	Revision *Revision
	Endpoint *Endpoint
}

CreatedFunction is CreateWebFunction's result.

type CredentialIssuer

type CredentialIssuer interface {
	IssueCredentials(roleARN, sessionName string) (Credentials, error)
}

CredentialIssuer mints execution-role credentials for an execution environment.

type Credentials

type Credentials struct {
	AccessKeyID     string
	SecretAccessKey string
	SessionToken    string
}

Credentials are temporary credentials for an execution role.

type DockerConfig

type DockerConfig struct {
	Runtime Runtime
	Ports   *portalloc.Allocator
	Image   string
	Host    string
	// ListenTimeout bounds how long a started app has to begin listening; zero means 10s.
	ListenTimeout time.Duration
}

DockerConfig configures the docker launcher.

type Endpoint

type Endpoint struct {
	CreatedAt          time.Time
	UpdatedAt          time.Time
	PendingUntil       time.Time
	UpdatePendingUntil time.Time
	RegionDomains      map[string]string
	Replicas           map[string]*Replica
	MaxEnvironments    *int32
	RateLimit          *int32
	AccountID          string
	Description        string
	Region             string
	UpdateReason       string
	FunctionName       string
	Name               string
	ARN                string
	UpdateStatus       string
	Type               string
	AuthType           string
	AutoDeploymentMode string
	DomainName         string
	State              string
	StateReason        string
	Weights            []RevisionWeight
	Regions            []string
}

Endpoint is a network entry point routing traffic to a function's revisions.

type EndpointInput

type EndpointInput struct {
	Scaling            *ScalingInput
	Throttle           *ThrottleInput
	Name               string
	Description        string
	Type               string
	AuthType           string
	AutoDeploymentMode string
	Regions            []string
	Weights            []RevisionWeight
}

EndpointInput is the user-supplied part of an endpoint.

type EndpointUpdate

type EndpointUpdate struct {
	Description        *string
	Scaling            *ScalingInput
	Throttle           *ThrottleInput
	AuthType           string
	AutoDeploymentMode string
	Weights            []RevisionWeight
	WeightsSet         bool
}

EndpointUpdate is a partial endpoint update; nil/empty fields keep the current value.

type EnvStats

type EnvStats struct {
	// CPUTime is the cumulative CPU time the environment has consumed.
	CPUTime time.Duration
	// MemoryBytes is the memory in use; PeakMemoryBytes the peak the runtime reports, or zero.
	MemoryBytes     uint64
	PeakMemoryBytes uint64
}

EnvStats is one resource-use sample of an environment.

type Environment

type Environment interface {
	// Addr is the host and port the app serves plain HTTP on.
	Addr() (string, int)
	// Close stops the environment and releases its resources.
	Close(ctx context.Context)
}

Environment is one running execution environment: an HTTP app serving a revision.

type Filter

type Filter struct {
	Name   string
	Values []string
}

Filter is a list filter.

type Function

type Function struct {
	CreatedAt    time.Time
	UpdatedAt    time.Time
	PendingUntil time.Time
	Tags         map[string]string
	Region       string
	AccountID    string
	Name         string
	ARN          string
	State        string
	StateReason  string
	Policy       string
	PolicyRevID  string
}

Function is a web function.

type GracefulEnvironment

type GracefulEnvironment interface {
	// CloseWithin stops the environment and reports whether the app exited within grace; false means it was killed.
	CloseWithin(ctx context.Context, grace time.Duration) bool
}

GracefulEnvironment is implemented by environments that stop with a SIGTERM grace period.

type Handler

type Handler struct {
	Backend       StorageBackend
	AccountID     string
	DefaultRegion string
}

Handler is the HTTP handler for the Lambda Web Functions control plane and endpoint data plane.

func NewHandler

func NewHandler(backend StorageBackend) *Handler

NewHandler creates a handler backed by backend.

func (*Handler) ChaosOperations

func (h *Handler) ChaosOperations() []string

ChaosOperations returns all operations that can be fault-injected.

func (*Handler) ChaosRegions

func (h *Handler) ChaosRegions() []string

ChaosRegions returns all regions this handler handles.

func (*Handler) ChaosServiceName

func (h *Handler) ChaosServiceName() string

ChaosServiceName returns the service name used for fault rule matching.

func (*Handler) ExtractOperation

func (h *Handler) ExtractOperation(c *echo.Context) string

ExtractOperation returns the operation name for metrics.

func (*Handler) ExtractResource

func (h *Handler) ExtractResource(c *echo.Context) string

ExtractResource returns the resource identifier for metrics.

func (*Handler) GetSupportedOperations

func (h *Handler) GetSupportedOperations() []string

GetSupportedOperations returns the control-plane operations.

func (*Handler) Handler

func (h *Handler) Handler() echo.HandlerFunc

Handler returns the Echo handler.

func (*Handler) IAMAction

func (h *Handler) IAMAction(r *http.Request) string

IAMAction returns the IAM action for a request; ApplicationManaged endpoints are not IAM-gated.

func (*Handler) MatchPriority

func (h *Handler) MatchPriority() int

MatchPriority returns the routing priority; endpoint hosts must win over path-based services.

func (*Handler) Name

func (h *Handler) Name() string

Name returns the service name.

func (*Handler) Reset

func (h *Handler) Reset()

Reset clears all backend state.

func (*Handler) Restore

func (h *Handler) Restore(ctx context.Context, data []byte) error

Restore implements persistence by delegating to the backend.

func (*Handler) RouteMatcher

func (h *Handler) RouteMatcher() service.Matcher

RouteMatcher claims the versioned control-plane path and endpoint data-plane hosts.

func (*Handler) Shutdown

func (h *Handler) Shutdown(_ context.Context)

Shutdown stops every execution environment.

func (*Handler) Snapshot

func (h *Handler) Snapshot(ctx context.Context) []byte

Snapshot implements persistence by delegating to the backend.

type InMemoryBackend

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

InMemoryBackend is the in-memory Lambda Web Functions backend.

func NewInMemoryBackend

func NewInMemoryBackend(accountID string) *InMemoryBackend

NewInMemoryBackend creates a backend for accountID.

func (*InMemoryBackend) AccountSettings

func (b *InMemoryBackend) AccountSettings(region string) AccountSettings

AccountSettings reports the Region's quotas and function count.

func (*InMemoryBackend) Close

func (b *InMemoryBackend) Close()

Close stops every execution environment and refuses new launches.

func (*InMemoryBackend) CreateWebFunction

func (b *InMemoryBackend) CreateWebFunction(
	ctx context.Context, region string, in CreateFunctionInput,
) (*CreatedFunction, error)

CreateWebFunction creates a function with its optional initial revision and endpoint.

func (*InMemoryBackend) CreateWebFunctionEndpoint

func (b *InMemoryBackend) CreateWebFunctionEndpoint(region, ref string, in EndpointInput) (*Endpoint, error)

CreateWebFunctionEndpoint adds an endpoint to a function.

func (*InMemoryBackend) CreateWebFunctionRevision

func (b *InMemoryBackend) CreateWebFunctionRevision(
	ctx context.Context, region, ref string, in RevisionInput,
) (*Revision, error)

CreateWebFunctionRevision creates an immutable revision.

func (*InMemoryBackend) DeleteResourcePolicy

func (b *InMemoryBackend) DeleteResourcePolicy(resourceARN, revisionID string) error

DeleteResourcePolicy removes a function's resource-based policy.

func (*InMemoryBackend) DeleteWebFunction

func (b *InMemoryBackend) DeleteWebFunction(region, ref string) error

DeleteWebFunction deletes a function with its revisions and endpoints.

func (*InMemoryBackend) DeleteWebFunctionEndpoint

func (b *InMemoryBackend) DeleteWebFunctionEndpoint(region, fnRef, epRef string) error

DeleteWebFunctionEndpoint deletes an endpoint; its domain stops serving immediately.

func (*InMemoryBackend) DeleteWebFunctionRevision

func (b *InMemoryBackend) DeleteWebFunctionRevision(region, fnRef, revRef string) error

DeleteWebFunctionRevision deletes a revision no endpoint routes traffic to.

func (*InMemoryBackend) EndpointAuthType

func (b *InMemoryBackend) EndpointAuthType(host string) string

EndpointAuthType returns the authType of the endpoint a Host header names, or "" when none matches.

func (*InMemoryBackend) GetResourcePolicy

func (b *InMemoryBackend) GetResourcePolicy(resourceARN string) (*ResourcePolicy, error)

GetResourcePolicy returns a function's resource-based policy.

func (*InMemoryBackend) GetWebFunction

func (b *InMemoryBackend) GetWebFunction(region, ref string) (*Function, error)

GetWebFunction returns one function.

func (*InMemoryBackend) GetWebFunctionEndpoint

func (b *InMemoryBackend) GetWebFunctionEndpoint(region, fnRef, epRef string) (*Endpoint, error)

GetWebFunctionEndpoint returns one endpoint.

func (*InMemoryBackend) GetWebFunctionRevision

func (b *InMemoryBackend) GetWebFunctionRevision(region, fnRef, revRef string) (*Revision, error)

GetWebFunctionRevision returns one revision.

func (*InMemoryBackend) ListTags

func (b *InMemoryBackend) ListTags(resourceARN string) (map[string]string, error)

ListTags returns a function's tags.

func (*InMemoryBackend) ListWebFunctionEndpoints

func (b *InMemoryBackend) ListWebFunctionEndpoints(
	region, ref string, opts ListOptions,
) (page.Page[*Endpoint], error)

ListWebFunctionEndpoints lists a function's endpoints ordered by name.

func (*InMemoryBackend) ListWebFunctionRevisions

func (b *InMemoryBackend) ListWebFunctionRevisions(
	region, ref string, opts ListOptions,
) (page.Page[*Revision], error)

ListWebFunctionRevisions lists a function's revisions, newest first.

func (*InMemoryBackend) ListWebFunctions

func (b *InMemoryBackend) ListWebFunctions(region string, opts ListOptions) (page.Page[*Function], error)

ListWebFunctions lists the Region's functions ordered by name.

func (*InMemoryBackend) PutResourcePolicy

func (b *InMemoryBackend) PutResourcePolicy(resourceARN, policy, revisionID string) (*ResourcePolicy, error)

PutResourcePolicy replaces a function's resource-based policy.

func (*InMemoryBackend) Reset

func (b *InMemoryBackend) Reset()

Reset clears all backend state and stops every execution environment.

func (*InMemoryBackend) Restore

func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error

Restore deserializes backend state from a JSON snapshot. Execution environments are ephemeral and start again on the next request.

func (*InMemoryBackend) RunVerifier

func (b *InMemoryBackend) RunVerifier(ctx context.Context, interval time.Duration)

RunVerifier calls VerifyRevisions every interval until ctx ends.

func (*InMemoryBackend) ServeEndpoint

func (b *InMemoryBackend) ServeEndpoint(w http.ResponseWriter, r *http.Request) bool

ServeEndpoint serves r when its Host names a web function endpoint. It reports false for any other host.

func (*InMemoryBackend) SetClock

func (b *InMemoryBackend) SetClock(now func() time.Time)

SetClock replaces the wall clock used for lifecycle deadlines and rate windows; nil restores time.Now.

func (*InMemoryBackend) SetCodeStore

func (b *InMemoryBackend) SetCodeStore(cs CodeStore)

SetCodeStore wires the S3 backend revisions pull their code from.

func (*InMemoryBackend) SetCredentialIssuer

func (b *InMemoryBackend) SetCredentialIssuer(i CredentialIssuer)

SetCredentialIssuer wires STS-backed execution-role credentials into environments.

func (*InMemoryBackend) SetEndpointURL

func (b *InMemoryBackend) SetEndpointURL(u string)

SetEndpointURL sets the AWS_ENDPOINT_URL injected into environments.

func (*InMemoryBackend) SetIdleTimeout

func (b *InMemoryBackend) SetIdleTimeout(d time.Duration)

SetIdleTimeout sets how long an environment with no in-flight request lives before it is scaled down.

func (*InMemoryBackend) SetKeyChecker

func (b *InMemoryBackend) SetKeyChecker(k KeyChecker)

SetKeyChecker wires the KMS check run at revision creation and when an execution environment starts.

func (*InMemoryBackend) SetLauncher

func (b *InMemoryBackend) SetLauncher(l Launcher)

SetLauncher enables the data plane: requests to Active endpoints run in launcher-built environments.

func (*InMemoryBackend) SetLifecycleDelay

func (b *InMemoryBackend) SetLifecycleDelay(d time.Duration)

SetLifecycleDelay overrides every Pending/Deleting window; 0 keeps the built-in values.

func (*InMemoryBackend) SetLogSink

func (b *InMemoryBackend) SetLogSink(s LogSink)

SetLogSink wires the CloudWatch Logs backend environments write to.

func (*InMemoryBackend) SetMaxConcurrentInits

func (b *InMemoryBackend) SetMaxConcurrentInits(n int)

SetMaxConcurrentInits sets how many environments of one endpoint may initialize at once; n <= 0 restores the default.

func (*InMemoryBackend) SetMetricEmitter

func (b *InMemoryBackend) SetMetricEmitter(e cwmetric.Emitter)

SetMetricEmitter wires the in-process CloudWatch backend the AWS/Lambda/Web metrics are published to.

func (*InMemoryBackend) SetOrgResolver

func (b *InMemoryBackend) SetOrgResolver(o OrgResolver)

SetOrgResolver wires the organization lookup behind aws:PrincipalOrgID and aws:ResourceOrgID.

func (*InMemoryBackend) SetPrincipalResolver

func (b *InMemoryBackend) SetPrincipalResolver(r awsmeta.PrincipalResolver)

SetPrincipalResolver wires the resolver that maps a request's access key to its IAM principal.

func (*InMemoryBackend) SetRand

func (b *InMemoryBackend) SetRand(intn func(int) int)

SetRand replaces the revision-weight randomness: intn(n) returns a value in [0, n).

func (*InMemoryBackend) SetRateQuotas

func (b *InMemoryBackend) SetRateQuotas(endpoint, account int32)

SetRateQuotas sets the per-endpoint and per-account request-rate quotas (requests per second, per Region), as a quota increase would; values <= 0 restore the defaults of 10,000 and 100,000.

func (*InMemoryBackend) SetRoleAuthorizer

func (b *InMemoryBackend) SetRoleAuthorizer(a roleauth.Authorizer)

SetRoleAuthorizer enforces the Lambda service principal's and the execution role's permissions (KMS key policy, S3 bucket policy, CloudWatch Logs) under IAM enforcement.

func (*InMemoryBackend) SetRoleTrust

func (b *InMemoryBackend) SetRoleTrust(t RoleTrust)

SetRoleTrust wires the IAM/STS trust check run when an execution environment starts.

func (*InMemoryBackend) SetSigV4Secret

func (b *InMemoryBackend) SetSigV4Secret(secret string)

SetSigV4Secret sets the secret IamAuth endpoints verify signatures against; empty means "test".

func (*InMemoryBackend) Snapshot

func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte

Snapshot serializes backend state to JSON.

func (*InMemoryBackend) SweepEnvironments

func (b *InMemoryBackend) SweepEnvironments()

SweepEnvironments drains environments of revisions no endpoint routes to, scales idle environments down (to zero when none is busy) and emits the periodic environment reports.

func (*InMemoryBackend) TagResource

func (b *InMemoryBackend) TagResource(resourceARN string, tags map[string]string) error

TagResource adds or overwrites tags on a function.

func (*InMemoryBackend) UntagResource

func (b *InMemoryBackend) UntagResource(resourceARN string, keys []string) error

UntagResource removes tags from a function.

func (*InMemoryBackend) UpdateWebFunctionEndpoint

func (b *InMemoryBackend) UpdateWebFunctionEndpoint(
	region, fnRef, epRef string, up EndpointUpdate,
) (*Endpoint, error)

UpdateWebFunctionEndpoint applies a partial endpoint update; the change is in effect once updateStatus is Successful.

func (*InMemoryBackend) VerifyRevisions

func (b *InMemoryBackend) VerifyRevisions(ctx context.Context)

VerifyRevisions re-checks that every Active revision's pinned object can still be read by Lambda; a revision whose object version is gone or whose bucket policy no longer admits Lambda becomes Failed, permanently.

type KeyChecker

type KeyChecker interface {
	CheckKey(ctx context.Context, region, keyARN string) error
}

KeyChecker validates that a KMS key can protect a revision: it exists, is enabled and is a symmetric encryption key.

type LaunchSpec

type LaunchSpec struct {
	Revision *Revision
	// Output receives each line the app writes to stdout or stderr; nil drops the output.
	Output func(stderr bool, line string)
	// LogStream is the CloudWatch Logs stream the environment's events go to.
	LogStream string
	// Region is the Region the environment serves in; it differs from the revision's Region on a replica.
	Region string
}

LaunchSpec identifies the revision an environment is started for.

type Launcher

type Launcher interface {
	Launch(ctx context.Context, spec LaunchSpec) (Environment, error)
}

Launcher starts execution environments and returns once the app accepts connections.

func NewDockerLauncher

func NewDockerLauncher(b *InMemoryBackend, cfg DockerConfig) Launcher

NewDockerLauncher returns a Launcher running each revision in a node container.

type ListOptions

type ListOptions struct {
	NextToken  string
	Filters    []Filter
	MaxResults int
}

ListOptions carries list pagination and filters.

type LogSink

type LogSink interface {
	EnsureLogGroupAndStream(ctx context.Context, region, group, stream string) error
	PutLogLines(ctx context.Context, region, group, stream string, lines []string) error
}

LogSink delivers execution environment output to CloudWatch Logs.

type LoggingConfig

type LoggingConfig struct {
	ApplicationLogLevel string
	LogGroup            string
	SystemLogLevel      string
}

LoggingConfig is a revision's logging configuration.

type OrgResolver

type OrgResolver interface {
	OrgIDForAccount(accountID string) string
}

OrgResolver maps an account to the organization it belongs to; the Organizations backend implements it.

type Provider

type Provider struct{}

Provider implements service.Provider for Lambda Web Functions.

func (*Provider) Init

Init initializes the Lambda Web Functions backend and handler.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider name.

type Replica

type Replica struct {
	PendingUntil       time.Time
	UpdatePendingUntil time.Time
	State              string
	StateReason        string
	UpdateStatus       string
	UpdateReason       string
	Weights            []RevisionWeight
	NextWeights        []RevisionWeight
}

Replica is a MultiRegion or PerRegion endpoint's deployment in one non-home Region. The home Region's state is the endpoint's own.

type ResourcePolicy

type ResourcePolicy struct {
	Policy     string
	RevisionID string
}

ResourcePolicy is a function's resource-based policy.

type Revision

type Revision struct {
	PendingUntil  time.Time
	CreatedAt     time.Time
	S3            S3Object
	ARN           string
	Region        string
	AccountID     string
	FunctionName  string
	ID            string
	Description   string
	KmsKeyArn     string
	Runtime       string
	State         string
	StateReason   string
	ServiceConfig ServiceConfig
	Errors        []RevisionError
}

Revision is an immutable snapshot of a web function's code and configuration.

type RevisionError

type RevisionError struct {
	Attribute    string
	ErrorCode    string
	ErrorMessage string
}

RevisionError is one error found while creating a revision.

type RevisionInput

type RevisionInput struct {
	S3            S3Object
	Description   string
	KmsKeyArn     string
	Runtime       string
	ServiceConfig ServiceConfig
}

RevisionInput is the user-supplied part of a revision.

type RevisionWeight

type RevisionWeight struct {
	RevisionID string
	Weight     int32
}

RevisionWeight routes Weight percent of an endpoint's traffic to a revision.

type RoleTrust

type RoleTrust interface {
	CheckServiceRoleTrust(servicePrincipal, roleArn string) error
}

RoleTrust checks that a service principal may assume a role; the STS backend implements it.

type Runtime

type Runtime interface {
	Ping(ctx context.Context) error
	HasImage(ctx context.Context, imageRef string) (bool, error)
	PullImage(ctx context.Context, imageRef string) error
	CreateAndStart(ctx context.Context, spec container.Spec) (string, error)
	StopAndRemove(ctx context.Context, containerID string) error
}

Runtime is the slice of the container runtime the launcher uses.

type S3Object

type S3Object struct {
	Bucket    string
	Key       string
	VersionID string
}

S3Object locates a revision's deployment package.

type ScalingInput

type ScalingInput struct {
	MaxEnvironments *int32
}

ScalingInput carries an endpoint's scalingConfig; a nil MaxEnvironments clears it.

type ServiceConfig

type ServiceConfig struct {
	EnvironmentVariables         map[string]string
	Logging                      *LoggingConfig
	ExecutionRoleArn             string
	EgressNetworkConnectorArn    string
	MaxConcurrencyPerEnvironment int32
	TimeoutSeconds               int32
}

ServiceConfig is a revision's runtime configuration.

type Settings

type Settings struct {
	Engine string `` //nolint:lll // Kong struct tag makes this line long
	/* 239-byte string literal not displayed */
	RuntimeImage string `` //nolint:lll // Kong struct tag makes this line long
	/* 180-byte string literal not displayed */
}

Settings holds service-level configuration for Lambda Web Functions. Kong picks the fields up when the struct is embedded in the root CLI command.

type Snapshottable

type Snapshottable interface {
	Snapshot(ctx context.Context) []byte
	Restore(context.Context, []byte) error
}

Snapshottable is implemented by backends that support snapshot/restore.

type StatsEnvironment

type StatsEnvironment interface {
	Stats(ctx context.Context) (EnvStats, bool)
}

StatsEnvironment is implemented by environments that can report their resource use.

type StorageBackend

type StorageBackend interface {
	CreateWebFunction(ctx context.Context, region string, in CreateFunctionInput) (*CreatedFunction, error)
	GetWebFunction(region, ref string) (*Function, error)
	ListWebFunctions(region string, opts ListOptions) (page.Page[*Function], error)
	DeleteWebFunction(region, ref string) error

	CreateWebFunctionRevision(ctx context.Context, region, ref string, in RevisionInput) (*Revision, error)
	GetWebFunctionRevision(region, fnRef, revRef string) (*Revision, error)
	ListWebFunctionRevisions(region, ref string, opts ListOptions) (page.Page[*Revision], error)
	DeleteWebFunctionRevision(region, fnRef, revRef string) error

	CreateWebFunctionEndpoint(region, ref string, in EndpointInput) (*Endpoint, error)
	GetWebFunctionEndpoint(region, fnRef, epRef string) (*Endpoint, error)
	ListWebFunctionEndpoints(region, ref string, opts ListOptions) (page.Page[*Endpoint], error)
	UpdateWebFunctionEndpoint(region, fnRef, epRef string, up EndpointUpdate) (*Endpoint, error)
	DeleteWebFunctionEndpoint(region, fnRef, epRef string) error

	PutResourcePolicy(resourceARN, policy, revisionID string) (*ResourcePolicy, error)
	GetResourcePolicy(resourceARN string) (*ResourcePolicy, error)
	DeleteResourcePolicy(resourceARN, revisionID string) error

	AccountSettings(region string) AccountSettings

	TagResource(resourceARN string, tags map[string]string) error
	UntagResource(resourceARN string, keys []string) error
	ListTags(resourceARN string) (map[string]string, error)

	// ServeEndpoint serves a data-plane request; it reports false when the Host names no endpoint domain.
	ServeEndpoint(w http.ResponseWriter, r *http.Request) bool
	// EndpointAuthType returns the authType of the endpoint a Host names, or "".
	EndpointAuthType(host string) string

	Reset()
}

StorageBackend is the Lambda Web Functions backend.

type ThrottleInput

type ThrottleInput struct {
	RateLimit *int32
}

ThrottleInput carries an endpoint's throttleConfig; a nil RateLimit clears it.

Jump to

Keyboard shortcuts

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