Documentation
¶
Index ¶
- Constants
- func GetRequest(config Config, query Query, headersFromGrafana map[string]string) (*http.Request, error)
- func NewHTTPClient(config *Config) *http.Client
- func NewPlugin(restDriver RestDriver, restDriverOptions RestDriverOptions) datasource.ServeOpts
- func QueryData(ctx context.Context, backendQuery backend.DataQuery, ...) backend.DataResponse
- func QueryDataResponse(ctx context.Context, instance *datasourceInstance, ...) (*backend.QueryDataResponse, error)
- func SpecFromJson(jsonString string) (openapi3.Spec, error)
- type APIKeyType
- type AuthType
- type BodyType
- type Config
- type KV
- type OAuth2Type
- type Query
- type QueryType
- type QueryURLMethod
- type ResponseMeta
- type RestDS
- type RestDriver
- type RestDriverOptions
Constants ¶
View Source
const ( HeaderKeyAccept = "Accept" HeaderKeyContentType = "Content-Type" HeaderKeyAuthorization = "Authorization" )
Variables ¶
This section is empty.
Functions ¶
func GetRequest ¶
func NewHTTPClient ¶
func NewPlugin ¶
func NewPlugin(restDriver RestDriver, restDriverOptions RestDriverOptions) datasource.ServeOpts
func QueryData ¶
func QueryData(ctx context.Context, backendQuery backend.DataQuery, instance datasourceInstance, headersFromGrafana map[string]string, pluginContext backend.PluginContext) backend.DataResponse
func QueryDataResponse ¶
func QueryDataResponse(ctx context.Context, instance *datasourceInstance, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
Types ¶
type APIKeyType ¶
type APIKeyType string
const ( ApiKeyTypeHeader APIKeyType = "header" ApiKeyTypeQuery APIKeyType = "query" )
type Config ¶
type Config struct { BaseURL string AuthenticationMethod AuthType BasicAuthUser string BasicAuthPassword string ApiKeyType APIKeyType ApiKeyKey string ApiKeyValue string BearerToken string Headers map[string]string QueryParams map[string]string OAuth2Settings struct { Type OAuth2Type TokenURL string ClientID string ClientSecret string Email string PrivateKeyID string PrivateKey string Subject string Scopes []string EndpointParams map[string]string } }
type OAuth2Type ¶
type OAuth2Type string
const ( OAuth2TypeClientCredentials OAuth2Type = "client_credentials" OAuth2TypeJWT OAuth2Type = "jwt" )
type Query ¶
type Query struct { RefID string `json:"refId"` QueryType QueryType `json:"type"` URL string `json:"url,omitempty"` Method QueryURLMethod `json:"method,omitempty"` Headers []KV `json:"headers,omitempty"` BodyType BodyType `json:"bodyType,omitempty"` Body string `json:"body,omitempty"` BodyContentType string `json:"bodyContentType,omitempty"` BodyForm []KV `json:"bodyForm,omitempty"` BodyGraphQLQuery string `json:"bodyGraphQLQuery,omitempty"` RootSelector string `json:"rootSelector,omitempty"` }
type QueryURLMethod ¶
type QueryURLMethod string
const ( QueryURLMethodGet QueryURLMethod = http.MethodGet QueryURLMethodPost QueryURLMethod = http.MethodPost )
type ResponseMeta ¶
type RestDS ¶
func (*RestDS) GetResponse ¶
func (restds *RestDS) GetResponse(query Query) (responseBody string, meta ResponseMeta, err error)
type RestDriver ¶
type RestDriverOptions ¶
type RestDriverOptions struct { PluginName string PluginID string HealthCheckURL string CustomHealthCheckValidation func(responseString string, meta ResponseMeta) *backend.CheckHealthResult }
Click to show internal directories.
Click to hide internal directories.