Documentation
¶
Index ¶
- Constants
- Variables
- func RegisterServiceAPIServer(s grpc.ServiceRegistrar, srv ServiceAPIServer)
- type GenerateCodeRequest
- func (*GenerateCodeRequest) Descriptor() ([]byte, []int)deprecated
- func (x *GenerateCodeRequest) GetCodeGeneratorRequest() *pluginpb.CodeGeneratorRequest
- func (x *GenerateCodeRequest) GetPluginName() string
- func (*GenerateCodeRequest) ProtoMessage()
- func (x *GenerateCodeRequest) ProtoReflect() protoreflect.Message
- func (x *GenerateCodeRequest) Reset()
- func (x *GenerateCodeRequest) String() string
- type GenerateCodeResponse
- func (*GenerateCodeResponse) Descriptor() ([]byte, []int)deprecated
- func (x *GenerateCodeResponse) GetCodeGeneratorResponse() *pluginpb.CodeGeneratorResponse
- func (*GenerateCodeResponse) ProtoMessage()
- func (x *GenerateCodeResponse) ProtoReflect() protoreflect.Message
- func (x *GenerateCodeResponse) Reset()
- func (x *GenerateCodeResponse) String() string
- type PluginInfo
- func (*PluginInfo) Descriptor() ([]byte, []int)deprecated
- func (x *PluginInfo) GetCreatedAt() *timestamppb.Timestamp
- func (x *PluginInfo) GetGroup() string
- func (x *PluginInfo) GetId() string
- func (x *PluginInfo) GetName() string
- func (x *PluginInfo) GetTags() []string
- func (x *PluginInfo) GetVersion() string
- func (*PluginInfo) ProtoMessage()
- func (x *PluginInfo) ProtoReflect() protoreflect.Message
- func (x *PluginInfo) Reset()
- func (x *PluginInfo) String() string
- type PluginsRequest
- type PluginsResponse
- type ServiceAPIClient
- type ServiceAPIServer
- type UnimplementedServiceAPIServer
- type UnsafeServiceAPIServer
Constants ¶
const ( ServiceAPI_GenerateCode_FullMethodName = "/api.generator.v1.ServiceAPI/GenerateCode" ServiceAPI_Plugins_FullMethodName = "/api.generator.v1.ServiceAPI/Plugins" )
Variables ¶
var File_api_generator_v1_generator_proto protoreflect.FileDescriptor
var ServiceAPI_ServiceDesc = grpc.ServiceDesc{ ServiceName: "api.generator.v1.ServiceAPI", HandlerType: (*ServiceAPIServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "GenerateCode", Handler: _ServiceAPI_GenerateCode_Handler, }, { MethodName: "Plugins", Handler: _ServiceAPI_Plugins_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "api/generator/v1/generator.proto", }
ServiceAPI_ServiceDesc is the grpc.ServiceDesc for ServiceAPI service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterServiceAPIServer ¶
func RegisterServiceAPIServer(s grpc.ServiceRegistrar, srv ServiceAPIServer)
Types ¶
type GenerateCodeRequest ¶
type GenerateCodeRequest struct {
// Standard protobuf code generator request.
//
// This should contain the proto files to process and any plugin-specific parameters.
// The request is passed directly to the plugin's stdin.
CodeGeneratorRequest *pluginpb.CodeGeneratorRequest `protobuf:"bytes,1,opt,name=code_generator_request,json=codeGeneratorRequest,proto3" json:"code_generator_request,omitempty"`
// Name of the plugin to use for generation.
//
// Format: `<group>/<name>:<version>`
//
// Examples:
// - `protocolbuffers/go:v1.36.10`
// - `grpc/go:v1.5.1`
// - `grpc-ecosystem/gateway:latest`
PluginName string `protobuf:"bytes,2,opt,name=plugin_name,json=pluginName,proto3" json:"plugin_name,omitempty"`
// contains filtered or unexported fields
}
Request message for code generation.
func (*GenerateCodeRequest) Descriptor
deprecated
func (*GenerateCodeRequest) Descriptor() ([]byte, []int)
Deprecated: Use GenerateCodeRequest.ProtoReflect.Descriptor instead.
func (*GenerateCodeRequest) GetCodeGeneratorRequest ¶
func (x *GenerateCodeRequest) GetCodeGeneratorRequest() *pluginpb.CodeGeneratorRequest
func (*GenerateCodeRequest) GetPluginName ¶
func (x *GenerateCodeRequest) GetPluginName() string
func (*GenerateCodeRequest) ProtoMessage ¶
func (*GenerateCodeRequest) ProtoMessage()
func (*GenerateCodeRequest) ProtoReflect ¶
func (x *GenerateCodeRequest) ProtoReflect() protoreflect.Message
func (*GenerateCodeRequest) Reset ¶
func (x *GenerateCodeRequest) Reset()
func (*GenerateCodeRequest) String ¶
func (x *GenerateCodeRequest) String() string
type GenerateCodeResponse ¶
type GenerateCodeResponse struct {
// Standard protobuf code generator response.
//
// Contains the generated files and any error messages from the plugin.
// Check the `error` field in the response for plugin-level errors.
CodeGeneratorResponse *pluginpb.CodeGeneratorResponse `` /* 126-byte string literal not displayed */
// contains filtered or unexported fields
}
Response message for code generation.
func (*GenerateCodeResponse) Descriptor
deprecated
func (*GenerateCodeResponse) Descriptor() ([]byte, []int)
Deprecated: Use GenerateCodeResponse.ProtoReflect.Descriptor instead.
func (*GenerateCodeResponse) GetCodeGeneratorResponse ¶
func (x *GenerateCodeResponse) GetCodeGeneratorResponse() *pluginpb.CodeGeneratorResponse
func (*GenerateCodeResponse) ProtoMessage ¶
func (*GenerateCodeResponse) ProtoMessage()
func (*GenerateCodeResponse) ProtoReflect ¶
func (x *GenerateCodeResponse) ProtoReflect() protoreflect.Message
func (*GenerateCodeResponse) Reset ¶
func (x *GenerateCodeResponse) Reset()
func (*GenerateCodeResponse) String ¶
func (x *GenerateCodeResponse) String() string
type PluginInfo ¶
type PluginInfo struct {
// Unique identifier for the plugin.
//
// This is an internal UUID assigned when the plugin is registered.
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
// Group to which the plugin belongs.
//
// Groups organize plugins by maintainer or ecosystem.
//
// Common groups:
// - `protocolbuffers` — Official Google protobuf plugins
// - `grpc` — Official gRPC plugins
// - `grpc-ecosystem` — gRPC ecosystem plugins (gateway, openapi)
// - `community` — Community-maintained plugins
Group string `protobuf:"bytes,2,opt,name=group,proto3" json:"group,omitempty"`
// Name of the plugin.
//
// This is the plugin's identifier within its group.
//
// Examples: `go`, `python`, `gateway`, `openapiv2`
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
// Version of the plugin.
//
// Follows semantic versioning (semver) format.
Version string `protobuf:"bytes,4,opt,name=version,proto3" json:"version,omitempty"`
// Timestamp when the plugin was registered.
CreatedAt *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
// Tags associated with the plugin for categorization.
//
// Tags help organize and filter plugins by category.
// Examples: `go`, `grpc`, `official`, `community`
Tags []string `protobuf:"bytes,6,rep,name=tags,proto3" json:"tags,omitempty"`
// contains filtered or unexported fields
}
Information about a registered plugin.
func (*PluginInfo) Descriptor
deprecated
func (*PluginInfo) Descriptor() ([]byte, []int)
Deprecated: Use PluginInfo.ProtoReflect.Descriptor instead.
func (*PluginInfo) GetCreatedAt ¶
func (x *PluginInfo) GetCreatedAt() *timestamppb.Timestamp
func (*PluginInfo) GetGroup ¶
func (x *PluginInfo) GetGroup() string
func (*PluginInfo) GetId ¶
func (x *PluginInfo) GetId() string
func (*PluginInfo) GetName ¶
func (x *PluginInfo) GetName() string
func (*PluginInfo) GetTags ¶ added in v0.7.0
func (x *PluginInfo) GetTags() []string
func (*PluginInfo) GetVersion ¶
func (x *PluginInfo) GetVersion() string
func (*PluginInfo) ProtoMessage ¶
func (*PluginInfo) ProtoMessage()
func (*PluginInfo) ProtoReflect ¶
func (x *PluginInfo) ProtoReflect() protoreflect.Message
func (*PluginInfo) Reset ¶
func (x *PluginInfo) Reset()
func (*PluginInfo) String ¶
func (x *PluginInfo) String() string
type PluginsRequest ¶
type PluginsRequest struct {
// contains filtered or unexported fields
}
Request message for listing plugins.
Currently accepts no parameters. Future versions may add filtering options.
func (*PluginsRequest) Descriptor
deprecated
func (*PluginsRequest) Descriptor() ([]byte, []int)
Deprecated: Use PluginsRequest.ProtoReflect.Descriptor instead.
func (*PluginsRequest) ProtoMessage ¶
func (*PluginsRequest) ProtoMessage()
func (*PluginsRequest) ProtoReflect ¶
func (x *PluginsRequest) ProtoReflect() protoreflect.Message
func (*PluginsRequest) Reset ¶
func (x *PluginsRequest) Reset()
func (*PluginsRequest) String ¶
func (x *PluginsRequest) String() string
type PluginsResponse ¶
type PluginsResponse struct {
// List of available plugins.
//
// Plugins are sorted by group, name, and version.
Plugins []*PluginInfo `protobuf:"bytes,1,rep,name=plugins,proto3" json:"plugins,omitempty"`
// contains filtered or unexported fields
}
Response message for listing plugins.
func (*PluginsResponse) Descriptor
deprecated
func (*PluginsResponse) Descriptor() ([]byte, []int)
Deprecated: Use PluginsResponse.ProtoReflect.Descriptor instead.
func (*PluginsResponse) GetPlugins ¶
func (x *PluginsResponse) GetPlugins() []*PluginInfo
func (*PluginsResponse) ProtoMessage ¶
func (*PluginsResponse) ProtoMessage()
func (*PluginsResponse) ProtoReflect ¶
func (x *PluginsResponse) ProtoReflect() protoreflect.Message
func (*PluginsResponse) Reset ¶
func (x *PluginsResponse) Reset()
func (*PluginsResponse) String ¶
func (x *PluginsResponse) String() string
type ServiceAPIClient ¶
type ServiceAPIClient interface {
// Generate code using a specified plugin.
//
// This method executes a protobuf code generation plugin and returns the generated files.
// The plugin runs in an isolated Docker container with the following default limits:
//
// - **Network**: Disabled (no external access)
// - **Memory**: 128MB
// - **CPU**: 1.0 core
//
// ## Error Codes
//
// | Code | Description |
// |------|-------------|
// | `NOT_FOUND` | Plugin not found in registry |
// | `INVALID_ARGUMENT` | Invalid plugin name format |
// | `INTERNAL` | Plugin execution failed |
// | `DEADLINE_EXCEEDED` | Plugin execution timeout |
GenerateCode(ctx context.Context, in *GenerateCodeRequest, opts ...grpc.CallOption) (*GenerateCodeResponse, error)
// List available plugins.
//
// Returns a list of all plugins registered in the service.
// Use this to discover available plugins and their versions.
Plugins(ctx context.Context, in *PluginsRequest, opts ...grpc.CallOption) (*PluginsResponse, error)
}
ServiceAPIClient is the client API for ServiceAPI service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
EasyP Code Generation Service ¶
This service provides a centralized API for executing protobuf/gRPC code generation plugins. Plugins run as isolated Docker containers, ensuring version consistency across development teams.
## Benefits
- **Version Control**: All developers use the same plugin versions - **Zero Setup**: No local plugin installation required - **Security**: Plugins run in sandboxed containers with resource limits - **Auditability**: Centralized logging of all generation requests
## Quick Start
1. Call `Plugins` to list available plugins 2. Build a `CodeGeneratorRequest` with your proto files 3. Call `GenerateCode` with the plugin name and request 4. Process the `CodeGeneratorResponse` with generated files
## Plugin Naming Convention
Plugins are identified using the format: `<group>/<name>:<version>`
Examples: - `protocolbuffers/go:v1.36.10` — Official Go protobuf plugin - `grpc/go:v1.5.1` — Official gRPC Go plugin - `grpc-ecosystem/gateway:v2.27.3` — gRPC-Gateway plugin
Use `latest` as version to get the most recent version: - `protocolbuffers/go:latest`
func NewServiceAPIClient ¶
func NewServiceAPIClient(cc grpc.ClientConnInterface) ServiceAPIClient
type ServiceAPIServer ¶
type ServiceAPIServer interface {
// Generate code using a specified plugin.
//
// This method executes a protobuf code generation plugin and returns the generated files.
// The plugin runs in an isolated Docker container with the following default limits:
//
// - **Network**: Disabled (no external access)
// - **Memory**: 128MB
// - **CPU**: 1.0 core
//
// ## Error Codes
//
// | Code | Description |
// |------|-------------|
// | `NOT_FOUND` | Plugin not found in registry |
// | `INVALID_ARGUMENT` | Invalid plugin name format |
// | `INTERNAL` | Plugin execution failed |
// | `DEADLINE_EXCEEDED` | Plugin execution timeout |
GenerateCode(context.Context, *GenerateCodeRequest) (*GenerateCodeResponse, error)
// List available plugins.
//
// Returns a list of all plugins registered in the service.
// Use this to discover available plugins and their versions.
Plugins(context.Context, *PluginsRequest) (*PluginsResponse, error)
}
ServiceAPIServer is the server API for ServiceAPI service. All implementations should embed UnimplementedServiceAPIServer for forward compatibility.
EasyP Code Generation Service ¶
This service provides a centralized API for executing protobuf/gRPC code generation plugins. Plugins run as isolated Docker containers, ensuring version consistency across development teams.
## Benefits
- **Version Control**: All developers use the same plugin versions - **Zero Setup**: No local plugin installation required - **Security**: Plugins run in sandboxed containers with resource limits - **Auditability**: Centralized logging of all generation requests
## Quick Start
1. Call `Plugins` to list available plugins 2. Build a `CodeGeneratorRequest` with your proto files 3. Call `GenerateCode` with the plugin name and request 4. Process the `CodeGeneratorResponse` with generated files
## Plugin Naming Convention
Plugins are identified using the format: `<group>/<name>:<version>`
Examples: - `protocolbuffers/go:v1.36.10` — Official Go protobuf plugin - `grpc/go:v1.5.1` — Official gRPC Go plugin - `grpc-ecosystem/gateway:v2.27.3` — gRPC-Gateway plugin
Use `latest` as version to get the most recent version: - `protocolbuffers/go:latest`
type UnimplementedServiceAPIServer ¶
type UnimplementedServiceAPIServer struct{}
UnimplementedServiceAPIServer should be embedded to have forward compatible implementations.
NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.
func (UnimplementedServiceAPIServer) GenerateCode ¶
func (UnimplementedServiceAPIServer) GenerateCode(context.Context, *GenerateCodeRequest) (*GenerateCodeResponse, error)
func (UnimplementedServiceAPIServer) Plugins ¶
func (UnimplementedServiceAPIServer) Plugins(context.Context, *PluginsRequest) (*PluginsResponse, error)
type UnsafeServiceAPIServer ¶
type UnsafeServiceAPIServer interface {
// contains filtered or unexported methods
}
UnsafeServiceAPIServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ServiceAPIServer will result in compilation errors.