Documentation
¶
Index ¶
- Constants
- Variables
- func GetBlueprintSource(blueprintInfo *includes.ChildBlueprintInfo) string
- func GetCleanupStatus(w http.ResponseWriter, r *http.Request, store manage.CleanupOperations, ...)
- func GetFormat(blueprintFileName string) schema.SpecFormat
- func ParsePreciseLinkStatus(value string) (core.PreciseLinkStatus, bool)
- func ParsePreciseResourceStatus(value string) (core.PreciseResourceStatus, bool)
- 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()
- func StartCleanup(w http.ResponseWriter, r *http.Request, runner *cleanup.Runner, ...)
- 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 GetCleanupStatus ¶ added in v0.9.0
func GetCleanupStatus( w http.ResponseWriter, r *http.Request, store manage.CleanupOperations, cleanupType manage.CleanupType, logger core.Logger, )
GetCleanupStatus answers a request for the status of a cleanup operation in one category.
An operation from another category is answered as not found, so that each status route only reports on operations started through its own cleanup endpoint.
func GetFormat ¶
func GetFormat( blueprintFileName string, ) schema.SpecFormat
GetFormat determines the format of the blueprint file based on its extension.
func ParsePreciseLinkStatus ¶ added in v0.9.0
func ParsePreciseLinkStatus(value string) (core.PreciseLinkStatus, bool)
ParsePreciseLinkStatus parses a precise link status from its label, ignoring case, or from its integer.
func ParsePreciseResourceStatus ¶ added in v0.9.0
func ParsePreciseResourceStatus(value string) (core.PreciseResourceStatus, bool)
ParsePreciseResourceStatus parses a precise resource status from its label, ignoring case (e.g. "created"), or from its integer (e.g. "3"), the form a reconciliation check returns.
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.
func StartCleanup ¶ added in v0.9.0
func StartCleanup( w http.ResponseWriter, r *http.Request, runner *cleanup.Runner, task cleanup.Task, logger core.Logger, )
StartCleanup answers a request to clean up one category of state.
Shared by every cleanup endpoint, so that they cannot drift from each other over what a refused or a failed start looks like. A category already being cleaned up, whether by another request or by the scheduler, is answered with a conflict rather than by starting a second run over the same records. An engine that is shutting down is answered as unavailable.
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.