bufplugin

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2022 License: Apache-2.0 Imports: 8 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OptionsSliceToPluginOptions added in v1.7.0

func OptionsSliceToPluginOptions(options []string) map[string]string

OptionsSliceToPluginOptions converts a slice of plugin options to a map (using the first '=' as a delimiter between key and value). If no '=' is found, the option will be stored in the map with an empty string value.

func PluginOptionsToOptionsSlice added in v1.7.0

func PluginOptionsToOptionsSlice(pluginOptions map[string]string) []string

PluginOptionsToOptionsSlice converts a map representation of plugin options to a slice of the form '<key>=<value>' or '<key>' for empty values.

func PluginReferenceToProtoCuratedPluginReference added in v1.7.0

func PluginReferenceToProtoCuratedPluginReference(reference bufpluginref.PluginReference) *registryv1alpha1.CuratedPluginReference

PluginReferenceToProtoCuratedPluginReference converts a bufpluginref.PluginReference to a registryv1alpha1.CuratedPluginReference.

func PluginReferencesToCuratedProtoPluginReferences added in v1.7.0

func PluginReferencesToCuratedProtoPluginReferences(references []bufpluginref.PluginReference) []*registryv1alpha1.CuratedPluginReference

PluginReferencesToCuratedProtoPluginReferences converts a slice of bufpluginref.PluginReference to a slice of registryv1alpha1.CuratedPluginReference.

func PluginRuntimeToProtoRuntimeConfig added in v1.7.0

func PluginRuntimeToProtoRuntimeConfig(pluginRuntime *bufpluginconfig.RuntimeConfig) *registryv1alpha1.RuntimeConfig

PluginRuntimeToProtoRuntimeConfig converts a bufpluginconfig.RuntimeConfig to a registryv1alpha1.RuntimeConfig.

func PluginToProtoPluginLanguage added in v1.7.0

func PluginToProtoPluginLanguage(plugin Plugin) registryv1alpha1.PluginLanguage

PluginToProtoPluginLanguage determines the appropriate registryv1alpha1.PluginLanguage for the plugin.

func ProtoRuntimeConfigToPluginRuntime added in v1.7.0

func ProtoRuntimeConfigToPluginRuntime(config *registryv1alpha1.RuntimeConfig) *bufpluginconfig.RuntimeConfig

ProtoRuntimeConfigToPluginRuntime converts a registryv1alpha1.RuntimeConfig to a bufpluginconfig.RuntimeConfig .

Types

type Plugin added in v1.7.0

type Plugin interface {
	// Version is the version of the plugin's implementation
	// (e.g the protoc-gen-connect-go implementation is v0.2.0).
	Version() string
	// SourceURL is an optional attribute used to specify where the source
	// for the plugin can be found.
	SourceURL() string
	// Description is an optional attribute to provide a more detailed
	// description for the plugin.
	Description() string
	// Dependencies are the dependencies this plugin has on other plugins.
	//
	// An example of a dependency might be a 'protoc-gen-go-grpc' plugin
	// which depends on the 'protoc-gen-go' generated code.
	Dependencies() []bufpluginref.PluginReference
	// DefaultOptions is the set of default options passed to the plugin.
	//
	// For now, all options are string values. This could eventually
	// support other types (like JSON Schema and Terraform variables),
	// where strings are the default value unless otherwise specified.
	//
	// Note that some legacy plugins don't always express their options
	// as key value pairs. For example, protoc-gen-java has an option
	// that can be passed like so:
	//
	//  java_opt=annotate_code
	//
	// In those cases, the option value in this map will be set to
	// the empty string, and the option will be propagated to the
	// compiler without the '=' delimiter.
	DefaultOptions() map[string]string
	// Runtime is the runtime configuration, which lets the user specify
	// runtime dependencies, and other metadata that applies to a specific
	// remote generation registry (e.g. the Go module proxy, NPM registry,
	// etc).
	Runtime() *bufpluginconfig.RuntimeConfig
	// ContainerImageDigest returns the plugin's source image digest.
	//
	// For now we only support docker image sources, but this
	// might evolve to support others later on.
	ContainerImageDigest() string
}

Plugin represents a plugin defined by a buf.plugin.yaml.

func NewPlugin added in v1.7.0

func NewPlugin(
	version string,
	dependencies []bufpluginref.PluginReference,
	defaultOptions map[string]string,
	runtimeConfig *bufpluginconfig.RuntimeConfig,
	imageDigest string,
	sourceURL string,
	description string,
) (Plugin, error)

NewPlugin creates a new plugin from the given configuration and image digest.

Directories

Path Synopsis
Package bufpluginconfig defines the buf.plugin.yaml file.
Package bufpluginconfig defines the buf.plugin.yaml file.
Package bufplugindocker contains utilities for building Buf plugins using the Docker API.
Package bufplugindocker contains utilities for building Buf plugins using the Docker API.

Jump to

Keyboard shortcuts

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