models

package
v1.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthenticationMethodNone         = "none"
	AuthenticationMethodBasic        = "basicAuth"
	AuthenticationMethodApiKey       = "apiKey"
	AuthenticationMethodBearerToken  = "bearerToken"
	AuthenticationMethodForwardOauth = "oauthPassThru"
	AuthenticationMethodDigestAuth   = "digestAuth"
	AuthenticationMethodOAuth        = "oauth2"
	AuthenticationMethodAWS          = "aws"
)
View Source
const (
	AuthOAuthTypeClientCredentials = "client_credentials"
	AuthOAuthJWT                   = "jwt"
	AuthOAuthOthers                = "others"
)
View Source
const (
	ApiKeyTypeHeader = "header"
	ApiKeyTypeQuery  = "query"
)

Variables

This section is empty.

Functions

func GetSecrets

func GetSecrets(config backend.DataSourceInstanceSettings, secretType string, secretValue string) map[string]string

func InterPolateMacros

func InterPolateMacros(queryString string, timeRange backend.TimeRange, pluginContext backend.PluginContext) (string, error)

InterPolateMacros interpolate macros on a given string

Types

type AWSAuthType

type AWSAuthType string
const (
	AWSAuthTypeKeys AWSAuthType = "keys"
)

type AWSSettings

type AWSSettings struct {
	AuthType AWSAuthType `json:"authType"`
	Region   string      `json:"region"`
	Service  string      `json:"service"`
}

type InfinityCSVOptions

type InfinityCSVOptions struct {
	Delimiter          string `json:"delimiter"`
	SkipEmptyLines     bool   `json:"skip_empty_lines"`
	SkipLinesWithError bool   `json:"skip_lines_with_error"`
	RelaxColumnCount   bool   `json:"relax_column_count"`
	Columns            string `json:"columns"`
	Comment            string `json:"comment"`
}

type InfinityColumn

type InfinityColumn struct {
	Selector        string `json:"selector"`
	Text            string `json:"text"`
	Type            string `json:"type"` // "string" | "number" | "timestamp" | "timestamp_epoch" | "timestamp_epoch_s"
	TimeStampFormat string `json:"timestampFormat"`
}

type InfinityDataOverride

type InfinityDataOverride struct {
	Values   []string `json:"values"`
	Operator string   `json:"operator"`
	Override string   `json:"override"`
}

type InfinityFilter

type InfinityFilter struct {
	Field    string   `json:"field"`
	Operator string   `json:"operator"`
	Value    []string `json:"value"`
}

type InfinityJSONOptions

type InfinityJSONOptions struct {
	RootIsNotArray bool `json:"root_is_not_array"`
	ColumnNar      bool `json:"columnar"`
}

type InfinityParser

type InfinityParser string
const (
	InfinityParserSimple  InfinityParser = "simple"
	InfinityParserBackend InfinityParser = "backend"
	InfinityParserSQLite  InfinityParser = "sqlite"
	InfinityParserUQL     InfinityParser = "uql"
	InfinityParserGROQ    InfinityParser = "groq"
)

type InfinitySettings

type InfinitySettings struct {
	AuthenticationMethod string
	OAuth2Settings       OAuth2Settings
	BearerToken          string
	ApiKeyKey            string
	ApiKeyType           string
	ApiKeyValue          string
	AWSSettings          AWSSettings
	AWSAccessKey         string
	AWSSecretKey         string
	URL                  string
	BasicAuthEnabled     bool
	UserName             string
	Password             string
	ForwardOauthIdentity bool
	CustomHeaders        map[string]string
	SecureQueryFields    map[string]string
	InsecureSkipVerify   bool
	ServerName           string
	TimeoutInSeconds     int64
	TLSClientAuth        bool
	TLSAuthWithCACert    bool
	TLSCACert            string
	TLSClientCert        string
	TLSClientKey         string
	AllowedHosts         []string
	EnableOpenAPI        bool
	OpenAPIVersion       string
	OpenAPIUrl           string
	OpenAPIBaseUrl       string
	ReferenceData        []RefData
}

func LoadSettings

func LoadSettings(config backend.DataSourceInstanceSettings) (settings InfinitySettings, err error)

func (*InfinitySettings) HaveSecureHeaders

func (s *InfinitySettings) HaveSecureHeaders() bool

func (*InfinitySettings) Validate

func (s *InfinitySettings) Validate() error

type InfinitySettingsJson

type InfinitySettingsJson struct {
	AuthenticationMethod string         `json:"auth_method,omitempty"`
	APIKeyKey            string         `json:"apiKeyKey,omitempty"`
	APIKeyType           string         `json:"apiKeyType,omitempty"`
	OAuth2Settings       OAuth2Settings `json:"oauth2,omitempty"`
	AWSSettings          AWSSettings    `json:"aws,omitempty"`
	ForwardOauthIdentity bool           `json:"oauthPassThru,omitempty"`
	InsecureSkipVerify   bool           `json:"tlsSkipVerify,omitempty"`
	ServerName           string         `json:"serverName,omitempty"`
	TLSClientAuth        bool           `json:"tlsAuth,omitempty"`
	TLSAuthWithCACert    bool           `json:"tlsAuthWithCACert,omitempty"`
	TimeoutInSeconds     int64          `json:"timeoutInSeconds,omitempty"`
	AllowedHosts         []string       `json:"allowedHosts,omitempty"`
	EnableOpenAPI        bool           `json:"enableOpenApi,omitempty"`
	OpenAPIVersion       string         `json:"openApiVersion,omitempty"`
	OpenAPIUrl           string         `json:"openApiUrl,omitempty"`
	OpenAPIBaseUrl       string         `json:"openAPIBaseURL,omitempty"`
	ReferenceData        []RefData      `json:"refData,omitempty"`
}

