blueprint

package module
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: May 5, 2024 License: MIT Imports: 7 Imported by: 0

README

Blueprint

Blueprint Go package. Holds necessary interfaces and structs for building plugins. Part of the power project.

tag Go Version GoDoc Lint Scan Build Status Go Report Card Contributors License

Usage

go get github.com/zcubbs/blueprint

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HandshakeConfig = plugin.HandshakeConfig{
	ProtocolVersion:  1,
	MagicCookieKey:   "BASIC_PLUGIN",
	MagicCookieValue: "hello",
}

Functions

func GetAllBlueprintSpecs

func GetAllBlueprintSpecs() map[string]Spec

GetAllBlueprintSpecs returns a map of all registered blueprint specs.

func Register

func Register(blueprint Blueprint) error

Register registers the spec for a given blueprint type.

Types

type Blueprint

type Blueprint struct {
	Type      Type `yaml:"type" json:"type"`
	Spec      Spec `yaml:"spec" json:"spec"`
	Generator Generator
}

func GetAllBlueprints

func GetAllBlueprints() []Blueprint

GetAllBlueprints returns a map of all registered blueprints.

type GenerateArgs added in v0.1.1

type GenerateArgs struct {
	Spec    Spec
	Values  map[string]string
	Workdir string
}

GenerateArgs Define argument and response structures for the methods

type GenerateResponse added in v0.1.1

type GenerateResponse struct {
	Error error
}

type Generator

type Generator interface {
	Generate(spec Spec, values map[string]string, workdir string) error
	LoadSpec() (Spec, error)
}

Generator defines the interface for a blueprint.

func GetGenerator

func GetGenerator(id string) (Generator, bool)

GetGenerator retrieves a generator from the registry.

type GeneratorPlugin added in v0.1.3

type GeneratorPlugin struct {
	Impl Generator
}

func (*GeneratorPlugin) Client added in v0.1.3

func (p *GeneratorPlugin) Client(_ *plugin.MuxBroker, c *rpc.Client) (interface{}, error)

func (*GeneratorPlugin) Server added in v0.1.3

func (p *GeneratorPlugin) Server(*plugin.MuxBroker) (interface{}, error)

type GeneratorRPC added in v0.1.3

type GeneratorRPC struct {
	// contains filtered or unexported fields
}

func (*GeneratorRPC) Generate added in v0.1.3

func (c *GeneratorRPC) Generate(spec Spec, values map[string]string, workdir string) error

Generate makes an RPC client call to Generate

func (*GeneratorRPC) LoadSpec added in v0.1.3

func (c *GeneratorRPC) LoadSpec() (Spec, error)

LoadSpec makes an RPC client call to LoadSpec

type GeneratorRPCServer added in v0.1.3

type GeneratorRPCServer struct {
	Impl Generator
}

GeneratorRPCServer is the server side of the RPC

func (*GeneratorRPCServer) Generate added in v0.1.3

func (s *GeneratorRPCServer) Generate(args *GenerateArgs, resp *GenerateResponse) error

Generate handles the server-side RPC call for Generate

func (*GeneratorRPCServer) LoadSpec added in v0.1.3

func (s *GeneratorRPCServer) LoadSpec(_ *LoadSpecArgs, resp *LoadSpecResponse) error

LoadSpec handles the server-side RPC call for LoadSpec

type LoadSpecArgs added in v0.1.1

type LoadSpecArgs struct {
}

type LoadSpecResponse added in v0.1.1

type LoadSpecResponse struct {
	Spec  Spec
	Error error
}

type Option

type Option struct {
	ID          string   `yaml:"id"`
	Name        string   `yaml:"name"`
	Description string   `yaml:"description"`
	Type        string   `yaml:"type"`
	Default     string   `yaml:"default,omitempty"`
	Choices     []string `yaml:"choices,omitempty"`
}

func (*Option) String

func (b *Option) String() string

type Spec

type Spec struct {
	ID          string   `yaml:"id"`
	Name        string   `yaml:"name"`
	Description string   `yaml:"description"`
	Options     []Option `yaml:"options"`
	Version     string   `yaml:"version"`
}

Spec BlueprintSpec represents the structure of a YAML blueprint spec.

func GetBlueprintSpec

func GetBlueprintSpec(id string) (*Spec, error)

GetBlueprintSpec retrieves the spec for a given blueprint type.

func LoadBlueprintSpec

func LoadBlueprintSpec(filePath string) (Spec, error)

LoadBlueprintSpec reads and parses the YAML spec file for a blueprint.

func LoadBlueprintSpecFromBytes

func LoadBlueprintSpecFromBytes(data []byte) (Spec, error)

LoadBlueprintSpecFromBytes parses the YAML spec file for a blueprint from a byte array.

func (Spec) String

func (b Spec) String() string

type Type

type Type string
const (
	TypeBuiltIn  Type = "built-in"
	TypePlugin   Type = "plugin"
	TypeRgistrar Type = "registrar"
)

Jump to

Keyboard shortcuts

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