Documentation
¶
Index ¶
- Variables
- type AuthOpts
- type CSVOpts
- type Capability
- type CapabilityName
- type CapabilitySupportRequestResult
- type CommonOpts
- type ErrorOpts
- type MockService
- func (m *MockService) CreateRenderingSession(ctx context.Context, authOpts AuthOpts, sessionOpts SessionOpts) (Session, error)
- func (m *MockService) EXPECT() *MockServiceMockRecorder
- func (m *MockService) GetRenderUser(ctx context.Context, key string) (*RenderUser, bool)
- func (m *MockService) HasCapability(ctx context.Context, capability CapabilityName) (CapabilitySupportRequestResult, error)
- func (m *MockService) IsAvailable(ctx context.Context) bool
- func (m *MockService) IsCapabilitySupported(ctx context.Context, capability CapabilityName) error
- func (m *MockService) Render(ctx context.Context, renderType RenderType, opts Opts, session Session) (*RenderResult, error)
- func (m *MockService) RenderCSV(ctx context.Context, opts CSVOpts, session Session) (*RenderCSVResult, error)
- func (m *MockService) RenderErrorImage(theme models.Theme, err error) (*RenderResult, error)
- func (m *MockService) SanitizeSVG(ctx context.Context, req *SanitizeSVGRequest) (*SanitizeSVGResponse, error)
- func (m *MockService) Version() string
- type MockServiceMockRecorder
- func (mr *MockServiceMockRecorder) CreateRenderingSession(ctx, authOpts, sessionOpts interface{}) *gomock.Call
- func (mr *MockServiceMockRecorder) GetRenderUser(ctx, key interface{}) *gomock.Call
- func (mr *MockServiceMockRecorder) HasCapability(ctx, capability interface{}) *gomock.Call
- func (mr *MockServiceMockRecorder) IsAvailable(ctx interface{}) *gomock.Call
- func (mr *MockServiceMockRecorder) IsCapabilitySupported(ctx, capability interface{}) *gomock.Call
- func (mr *MockServiceMockRecorder) Render(ctx, renderType, opts, session interface{}) *gomock.Call
- func (mr *MockServiceMockRecorder) RenderCSV(ctx, opts, session interface{}) *gomock.Call
- func (mr *MockServiceMockRecorder) RenderErrorImage(theme, error interface{}) *gomock.Call
- func (mr *MockServiceMockRecorder) SanitizeSVG(ctx, req interface{}) *gomock.Call
- func (mr *MockServiceMockRecorder) Version() *gomock.Call
- type Opts
- type Plugin
- type PluginManager
- type RenderCSVResult
- type RenderResult
- type RenderType
- type RenderUser
- type RenderingService
- func (rs *RenderingService) CreateRenderingSession(ctx context.Context, opts AuthOpts, sessionOpts SessionOpts) (Session, error)
- func (rs *RenderingService) GetRenderUser(ctx context.Context, key string) (*RenderUser, bool)
- func (rs *RenderingService) HasCapability(ctx context.Context, capability CapabilityName) (CapabilitySupportRequestResult, error)
- func (rs *RenderingService) IsAvailable(ctx context.Context) bool
- func (rs *RenderingService) IsCapabilitySupported(ctx context.Context, capabilityName CapabilityName) error
- func (rs *RenderingService) Render(ctx context.Context, renderType RenderType, opts Opts, session Session) (*RenderResult, error)
- func (rs *RenderingService) RenderCSV(ctx context.Context, opts CSVOpts, session Session) (*RenderCSVResult, error)
- func (rs *RenderingService) RenderErrorImage(theme models.Theme, err error) (*RenderResult, error)
- func (rs *RenderingService) Run(ctx context.Context) error
- func (rs *RenderingService) SanitizeSVG(ctx context.Context, req *SanitizeSVGRequest) (*SanitizeSVGResponse, error)
- func (rs *RenderingService) Version() string
- type Result
- type SanitizeSVGRequest
- type SanitizeSVGResponse
- type Service
- type Session
- type SessionOpts
- type TimeoutOpts
Constants ¶
This section is empty.
Variables ¶
var ErrConcurrentLimitReached = errors.New("rendering concurrent limit reached")
var ErrInvalidPluginVersion = errors.New("invalid plugin version")
var ErrServerTimeout = errutil.NewBase(errutil.StatusUnknown, "rendering.serverTimeout", errutil.WithPublicMessage("error trying to connect to image-renderer service"))
var ErrTimeout = errors.New("timeout error - you can set timeout in seconds with &timeout url parameter")
var ErrUnknownCapability = errors.New("unknown capability")
Functions ¶
This section is empty.
Types ¶
type CSVOpts ¶
type CSVOpts struct {
CommonOpts
}
type Capability ¶
type Capability struct {
// contains filtered or unexported fields
}
type CapabilityName ¶
type CapabilityName string
const ( ScalingDownImages CapabilityName = "ScalingDownImages" FullHeightImages CapabilityName = "FullHeightImages" SVGSanitization CapabilityName = "SvgSanitization" PDFRendering CapabilityName = "PdfRendering" )
type CommonOpts ¶
type MockService ¶
type MockService struct {
// contains filtered or unexported fields
}
MockService is a mock of Service interface.
func NewMockService ¶
func NewMockService(ctrl *gomock.Controller) *MockService
NewMockService creates a new mock instance.
func (*MockService) CreateRenderingSession ¶
func (m *MockService) CreateRenderingSession(ctx context.Context, authOpts AuthOpts, sessionOpts SessionOpts) (Session, error)
CreateRenderingSession mocks base method.
func (*MockService) EXPECT ¶
func (m *MockService) EXPECT() *MockServiceMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockService) GetRenderUser ¶
func (m *MockService) GetRenderUser(ctx context.Context, key string) (*RenderUser, bool)
GetRenderUser mocks base method.
func (*MockService) HasCapability ¶
func (m *MockService) HasCapability(ctx context.Context, capability CapabilityName) (CapabilitySupportRequestResult, error)
HasCapability mocks base method.
func (*MockService) IsAvailable ¶
func (m *MockService) IsAvailable(ctx context.Context) bool
IsAvailable mocks base method.
func (*MockService) IsCapabilitySupported ¶
func (m *MockService) IsCapabilitySupported(ctx context.Context, capability CapabilityName) error
IsCapabilitySupported mocks base method.
func (*MockService) Render ¶
func (m *MockService) Render(ctx context.Context, renderType RenderType, opts Opts, session Session) (*RenderResult, error)
Render mocks base method.
func (*MockService) RenderCSV ¶
func (m *MockService) RenderCSV(ctx context.Context, opts CSVOpts, session Session) (*RenderCSVResult, error)
RenderCSV mocks base method.
func (*MockService) RenderErrorImage ¶
func (m *MockService) RenderErrorImage(theme models.Theme, err error) (*RenderResult, error)
RenderErrorImage mocks base method.
func (*MockService) SanitizeSVG ¶
func (m *MockService) SanitizeSVG(ctx context.Context, req *SanitizeSVGRequest) (*SanitizeSVGResponse, error)
SanitizeSVG mocks base method.
type MockServiceMockRecorder ¶
type MockServiceMockRecorder struct {
// contains filtered or unexported fields
}
MockServiceMockRecorder is the mock recorder for MockService.
func (*MockServiceMockRecorder) CreateRenderingSession ¶
func (mr *MockServiceMockRecorder) CreateRenderingSession(ctx, authOpts, sessionOpts interface{}) *gomock.Call
CreateRenderingSession indicates an expected call of CreateRenderingSession.
func (*MockServiceMockRecorder) GetRenderUser ¶
func (mr *MockServiceMockRecorder) GetRenderUser(ctx, key interface{}) *gomock.Call
GetRenderUser indicates an expected call of GetRenderUser.
func (*MockServiceMockRecorder) HasCapability ¶
func (mr *MockServiceMockRecorder) HasCapability(ctx, capability interface{}) *gomock.Call
HasCapability indicates an expected call of HasCapability.
func (*MockServiceMockRecorder) IsAvailable ¶
func (mr *MockServiceMockRecorder) IsAvailable(ctx interface{}) *gomock.Call
IsAvailable indicates an expected call of IsAvailable.
func (*MockServiceMockRecorder) IsCapabilitySupported ¶
func (mr *MockServiceMockRecorder) IsCapabilitySupported(ctx, capability interface{}) *gomock.Call
IsCapabilitySupported indicates an expected call of IsCapabilitySupported.
func (*MockServiceMockRecorder) Render ¶
func (mr *MockServiceMockRecorder) Render(ctx, renderType, opts, session interface{}) *gomock.Call
Render indicates an expected call of Render.
func (*MockServiceMockRecorder) RenderCSV ¶
func (mr *MockServiceMockRecorder) RenderCSV(ctx, opts, session interface{}) *gomock.Call
RenderCSV indicates an expected call of RenderCSV.
func (*MockServiceMockRecorder) RenderErrorImage ¶
func (mr *MockServiceMockRecorder) RenderErrorImage(theme, error interface{}) *gomock.Call
RenderErrorImage indicates an expected call of RenderErrorImage.
func (*MockServiceMockRecorder) SanitizeSVG ¶
func (mr *MockServiceMockRecorder) SanitizeSVG(ctx, req interface{}) *gomock.Call
SanitizeSVG indicates an expected call of SanitizeSVG.
func (*MockServiceMockRecorder) Version ¶
func (mr *MockServiceMockRecorder) Version() *gomock.Call
Version indicates an expected call of Version.
type Plugin ¶
type Plugin interface { Client() (pluginextensionv2.RendererPlugin, error) Start(ctx context.Context) error Version() string }
type RenderCSVResult ¶
type RenderResult ¶
type RenderResult struct {
FilePath string
}
type RenderType ¶
type RenderType string
const ( RenderCSV RenderType = "csv" RenderPNG RenderType = "png" RenderPDF RenderType = "pdf" )
type RenderUser ¶
type RenderingService ¶
type RenderingService struct { Cfg *setting.Cfg RemoteCacheService *remotecache.RemoteCache RendererPluginManager PluginManager // contains filtered or unexported fields }
func ProvideService ¶
func ProvideService(cfg *setting.Cfg, features featuremgmt.FeatureToggles, remoteCache *remotecache.RemoteCache, rm PluginManager) (*RenderingService, error)
func (*RenderingService) CreateRenderingSession ¶
func (rs *RenderingService) CreateRenderingSession(ctx context.Context, opts AuthOpts, sessionOpts SessionOpts) (Session, error)
func (*RenderingService) GetRenderUser ¶
func (rs *RenderingService) GetRenderUser(ctx context.Context, key string) (*RenderUser, bool)
func (*RenderingService) HasCapability ¶
func (rs *RenderingService) HasCapability(ctx context.Context, capability CapabilityName) (CapabilitySupportRequestResult, error)
func (*RenderingService) IsAvailable ¶
func (rs *RenderingService) IsAvailable(ctx context.Context) bool
func (*RenderingService) IsCapabilitySupported ¶
func (rs *RenderingService) IsCapabilitySupported(ctx context.Context, capabilityName CapabilityName) error
func (*RenderingService) Render ¶
func (rs *RenderingService) Render(ctx context.Context, renderType RenderType, opts Opts, session Session) (*RenderResult, error)
Render calls the grafana image renderer and returns Grafana resource as PNG or PDF
func (*RenderingService) RenderCSV ¶
func (rs *RenderingService) RenderCSV(ctx context.Context, opts CSVOpts, session Session) (*RenderCSVResult, error)
func (*RenderingService) RenderErrorImage ¶
func (rs *RenderingService) RenderErrorImage(theme models.Theme, err error) (*RenderResult, error)
func (*RenderingService) SanitizeSVG ¶
func (rs *RenderingService) SanitizeSVG(ctx context.Context, req *SanitizeSVGRequest) (*SanitizeSVGResponse, error)
func (*RenderingService) Version ¶
func (rs *RenderingService) Version() string
type SanitizeSVGRequest ¶
type SanitizeSVGResponse ¶
type SanitizeSVGResponse struct {
Sanitized []byte
}
type Service ¶
type Service interface { IsAvailable(ctx context.Context) bool Version() string Render(ctx context.Context, renderType RenderType, opts Opts, session Session) (*RenderResult, error) RenderCSV(ctx context.Context, opts CSVOpts, session Session) (*RenderCSVResult, error) RenderErrorImage(theme models.Theme, error error) (*RenderResult, error) GetRenderUser(ctx context.Context, key string) (*RenderUser, bool) HasCapability(ctx context.Context, capability CapabilityName) (CapabilitySupportRequestResult, error) IsCapabilitySupported(ctx context.Context, capability CapabilityName) error CreateRenderingSession(ctx context.Context, authOpts AuthOpts, sessionOpts SessionOpts) (Session, error) SanitizeSVG(ctx context.Context, req *SanitizeSVGRequest) (*SanitizeSVGResponse, error) }