Documentation
¶
Index ¶
- Constants
- Variables
- func FunctionARNOf(resourceARN string) (string, bool)
- func IsEndpointHost(host string) bool
- func RegionOf(resourceARN string) (string, bool)
- type AccountSettings
- type CodeStore
- type ConfigProvider
- type CreateFunctionInput
- type CreatedFunction
- type CredentialIssuer
- type Credentials
- type DockerConfig
- type Endpoint
- type EndpointInput
- type EndpointUpdate
- type EnvStats
- type Environment
- type Filter
- type Function
- type GracefulEnvironment
- type Handler
- func (h *Handler) ChaosOperations() []string
- func (h *Handler) ChaosRegions() []string
- func (h *Handler) ChaosServiceName() string
- func (h *Handler) ExtractOperation(c *echo.Context) string
- func (h *Handler) ExtractResource(c *echo.Context) string
- func (h *Handler) GetSupportedOperations() []string
- func (h *Handler) Handler() echo.HandlerFunc
- func (h *Handler) IAMAction(r *http.Request) string
- func (h *Handler) MatchPriority() int
- func (h *Handler) Name() string
- func (h *Handler) Reset()
- func (h *Handler) Restore(ctx context.Context, data []byte) error
- func (h *Handler) RouteMatcher() service.Matcher
- func (h *Handler) Shutdown(_ context.Context)
- func (h *Handler) Snapshot(ctx context.Context) []byte
- type InMemoryBackend
- func (b *InMemoryBackend) AccountSettings(region string) AccountSettings
- func (b *InMemoryBackend) Close()
- func (b *InMemoryBackend) CreateWebFunction(ctx context.Context, region string, in CreateFunctionInput) (*CreatedFunction, error)
- func (b *InMemoryBackend) CreateWebFunctionEndpoint(region, ref string, in EndpointInput) (*Endpoint, error)
- func (b *InMemoryBackend) CreateWebFunctionRevision(ctx context.Context, region, ref string, in RevisionInput) (*Revision, error)
- func (b *InMemoryBackend) DeleteResourcePolicy(resourceARN, revisionID string) error
- func (b *InMemoryBackend) DeleteWebFunction(region, ref string) error
- func (b *InMemoryBackend) DeleteWebFunctionEndpoint(region, fnRef, epRef string) error
- func (b *InMemoryBackend) DeleteWebFunctionRevision(region, fnRef, revRef string) error
- func (b *InMemoryBackend) EndpointAuthType(host string) string
- func (b *InMemoryBackend) GetResourcePolicy(resourceARN string) (*ResourcePolicy, error)
- func (b *InMemoryBackend) GetWebFunction(region, ref string) (*Function, error)
- func (b *InMemoryBackend) GetWebFunctionEndpoint(region, fnRef, epRef string) (*Endpoint, error)
- func (b *InMemoryBackend) GetWebFunctionRevision(region, fnRef, revRef string) (*Revision, error)
- func (b *InMemoryBackend) ListTags(resourceARN string) (map[string]string, error)
- func (b *InMemoryBackend) ListWebFunctionEndpoints(region, ref string, opts ListOptions) (page.Page[*Endpoint], error)
- func (b *InMemoryBackend) ListWebFunctionRevisions(region, ref string, opts ListOptions) (page.Page[*Revision], error)
- func (b *InMemoryBackend) ListWebFunctions(region string, opts ListOptions) (page.Page[*Function], error)
- func (b *InMemoryBackend) PutResourcePolicy(resourceARN, policy, revisionID string) (*ResourcePolicy, error)
- func (b *InMemoryBackend) Reset()
- func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
- func (b *InMemoryBackend) RunVerifier(ctx context.Context, interval time.Duration)
- func (b *InMemoryBackend) ServeEndpoint(w http.ResponseWriter, r *http.Request) bool
- func (b *InMemoryBackend) SetClock(now func() time.Time)
- func (b *InMemoryBackend) SetCodeStore(cs CodeStore)
- func (b *InMemoryBackend) SetCredentialIssuer(i CredentialIssuer)
- func (b *InMemoryBackend) SetEndpointURL(u string)
- func (b *InMemoryBackend) SetIdleTimeout(d time.Duration)
- func (b *InMemoryBackend) SetKeyChecker(k KeyChecker)
- func (b *InMemoryBackend) SetLauncher(l Launcher)
- func (b *InMemoryBackend) SetLifecycleDelay(d time.Duration)
- func (b *InMemoryBackend) SetLogSink(s LogSink)
- func (b *InMemoryBackend) SetMaxConcurrentInits(n int)
- func (b *InMemoryBackend) SetMetricEmitter(e cwmetric.Emitter)
- func (b *InMemoryBackend) SetOrgResolver(o OrgResolver)
- func (b *InMemoryBackend) SetPrincipalResolver(r awsmeta.PrincipalResolver)
- func (b *InMemoryBackend) SetRand(intn func(int) int)
- func (b *InMemoryBackend) SetRateQuotas(endpoint, account int32)
- func (b *InMemoryBackend) SetRoleAuthorizer(a roleauth.Authorizer)
- func (b *InMemoryBackend) SetRoleTrust(t RoleTrust)
- func (b *InMemoryBackend) SetSigV4Secret(secret string)
- func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
- func (b *InMemoryBackend) SweepEnvironments()
- func (b *InMemoryBackend) TagResource(resourceARN string, tags map[string]string) error
- func (b *InMemoryBackend) UntagResource(resourceARN string, keys []string) error
- func (b *InMemoryBackend) UpdateWebFunctionEndpoint(region, fnRef, epRef string, up EndpointUpdate) (*Endpoint, error)
- func (b *InMemoryBackend) VerifyRevisions(ctx context.Context)
- type KeyChecker
- type LaunchSpec
- type Launcher
- type ListOptions
- type LogSink
- type LoggingConfig
- type OrgResolver
- type Provider
- type Replica
- type ResourcePolicy
- type Revision
- type RevisionError
- type RevisionInput
- type RevisionWeight
- type RoleTrust
- type Runtime
- type S3Object
- type ScalingInput
- type ServiceConfig
- type Settings
- type Snapshottable
- type StatsEnvironment
- type StorageBackend
- type ThrottleInput
Constants ¶
const ( EngineStub = "stub" EngineDocker = "docker" )
Engine modes for the web function data plane.
const ServicePrincipal = "lambda.amazonaws.com"
ServicePrincipal is the service principal an execution role's trust policy must allow.
Variables ¶
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.
var ErrAccessDenied = errors.New("access denied")
ErrAccessDenied maps to AccessDeniedException.
ErrCodeUnavailable is returned when a revision's code package cannot be read.
var ErrNoSnapshot = errors.New("backend does not support restore")
ErrNoSnapshot is returned when a backend does not support snapshot/restore.
var ErrQuotaExceeded = errors.New("quota exceeded")
ErrQuotaExceeded maps to ServiceQuotaExceededException.
ErrRuntimeUnavailable is returned when the container runtime is unreachable or the sandbox image cannot be had.
Functions ¶
func FunctionARNOf ¶
FunctionARNOf returns the web function ARN that owns a function, revision or endpoint ARN.
func IsEndpointHost ¶
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).
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 ¶
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 ¶
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 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 ¶
ChaosOperations returns all operations that can be fault-injected.
func (*Handler) ChaosRegions ¶
ChaosRegions returns all regions this handler handles.
func (*Handler) ChaosServiceName ¶
ChaosServiceName returns the service name used for fault rule matching.
func (*Handler) ExtractOperation ¶
ExtractOperation returns the operation name for metrics.
func (*Handler) ExtractResource ¶
ExtractResource returns the resource identifier for metrics.
func (*Handler) GetSupportedOperations ¶
GetSupportedOperations returns the control-plane operations.
func (*Handler) Handler ¶
func (h *Handler) Handler() echo.HandlerFunc
Handler returns the Echo handler.
func (*Handler) IAMAction ¶
IAMAction returns the IAM action for a request; ApplicationManaged endpoints are not IAM-gated.
func (*Handler) MatchPriority ¶
MatchPriority returns the routing priority; endpoint hosts must win over path-based services.
func (*Handler) RouteMatcher ¶
RouteMatcher claims the versioned control-plane path and endpoint data-plane hosts.
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 ¶
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 ¶
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 ¶
LoggingConfig is a revision's logging configuration.
type OrgResolver ¶
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 ¶
func (p *Provider) Init(ctx *service.AppContext) (service.Registerable, error)
Init initializes the Lambda Web Functions backend and handler.
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 ¶
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 ¶
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 ¶
RevisionWeight routes Weight percent of an endpoint's traffic to a revision.
type RoleTrust ¶
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 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 ¶
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.
Source Files
¶
- clock.go
- code.go
- dataplane.go
- emf.go
- endpoints.go
- engine_docker.go
- envlogs.go
- errors.go
- fleet.go
- functions.go
- handler.go
- handler_ops.go
- inputs.go
- interfaces.go
- invokeauth.go
- metrics.go
- models.go
- persistence.go
- policy.go
- policy_public.go
- provider.go
- replication.go
- revisions.go
- routes.go
- runtime.go
- services.go
- settings.go
- store.go
- store_setup.go
- validation.go
- wire.go
- wire_convert.go