external

package
v0.29.4 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ResponseProtocol is the protocol responses from the external script should have
	ResponseProtocol = "io.choria.choria.discovery.v1.external_reply"
	// RequestProtocol is a protocol set in the request that the external script can validate
	RequestProtocol = "io.choria.choria.discovery.v1.external_request"
	// RequestSchema is the location to a JSON Schema for requests
	RequestSchema = "https://choria.io/schemas/choria/discovery/v1/external_request.json"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DiscoverOption

type DiscoverOption func(o *dOpts)

DiscoverOption configures the broadcast discovery method

func Collective

func Collective(c string) DiscoverOption

Collective sets the collective to discover in, else main collective is used

func Command

func Command(c string) DiscoverOption

func DiscoveryOptions

func DiscoveryOptions(opt map[string]string) DiscoverOption

DiscoveryOptions sets the key value pairs that make user supplied discovery options.

Supported options:

command - The command to execute instead of configured default

All options will be passed to the external command in the request, so other command specific options is supported and will be ignored by this code

func Federations added in v0.29.0

func Federations(f []string) DiscoverOption

Federations sets the list of federated collectives to discover in

func Filter

func Filter(f *protocol.Filter) DiscoverOption

Filter sets the filter to use for the discovery, else a blank one is used

func Timeout

func Timeout(t time.Duration) DiscoverOption

Timeout sets the discovery timeout, else the configured default is used

type External

type External struct {
	// contains filtered or unexported fields
}

External implements discovery via externally executed binaries

func New

func New(fw inter.Framework) *External

func (*External) Discover

func (e *External) Discover(ctx context.Context, opts ...DiscoverOption) (n []string, err error)

type Request

type Request struct {
	Protocol    string            `json:"protocol"`
	Collective  string            `json:"collective"`
	Filter      *protocol.Filter  `json:"filter"`
	Federations []string          `json:"federations"`
	Options     map[string]string `json:"options"`
	Schema      string            `json:"$schema"`
	Timeout     float64           `json:"timeout"`
}

Request is the request sent to the external script on its STDIN

type Response

type Response struct {
	Protocol string   `json:"protocol"`
	Nodes    []string `json:"nodes"`
	Error    string   `json:"error"`
}

Response is the expected response from the external script on its STDOUT

Jump to

Keyboard shortcuts

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