helpersv1

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

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 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