knock

package
v0.0.0-...-0e469d2 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2022 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HttpKnock

type HttpKnock struct {
	KnockBase

	Hand    *hand.HttpHand    `json:"-" yaml:"-"`
	Options *hand.HttpOptions `json:"options"`
}

func NewHttpKnock

func NewHttpKnock(h *hand.HttpHand, options *hand.HttpOptions) *HttpKnock

func (*HttpKnock) GetExports

func (k *HttpKnock) GetExports() map[string]interface{}

func (*HttpKnock) GetHandExports

func (k *HttpKnock) GetHandExports() map[string]interface{}

func (*HttpKnock) Run

func (k *HttpKnock) Run() (*Result, error)

func (*HttpKnock) Validate

func (k *HttpKnock) Validate() error

type Knock

type Knock interface {
	Validate() error
	Run() (*Result, error)
	RunScript(externalScripts map[string]string, vars map[string]string, scriptType string) error
	PatchOptions(handOptions interface{}) error
	ApplyVariables(vars map[string]string) error
	GetType() string
	GetExports() map[string]interface{}
	GetHandExports() map[string]interface{}
}

func FromData

func FromData(vfs storage.Storage, data []byte, format settings.SettingsFormat) (Knock, error)

func FromFile

func FromFile(path string, vfs storage.Storage) (Knock, error)

type KnockBase

type KnockBase struct {
	Description string `json:"description"`

	Type    string            `json:"type"`
	Scripts map[string]string `json:"scripts,omitempty" yaml:"scripts,omitempty"`
	// contains filtered or unexported fields
}

func (*KnockBase) ApplyVariables

func (k *KnockBase) ApplyVariables(vars map[string]string) error

func (*KnockBase) GetType

func (k *KnockBase) GetType() string

func (*KnockBase) PatchOptions

func (k *KnockBase) PatchOptions(handOptions interface{}) error

func (*KnockBase) Run

func (k *KnockBase) Run() (*Result, error)

func (*KnockBase) RunScript

func (k *KnockBase) RunScript(
	externalScripts map[string]string,
	vars map[string]string,
	scriptType string,
) error

func (*KnockBase) Validate

func (k *KnockBase) Validate() error

type Result

type Result struct {
	Entities []ResultEntity `json:"entities"`
	Statuses []ResultStatus `json:"statuses"`
}

type ResultEntity

type ResultEntity struct {
	Title  string      `json:"title"`
	Entity interface{} `json:"result"`
}

type ResultStatus

type ResultStatus struct {
	Title string       `json:"title"`
	Value string       `json:"value"`
	Flags []StatusFlag `json:"flags,omitempty"`
}

type StatusFlag

type StatusFlag string
const (
	StatusFlagGood    StatusFlag = "good"
	StatusFlagWarning StatusFlag = "warning"
	StatusFlagBad     StatusFlag = "bad"
)

Jump to

Keyboard shortcuts

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