Documentation
¶
Index ¶
- Variables
- func Serve(opts ServeOpts) error
- func SetupPluginEnvironment(pluginID string) hclog.Logger
- type CallResourceHandler
- type CallResourceRequest
- type CallResourceResponse
- type CallResourceResponseSender
- type CheckHealthHandler
- type CheckHealthRequest
- type CheckHealthResult
- type DataQuery
- type DataSourceConfig
- type HealthStatus
- type PluginConfig
- type QueryDataHandler
- type QueryDataRequest
- type QueryDataResponse
- type ServeOpts
- type TimeRange
- type TransformDataCallBackHandler
- type TransformDataHandler
- type TransformHandlers
- type User
Constants ¶
This section is empty.
Variables ¶
var Logger log.Logger = log.New()
Logger is the default logger instance.
Functions ¶
func SetupPluginEnvironment ¶ added in v0.29.0
SetupPluginEnvironment will read the environment variables and apply the standard environment behavior. As the SDK evolves, this will likely change!
Types ¶
type CallResourceHandler ¶
type CallResourceHandler interface {
CallResource(ctx context.Context, req *CallResourceRequest, sender CallResourceResponseSender) error
}
CallResourceHandler handles resource calls.
type CallResourceRequest ¶
type CallResourceResponse ¶
type CallResourceResponseSender ¶
type CallResourceResponseSender interface {
Send(*CallResourceResponse) error
}
CallResourceResponseSender used for sending resource call responses.
type CheckHealthHandler ¶
type CheckHealthHandler interface {
CheckHealth(ctx context.Context, req *CheckHealthRequest) (*CheckHealthResult, error)
}
CheckHealthHandler enables users to send health check requests to a backend plugin
type CheckHealthRequest ¶
type CheckHealthRequest struct {
PluginConfig PluginConfig
}
CheckHealthRequest contains the healthcheck request
type CheckHealthResult ¶
type CheckHealthResult struct {
Status HealthStatus
Message string
JSONDetails string
}
CheckHealthResult contains the healthcheck response
type DataQuery ¶
type DataQuery struct {
RefID string
MaxDataPoints int64
Interval time.Duration
TimeRange TimeRange
JSON json.RawMessage
}
DataQuery represents the query as sent from the frontend.
type DataSourceConfig ¶
type DataSourceConfig struct {
ID int64
Name string
URL string
User string
Database string
BasicAuthEnabled bool
BasicAuthUser string
JSONData json.RawMessage
DecryptedSecureJSONData map[string]string
Updated time.Time
}
DataSourceConfig configuration for a datasource plugin.
type HealthStatus ¶
type HealthStatus int
HealthStatus is the status of the plugin.
const ( // HealthStatusUnknown means the status of the plugin is unknown. HealthStatusUnknown HealthStatus = iota // HealthStatusOk means the status of the plugin is good. HealthStatusOk // HealthStatusError means the plugin is in an error state. HealthStatusError )
type PluginConfig ¶
type PluginConfig struct {
OrgID int64
PluginID string
JSONData json.RawMessage
DecryptedSecureJSONData map[string]string
Updated time.Time
DataSourceConfig *DataSourceConfig
}
PluginConfig configuration for a plugin.
type QueryDataHandler ¶
type QueryDataHandler interface {
QueryData(ctx context.Context, req *QueryDataRequest) (*QueryDataResponse, error)
}
QueryDataHandler handles data queries.
type QueryDataRequest ¶
type QueryDataRequest struct {
PluginConfig PluginConfig
Headers map[string]string
Queries []DataQuery
User *User
}
type QueryDataResponse ¶
QueryDataResponse holds the results for a given query.
type ServeOpts ¶
type ServeOpts struct {
CheckHealthHandler CheckHealthHandler
CallResourceHandler CallResourceHandler
QueryDataHandler QueryDataHandler
TransformDataHandler TransformDataHandler
}
ServeOpts options for serving plugins.
type TransformDataCallBackHandler ¶
type TransformDataCallBackHandler interface {
// TODO: Forget if I actually need PluginConfig on the callback or not.
QueryData(ctx context.Context, req *QueryDataRequest) (*QueryDataResponse, error)
}
type TransformDataHandler ¶
type TransformDataHandler interface {
TransformData(ctx context.Context, req *QueryDataRequest, callBack TransformDataCallBackHandler) (*QueryDataResponse, error)
}
type TransformHandlers ¶
type TransformHandlers interface {
TransformDataHandler
}
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
resource
|
|
|
httpadapter
Package httpadapter provides support for handling resource calls using an http.Handler.
|
Package httpadapter provides support for handling resource calls using an http.Handler. |