Documentation ¶
Overview ¶
Package bufpluginconfig defines the buf.plugin.yaml file.
Index ¶
- Constants
- Variables
- func ExistingConfigFilePath(ctx context.Context, readBucket storage.ReadBucket) (string, error)
- type Config
- type ExternalConfig
- type ExternalDependency
- type ExternalGoRuntimeConfig
- type ExternalNPMRuntimeConfig
- type ExternalRuntimeConfig
- type GoRuntimeConfig
- type GoRuntimeDependencyConfig
- type NPMRuntimeConfig
- type NPMRuntimeDependencyConfig
- type RuntimeConfig
Constants ¶
const ( // ExternalConfigFilePath is the default configuration file path for v1. ExternalConfigFilePath = "buf.plugin.yaml" // V1Version is the version string used to indicate the v1 version of the buf.plugin.yaml file. V1Version = "v1" )
Variables ¶
var ( // AllConfigFilePaths are all acceptable config file paths without overrides. // // These are in the order we should check. AllConfigFilePaths = []string{ ExternalConfigFilePath, } )
Functions ¶
func ExistingConfigFilePath ¶
ExistingConfigFilePath checks if a configuration file exists, and if so, returns the path within the ReadBucket of this configuration file.
Returns empty string and no error if no configuration file exists.
Types ¶
type Config ¶
type Config struct { // Name is the name of the plugin (e.g. 'buf.build/protocolbuffers/go'). Name bufpluginref.PluginIdentity // PluginVersion is the version of the plugin's implementation // (e.g the protoc-gen-connect-go implementation is v0.2.0). // // This excludes any other details found in the buf.plugin.yaml // or plugin source (e.g. Dockerfile) that would otherwise influence // the plugin's behavior. PluginVersion 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 default set of options passed into 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 *RuntimeConfig }
Config is the plugin config.
func GetConfigForBucket ¶
GetConfigForBucket gets the Config for the YAML data at ConfigFilePath.
If the data is of length 0, returns the default config.
func GetConfigForData ¶
GetConfigForData gets the Config for the given JSON or YAML data.
If the data is of length 0, returns the default config.
func ParseConfig ¶
ParseConfig parses the file at the given path as a Config.
type ExternalConfig ¶
type ExternalConfig struct { Version string `json:"version,omitempty" yaml:"version,omitempty"` Name string `json:"name,omitempty" yaml:"name,omitempty"` PluginVersion string `json:"plugin_version,omitempty" yaml:"plugin_version,omitempty"` SourceURL string `json:"source_url,omitempty" yaml:"source_url,omitempty"` Description string `json:"description,omitempty" yaml:"description,omitempty"` Deps []ExternalDependency `json:"deps,omitempty" yaml:"deps,omitempty"` DefaultOpts []string `json:"default_opts,omitempty" yaml:"default_opts,omitempty"` Runtime ExternalRuntimeConfig `json:"runtime,omitempty" yaml:"runtime,omitempty"` }
ExternalConfig represents the on-disk representation of the plugin configuration at version v1.
type ExternalDependency ¶
type ExternalDependency struct { Plugin string `json:"plugin,omitempty" yaml:"plugin,omitempty"` Revision int `json:"revision,omitempty" yaml:"revision,omitempty"` }
ExternalDependency represents a dependency on another plugin.
type ExternalGoRuntimeConfig ¶
type ExternalGoRuntimeConfig struct { // The minimum Go version required by the plugin. MinVersion string `json:"min_version,omitempty" yaml:"min_version,omitempty"` Deps []struct { Module string `json:"module,omitempty" yaml:"module,omitempty"` Version string `json:"version,omitempty" yaml:"version,omitempty"` } `json:"deps,omitempty" yaml:"deps,omitempty"` }
ExternalGoRuntimeConfig is the external runtime configuration for a Go plugin.
func (ExternalGoRuntimeConfig) IsEmpty ¶
func (e ExternalGoRuntimeConfig) IsEmpty() bool
IsEmpty returns true if the configuration is empty.
type ExternalNPMRuntimeConfig ¶
type ExternalNPMRuntimeConfig struct { Deps []struct { Package string `json:"package,omitempty" yaml:"package,omitempty"` Version string `json:"version,omitempty" yaml:"version,omitempty"` } `json:"deps,omitempty" yaml:"deps,omitempty"` }
ExternalNPMRuntimeConfig is the external runtime configuration for a JavaScript NPM plugin.
func (ExternalNPMRuntimeConfig) IsEmpty ¶
func (e ExternalNPMRuntimeConfig) IsEmpty() bool
IsEmpty returns true if the configuration is empty.
type ExternalRuntimeConfig ¶
type ExternalRuntimeConfig struct { Go ExternalGoRuntimeConfig `json:"go,omitempty" yaml:"go,omitempty"` NPM ExternalNPMRuntimeConfig `json:"npm,omitempty" yaml:"npm,omitempty"` }
ExternalRuntimeConfig is the external configuration for the runtime of a plugin.
type GoRuntimeConfig ¶
type GoRuntimeConfig struct { MinVersion string Deps []*GoRuntimeDependencyConfig }
GoRuntimeConfig is the runtime configuration for a Go plugin.
type GoRuntimeDependencyConfig ¶
GoRuntimeDependencyConfig is the go runtime dependency configuration.
type NPMRuntimeConfig ¶
type NPMRuntimeConfig struct {
Deps []*NPMRuntimeDependencyConfig
}
NPMRuntimeConfig is the runtime configuration for a JavaScript NPM plugin.
type NPMRuntimeDependencyConfig ¶
NPMRuntimeDependencyConfig is the npm runtime dependency configuration.
type RuntimeConfig ¶
type RuntimeConfig struct { Go *GoRuntimeConfig NPM *NPMRuntimeConfig }
RuntimeConfig is the configuration for the runtime of a plugin.
Only one field will be set.