query

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: Apache-2.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 BuildInput

type BuildInput struct {
	Config  interface{}            `yaml:"config,omitempty"`
	Actions map[string]interface{} `yaml:"actions"`
}

type ManifestGenerator

type ManifestGenerator struct {
	Manifest *manifest.Manifest
}

ManifestGenerator generates mixin input from the manifest contents associated with each mixin.

func NewManifestGenerator

func NewManifestGenerator(m *manifest.Manifest) *ManifestGenerator

func (ManifestGenerator) BuildInput

func (g ManifestGenerator) BuildInput(mixinName string) ([]byte, error)

func (ManifestGenerator) ListMixins

func (g ManifestGenerator) ListMixins() []string

type MixinBuildOutput added in v1.0.3

type MixinBuildOutput struct {
	// Name of the mixin.
	Name string

	// Stdout is the contents of stdout from calling the mixin.
	Stdout string

	// Error returned when the mixin was called.
	Error error
}

type MixinInputGenerator

type MixinInputGenerator interface {
	// ListMixins provides the list of mixin names to query over.
	ListMixins() []string

	// BuildInput generates the input to send to the specified mixin given its name.
	BuildInput(mixinName string) ([]byte, error)
}

MixinInputGenerator provides data about the mixins to the MixinQuery for it to execute upon.

type MixinQuery

type MixinQuery struct {
	*portercontext.Context

	// RequireMixinResponse indicates if every mixin must return a successful response.
	// Set to true for required mixin commands that need every mixin to respond to.
	// Set to false for optional mixin commands that every mixin may not have implemented.
	RequireAllMixinResponses bool

	// LogMixinStderr to the supplied contexts Stdout (Context.Out)
	LogMixinErrors bool

	Mixins pkgmgmt.PackageManager
}

MixinQuery allows us to send a command to a bunch of mixins and collect their response.

func New

New creates a new instance of a MixinQuery.

func (*MixinQuery) Execute

func (q *MixinQuery) Execute(ctx context.Context, cmd string, inputGenerator MixinInputGenerator) ([]MixinBuildOutput, error)

Execute the specified command using an input generator. For example, the ManifestGenerator will iterate over the mixins in a manifest and send them their config and the steps associated with their mixin. The mixins are queried in parallel but the results are sorted in the order that the mixins were defined in the manifest.

Jump to

Keyboard shortcuts

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