Documentation ¶
Overview ¶
Package experimental is a place where we include interfaces and structures that may be useful, but require additional testing and feedback before we think they should be added to the main SDK. The features in this package may change without notice.
Index ¶
- func MainXYZ()
- func SendJSON(sender backend.CallResourceResponseSender, obj interface{}) error
- func SendPlainText(sender backend.CallResourceResponseSender, text string) error
- func SendResourceResponse(sender backend.CallResourceResponseSender, status int, ...) error
- type DataSourceInstance
- type InstanceManager
- func (p *InstanceManager) CallResource(ctx context.Context, req *backend.CallResourceRequest, ...) error
- func (p *InstanceManager) CheckHealth(ctx context.Context, req *backend.CheckHealthRequest) (*backend.CheckHealthResult, error)
- func (p *InstanceManager) QueryData(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
- func (p *InstanceManager) RunGRPCServer() error
- type MyDataSourceInstance
- func (ds *MyDataSourceInstance) CallResource(req *backend.CallResourceRequest, sender backend.CallResourceResponseSender) error
- func (ds *MyDataSourceInstance) CheckHealth() *backend.CheckHealthResult
- func (ds *MyDataSourceInstance) Destroy()
- func (ds *MyDataSourceInstance) QueryData(req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
- type MyHost
- type PluginHost
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SendJSON ¶
func SendJSON(sender backend.CallResourceResponseSender, obj interface{}) error
SendJSON sends a JSON object.
func SendPlainText ¶
func SendPlainText(sender backend.CallResourceResponseSender, text string) error
SendPlainText sends a plain text snippet.
func SendResourceResponse ¶
func SendResourceResponse( sender backend.CallResourceResponseSender, status int, headers map[string][]string, body []byte, ) error
SendResourceResponse sends a JSON object.
Types ¶
type DataSourceInstance ¶
type DataSourceInstance interface { CheckHealth() *backend.CheckHealthResult // If the request does not need access to the headers or user, use this request QueryData(req *backend.QueryDataRequest) (*backend.QueryDataResponse, error) // CallResource calls a resource. CallResource(req *backend.CallResourceRequest, sender backend.CallResourceResponseSender) error // Destroy lets you clean up any instance variables when the settings change Destroy() }
DataSourceInstance implements each of the supported requests. Alternatively this could be a set of interfaces that work for DataSource|AlertNotifier|etc|etc... with the support interrogated and maintained by the helper on startup.
type InstanceManager ¶
InstanceManager is a singleton that holds all datasource instances
func NewInstanceManager ¶
func NewInstanceManager(host PluginHost) *InstanceManager
NewInstanceManager creates a new instance manager.
func (*InstanceManager) CallResource ¶
func (p *InstanceManager) CallResource(ctx context.Context, req *backend.CallResourceRequest, sender backend.CallResourceResponseSender) error
CallResource calls a resource.
func (*InstanceManager) CheckHealth ¶
func (p *InstanceManager) CheckHealth(ctx context.Context, req *backend.CheckHealthRequest) (*backend.CheckHealthResult, error)
CheckHealth checks if the plugin is running properly
func (*InstanceManager) QueryData ¶
func (p *InstanceManager) QueryData(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
QueryData queries for data.
func (*InstanceManager) RunGRPCServer ¶
func (p *InstanceManager) RunGRPCServer() error
RunGRPCServer starts the GRPC server
type MyDataSourceInstance ¶
type MyDataSourceInstance struct {
// contains filtered or unexported fields
}
MyDataSourceInstance implements backend.DataSourceInstance
func (*MyDataSourceInstance) CallResource ¶
func (ds *MyDataSourceInstance) CallResource(req *backend.CallResourceRequest, sender backend.CallResourceResponseSender) error
CallResource HTTP style resource
func (*MyDataSourceInstance) CheckHealth ¶
func (ds *MyDataSourceInstance) CheckHealth() *backend.CheckHealthResult
CheckHealth will check the currently configured settings
func (*MyDataSourceInstance) Destroy ¶
func (ds *MyDataSourceInstance) Destroy()
Destroy destroy an instance (if necessary)
func (*MyDataSourceInstance) QueryData ¶
func (ds *MyDataSourceInstance) QueryData(req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
QueryData will run a set of queries
type MyHost ¶
type MyHost struct{}
MyHost is a singleton host service.
func (*MyHost) CheckHostHealth ¶
func (ds *MyHost) CheckHostHealth(ctx backend.PluginContext) *backend.CheckHealthResult
CheckHostHealth returns a backend.CheckHealthResult.
func (*MyHost) NewDataSourceInstance ¶
func (ds *MyHost) NewDataSourceInstance(ctx backend.PluginContext) (DataSourceInstance, error)
NewDataSourceInstance creates a new datasource instance.
type PluginHost ¶
type PluginHost interface { // CheckExeHealth corresponds to CheckHostHealth for the plugin executable. CheckHostHealth(ctx backend.PluginContext) *backend.CheckHealthResult // NewDataSourceInstance makes a request for a new datasource. NewDataSourceInstance(ctx backend.PluginContext) (DataSourceInstance, error) }
PluginHost is the singleton container for your plugin.