helpersv1

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: Apache-2.0 Imports: 17 Imported by: 0 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.

Documentation

Index

Constants

View Source
const (
	// ChannelTypeValidation is the channel type identifier
	// for validation events.
	ChannelTypeValidation = "validation"
	// ChannelTypeChangeset is the channel type identifier
	// for change staging (change set) events.
	ChannelTypeChangeset = "changeset"
	// ChannelTypeDeployment is the channel type identifier
	// for deployment events.
	ChannelTypeDeployment = "deployment"
	// LastEventIDHeader is the name of the HTTP header
	// that can contain the last event ID for SSE.
	LastEventIDHeader = "Last-Event-ID"
)
View Source
const (
	// DefaultFileSourceScheme is the default file source scheme
	// used for requests that need to fetch a blueprint document.
	DefaultFileSourceScheme = "file"
	// DefaultBlueprintFile is the default name of the blueprint file
	// used for requests that need to fetch a blueprint document.
	DefaultBlueprintFile = "project.blueprint.yml"
)

Default values for shared request payload fields.

Variables

View Source
var ValidateRequestBody *validator.Validate

ValidateRequestBody is the request body validator shared between endpoints.

Functions

func GetBlueprintSource

func GetBlueprintSource(
	blueprintInfo *includes.ChildBlueprintInfo,
) string

GetBlueprintSource retrieves the source of the blueprint from the provided ChildBlueprintInfo. If the source is not set, it returns an empty string.

func GetFormat

func GetFormat(
	blueprintFileName string,
) schema.SpecFormat

GetFormat determines the format of the blueprint file based on its extension.

func PopulateBlueprintDocInfoDefaults

func PopulateBlueprintDocInfoDefaults(payload *resolve.BlueprintDocumentInfo)

func PrepareAndValidatePluginConfig

func PrepareAndValidatePluginConfig(
	r *http.Request,
	w http.ResponseWriter,
	inputConfig *types.BlueprintOperationConfig,
	validate bool,
	pluginConfigPreparer pluginconfig.Preparer,
	logger core.Logger,
) (*types.BlueprintOperationConfig, []*core.Diagnostic, bool)

PrepareAndValidatePluginConfig prepares and validates the plugin configuration for a blueprint operation. This will write an error response to the provided http.ResponseWriter if there are any errors during preparation or validation.

func SSEStreamEvents

func SSEStreamEvents(
	w http.ResponseWriter,
	r *http.Request,
	info *StreamInfo,
	eventStore manage.Events,
	logger core.Logger,
)

SSEStreamEvents deals with streaming events from a channel to a client using Server-Sent Events (SSE).

func SetupRequestBodyValidator

func SetupRequestBodyValidator()

SetupRequestBodyValidator sets up the request body validator for all endpoints.

Types

type AsyncOperationResponse added in v0.2.0

type AsyncOperationResponse[T any] struct {
	// LastEventID is the ID of the last event for the channel before this operation started.
	// Clients should pass this to streaming methods to avoid missing events.
	// Omitted from JSON if no events have been generated yet for the channel.
	LastEventID string `json:"lastEventId,omitempty"`
	// Data contains the core response data.
	Data T `json:"data"`
}

AsyncOperationResponse wraps responses for async operations that have SSE streams. The LastEventID can be used as the starting offset for SSE streaming.

type MessageResponse

type MessageResponse struct {
	Message string `json:"message"`
}

MessageResponse is a data type for a JSON response that contains a message string.

type StreamInfo

type StreamInfo struct {
	ChannelType string
	ChannelID   string
}

StreamInfo holds information about the stream channel type and ID to be used for streaming events to clients over SSE.

Jump to

Keyboard shortcuts

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