info

package
v0.8.0 Latest Latest
Warning

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

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

Documentation

Overview

Package info provides plugin information.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPluginInfoServiceHandler

func NewPluginInfoServiceHandler(spec *Spec, options ...PluginInfoServiceHandlerOption) (v1pluginrpc.PluginInfoServiceHandler, error)

NewPluginInfoServiceHandler returns a new v1pluginrpc.PluginInfoServiceHandler for the given Spec.

The Spec will be validated.

func ValidateSpec

func ValidateSpec(spec *Spec) error

ValidateSpec validates all values on a Spec.

Types

type Client

type Client interface {
	// GetPluginInfo gets plugin information.
	GetPluginInfo(ctx context.Context, options ...GetPluginInfoCallOption) (PluginInfo, error)
	// contains filtered or unexported methods
}

Client is a client for plugin information.

All calls with pluginrpc.Error with CodeUnimplemented if any procedure is not implemented.

func NewClient

func NewClient(pluginrpcClient pluginrpc.Client, options ...ClientOption) Client

NewClient returns a new Client for the given pluginrpc.Client.

type ClientOption

type ClientOption interface {
	// contains filtered or unexported methods
}

ClientOption is an option for a new Client.

func ClientWithCaching

func ClientWithCaching() ClientOption

ClientWithCaching returns a new ClientOption that will result caching for items expected to be static:

- PluginInfo from GetPluginInfo.

The default is to not cache.

type GetPluginInfoCallOption

type GetPluginInfoCallOption func(*getPluginInfoCallOptions)

GetPluginInfoCallOption is an option for a Client.GetPluginInfo call.

type License

type License interface {
	// SPDXLicenseID returns the SPDX license ID.
	//
	// Optional.
	//
	// Will be a valid SPDX license ID contained within https://spdx.org/licenses
	// if present.
	SPDXLicenseID() string
	// Text returns the raw text of the License.
	//
	// At most one of Text and URL will be set.
	Text() string
	// URL returns the URL that contains the License.
	//
	// At most one of Text and URL will be set.
	// Must be absolute if set.
	URL() *url.URL
	// contains filtered or unexported methods
}

License contains license information about a plugin.

A License will either have raw text or a URL that contains the License. Zero or one of these will be set.

type PluginInfo

type PluginInfo interface {
	// Documentation returns the documentation of the plugin.
	//
	// Optional.
	Documentation() string
	// License returns the license of the plugin.
	//
	// Optional.
	License() License
	// contains filtered or unexported methods
}

PluginInfo contains information about a plugin.

func NewPluginInfoForSpec

func NewPluginInfoForSpec(spec *Spec) (PluginInfo, error)

NewPluginInfoForSpec returns a new PluginInfo for the given Spec.

type PluginInfoServiceHandlerOption

type PluginInfoServiceHandlerOption func(*pluginInfoServiceHandlerOptions)

PluginInfoServiceHandlerOption is an option for PluginInfoServiceHandler.

type Spec

type Spec struct {
	// Documentation contains the documentation of the plugin.
	//
	// Optional.
	Documentation string
	// SPDXLicenseID is the SDPX ID of the License.
	//
	// Optional.
	//
	// This must be present in the SPDX license list.
	// https://spdx.org/licenses
	//
	// This can be specified in any case. This package will translate this into
	// proper casing.
	SPDXLicenseID string
	// LicenseText is the raw text of the License.
	//
	// Optional.
	//
	// Zero or one of LicenseText and LicenseURL must be set.
	LicenseText string
	// LicenseURL is the URL that contains the License.
	//
	// Optional.
	//
	// Zero or one of LicenseText and LicenseURL must be set.
	// Must be absolute if set.
	LicenseURL string
}

Spec is the spec for the information about a plugin.

Jump to

Keyboard shortcuts

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