runtime

package
v0.428.2 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2025 License: AGPL-3.0 Imports: 53 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Handles API requests.
	RuntimeModeApi = "api"

	// Handles events from SQS.
	RuntimeModeSubscriber = "subscriber"

	// Handles both manual and scheduled jobs.
	RuntimeModeJob = "job"

	// Handles flows.
	RuntimeModeFlow = "flow"
)
View Source
const (
	JobStatusProcessing = "processing"
	JobStatusSuccess    = "success"
	JobStatusFailed     = "failed"
)

Variables

This section is empty.

Functions

func GetRDSConnection

func GetRDSConnection(ctx context.Context, args *GetRDSConnectionArgs) (string, error)

func SsmParameterName

func SsmParameterName(projectName string, env string, paramName string) string

Types

type CustomS3EndpointResolverV2

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

CustomS3EndpointResolverV2 allows us to use a custom endpoint.

If a custom endpoint is set we need to use a custom resolver. Just settng the base endpoint isn't enough for S3 as the default resolver uses the bucket name as a sub-domain, which likely won't work with the custom endpoint. By implementing a full resolver we can force it to be the endpoint we want.

func (*CustomS3EndpointResolverV2) ResolveEndpoint

type EventPayload

type EventPayload struct {
	Subscriber  string        `json:"subscriber,omitempty"`
	Event       *events.Event `json:"event,omitempty"`
	Traceparent string        `json:"traceparent,omitempty"`
}

type GetRDSConnectionArgs

type GetRDSConnectionArgs struct {
	Cfg       aws.Config
	Endpoint  string
	DbName    string
	SecretArn string
}

type Handler

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

func New

func New(ctx context.Context, args *HandlerArgs) (*Handler, error)

func (*Handler) EventHandler

func (h *Handler) EventHandler(ctx context.Context, event lambdaevents.SQSEvent) error

func (*Handler) FlowHandler added in v0.413.1

func (h *Handler) FlowHandler(ctx context.Context, event lambdaevents.SQSEvent) error

func (*Handler) JobHandler

func (h *Handler) JobHandler(ctx context.Context, event *RunJobPayload) error

func (*Handler) Stop

func (h *Handler) Stop() error

type HandlerArgs

type HandlerArgs struct {
	// One of the logrus log levels, if omitted defaults to "error"
	LogLevel string

	// File-system path for the proto JSON for the Keel schema
	SchemaPath string
	// File-system path to a JSON file containing the Keel config. Note this should be a JSON file, not YAML.
	ConfigPath string
	// The project name. This needs to be provided as for local environments there won't necessarily be a project name in the config.
	ProjectName string
	// The env. For local environments will be "development" or "test", for deployed environments it's the user-provided env name.
	Env string
	// URL of SQS queue for subscriber events
	EventsQueueURL string
	// URL of SQS queue used to trigger orchestrate flows
	FlowsQueueURL string
	// ARN fo the iam role for scheduling
	SchedulerRoleARN string
	// Full ARN of functions Lambda.
	FunctionsARN string
	// Bucket name used for files and job inputs
	BucketName string
	// List of secret names to looad from SSM
	SecretNames []string
	// Webhook URL to use for sending job run updates
	JobsWebhookURL string
	// If true then tracing data will be exported using the GRPC exporter, otherwise a no-nop exporter will be used.
	TracingEnabled bool

	// RDS config (can be omitted if using an external db or local postgres)
	DBEndpoint  string
	DBName      string
	DBSecretArn string

	// If this is set all AWS operations will be directed to this endpoint by configuring the clients to use it.
	// This is used for mocking the API calls in integration tests
	AWSEndpoint string
}

type JobStatusWebhookPayload

type JobStatusWebhookPayload struct {
	// The ID provided in the payload
	ID string `json:"id"`
	// The name of the job
	Name        string `json:"name"`
	ProjectName string `json:"projectName"`
	Env         string `json:"env"`
	// One of "processing", "success", or "failed"
	Status string `json:"status"`
	// The OTEL trace ID for the job run
	TraceID   string `json:"traceId"`
	Timestamp string `json:"timestamp"`
}

type LambdaErrorResponse

type LambdaErrorResponse struct {
	ErrorType    string   `json:"errorType,omitempty"`
	ErrorMessage string   `json:"errorMessage,omitempty"`
	Trace        []string `json:"stackTrace,omitempty"`
}

type NoopExporter

type NoopExporter struct {
}

func (*NoopExporter) ExportSpans

func (n *NoopExporter) ExportSpans(ctx context.Context, spans []sdktrace.ReadOnlySpan) error

func (*NoopExporter) Shutdown

func (n *NoopExporter) Shutdown(ctx context.Context) error

type ResponseWriter

type ResponseWriter struct {
	StatusCode int
	Body       bytes.Buffer
	HeaderMap  http.Header
}

ResponseWriter is a minimal implementation of http.ResponseWriter that simply stores the response for later inspection.

func (*ResponseWriter) Header

func (c *ResponseWriter) Header() http.Header

Header needed to implement http.ResponseWriter.

func (*ResponseWriter) Write

func (c *ResponseWriter) Write(b []byte) (int, error)

Write needed to implement http.ResponseWriter.

func (*ResponseWriter) WriteHeader

func (c *ResponseWriter) WriteHeader(statusCode int)

WriteHeader needed to implement http.ResponseWriter.

type RunJobPayload

type RunJobPayload struct {
	// An ID for this job, if provided then it will be sent in the webhook status payload. Will be empty for scheduled jobs.
	ID string `json:"id"`
	// The name of the job to run e.g. MySpecialJob
	Name string `json:"name"`
	// An auth token to use to determine the identity running the job. Will be empty for scheduled jobs.
	Token string `json:"token"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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