Documentation
¶
Index ¶
- type Config
- type Engine
- func (e *Engine) GetWorkflowsForRequest(req *oapi.Request) ([]cue.Path, error)
- func (e *Engine) OpenAPISpec(kind string) ([]byte, error)
- func (e *Engine) RunTests(config *TestConfig) (*TestResult, error)
- func (e *Engine) RunWorkflow(wfPath cue.Path, req *oapi.Request) (cue.Value, error)
- func (e *Engine) TemplatesForService(service *oapi.Service) []*Template
- func (e *Engine) ValidateRequest(body io.Reader) (*oapi.NewRequest, error)
- type MatchLabels
- type ServiceSelector
- type Template
- type TemplateDef
- type TestCase
- type TestConfig
- type TestResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine is responsible for storing all the templates, validating incoming requests, serving OpenAPI specifications, and running worker cue-based workflows
func (*Engine) GetWorkflowsForRequest ¶
func (*Engine) OpenAPISpec ¶
OpenAPISpec takes a Request Template kind and returns an OpenAPI JSON specification for it. If the Request Template kind does not exist, or there's an error generating the OpenAPI spec, an error is returned.
There are little options to filter which Request Types should be included in the OpenAPI specification. What happens here is that an empty cue Instance is built and the specific Request Template is programmtically filled in to the empty instance
func (*Engine) RunTests ¶
func (e *Engine) RunTests(config *TestConfig) (*TestResult, error)
func (*Engine) RunWorkflow ¶
RunWorkflow takes a cue path to a workflow and a request and runs the workflow at the given path, replacing the input with the spec from the given request
func (*Engine) TemplatesForService ¶
func (*Engine) ValidateRequest ¶
type MatchLabels ¶
type ServiceSelector ¶
type ServiceSelector struct {
MatchLabels MatchLabels `json:"matchLabels"`
}
type Template ¶
type Template struct { Def TemplateDef Value cue.Value }
type TemplateDef ¶
type TemplateDef struct { Kind string `json:"kind"` ServiceSelector ServiceSelector `json:"serviceSelector"` }
TemplateDef defines the fields of a CUE-based Template for decoding and identifying which definitions in CUE are Request Templates
type TestConfig ¶
type TestConfig struct {
Filter string
}
type TestResult ¶
type TestResult struct {
Tests []*TestCase
}
func (*TestResult) Print ¶
func (t *TestResult) Print(verbose bool)