mirror of
https://github.com/grafana/grafana.git
synced 2024-12-01 21:19:28 -06:00
e96f67ae2e
* svg fun * #50597: add proto * #50597: add sanitizer methods * #50597: add provider * #50597: use sanitizer * #50597: use sanitizer * update grafana to match new api * add comments * add capability check * add timing * update sanitize path * improve log message * strings.HasPrefix rather than filepath.IsAbs * filepath.Clean + filepath.ToSlash for windows * read 404 * remove `path.clean` from `getPathAndScope` * add resp body close * remove unneeded prop * Update pkg/services/rendering/rendering.go Co-authored-by: Agnès Toulet <35176601+AgnesToulet@users.noreply.github.com> * remove test files * filepath.ToSlash correct wrapping * filepath.ToSlash correct wrapping * filepath.ToSlash comment * compilation error * lint fix * fix error message * Update pkg/services/rendering/rendering.go Co-authored-by: Agnès Toulet <35176601+AgnesToulet@users.noreply.github.com> * add `image/svg+xml` mime type * refactored log * refactored log Co-authored-by: Agnès Toulet <35176601+AgnesToulet@users.noreply.github.com>
43 lines
1.1 KiB
Go
43 lines
1.1 KiB
Go
package pluginextensionv2
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/hashicorp/go-plugin"
|
|
"google.golang.org/grpc"
|
|
)
|
|
|
|
type RendererPlugin interface {
|
|
RendererClient
|
|
SanitizerClient
|
|
}
|
|
|
|
type RendererGRPCPlugin struct {
|
|
plugin.NetRPCUnsupportedPlugin
|
|
}
|
|
|
|
func (p *RendererGRPCPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error {
|
|
return nil
|
|
}
|
|
|
|
func (p *RendererGRPCPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error) {
|
|
return &RendererGRPCClient{NewRendererClient(c), NewSanitizerClient(c)}, nil
|
|
}
|
|
|
|
type RendererGRPCClient struct {
|
|
RendererClient
|
|
SanitizerClient
|
|
}
|
|
|
|
func (m *RendererGRPCClient) Sanitize(ctx context.Context, req *SanitizeRequest, opts ...grpc.CallOption) (*SanitizeResponse, error) {
|
|
return m.SanitizerClient.Sanitize(ctx, req, opts...)
|
|
}
|
|
|
|
func (m *RendererGRPCClient) Render(ctx context.Context, req *RenderRequest, opts ...grpc.CallOption) (*RenderResponse, error) {
|
|
return m.RendererClient.Render(ctx, req)
|
|
}
|
|
|
|
var _ RendererClient = &RendererGRPCClient{}
|
|
var _ SanitizerClient = &RendererGRPCClient{}
|
|
var _ plugin.GRPCPlugin = &RendererGRPCPlugin{}
|