generators

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Generator

type Generator interface {
	// RenderToDirectory renders the output to directory target
	RenderToDirectory(target string) error
}

Generator is the interfaces generators must implement

type GoContainer

type GoContainer struct {
	// Package describes the package to build
	Package *Package
	// BuildTime is when the package is being built, set at runtime
	BuildTime string
}

GoContainer builds docker containers based on the package spec

func NewGoContainer

func NewGoContainer(handlers *Package) (*GoContainer, error)

NewGoContainer create a new go container builder

func (*GoContainer) RenderToDirectory

func (g *GoContainer) RenderToDirectory(target string) error

RenderToDirectory renders the container to a specific directory

type Package

type Package struct {
	// ContextName is the optional NATS Context name to use when none is configured
	ContextName string `yaml:"nats"`
	// WorkQueue is the optional Work Queue name to bind to, else DEFAULT will be used
	WorkQueue string `yaml:"queue"`
	// TaskHandlers is a list of handlers for tasks
	TaskHandlers []TaskHandler `yaml:"tasks"`
	// Name is an optional name for the generated go package
	Name string `yaml:"name"`
	// AJVersion is an optional version to use for the choria-io/asyncjobs dependency
	AJVersion string `yaml:"asyncjobs"`
	// RetryPolicy is the name of a retry policy, see RetryPolicyNames()
	RetryPolicy string `yaml:"retry"`
	// DiscardStates indicates what termination states to discard
	DiscardStates []string `yaml:"discard"`
}

Package describe a configuration of a asyncjobs handler with multiple handlers loaded

type TaskHandler

type TaskHandler struct {
	// TaskType is the type to handle like email:new
	TaskType string `yaml:"type"`
	// Package is a golang package name that has a AsyncJobHandler() implementing HandlerFunc
	Package string `yaml:"package"`
	// Version is the version to fetch of this package
	Version string `yaml:"version"`
	// RequestReply indicates the handler is a callout to a remote service
	RequestReply bool `yaml:"remote"`
	// Command indicates the handler is a callout to a command in the given file
	Command string `yaml:"command"`
}

TaskHandler is an individual Task Handler

Jump to

Keyboard shortcuts

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