Documentation
¶
Index ¶
- Constants
- Variables
- func GetBlueprintSource(blueprintInfo *includes.ChildBlueprintInfo) string
- func GetFormat(blueprintFileName string) schema.SpecFormat
- func PopulateBlueprintDocInfoDefaults(payload *resolve.BlueprintDocumentInfo)
- func PrepareAndValidatePluginConfig(r *http.Request, w http.ResponseWriter, ...) (*types.BlueprintOperationConfig, []*core.Diagnostic, bool)
- func SSEStreamEvents(w http.ResponseWriter, r *http.Request, info *StreamInfo, ...)
- func SetupRequestBodyValidator()
- type AsyncOperationResponse
- type MessageResponse
- type StreamInfo
Constants ¶
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" )
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 ¶
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 ¶
StreamInfo holds information about the stream channel type and ID to be used for streaming events to clients over SSE.