Documentation
¶
Index ¶
- type Environment
- type EventSourceMapping
- type EventSourceMappingStore
- func (s *EventSourceMappingStore) Create(m *EventSourceMapping)
- func (s *EventSourceMappingStore) Delete(uuid string) bool
- func (s *EventSourceMappingStore) Get(uuid string) (*EventSourceMapping, bool)
- func (s *EventSourceMappingStore) List(eventSourceArn, functionName string) []*EventSourceMapping
- func (s *EventSourceMappingStore) SetStopCh(uuid string, ch chan struct{})
- func (s *EventSourceMappingStore) StopAll()
- type Executor
- type Function
- type FunctionAlias
- type FunctionStore
- func (s *FunctionStore) Create(f *Function) (*Function, error)
- func (s *FunctionStore) Delete(name string) bool
- func (s *FunctionStore) Get(name string) (*Function, bool)
- func (s *FunctionStore) List() []*Function
- func (s *FunctionStore) UpdateCode(name string, code []byte, codeSha256 string, codeSize int64) (*Function, error)
- func (s *FunctionStore) UpdateConfiguration(name string, updates map[string]any) (*Function, error)
- type FunctionURLConfig
- type FunctionURLCors
- type FunctionVersion
- type LambdaLogEntry
- type LambdaService
- func (s *LambdaService) Actions() []service.Action
- func (s *LambdaService) ExportState() (json.RawMessage, error)
- func (s *LambdaService) GetEventSourceMappings() []*EventSourceMapping
- func (s *LambdaService) GetEventSourceMappingsSummary() (arns []string, funcNames []string)
- func (s *LambdaService) GetFunctionNames() []string
- func (s *LambdaService) HandleRequest(ctx *service.RequestContext) (*service.Response, error)
- func (s *LambdaService) HealthCheck() error
- func (s *LambdaService) ImportState(data json.RawMessage) error
- func (s *LambdaService) InvokeDirect(functionName string, event []byte) ([]byte, error)
- func (s *LambdaService) Logs() *LogBuffer
- func (s *LambdaService) Name() string
- func (s *LambdaService) ResourceSchemas() []schema.ResourceSchema
- func (s *LambdaService) SetLocator(locator ServiceLocator)
- func (s *LambdaService) Store() *FunctionStore
- type Layer
- type LayerStore
- func (s *LayerStore) DeleteVersion(name string, version int64) bool
- func (s *LayerStore) GetVersion(name string, version int64) (*LayerVersion, bool)
- func (s *LayerStore) ListLayers() []*Layer
- func (s *LayerStore) ListVersions(name string) []*LayerVersion
- func (s *LayerStore) PublishVersion(name, description string, runtimes, architectures []string, code []byte) *LayerVersion
- type LayerVersion
- type LogBuffer
- type S3ObjectGetter
- type SQSDirectAccess
- type ServiceLocator
- type VersionStore
- func (s *VersionStore) AddPermission(funcName string, statement map[string]any)
- func (s *VersionStore) CreateAlias(funcName, funcArn, aliasName, funcVersion, description string) *FunctionAlias
- func (s *VersionStore) CreateURL(funcName, funcArn, authType string, cors *FunctionURLCors) *FunctionURLConfig
- func (s *VersionStore) DeleteAlias(funcName, aliasName string) bool
- func (s *VersionStore) DeleteConcurrency(funcName string)
- func (s *VersionStore) DeleteURL(funcName string) bool
- func (s *VersionStore) GetAlias(funcName, aliasName string) (*FunctionAlias, bool)
- func (s *VersionStore) GetConcurrency(funcName string) (int, bool)
- func (s *VersionStore) GetPolicy(funcName string) []map[string]any
- func (s *VersionStore) GetTags(arn string) map[string]string
- func (s *VersionStore) GetURL(funcName string) (*FunctionURLConfig, bool)
- func (s *VersionStore) ListAliases(funcName string) []*FunctionAlias
- func (s *VersionStore) ListVersions(funcName string) []*FunctionVersion
- func (s *VersionStore) PublishVersion(f *Function, description string) *FunctionVersion
- func (s *VersionStore) PutConcurrency(funcName string, reserved int)
- func (s *VersionStore) RemovePermission(funcName, statementID string) bool
- func (s *VersionStore) RemoveTags(arn string, keys []string)
- func (s *VersionStore) SetTags(arn string, tags map[string]string)
- func (s *VersionStore) UpdateAlias(funcName, aliasName, funcVersion, description string) (*FunctionAlias, bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Environment ¶
Environment holds Lambda environment variables.
type EventSourceMapping ¶
type EventSourceMapping struct {
UUID string `json:"UUID"`
EventSourceArn string `json:"EventSourceArn"`
FunctionArn string `json:"FunctionArn"`
FunctionName string `json:"-"`
BatchSize int `json:"BatchSize"`
Enabled bool `json:"Enabled"`
State string `json:"State"`
LastModified string `json:"LastModified"`
MaximumBatchingWindowInSeconds int `json:"MaximumBatchingWindowInSeconds"`
}
EventSourceMapping represents a Lambda event source mapping (SQS → Lambda).
type EventSourceMappingStore ¶
type EventSourceMappingStore struct {
// contains filtered or unexported fields
}
EventSourceMappingStore manages event source mappings.
func NewEventSourceMappingStore ¶
func NewEventSourceMappingStore() *EventSourceMappingStore
NewEventSourceMappingStore returns a new store.
func (*EventSourceMappingStore) Create ¶
func (s *EventSourceMappingStore) Create(m *EventSourceMapping)
Create adds a new event source mapping.
func (*EventSourceMappingStore) Delete ¶
func (s *EventSourceMappingStore) Delete(uuid string) bool
Delete removes a mapping by UUID.
func (*EventSourceMappingStore) Get ¶
func (s *EventSourceMappingStore) Get(uuid string) (*EventSourceMapping, bool)
Get returns a mapping by UUID.
func (*EventSourceMappingStore) List ¶
func (s *EventSourceMappingStore) List(eventSourceArn, functionName string) []*EventSourceMapping
List returns all mappings, optionally filtered by EventSourceArn or FunctionName.
func (*EventSourceMappingStore) SetStopCh ¶
func (s *EventSourceMappingStore) SetStopCh(uuid string, ch chan struct{})
SetStopCh records the stop channel for a poller.
func (*EventSourceMappingStore) StopAll ¶
func (s *EventSourceMappingStore) StopAll()
StopAll stops all running pollers.
type Executor ¶
type Executor struct {
// contains filtered or unexported fields
}
Executor manages function code extraction and execution.
func (*Executor) InvalidateCache ¶
InvalidateCache removes the cached temp directory for a function, forcing re-extraction on next invocation.
type Function ¶
type Function struct {
FunctionName string
FunctionArn string
Runtime string
Role string
Handler string
Description string
Timeout int
MemorySize int
CodeSha256 string
CodeSize int64
Version string
LastModified string
Environment *Environment
Code []byte // raw zip bytes
}
Function represents an AWS Lambda function.
type FunctionAlias ¶
FunctionAlias maps a name to a function version.
type FunctionStore ¶
type FunctionStore struct {
// contains filtered or unexported fields
}
FunctionStore manages Lambda functions in memory.
func NewStore ¶
func NewStore(accountID, region string) *FunctionStore
NewStore returns a new empty FunctionStore.
func (*FunctionStore) Create ¶
func (s *FunctionStore) Create(f *Function) (*Function, error)
Create stores a new Lambda function. Returns an error if the function already exists.
func (*FunctionStore) Delete ¶
func (s *FunctionStore) Delete(name string) bool
Delete removes a function by name. Returns false if not found.
func (*FunctionStore) Get ¶
func (s *FunctionStore) Get(name string) (*Function, bool)
Get retrieves a function by name.
func (*FunctionStore) UpdateCode ¶
func (s *FunctionStore) UpdateCode(name string, code []byte, codeSha256 string, codeSize int64) (*Function, error)
UpdateCode replaces the code for a function.
func (*FunctionStore) UpdateConfiguration ¶
UpdateConfiguration updates the non-code configuration of a function.
type FunctionURLConfig ¶
type FunctionURLConfig struct {
FunctionArn string
FunctionUrl string
AuthType string // "NONE" or "AWS_IAM"
Cors *FunctionURLCors
CreationTime string
LastModified string
}
FunctionURLConfig stores a Lambda function URL configuration.
type FunctionURLCors ¶
type FunctionVersion ¶
type FunctionVersion struct {
FunctionName string
FunctionArn string
Version string
Description string
Runtime string
Handler string
Role string
CodeSha256 string
CodeSize int64
Timeout int
MemorySize int
LastModified string
}
FunctionVersion represents a published version of a Lambda function.
type LambdaLogEntry ¶
type LambdaLogEntry struct {
Timestamp time.Time `json:"timestamp"`
FunctionName string `json:"functionName"`
RequestID string `json:"requestId"`
Message string `json:"message"`
Stream string `json:"stream"` // "stdout" or "stderr"
}
LambdaLogEntry represents a single log line from a Lambda execution.
type LambdaService ¶
type LambdaService struct {
// contains filtered or unexported fields
}
LambdaService is the cloudmock implementation of the AWS Lambda API.
func New ¶
func New(accountID, region string) *LambdaService
New returns a new LambdaService for the given AWS account ID and region.
func (*LambdaService) Actions ¶
func (s *LambdaService) Actions() []service.Action
Actions returns the list of Lambda API actions supported by this service. Lambda uses REST path-based routing, so these are descriptive only.
func (*LambdaService) ExportState ¶
func (s *LambdaService) ExportState() (json.RawMessage, error)
ExportState returns a JSON snapshot of all Lambda functions.
func (*LambdaService) GetEventSourceMappings ¶
func (s *LambdaService) GetEventSourceMappings() []*EventSourceMapping
GetEventSourceMappings returns all event source mappings for topology queries.
func (*LambdaService) GetEventSourceMappingsSummary ¶
func (s *LambdaService) GetEventSourceMappingsSummary() (arns []string, funcNames []string)
GetEventSourceMappingsSummary returns parallel slices of event source ARNs and function names for topology building without exposing internal types.
func (*LambdaService) GetFunctionNames ¶
func (s *LambdaService) GetFunctionNames() []string
GetFunctionNames returns all Lambda function names for topology queries.
func (*LambdaService) HandleRequest ¶
func (s *LambdaService) HandleRequest(ctx *service.RequestContext) (*service.Response, error)
HandleRequest routes an incoming Lambda request to the appropriate handler. Lambda uses REST path-based routing.
Routes:
POST /2015-03-31/functions -> CreateFunction
GET /2015-03-31/functions -> ListFunctions
GET /2015-03-31/functions/{name} -> GetFunction
DELETE /2015-03-31/functions/{name} -> DeleteFunction
PUT /2015-03-31/functions/{name}/code -> UpdateFunctionCode
POST /2015-03-31/functions/{name}/invocations -> Invoke
GET /2015-03-31/functions/{name}/configuration -> GetFunctionConfiguration
PUT /2015-03-31/functions/{name}/configuration -> UpdateFunctionConfiguration
func (*LambdaService) HealthCheck ¶
func (s *LambdaService) HealthCheck() error
HealthCheck always returns nil (no external dependencies).
func (*LambdaService) ImportState ¶
func (s *LambdaService) ImportState(data json.RawMessage) error
ImportState restores Lambda state from a JSON snapshot.
func (*LambdaService) InvokeDirect ¶
func (s *LambdaService) InvokeDirect(functionName string, event []byte) ([]byte, error)
InvokeDirect invokes a Lambda function by name with the given event payload. This is used for cross-service delivery (SNS → Lambda, EventBridge → Lambda, SQS → Lambda event source mappings). Returns the result bytes, or an error.
func (*LambdaService) Logs ¶
func (s *LambdaService) Logs() *LogBuffer
Logs returns the Lambda execution log buffer.
func (*LambdaService) Name ¶
func (s *LambdaService) Name() string
Name returns the AWS service name used for routing.
func (*LambdaService) ResourceSchemas ¶
func (s *LambdaService) ResourceSchemas() []schema.ResourceSchema
ResourceSchemas returns the schema for Lambda function resources.
func (*LambdaService) SetLocator ¶
func (s *LambdaService) SetLocator(locator ServiceLocator)
SetLocator sets the service locator for cross-service communication (S3 code source).
func (*LambdaService) Store ¶
func (s *LambdaService) Store() *FunctionStore
Store returns the function store (used by event source mapping pollers).
type Layer ¶
type Layer struct {
LayerName string
LayerArn string
Versions []*LayerVersion
}
Layer represents a Lambda layer.
type LayerStore ¶
type LayerStore struct {
// contains filtered or unexported fields
}
LayerStore manages Lambda layers.
func NewLayerStore ¶
func NewLayerStore(accountID, region string) *LayerStore
func (*LayerStore) DeleteVersion ¶
func (s *LayerStore) DeleteVersion(name string, version int64) bool
func (*LayerStore) GetVersion ¶
func (s *LayerStore) GetVersion(name string, version int64) (*LayerVersion, bool)
func (*LayerStore) ListLayers ¶
func (s *LayerStore) ListLayers() []*Layer
func (*LayerStore) ListVersions ¶
func (s *LayerStore) ListVersions(name string) []*LayerVersion
func (*LayerStore) PublishVersion ¶
func (s *LayerStore) PublishVersion(name, description string, runtimes, architectures []string, code []byte) *LayerVersion
type LayerVersion ¶
type LayerVersion struct {
LayerName string
LayerArn string
LayerVersionArn string
Version int64
Description string
CompatibleRuntimes []string
CompatibleArchitectures []string
CreatedDate string
CodeSha256 string
CodeSize int64
Content []byte
}
LayerVersion represents a specific version of a layer.
type LogBuffer ¶
type LogBuffer struct {
// contains filtered or unexported fields
}
LogBuffer is a thread-safe circular buffer of Lambda log entries per function.
func NewLogBuffer ¶
NewLogBuffer creates a LogBuffer with the given per-function capacity.
func (*LogBuffer) Add ¶
func (lb *LogBuffer) Add(entry LambdaLogEntry)
Add appends a log entry to the buffer.
func (*LogBuffer) Recent ¶
func (lb *LogBuffer) Recent(functionName string, limit int) []LambdaLogEntry
Recent returns up to limit entries, newest first. If functionName is non-empty, only matching entries are returned.
func (*LogBuffer) SetOnEmit ¶
func (lb *LogBuffer) SetOnEmit(fn func(LambdaLogEntry))
SetOnEmit sets a callback invoked for every log entry added.
type S3ObjectGetter ¶
S3ObjectGetter allows retrieving object data from the S3 service.
type SQSDirectAccess ¶
type SQSDirectAccess interface {
EnqueueDirect(queueName, messageBody string) bool
PollMessages(queueName string, maxCount, visibilityTimeout int) (messageIDs, bodies, receiptHandles []string, ok bool)
AckMessage(queueName, receiptHandle string) bool
}
SQSDirectAccess provides direct access to SQS queue internals for event source mapping. The SQS service satisfies this interface.
type ServiceLocator ¶
ServiceLocator provides access to other services for cross-service communication.
type VersionStore ¶
type VersionStore struct {
// contains filtered or unexported fields
}
VersionStore manages versions, aliases, URLs, permissions, concurrency, and tags.
func NewVersionStore ¶
func NewVersionStore(accountID, region string) *VersionStore
func (*VersionStore) AddPermission ¶
func (s *VersionStore) AddPermission(funcName string, statement map[string]any)
func (*VersionStore) CreateAlias ¶
func (s *VersionStore) CreateAlias(funcName, funcArn, aliasName, funcVersion, description string) *FunctionAlias
func (*VersionStore) CreateURL ¶
func (s *VersionStore) CreateURL(funcName, funcArn, authType string, cors *FunctionURLCors) *FunctionURLConfig
func (*VersionStore) DeleteAlias ¶
func (s *VersionStore) DeleteAlias(funcName, aliasName string) bool
func (*VersionStore) DeleteConcurrency ¶
func (s *VersionStore) DeleteConcurrency(funcName string)
func (*VersionStore) DeleteURL ¶
func (s *VersionStore) DeleteURL(funcName string) bool
func (*VersionStore) GetAlias ¶
func (s *VersionStore) GetAlias(funcName, aliasName string) (*FunctionAlias, bool)
func (*VersionStore) GetConcurrency ¶
func (s *VersionStore) GetConcurrency(funcName string) (int, bool)
func (*VersionStore) GetURL ¶
func (s *VersionStore) GetURL(funcName string) (*FunctionURLConfig, bool)
func (*VersionStore) ListAliases ¶
func (s *VersionStore) ListAliases(funcName string) []*FunctionAlias
func (*VersionStore) ListVersions ¶
func (s *VersionStore) ListVersions(funcName string) []*FunctionVersion
func (*VersionStore) PublishVersion ¶
func (s *VersionStore) PublishVersion(f *Function, description string) *FunctionVersion
func (*VersionStore) PutConcurrency ¶
func (s *VersionStore) PutConcurrency(funcName string, reserved int)
func (*VersionStore) RemovePermission ¶
func (s *VersionStore) RemovePermission(funcName, statementID string) bool
func (*VersionStore) RemoveTags ¶
func (s *VersionStore) RemoveTags(arn string, keys []string)
func (*VersionStore) UpdateAlias ¶
func (s *VersionStore) UpdateAlias(funcName, aliasName, funcVersion, description string) (*FunctionAlias, bool)