config

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: May 23, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Body

type Body struct {
	Text *Text       `yaml:"text"`
	JSON *JSON       `yaml:"json"`
	XML  *XML        `yaml:"xml"`
	Form *url.Values `yaml:"form"`
}

Body struct

type Command

type Command struct {
	Shell   *Shell        `yaml:"shell,omitempty"`
	HTTP    *HTTP         `yaml:"http,omitempty"`
	Stdout  bool          `yaml:"stdout"`
	Retry   int           `yaml:"retry"`
	Timeout time.Duration `yaml:"timeout"`
}

Command struct

type HTTP

type HTTP struct {
	Request Request `yaml:"request"`
}

HTTP struct

type JD

type JD struct {
	Name       string                 `yaml:"name"`
	Metadata   map[string]interface{} `yaml:"metadata,omitempty"`
	Command    Command                `yaml:"command"`
	Guarantee  bool                   `yaml:"guarantee"`
	Crontab    string                 `yaml:"crontab"`
	Repeat     Repeat                 `yaml:"repeat"`
	Concurrent int                    `yaml:"concurrent"`
	Timeout    time.Duration          `yaml:"timeout"`
	Report     bool                   `yaml:"report"`
	Order      Order                  `yaml:"order"`
}

JD struct config for job

func CommandJD

func CommandJD() *JD

CommandJD default

func HTTPCommandJD

func HTTPCommandJD() *JD

HTTPCommandJD default

func ParseJDs

func ParseJDs(cf string) ([]*JD, error)

ParseJDs from config

func (*JD) String

func (jd *JD) String() string

type JSON

type JSON map[string]interface{}

JSON struct

type KV

type KV struct {
	Name  string `yaml:"name"`
	Value string `yaml:"value"`
}

KV struct

type Option

type Option func(*JD)

Option for JD

func CommandArgs

func CommandArgs(args ...string) Option

CommandArgs opt

func CommandEnv

func CommandEnv(key, val string) Option

CommandEnv opt

func CommandName

func CommandName(cmd string) Option

CommandName opt

func CommandRetry

func CommandRetry(n int) Option

CommandRetry opt

func CommandStdoutDiscard

func CommandStdoutDiscard(m bool) Option

CommandStdoutDiscard opt

func CommandTimeout

func CommandTimeout(d time.Duration) Option

CommandTimeout opt

func Concurrent

func Concurrent(c int) Option

Concurrent opt

func Crontab

func Crontab(plan string) Option

Crontab opt

func Guarantee

func Guarantee(g bool) Option

Guarantee opt

func Metadata

func Metadata(key string, val interface{}) Option

Metadata opt

func Name

func Name(n string) Option

Name opt

func RepeatInterval

func RepeatInterval(d time.Duration) Option

RepeatInterval opt

func RepeatTimes

func RepeatTimes(n int) Option

RepeatTimes opt

func Timeout

func Timeout(d time.Duration) Option

Timeout opt

type Order

type Order struct {
	Precondition []string `yaml:"precondition"`
	Weight       int      `yaml:"weight"`
	Wait         bool     `yaml:"wait"`
}

Order struct

type Repeat

type Repeat struct {
	Times    int           `yaml:"times"`
	Interval time.Duration `yaml:"interval"`
}

Repeat struct

type Request

type Request struct {
	Method  string            `yaml:"method"`
	URL     string            `yaml:"url"`
	Headers map[string]string `yaml:"headers"`
	Queries map[string]string `yaml:"queries"`
	Body    *Body             `yaml:"body"`
}

Request struct

type Shell

type Shell struct {
	Name string   `yaml:"name"`
	Args []string `yaml:"args"`
	Envs []KV     `yaml:"envs"`
}

Shell struct

type Text

type Text string

Text struct

type XML

type XML map[string]interface{}

XML struct

Jump to

Keyboard shortcuts

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