schemas

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SCHEMA_SUFFIX      = ".json"
	SCHEMA_PATH_PREFIX = "https://github.com/defenseunicorns/lula/tree/main/src/pkg/schemas/"
)

Variables

View Source
var Schemas embed.FS

Functions

func GetSchema

func GetSchema(path string) ([]byte, error)

GetSchema returns a schema from the schemas directory

func GetSchemaPath added in v0.5.0

func GetSchemaPath(schemaName string) string

func HasSchema

func HasSchema(path string) bool

HasSchema checks if a schema exists in the schemas directory

func ListSchemas

func ListSchemas() ([]string, error)

ListSchemas returns a list of schema names

func PrefixSchema

func PrefixSchema(path string) string

func ToMap

func ToMap() (fileMap map[string]fs.DirEntry, err error)

ToMap returns a map of schema names to schemas

Types

type ApiOpts added in v0.16.0

type ApiOpts struct {
	// Timeout in seconds
	Timeout string            `json:"timeout,omitempty" yaml:"timeout,omitempty"`
	Proxy   string            `json:"proxy,omitempty" yaml:"proxy,omitempty"`
	Headers map[string]string `json:"headers,omitempty" yaml:"headers,omitempty"`
}

User-defined options which can be set at the top level (for all requests) or request level (to apply to a single request, or override the top-level opts).

type ApiSpec added in v0.16.0

type ApiSpec struct {
	Requests []Request `mapstructure:"requests" json:"requests" yaml:"requests"`
	// Opts will be applied to all requests, except those which have their own
	// specified ApiOpts
	Options *ApiOpts `mapstructure:"options" json:"options,omitempty" yaml:"options,omitempty"`
}

User input fields for the API Domain ApiSpec contains the user-defined list of API requests

type Request added in v0.16.0

type Request struct {
	Name       string            `json:"name" yaml:"name"`
	URL        string            `json:"url" yaml:"url"`
	Params     map[string]string `json:"parameters,omitempty" yaml:"parameters,omitempty"`
	Method     string            `json:"method,omitempty" yaml:"method,omitempty"`
	Body       string            `json:"body,omitempty" yaml:"body,omitempty"`
	Executable bool              `json:"executable,omitempty" yaml:"executable,omitempty"`
	// ApiOpts specific to this request. If ApiOpts is present, values in the
	// ApiSpec-level Options are ignored for this request.
	Options *ApiOpts `json:"options,omitempty" yaml:"options,omitempty"`
}

Request is a user-defined single API request

Jump to

Keyboard shortcuts

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