Documentation
¶
Index ¶
- Constants
- Variables
- type Authentication
- type Config
- func (c *Config) FQMNForFunc(namespace, fn, ref string) (string, error)
- func (c *Config) FindModule(name string) (*Module, error)
- func (c *Config) Marshal() ([]byte, error)
- func (c *Config) Unmarshal(in []byte) error
- func (c *Config) UnmarshalYaml(in []byte) error
- func (c *Config) Validate() (err error)
- type Connection
- type ConnectionConfig
- type DBConfig
- type DBQuery
- type KafkaConfig
- type Module
- type ModuleRevision
- type NATSConfig
- type NamespaceConfig
- type RedisConfig
- type Schedule
- type ScheduleEvery
- type Trigger
- type WasmModuleRef
- type Workflow
Constants ¶
const ( InputTypeRequest = "request" InputTypeStream = "stream" InputSourceServer = "server" InputSourceNATS = "nats" InputSourceKafka = "kafka" )
InputTypeRequest and others represent consts for the tenantConfig.
const ( ConnectionTypeNATS = "nats" ConnectionTypeKafka = "kafka" ConnectionTypeRedis = "redis" ConnectionTypeMySQL = "mysql" ConnectionTypePostgres = "postgres" )
Variables ¶
var ( ErrQueryTypeUnknown = errors.New("unable to determine query type") ErrDBTypeUnknown = errors.New("unable to determine query's database type") )
Functions ¶
This section is empty.
Types ¶
type Authentication ¶
type Authentication struct {
Domains map[string]capabilities.AuthHeader `yaml:"domains,omitempty" json:"domains,omitempty"`
}
type Config ¶
type Config struct {
Identifier string `yaml:"identifier" json:"identifier"`
SpecVersion int `yaml:"specVersion" json:"specVersion"`
TenantVersion int64 `yaml:"tenantVersion" json:"tenantVersion"`
DefaultNamespace NamespaceConfig `yaml:"defaultNamespace" json:"defaultNamespace"`
Namespaces []NamespaceConfig `yaml:"namespaces" json:"namespaces"`
// Modules is a union of all consituent namespace modules
Modules []Module `yaml:"modules" json:"modules"`
}
Config describes a tenant and its related config
func (*Config) FQMNForFunc ¶
func (*Config) Unmarshal ¶
Unmarshal unmarshals JSON bytes into a TenantConfig struct it also calculates a map of FQMNs for later use.
func (*Config) UnmarshalYaml ¶
UnmarshalYaml unmarshals YAML bytes into a TenantConfig struct it also calculates a map of FQMNs for later use.
type Connection ¶
type Connection struct {
Type string `yaml:"type" json:"type"`
Name string `yaml:"name" json:"name"`
Config map[string]string `yaml:"config" json:"config"`
}
Connection describes a connection to an external resource
type ConnectionConfig ¶
type ConnectionConfig interface {
Validate() error
}
ConnectionConfig is an interface that defines a connection configuration
type DBConfig ¶
type DBConfig struct {
Type string `yaml:"type" json:"type"`
ConnectionString string `yaml:"connectionString" json:"connectionString"`
}
func DBConfigFromMap ¶
DBConfigFromMap returns a DB config from a map
func (*DBConfig) ToRCAPConfig ¶
func (d *DBConfig) ToRCAPConfig(queries []DBQuery) (*capabilities.DatabaseConfig, error)
type KafkaConfig ¶
type KafkaConfig struct {
BrokerAddress string `yaml:"brokerAddress" json:"brokerAddress"`
}
KafkaConfig describes a connection to a Kafka broker.
func KafkaConfigFromMap ¶
func KafkaConfigFromMap(orig map[string]string) *KafkaConfig
KafkaConfigFromMap returns a NATS config from a map
func (*KafkaConfig) Validate ¶
func (k *KafkaConfig) Validate() error
type Module ¶
type Module struct {
Name string `yaml:"name" json:"name"`
Namespace string `yaml:"namespace" json:"namespace"`
Lang string `yaml:"lang" json:"lang"`
Ref string `yaml:"ref" json:"ref"`
DraftRef string `yaml:"draftRef,omitempty" json:"draftRef,omitempty"`
APIVersion string `yaml:"apiVersion,omitempty" json:"apiVersion,omitempty"`
FQMN string `yaml:"fqmn,omitempty" json:"fqmn,omitempty"`
URI string `yaml:"uri" json:"uri,omitempty"`
Revisions []ModuleRevision `yaml:"revisions" json:"revisions"`
WasmRef *WasmModuleRef `yaml:"-" json:"wasmRef,omitempty"`
TokenHash []byte `yaml:"-" json:"-"`
}
Module is the structure of a .Module.yaml file.
type ModuleRevision ¶
type ModuleRevision struct {
Ref string `json:"ref"`
}
ModuleRevision is a revision of a module
type NATSConfig ¶
type NATSConfig struct {
ServerAddress string `yaml:"serverAddress" json:"serverAddress"`
}
NATSConfig describes a connection to a NATS server.
func NATSConfigFromMap ¶
func NATSConfigFromMap(orig map[string]string) *NATSConfig
NATSConfigFromMap returns a Kafka config from a map
func (*NATSConfig) Validate ¶
func (n *NATSConfig) Validate() error
type NamespaceConfig ¶
type NamespaceConfig struct {
Name string `yaml:"name" json:"name"`
Workflows []Workflow `yaml:"workflows,omitempty" json:"workflows,omitempty"`
Queries []DBQuery `yaml:"queries,omitempty" json:"queries,omitempty"`
Capabilities *capabilities.CapabilityConfig `yaml:"capabilities,omitempty" json:"capabilities,omitempty"`
Connections []Connection `yaml:"connections,omitempty" json:"connections,omitempty"`
Authentication *Authentication `yaml:"authentication,omitempty" json:"authentication,omitempty"`
// Modules is populated by subo, never by the user.
Modules []Module `yaml:"modules" json:"modules"`
}
NamespaceConfig is the configuration for a namespace
type RedisConfig ¶
type RedisConfig struct {
ServerAddress string `yaml:"serverAddress" json:"serverAddress"`
Username string `yaml:"username" json:"username"`
Password string `yaml:"password" json:"password"`
}
RedisConfig describes a connection to a Redis cache.
func RedisConfigFromMap ¶
func RedisConfigFromMap(orig map[string]string) *RedisConfig
RedisConfigFromMap returns a Redis config from a map
func (*RedisConfig) Validate ¶
func (r *RedisConfig) Validate() error
type Schedule ¶
type Schedule struct {
Every ScheduleEvery `yaml:"every" json:"every"`
State map[string]string `yaml:"state,omitempty" json:"state,omitempty"`
Steps []executable.Executable `yaml:"steps" json:"steps"`
}
Schedule represents the schedule settings for a workflow
func (*Schedule) NumberOfSeconds ¶
NumberOfSeconds calculates the total time in seconds for the schedule's 'every' value.
type ScheduleEvery ¶
type ScheduleEvery struct {
Seconds int `yaml:"seconds,omitempty" json:"seconds,omitempty"`
Minutes int `yaml:"minutes,omitempty" json:"minutes,omitempty"`
Hours int `yaml:"hours,omitempty" json:"hours,omitempty"`
Days int `yaml:"days,omitempty" json:"days,omitempty"`
}
ScheduleEvery represents the 'every' value for a schedule.
type Trigger ¶
type Trigger struct {
Source string `yaml:"source,omitempty" json:"source,omitempty"`
Topic string `yaml:"topic" json:"topic"`
Sink string `yaml:"sink" json:"sink"`
SinkTopic string `yaml:"sinkTopic" json:"sinkTopic"`
}
Trigger represents a trigger for a workflow.
type WasmModuleRef ¶
type WasmModuleRef struct {
Name string `json:"name"`
FQMN string `json:"fqmn"`
Data []byte `json:"data"`
}
WasmModuleRef is a reference to a Wasm module This is a duplicate of sat/engine/moduleref/WasmModuleRef (for JSON serialization purposes)
func NewWasmModuleRef ¶
func NewWasmModuleRef(name, fqmn string, data []byte) *WasmModuleRef
type Workflow ¶
type Workflow struct {
Name string `yaml:"name" json:"name"`
Steps []executable.Executable `yaml:"steps" json:"steps"`
Response string `yaml:"response,omitempty" json:"response,omitempty"`
Schedule *Schedule `yaml:"schedule,omitempty" json:"schedule,omitempty"`
Triggers []Trigger `yaml:"triggers" json:"triggers"`
}
Workflow represents the mapping between an input and a composition of functions.