serverless

package
v0.0.0-...-0c4b637 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package serverless holds the provider-agnostic core of the secrets-sync serverless entrypoints. The AWS Lambda and Azure Functions binaries are thin adapters that decode their platform's trigger into a Request and call Handle.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalResponse

func MarshalResponse(resp Response) string

MarshalResponse JSON-encodes a Response, returning "{}" on the (unreachable) marshal error so adapters always have a body.

Types

type ProviderSession

type ProviderSession struct {
	DelegateAuth       bool   `json:"delegate_auth,omitempty"`
	VaultAddress       string `json:"vault_address,omitempty"`
	VaultNamespace     string `json:"vault_namespace,omitempty"`
	VaultToken         string `json:"vault_token,omitempty"`
	AWSRegion          string `json:"aws_region,omitempty"`
	AWSAccessKeyID     string `json:"aws_access_key_id,omitempty"`
	AWSSecretAccessKey string `json:"aws_secret_access_key,omitempty"`
	AWSSessionToken    string `json:"aws_session_token,omitempty"`
	AWSRoleARN         string `json:"aws_role_arn,omitempty"`
	AWSEndpointURL     string `json:"aws_endpoint_url,omitempty"`
}

ProviderSession carries runtime auth material supplied by the caller.

type Request

type Request struct {
	ConfigYAML     string          `json:"config_yaml,omitempty"`
	ConfigPath     string          `json:"config_path,omitempty"`
	ConfigS3Bucket string          `json:"config_s3_bucket,omitempty"`
	ConfigS3Key    string          `json:"config_s3_key,omitempty"`
	Options        RequestOptions  `json:"options,omitempty"`
	Session        ProviderSession `json:"session,omitempty"`
}

Request is the trigger payload for a serverless pipeline run.

type RequestOptions

type RequestOptions struct {
	Operation       string `json:"operation,omitempty"`
	Targets         string `json:"targets,omitempty"`
	DryRun          bool   `json:"dry_run,omitempty"`
	ContinueOnError bool   `json:"continue_on_error,omitempty"`
	Parallelism     int    `json:"parallelism,omitempty"`
	ComputeDiff     bool   `json:"compute_diff,omitempty"`
	OutputFormat    string `json:"output_format,omitempty"`
	ShowValues      bool   `json:"show_values,omitempty"`
}

RequestOptions controls pipeline execution.

type Response

type Response struct {
	Success          bool         `json:"success"`
	TargetCount      int          `json:"target_count"`
	SecretsProcessed int          `json:"secrets_processed"`
	SecretsAdded     int          `json:"secrets_added"`
	SecretsModified  int          `json:"secrets_modified"`
	SecretsRemoved   int          `json:"secrets_removed"`
	SecretsUnchanged int          `json:"secrets_unchanged"`
	DurationMs       int64        `json:"duration_ms"`
	ErrorMessage     string       `json:"error_message,omitempty"`
	Results          []ResultItem `json:"results"`
	DiffOutput       string       `json:"diff_output,omitempty"`
}

Response is the serverless run summary.

func Handle

func Handle(ctx context.Context, event Request) Response

Handle runs the pipeline for a Request and returns a Response. It never returns an error; failures are reported in Response.Success/ErrorMessage so every platform adapter can serialize a uniform body.

type ResultItem

type ResultItem struct {
	Target     string                 `json:"target"`
	Phase      string                 `json:"phase"`
	Operation  string                 `json:"operation"`
	Success    bool                   `json:"success"`
	Error      string                 `json:"error,omitempty"`
	DurationMs int64                  `json:"duration_ms"`
	Details    pipeline.ResultDetails `json:"details,omitempty"`
}

ResultItem is a per-target result in the response.

Jump to

Keyboard shortcuts

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