package
0.23.1
Repository: https://github.com/grafana/grafana-app-sdk.git
Documentation: pkg.go.dev

# Functions

CtxWithVar adds new value value with name name to context ctx.
CtxWithVars adds Vars to context.
MatchedRouteFromContext returns the RouteInfo set in the request context by the router.
NewCapturingMiddleware creates a middleware that allows one to add behavior that affects both the request and the response of the call.
NewJSONRouter returns a new JSONRouter with a logger.
NewJSONRouterWithErrorHandler returns a new JSONRouter with a logger and a custom error handler.
NewLoggingMiddleware returns a MiddleWareFunc which logs an INFO level message for each request, and injects the provided Logger into the context used downstream.
No description provided by the author
NewResourceGroupRouter returns a new ResourceGroupRouter, exposing CRUD routes to manipulate resources in given group.
NewResourceGroupRouterWithStore returns a new ResourceGroupRouter with pre-configured Store.
NewRouter returns a new Router.
NewTracingMiddleware returns a MiddlewareFunc which adds a tracing span for every request which lasts the duration of the request's handle time and includes all attributes which are a part of OpenTelemetry's Semantic Conventions for HTTP spans: https://github.com/open-telemetry/semantic-conventions/blob/main/docs/http/http-spans.md.
NewVars returns a new empty Vars.
VarsFromCtx returns Vars that have been set in the context.Context provided.

# Constants

ContentTypeJSON is the content-type header value for JSON content.
HeaderContentType is the header key for content type.

# Variables

No description provided by the author
DefaultNotFoundHandler is the handler that is used for handling requests when a handler can't be found for a given route.

# Structs

CapturingSender is a backend.CallResourceResponseSender that captures the sent response, allowing other to tweak with it and send it afterwards.
JSONErrorResponse is the default response format used to render errors from JSON route handlers.
JSONRequest is the request that is parsed by JSONRouter and passed to its handlers.
JSONResourceHandler is a resource handler that uses the following routing convention: * GET "/{name}" - `List` all resources "name" * POST "/{name}" - `Create` a new resource "name" * GET "/{name}/{id}" - `Read` a resource "name" with id "id" * PUT "/{name}/{id}" - `Update` a resource "name" with id "id" * DELETE "/{name}/{id}" - `Delete` a resource "name" with id "id".
JSONRouter is a router that assumes that responses are JSON-encoded messages and errors carry response codes.
ResourceGroupRouter is a Router which exposes generic CRUD routes for every resource contained in a given group.
RouteHandler is a Handler function assigned to a route.
RouteInfo stores information about a matched route.
Router is a simple request router specific to the grafana plugin SDK backend.CallResourceRequest HTTP calls.
Subrouter is a slightly-extended router meant for being registered a with Subrouter() on either a Router or Subrouter.

# Interfaces

Store is the interface for a CRD storage component.

# Type aliases

HandlerFunc defines the signatures handlers need to have in order to be used in this router.
JSONErrorHandler is a function that takes an error and transforms it into an HTTP code and JSON response pair.
JSONHandlerFunc is a JSON request handler, that takes a context and request and returns a response or an error.
JSONResponse is the response that is returned by JSONRouter handlers.
MiddlewareFunc is a function that receives a HandlerFunc and returns another HandlerFunc.
NextFunc is the main function to call the downstream middleware when using a capturing middleware.
Vars is a mapping of string keys to string values, which holds variables captured from the route.