type OAuth2Settings

type OAuth2Settings struct {
	OAuth2Type     string   `json:"oauth2_type,omitempty"`
	ClientID       string   `json:"client_id,omitempty"`
	TokenURL       string   `json:"token_url,omitempty"`
	Email          string   `json:"email,omitempty"`
	PrivateKeyID   string   `json:"private_key_id,omitempty"`
	Subject        string   `json:"subject,omitempty"`
	Scopes         []string `json:"scopes,omitempty"`
	ClientSecret   string
	PrivateKey     string
	EndpointParams map[string]string
}

type Query

type Query struct {
	RefID               string                 `json:"refId"`
	Type                QueryType              `json:"type"`   // 'json' | 'json-backend' | 'csv' | 'tsv' | 'xml' | 'graphql' | 'html' | 'uql' | 'groq' | 'series' | 'global' | 'google-sheets'
	Format              string                 `json:"format"` // 'table' | 'timeseries' | 'dataframe' | 'as-is' | 'node-graph-nodes' | 'node-graph-edges'
	Source              string                 `json:"source"` // 'url' | 'inline' | 'reference' | 'random-walk' | 'expression'
	RefName             string                 `json:"referenceName,omitempty"`
	URL                 string                 `json:"url"`
	URLOptions          URLOptions             `json:"url_options"`
	Data                string                 `json:"data"`
	Parser              InfinityParser         `json:"parser"` // 'simple' | 'backend' | 'sqlite' | 'uql' | 'groq'
	FilterExpression    string                 `json:"filterExpression"`
	SummarizeExpression string                 `json:"summarizeExpression"`
	SummarizeBy         string                 `json:"summarizeBy"`
	UQL                 string                 `json:"uql"`
	GROQ                string                 `json:"groq"`
	SQLiteQuery         string                 `json:"sqlite_query"`
	CSVOptions          InfinityCSVOptions     `json:"csv_options"`
	JSONOptions         InfinityJSONOptions    `json:"json_options"`
	RootSelector        string                 `json:"root_selector"`
	Columns             []InfinityColumn       `json:"columns"`
	ComputedColumns     []InfinityColumn       `json:"computed_columns"`
	Filters             []InfinityFilter       `json:"filters"`
	SeriesCount         int64                  `json:"seriesCount"`
	Expression          string                 `json:"expression"`
	Alias               string                 `json:"alias"`
	DataOverrides       []InfinityDataOverride `json:"dataOverrides"`
	GlobalQueryID       string                 `json:"global_query_id"`
	QueryMode           string                 `json:"query_mode"`
	Spreadsheet         string                 `json:"spreadsheet,omitempty"`
	SheetName           string                 `json:"sheetName,omitempty"`
	SheetRange          string                 `json:"range,omitempty"`
}

func ApplyDefaultsToQuery

func ApplyDefaultsToQuery(ctx context.Context, query Query) Query

func ApplyMacros

func ApplyMacros(ctx context.Context, query Query, timeRange backend.TimeRange, pluginContext backend.PluginContext) (Query, error)

ApplyMacros interpolates macros on a given infinity Query

func LoadQuery

func LoadQuery(ctx context.Context, backendQuery backend.DataQuery, pluginContext backend.PluginContext) (Query, error)

type QueryType

type QueryType string
const (
	QueryTypeJSON    QueryType = "json"
	QueryTypeCSV     QueryType = "csv"
	QueryTypeTSV     QueryType = "tsv"
	QueryTypeXML     QueryType = "xml"
	QueryTypeGraphQL QueryType = "graphql"
	QueryTypeHTML    QueryType = "html"
	QueryTypeUQL     QueryType = "uql"
	QueryTypeGROQ    QueryType = "groq"
	QueryTypeGSheets QueryType = "google-sheets"
)

type RefData

type RefData struct {
	Name string `json:"name,omitempty"`
	Data string `json:"data,omitempty"`
}

type URLOptionKeyValuePair

type URLOptionKeyValuePair struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type URLOptions

type URLOptions struct {
	Method           string                  `json:"method"` // 'GET' | 'POST'
	Params           []URLOptionKeyValuePair `json:"params"`
	Headers          []URLOptionKeyValuePair `json:"headers"`
	Body             string                  `json:"data"`
	BodyType         string                  `json:"body_type"`
	BodyContentType  string                  `json:"body_content_type"`
	BodyForm         []URLOptionKeyValuePair `json:"body_form"`
	BodyGraphQLQuery string                  `json:"body_graphql_query"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL