manifest

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	Name     string            `json:"name"`
	Disabled bool              `json:"disabled"`
	Memo     map[string]string `json:"memo"`
}

func (Account) API

func (a Account) API(name string) (*apiaccount.Account, error)

func (Account) Compile

func (a Account) Compile(name string) ([]*Action, error)

type Action

type Action struct {
	Desc string
	Run  func(context.Context, *Env) (string, error)
}

type Actions

type Actions []*Action

type Env

type Env struct {
	EventSources eventsrcsstore.Store
	Plugins      *pluginsreg.Registry
	Projects     projectsstore.Store
	Accounts     accountsstore.Store
}

func (*Env) Apply

func (e *Env) Apply(ctx context.Context, actions []*Action) (log []string, _ error)

type EventSource

type EventSource struct {
	ID       apieventsrc.EventSourceID `json:"id"`
	Disabled bool                      `json:"disabled"`
	Types    []string                  `json:"types"`
}

func (EventSource) API

func (EventSource) Compile

func (a EventSource) Compile(id string) ([]*Action, error)

type Manifest

type Manifest struct {
	Accounts     map[string]Account     `json:"accounts"`  // name -> acount
	EventSources map[string]EventSource `json:"eventsrcs"` // id (=account.name) -> eventsrc
	Plugins      map[string]Plugin      `json:"plugins"`   // id (=account.name) -> plugin
	Projects     map[string]Project     `json:"projects"`  // id (=account.unique_id)-> project
}

func ManifestFromPath

func ManifestFromPath(ctx context.Context, path string) (*Manifest, error)

TODO: validate manifest using cue.Value.Subsume

func ParseManifest added in v0.12.2

func ParseManifest(ctx context.Context, src []byte) (*Manifest, error)

func (Manifest) Compile

func (d Manifest) Compile() (acts []*Action, errs error)

type Plugin

type Plugin struct {
	ID       apiplugin.PluginID `json:"id"`
	Address  string             `json:"address"`
	Port     uint16             `json:"port"`
	Disabled bool               `json:"disabled"`
	Exec     *struct {
		Path string `json:"path"`
	} `json:"exec"`
}

func (Plugin) API

func (a Plugin) API(id string) (*apiplugin.Plugin, error)

func (Plugin) Compile

func (a Plugin) Compile(id string) ([]*Action, error)

type Project

type Project struct {
	ID          string                          `json:"id"`
	AccountName string                          `json:"account_name"`
	Name        string                          `json:"name"`
	MainPath    string                          `json:"main_path"`
	Disabled    bool                            `json:"disabled"`
	Memo        map[string]string               `json:"memo"`
	Plugins     map[string]ProjectPlugin        `json:"plugins"`      // pluginID -> plugin
	Bindings    map[string]ProjectSourceBinding `json:"src_bindings"` // name -> binding
	Predecls    map[string]string               `json:"predecls"`     // TODO: allow more than just strings.
}

func ParseProject added in v0.12.2

func ParseProject(ctx context.Context, src []byte, tags []string) (*Project, error)

func (Project) API

func (p Project) API(id string) (*apiproject.Project, error)

func (Project) Compile

func (a Project) Compile(id string) ([]*Action, error)

type ProjectPlugin

type ProjectPlugin struct {
	Disabled bool `json:"disabled"`
}

type ProjectSourceBinding

type ProjectSourceBinding struct {
	SourceID     apieventsrc.EventSourceID `json:"src_id"`
	Assoc        string                    `json:"assoc"`
	SourceConfig string                    `json:"src_config"`
	Disabled     bool                      `json:"disabled"`
}

Jump to

Keyboard shortcuts

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