bufplugin

package
v1.0.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PluginsPathName is the path prefix used to signify that
	// a name belongs to a plugin.
	PluginsPathName = "plugins"

	// TemplatesPathName is the path prefix used to signify that
	// a name belongs to a template.
	TemplatesPathName = "templates"
)

Variables

This section is empty.

Functions

func ParsePluginPath

func ParsePluginPath(pluginPath string) (remote string, owner string, name string, _ error)

ParsePluginPath parses a string in the format <buf.build/owner/plugins/name> into remote, owner and name.

func ParsePluginVersionPath added in v0.55.0

func ParsePluginVersionPath(pluginVersionPath string) (remote string, owner string, name string, version string, _ error)

ParsePluginVersionPath parses a string in the format <buf.build/owner/plugins/name[:version]> into remote, owner, name and version. The version is empty if not specified.

func ParseTemplatePath

func ParseTemplatePath(templatePath string) (remote string, owner string, name string, _ error)

ParseTemplatePath parses a string in the format <buf.build/owner/templates/name> into remote, owner and name.

func TemplateConfigToProtoPluginConfigs

func TemplateConfigToProtoPluginConfigs(templateConfig *TemplateConfig) []*registryv1alpha1.PluginConfig

TemplateConfigToProtoPluginConfigs converts the template config to a slice of proto plugin configs, suitable for use with the Plugin Service CreateTemplate RPC.

func TemplateVersionConfigToProtoPluginVersionMappings

func TemplateVersionConfigToProtoPluginVersionMappings(
	templateVersionConfig *TemplateVersionConfig,
) []*registryv1alpha1.PluginVersionMapping

TemplateVersionConfigToProtoPluginVersionMappings converts the template version config to a slice of Plugin version mappings, suitable for use with the Plugin Service CreateTemplateVersion RPC.

func ValidateTemplateName

func ValidateTemplateName(templateName string) error

ValidateTemplateName validates the format of the template name. This is only used for client side validation and attempts to avoid validation constraints that we may want to change.

Types

type File added in v0.55.0

type File struct {
	Name       string
	Content    []byte
	PluginName string
}

File represents a generated file, and tracks the plugin that originally generated it (i.e. if insertion points are applied to this File, the PluginName will be unchanged).

type MergedPluginResult added in v0.55.0

type MergedPluginResult struct {
	Files []*File
}

MergedPluginResult holds the files for a plugin result.

func MergeInsertionPoints added in v0.54.0

func MergeInsertionPoints(pluginResponses []*PluginResponse) ([]*MergedPluginResult, error)

MergeInsertionPoints traverses the plugin results and merges any insertion points present in any responses. The order of inserts depends on the order of the input plugins. The returned results are in the same order as the input plugin results.

type PluginConfig

type PluginConfig struct {
	Owner      string
	Name       string
	Parameters []string
}

PluginConfig is the config used to describe a plugin in a new template.

type PluginResponse

type PluginResponse struct {
	Response   *pluginpb.CodeGeneratorResponse
	PluginName string
}

PluginResponse encapsulates a CodeGeneratorResponse, along with the name of the plugin that created it.

func NewPluginResponse

func NewPluginResponse(response *pluginpb.CodeGeneratorResponse, pluginName string) *PluginResponse

NewPluginResponse retruns a new *PluginResponse.

type PluginVersion

type PluginVersion struct {
	Owner   string
	Name    string
	Version string
}

PluginVersion describes a version of a plugin for use in a template version.

type TemplateConfig

type TemplateConfig struct {
	Plugins []PluginConfig
}

TemplateConfig is the config used to describe the plugins of a new template.

func ParseTemplateConfig

func ParseTemplateConfig(config string) (*TemplateConfig, error)

ParseTemplateConfig parses the input template config as a path or JSON/YAML literal.

type TemplateVersionConfig

type TemplateVersionConfig struct {
	PluginVersions []PluginVersion
}

TemplateVersionConfig is the config used to describe the plugin version of a new template version.

func ParseTemplateVersionConfig

func ParseTemplateVersionConfig(config string) (*TemplateVersionConfig, error)

ParseTemplateVersionConfig parses the input template version config as a path or JSON/YAML literal.

Jump to

Keyboard shortcuts

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