deps: Update thema, use CUE fork (#60496)
* deps: Update thema, use CUE fork * Remove superfluous openapi-codegen output * Update thema again to catch cuetsy changes * Rerun codegen with latest * Latest thema, removes cuetsy update * Latest of cuetsy * Update type usage * One last cuetsy rollback * Update playlist summary tests * More lint fixes * Remove TS veneer changes for VariableHide Co-authored-by: Clarity-89 <homes89@ukr.net>
This commit is contained in:
@@ -62,15 +62,17 @@ func (j *jennytypego) JennyName() string {
|
||||
}
|
||||
|
||||
func (j *jennytypego) Generate(lin thema.Lineage) (*codejen.File, error) {
|
||||
b, err := gocode.GenerateTypesOpenAPI(lin.Latest(), &gocode.TypeConfigOpenAPI{
|
||||
ApplyFuncs: []astutil.ApplyFunc{
|
||||
codegen.PrefixReplacer("Plugindef", "PluginDef"),
|
||||
},
|
||||
f, err := codegen.GoTypesJenny{ApplyFuncs: []astutil.ApplyFunc{
|
||||
codegen.PrefixReplacer("Plugindef", "PluginDef"),
|
||||
}}.Generate(codegen.SchemaForGen{
|
||||
Name: "PluginDef",
|
||||
Schema: lin.Latest(),
|
||||
IsGroup: false,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
if f != nil {
|
||||
f.RelativePath = filepath.Join(dirPlugindef, f.RelativePath)
|
||||
}
|
||||
return codejen.NewFile(filepath.Join(dirPlugindef, "plugindef_types_gen.go"), b, j), nil
|
||||
return f, err
|
||||
}
|
||||
|
||||
// one-off jenny for plugindef go bindings
|
||||
|
||||
@@ -77,7 +77,7 @@ func baseLineage(rt *thema.Runtime, opts ...thema.BindOption) (thema.Lineage, er
|
||||
// but is invalid due to the violation of some general Thema invariant -
|
||||
// for example, declared schemas don't follow backwards compatibility rules,
|
||||
// lenses are incomplete.
|
||||
return thema.BindLineage(raw, rt)
|
||||
return thema.BindLineage(raw, rt, opts...)
|
||||
}
|
||||
|
||||
// type guards
|
||||
|
||||
@@ -3,44 +3,12 @@
|
||||
// Generated by:
|
||||
// pkg/plugins/plugindef/gen.go
|
||||
// Using jennies:
|
||||
// PluginGoTypes
|
||||
// GoTypesJenny
|
||||
//
|
||||
// Run 'make gen-cue' from repository root to regenerate.
|
||||
|
||||
package plugindef
|
||||
|
||||
// Defines values for Category.
|
||||
const (
|
||||
CategoryCloud Category = "cloud"
|
||||
|
||||
CategoryEnterprise Category = "enterprise"
|
||||
|
||||
CategoryLogging Category = "logging"
|
||||
|
||||
CategoryOther Category = "other"
|
||||
|
||||
CategoryProfiling Category = "profiling"
|
||||
|
||||
CategorySql Category = "sql"
|
||||
|
||||
CategoryTracing Category = "tracing"
|
||||
|
||||
CategoryTsdb Category = "tsdb"
|
||||
)
|
||||
|
||||
// Defines values for Type.
|
||||
const (
|
||||
TypeApp Type = "app"
|
||||
|
||||
TypeDatasource Type = "datasource"
|
||||
|
||||
TypePanel Type = "panel"
|
||||
|
||||
TypeRenderer Type = "renderer"
|
||||
|
||||
TypeSecretsmanager Type = "secretsmanager"
|
||||
)
|
||||
|
||||
// Defines values for BasicRole.
|
||||
const (
|
||||
BasicRoleAdmin BasicRole = "Admin"
|
||||
@@ -98,17 +66,298 @@ const (
|
||||
ReleaseStateStable ReleaseState = "stable"
|
||||
)
|
||||
|
||||
// Defines values for RoleRegistrationGrants.
|
||||
// Defines values for Category.
|
||||
const (
|
||||
RoleRegistrationGrantsAdmin RoleRegistrationGrants = "Admin"
|
||||
CategoryCloud Category = "cloud"
|
||||
|
||||
RoleRegistrationGrantsEditor RoleRegistrationGrants = "Editor"
|
||||
CategoryEnterprise Category = "enterprise"
|
||||
|
||||
RoleRegistrationGrantsGrafanaAdmin RoleRegistrationGrants = "Grafana Admin"
|
||||
CategoryLogging Category = "logging"
|
||||
|
||||
RoleRegistrationGrantsViewer RoleRegistrationGrants = "Viewer"
|
||||
CategoryOther Category = "other"
|
||||
|
||||
CategoryProfiling Category = "profiling"
|
||||
|
||||
CategorySql Category = "sql"
|
||||
|
||||
CategoryTracing Category = "tracing"
|
||||
|
||||
CategoryTsdb Category = "tsdb"
|
||||
)
|
||||
|
||||
// Defines values for Type.
|
||||
const (
|
||||
TypeApp Type = "app"
|
||||
|
||||
TypeDatasource Type = "datasource"
|
||||
|
||||
TypePanel Type = "panel"
|
||||
|
||||
TypeRenderer Type = "renderer"
|
||||
|
||||
TypeSecretsmanager Type = "secretsmanager"
|
||||
)
|
||||
|
||||
// BasicRole is a Grafana basic role, which can be 'Viewer', 'Editor', 'Admin' or 'Grafana Admin'.
|
||||
// With RBAC, the Admin basic role inherits its default permissions from the Editor basic role which
|
||||
// in turn inherits them from the Viewer basic role.
|
||||
type BasicRole string
|
||||
|
||||
// BuildInfo defines model for BuildInfo.
|
||||
type BuildInfo struct {
|
||||
// Git branch the plugin was built from.
|
||||
Branch *string `json:"branch,omitempty"`
|
||||
|
||||
// Git hash of the commit the plugin was built from
|
||||
Hash *string `json:"hash,omitempty"`
|
||||
Number *int64 `json:"number,omitempty"`
|
||||
|
||||
// GitHub pull request the plugin was built from
|
||||
Pr *int32 `json:"pr,omitempty"`
|
||||
Repo *string `json:"repo,omitempty"`
|
||||
|
||||
// Time when the plugin was built, as a Unix timestamp.
|
||||
Time *int64 `json:"time,omitempty"`
|
||||
}
|
||||
|
||||
// Dependencies defines model for Dependencies.
|
||||
type Dependencies struct {
|
||||
// Required Grafana version for this plugin. Validated using
|
||||
// https://github.com/npm/node-semver.
|
||||
GrafanaDependency string `json:"grafanaDependency"`
|
||||
|
||||
// (Deprecated) Required Grafana version for this plugin, e.g.
|
||||
// `6.x.x 7.x.x` to denote plugin requires Grafana v6.x.x or
|
||||
// v7.x.x.
|
||||
GrafanaVersion *string `json:"grafanaVersion,omitempty"`
|
||||
|
||||
// An array of required plugins on which this plugin depends.
|
||||
Plugins *[]Dependency `json:"plugins,omitempty"`
|
||||
}
|
||||
|
||||
// Dependency describes another plugin on which a plugin depends.
|
||||
// The id refers to the plugin package identifier, as given on
|
||||
// the grafana.com plugin marketplace.
|
||||
type Dependency struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Type DependencyType `json:"type"`
|
||||
Version string `json:"version"`
|
||||
}
|
||||
|
||||
// DependencyType defines model for Dependency.Type.
|
||||
type DependencyType string
|
||||
|
||||
// Header describes an HTTP header that is forwarded with a proxied request for
|
||||
// a plugin route.
|
||||
type Header struct {
|
||||
Content string `json:"content"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
// A resource to be included in a plugin.
|
||||
type Include struct {
|
||||
// RBAC action the user must have to access the route
|
||||
Action *string `json:"action,omitempty"`
|
||||
|
||||
// Add the include to the side menu.
|
||||
AddToNav *bool `json:"addToNav,omitempty"`
|
||||
|
||||
// (Legacy) The Angular component to use for a page.
|
||||
Component *string `json:"component,omitempty"`
|
||||
|
||||
// Page or dashboard when user clicks the icon in the side menu.
|
||||
DefaultNav *bool `json:"defaultNav,omitempty"`
|
||||
|
||||
// Icon to use in the side menu. For information on available
|
||||
// icon, refer to [Icons
|
||||
// Overview](https://developers.grafana.com/ui/latest/index.html?path=/story/docs-overview-icon--icons-overview).
|
||||
Icon *string `json:"icon,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
|
||||
// Used for app plugins.
|
||||
Path *string `json:"path,omitempty"`
|
||||
Role *IncludeRole `json:"role,omitempty"`
|
||||
|
||||
// IncludeType is a string identifier of a plugin include type, which is
|
||||
// a superset of plugin types.
|
||||
Type IncludeType `json:"type"`
|
||||
|
||||
// Unique identifier of the included resource
|
||||
Uid *string `json:"uid,omitempty"`
|
||||
}
|
||||
|
||||
// IncludeRole defines model for Include.Role.
|
||||
type IncludeRole string
|
||||
|
||||
// IncludeType is a string identifier of a plugin include type, which is
|
||||
// a superset of plugin types.
|
||||
type IncludeType string
|
||||
|
||||
// Metadata about a Grafana plugin. Some fields are used on the plugins
|
||||
// page in Grafana and others on grafana.com, if the plugin is published.
|
||||
type Info struct {
|
||||
// Information about the plugin author.
|
||||
Author *struct {
|
||||
// Author's name.
|
||||
Email *string `json:"email,omitempty"`
|
||||
|
||||
// Author's name.
|
||||
Name *string `json:"name,omitempty"`
|
||||
|
||||
// Link to author's website.
|
||||
Url *string `json:"url,omitempty"`
|
||||
} `json:"author,omitempty"`
|
||||
Build *BuildInfo `json:"build,omitempty"`
|
||||
|
||||
// Description of plugin. Used on the plugins page in Grafana and
|
||||
// for search on grafana.com.
|
||||
Description *string `json:"description,omitempty"`
|
||||
|
||||
// Array of plugin keywords. Used for search on grafana.com.
|
||||
Keywords []string `json:"keywords"`
|
||||
|
||||
// An array of link objects to be displayed on this plugin's
|
||||
// project page in the form `{name: 'foo', url:
|
||||
// 'http://example.com'}`
|
||||
Links *[]struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
Url *string `json:"url,omitempty"`
|
||||
} `json:"links,omitempty"`
|
||||
|
||||
// SVG images that are used as plugin icons.
|
||||
Logos *struct {
|
||||
// Link to the "large" version of the plugin logo, which must be
|
||||
// an SVG image. "Large" and "small" logos can be the same image.
|
||||
Large string `json:"large"`
|
||||
|
||||
// Link to the "small" version of the plugin logo, which must be
|
||||
// an SVG image. "Large" and "small" logos can be the same image.
|
||||
Small string `json:"small"`
|
||||
} `json:"logos,omitempty"`
|
||||
|
||||
// An array of screenshot objects in the form `{name: 'bar', path:
|
||||
// 'img/screenshot.png'}`
|
||||
Screenshots *[]struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
Path *string `json:"path,omitempty"`
|
||||
} `json:"screenshots,omitempty"`
|
||||
|
||||
// Date when this plugin was built.
|
||||
Updated *string `json:"updated,omitempty"`
|
||||
|
||||
// Project version of this commit, e.g. `6.7.x`.
|
||||
Version *string `json:"version,omitempty"`
|
||||
}
|
||||
|
||||
// TODO docs
|
||||
// TODO should this really be separate from TokenAuth?
|
||||
type JWTTokenAuth struct {
|
||||
// Parameters for the JWT token authentication request.
|
||||
Params map[string]string `json:"params"`
|
||||
|
||||
// The list of scopes that your application should be granted
|
||||
// access to.
|
||||
Scopes []string `json:"scopes"`
|
||||
|
||||
// URL to fetch the JWT token.
|
||||
Url string `json:"url"`
|
||||
}
|
||||
|
||||
// Permission describes an RBAC permission on the plugin. A permission has an action and an optional
|
||||
// scope.
|
||||
// Example: action: 'test-app.schedules:read', scope: 'test-app.schedules:*'
|
||||
type Permission struct {
|
||||
Action string `json:"action"`
|
||||
Scope *string `json:"scope,omitempty"`
|
||||
}
|
||||
|
||||
// ReleaseState indicates release maturity state of a plugin.
|
||||
type ReleaseState string
|
||||
|
||||
// Role describes an RBAC role which allows grouping multiple related permissions on the plugin,
|
||||
// each of which has an action and an optional scope.
|
||||
// Example: the role 'Schedules Reader' bundles permissions to view all schedules of the plugin.
|
||||
type Role struct {
|
||||
Description string `json:"description"`
|
||||
Name string `json:"name"`
|
||||
Permissions []Permission `json:"permissions"`
|
||||
}
|
||||
|
||||
// RoleRegistration describes an RBAC role and its assignments to basic roles.
|
||||
// It organizes related RBAC permissions on the plugin into a role and defines which basic roles
|
||||
// will get them by default.
|
||||
// Example: the role 'Schedules Reader' bundles permissions to view all schedules of the plugin
|
||||
// which will be granted to Admins by default.
|
||||
type RoleRegistration struct {
|
||||
// Default assignment of the role to Grafana basic roles (Viewer, Editor, Admin, Grafana Admin)
|
||||
// The Admin basic role inherits its default permissions from the Editor basic role which in turn
|
||||
// inherits them from the Viewer basic role.
|
||||
Grants []BasicRole `json:"grants"`
|
||||
|
||||
// Role describes an RBAC role which allows grouping multiple related permissions on the plugin,
|
||||
// each of which has an action and an optional scope.
|
||||
// Example: the role 'Schedules Reader' bundles permissions to view all schedules of the plugin.
|
||||
Role Role `json:"role"`
|
||||
}
|
||||
|
||||
// A proxy route used in datasource plugins for plugin authentication
|
||||
// and adding headers to HTTP requests made by the plugin.
|
||||
// For more information, refer to [Authentication for data source
|
||||
// plugins](https://grafana.com/docs/grafana/latest/developers/plugins/authentication/).
|
||||
type Route struct {
|
||||
// For data source plugins. Route headers set the body content and
|
||||
// length to the proxied request.
|
||||
Body *map[string]interface{} `json:"body,omitempty"`
|
||||
|
||||
// For data source plugins. Route headers adds HTTP headers to the
|
||||
// proxied request.
|
||||
Headers *[]Header `json:"headers,omitempty"`
|
||||
|
||||
// TODO docs
|
||||
// TODO should this really be separate from TokenAuth?
|
||||
JwtTokenAuth *JWTTokenAuth `json:"jwtTokenAuth,omitempty"`
|
||||
|
||||
// For data source plugins. Route method matches the HTTP verb
|
||||
// like GET or POST. Multiple methods can be provided as a
|
||||
// comma-separated list.
|
||||
Method *string `json:"method,omitempty"`
|
||||
|
||||
// For data source plugins. The route path that is replaced by the
|
||||
// route URL field when proxying the call.
|
||||
Path *string `json:"path,omitempty"`
|
||||
ReqRole *string `json:"reqRole,omitempty"`
|
||||
ReqSignedIn *bool `json:"reqSignedIn,omitempty"`
|
||||
|
||||
// TODO docs
|
||||
TokenAuth *TokenAuth `json:"tokenAuth,omitempty"`
|
||||
|
||||
// For data source plugins. Route URL is where the request is
|
||||
// proxied to.
|
||||
Url *string `json:"url,omitempty"`
|
||||
UrlParams *[]URLParam `json:"urlParams,omitempty"`
|
||||
}
|
||||
|
||||
// TODO docs
|
||||
type TokenAuth struct {
|
||||
// Parameters for the token authentication request.
|
||||
Params map[string]string `json:"params"`
|
||||
|
||||
// The list of scopes that your application should be granted
|
||||
// access to.
|
||||
Scopes *[]string `json:"scopes,omitempty"`
|
||||
|
||||
// URL to fetch the authentication token.
|
||||
Url *string `json:"url,omitempty"`
|
||||
}
|
||||
|
||||
// URLParam describes query string parameters for
|
||||
// a url in a plugin route
|
||||
type URLParam struct {
|
||||
Content string `json:"content"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
// PluginDef defines model for plugindef.
|
||||
type PluginDef struct {
|
||||
// For data source plugins, if the plugin supports alerting.
|
||||
@@ -130,22 +379,8 @@ type PluginDef struct {
|
||||
BuiltIn bool `json:"builtIn"`
|
||||
|
||||
// Plugin category used on the Add data source page.
|
||||
Category *Category `json:"category,omitempty"`
|
||||
|
||||
// Dependencies needed by the plugin.
|
||||
Dependencies struct {
|
||||
// Required Grafana version for this plugin. Validated using
|
||||
// https://github.com/npm/node-semver.
|
||||
GrafanaDependency string `json:"grafanaDependency"`
|
||||
|
||||
// (Deprecated) Required Grafana version for this plugin, e.g.
|
||||
// `6.x.x 7.x.x` to denote plugin requires Grafana v6.x.x or
|
||||
// v7.x.x.
|
||||
GrafanaVersion *string `json:"grafanaVersion,omitempty"`
|
||||
|
||||
// An array of required plugins on which this plugin depends.
|
||||
Plugins *[]Dependency `json:"plugins,omitempty"`
|
||||
} `json:"dependencies"`
|
||||
Category *Category `json:"category,omitempty"`
|
||||
Dependencies Dependencies `json:"dependencies"`
|
||||
|
||||
// Grafana Enerprise specific features.
|
||||
EnterpriseFeatures *struct {
|
||||
@@ -179,60 +414,9 @@ type PluginDef struct {
|
||||
// Resources to include in plugin.
|
||||
Includes *[]Include `json:"includes,omitempty"`
|
||||
|
||||
// Metadata about the plugin.
|
||||
Info struct {
|
||||
// Information about the plugin author.
|
||||
Author *struct {
|
||||
// Author's name.
|
||||
Email *string `json:"email,omitempty"`
|
||||
|
||||
// Author's name.
|
||||
Name *string `json:"name,omitempty"`
|
||||
|
||||
// Link to author's website.
|
||||
Url *string `json:"url,omitempty"`
|
||||
} `json:"author,omitempty"`
|
||||
Build *BuildInfo `json:"build,omitempty"`
|
||||
|
||||
// Description of plugin. Used on the plugins page in Grafana and
|
||||
// for search on grafana.com.
|
||||
Description *string `json:"description,omitempty"`
|
||||
|
||||
// Array of plugin keywords. Used for search on grafana.com.
|
||||
Keywords []string `json:"keywords"`
|
||||
|
||||
// An array of link objects to be displayed on this plugin's
|
||||
// project page in the form `{name: 'foo', url:
|
||||
// 'http://example.com'}`
|
||||
Links *[]struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
Url *string `json:"url,omitempty"`
|
||||
} `json:"links,omitempty"`
|
||||
|
||||
// SVG images that are used as plugin icons.
|
||||
Logos *struct {
|
||||
// Link to the "large" version of the plugin logo, which must be
|
||||
// an SVG image. "Large" and "small" logos can be the same image.
|
||||
Large string `json:"large"`
|
||||
|
||||
// Link to the "small" version of the plugin logo, which must be
|
||||
// an SVG image. "Large" and "small" logos can be the same image.
|
||||
Small string `json:"small"`
|
||||
} `json:"logos,omitempty"`
|
||||
|
||||
// An array of screenshot objects in the form `{name: 'bar', path:
|
||||
// 'img/screenshot.png'}`
|
||||
Screenshots *[]struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
Path *string `json:"path,omitempty"`
|
||||
} `json:"screenshots,omitempty"`
|
||||
|
||||
// Date when this plugin was built.
|
||||
Updated *string `json:"updated,omitempty"`
|
||||
|
||||
// Project version of this commit, e.g. `6.7.x`.
|
||||
Version *string `json:"version,omitempty"`
|
||||
} `json:"info"`
|
||||
// Metadata about a Grafana plugin. Some fields are used on the plugins
|
||||
// page in Grafana and others on grafana.com, if the plugin is published.
|
||||
Info Info `json:"info"`
|
||||
|
||||
// For data source plugins, if the plugin supports logs.
|
||||
Logs *bool `json:"logs,omitempty"`
|
||||
@@ -302,270 +486,3 @@ type Category string
|
||||
// type indicates which type of Grafana plugin this is, of the defined
|
||||
// set of Grafana plugin types.
|
||||
type Type string
|
||||
|
||||
// BasicRole is a Grafana basic role, which can be 'Viewer', 'Editor', 'Admin' or 'Grafana Admin'.
|
||||
// With RBAC, the Admin basic role inherits its default permissions from the Editor basic role which
|
||||
// in turn inherits them from the Viewer basic role.
|
||||
type BasicRole string
|
||||
|
||||
// BuildInfo defines model for plugindef.BuildInfo.
|
||||
type BuildInfo struct {
|
||||
// Git branch the plugin was built from.
|
||||
Branch *string `json:"branch,omitempty"`
|
||||
|
||||
// Git hash of the commit the plugin was built from
|
||||
Hash *string `json:"hash,omitempty"`
|
||||
Number *int64 `json:"number,omitempty"`
|
||||
|
||||
// GitHub pull request the plugin was built from
|
||||
Pr *int32 `json:"pr,omitempty"`
|
||||
Repo *string `json:"repo,omitempty"`
|
||||
|
||||
// Time when the plugin was built, as a Unix timestamp.
|
||||
Time *int64 `json:"time,omitempty"`
|
||||
}
|
||||
|
||||
// Dependencies defines model for plugindef.Dependencies.
|
||||
type Dependencies struct {
|
||||
// Required Grafana version for this plugin. Validated using
|
||||
// https://github.com/npm/node-semver.
|
||||
GrafanaDependency string `json:"grafanaDependency"`
|
||||
|
||||
// (Deprecated) Required Grafana version for this plugin, e.g.
|
||||
// `6.x.x 7.x.x` to denote plugin requires Grafana v6.x.x or
|
||||
// v7.x.x.
|
||||
GrafanaVersion *string `json:"grafanaVersion,omitempty"`
|
||||
|
||||
// An array of required plugins on which this plugin depends.
|
||||
Plugins *[]Dependency `json:"plugins,omitempty"`
|
||||
}
|
||||
|
||||
// Dependency describes another plugin on which a plugin depends.
|
||||
// The id refers to the plugin package identifier, as given on
|
||||
// the grafana.com plugin marketplace.
|
||||
type Dependency struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Type DependencyType `json:"type"`
|
||||
Version string `json:"version"`
|
||||
}
|
||||
|
||||
// DependencyType defines model for Dependency.Type.
|
||||
type DependencyType string
|
||||
|
||||
// Header describes an HTTP header that is forwarded with a proxied request for
|
||||
// a plugin route.
|
||||
type Header struct {
|
||||
Content string `json:"content"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
// A resource to be included in a plugin.
|
||||
type Include struct {
|
||||
// RBAC action the user must have to access the route
|
||||
Action *string `json:"action,omitempty"`
|
||||
|
||||
// Add the include to the side menu.
|
||||
AddToNav *bool `json:"addToNav,omitempty"`
|
||||
|
||||
// (Legacy) The Angular component to use for a page.
|
||||
Component *string `json:"component,omitempty"`
|
||||
|
||||
// Page or dashboard when user clicks the icon in the side menu.
|
||||
DefaultNav *bool `json:"defaultNav,omitempty"`
|
||||
|
||||
// Icon to use in the side menu. For information on available
|
||||
// icon, refer to [Icons
|
||||
// Overview](https://developers.grafana.com/ui/latest/index.html?path=/story/docs-overview-icon--icons-overview).
|
||||
Icon *string `json:"icon,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
|
||||
// Used for app plugins.
|
||||
Path *string `json:"path,omitempty"`
|
||||
Role *IncludeRole `json:"role,omitempty"`
|
||||
Type IncludeType `json:"type"`
|
||||
|
||||
// Unique identifier of the included resource
|
||||
Uid *string `json:"uid,omitempty"`
|
||||
}
|
||||
|
||||
// IncludeRole defines model for Include.Role.
|
||||
type IncludeRole string
|
||||
|
||||
// IncludeType defines model for Include.Type.
|
||||
type IncludeType string
|
||||
|
||||
// Metadata about a Grafana plugin. Some fields are used on the plugins
|
||||
// page in Grafana and others on grafana.com, if the plugin is published.
|
||||
type Info struct {
|
||||
// Information about the plugin author.
|
||||
Author *struct {
|
||||
// Author's name.
|
||||
Email *string `json:"email,omitempty"`
|
||||
|
||||
// Author's name.
|
||||
Name *string `json:"name,omitempty"`
|
||||
|
||||
// Link to author's website.
|
||||
Url *string `json:"url,omitempty"`
|
||||
} `json:"author,omitempty"`
|
||||
Build *BuildInfo `json:"build,omitempty"`
|
||||
|
||||
// Description of plugin. Used on the plugins page in Grafana and
|
||||
// for search on grafana.com.
|
||||
Description *string `json:"description,omitempty"`
|
||||
|
||||
// Array of plugin keywords. Used for search on grafana.com.
|
||||
Keywords []string `json:"keywords"`
|
||||
|
||||
// An array of link objects to be displayed on this plugin's
|
||||
// project page in the form `{name: 'foo', url:
|
||||
// 'http://example.com'}`
|
||||
Links *[]struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
Url *string `json:"url,omitempty"`
|
||||
} `json:"links,omitempty"`
|
||||
|
||||
// SVG images that are used as plugin icons.
|
||||
Logos *struct {
|
||||
// Link to the "large" version of the plugin logo, which must be
|
||||
// an SVG image. "Large" and "small" logos can be the same image.
|
||||
Large string `json:"large"`
|
||||
|
||||
// Link to the "small" version of the plugin logo, which must be
|
||||
// an SVG image. "Large" and "small" logos can be the same image.
|
||||
Small string `json:"small"`
|
||||
} `json:"logos,omitempty"`
|
||||
|
||||
// An array of screenshot objects in the form `{name: 'bar', path:
|
||||
// 'img/screenshot.png'}`
|
||||
Screenshots *[]struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
Path *string `json:"path,omitempty"`
|
||||
} `json:"screenshots,omitempty"`
|
||||
|
||||
// Date when this plugin was built.
|
||||
Updated *string `json:"updated,omitempty"`
|
||||
|
||||
// Project version of this commit, e.g. `6.7.x`.
|
||||
Version *string `json:"version,omitempty"`
|
||||
}
|
||||
|
||||
// TODO docs
|
||||
// TODO should this really be separate from TokenAuth?
|
||||
type JWTTokenAuth struct {
|
||||
// Parameters for the JWT token authentication request.
|
||||
Params map[string]interface{} `json:"params"`
|
||||
|
||||
// The list of scopes that your application should be granted
|
||||
// access to.
|
||||
Scopes []string `json:"scopes"`
|
||||
|
||||
// URL to fetch the JWT token.
|
||||
Url string `json:"url"`
|
||||
}
|
||||
|
||||
// Permission describes an RBAC permission on the plugin. A permission has an action and an optional
|
||||
// scope.
|
||||
// Example: action: 'test-app.schedules:read', scope: 'test-app.schedules:*'
|
||||
type Permission struct {
|
||||
Action string `json:"action"`
|
||||
Scope *string `json:"scope,omitempty"`
|
||||
}
|
||||
|
||||
// ReleaseState indicates release maturity state of a plugin.
|
||||
type ReleaseState string
|
||||
|
||||
// Role describes an RBAC role which allows grouping multiple related permissions on the plugin,
|
||||
// each of which has an action and an optional scope.
|
||||
// Example: the role 'Schedules Reader' bundles permissions to view all schedules of the plugin.
|
||||
type Role struct {
|
||||
Description string `json:"description"`
|
||||
Name string `json:"name"`
|
||||
Permissions []struct {
|
||||
Action string `json:"action"`
|
||||
Scope *string `json:"scope,omitempty"`
|
||||
} `json:"permissions"`
|
||||
}
|
||||
|
||||
// RoleRegistration describes an RBAC role and its assignments to basic roles.
|
||||
// It organizes related RBAC permissions on the plugin into a role and defines which basic roles
|
||||
// will get them by default.
|
||||
// Example: the role 'Schedules Reader' bundles permissions to view all schedules of the plugin
|
||||
// which will be granted to Admins by default.
|
||||
type RoleRegistration struct {
|
||||
// Default assignment of the role to Grafana basic roles (Viewer, Editor, Admin, Grafana Admin)
|
||||
// The Admin basic role inherits its default permissions from the Editor basic role which in turn
|
||||
// inherits them from the Viewer basic role.
|
||||
Grants []RoleRegistrationGrants `json:"grants"`
|
||||
|
||||
// RBAC role definition to bundle related RBAC permissions on the plugin.
|
||||
Role struct {
|
||||
Description string `json:"description"`
|
||||
Name string `json:"name"`
|
||||
Permissions []struct {
|
||||
Action string `json:"action"`
|
||||
Scope *string `json:"scope,omitempty"`
|
||||
} `json:"permissions"`
|
||||
} `json:"role"`
|
||||
}
|
||||
|
||||
// RoleRegistrationGrants defines model for RoleRegistration.Grants.
|
||||
type RoleRegistrationGrants string
|
||||
|
||||
// A proxy route used in datasource plugins for plugin authentication
|
||||
// and adding headers to HTTP requests made by the plugin.
|
||||
// For more information, refer to [Authentication for data source
|
||||
// plugins](https://grafana.com/docs/grafana/latest/developers/plugins/authentication/).
|
||||
type Route struct {
|
||||
// For data source plugins. Route headers set the body content and
|
||||
// length to the proxied request.
|
||||
Body *map[string]interface{} `json:"body,omitempty"`
|
||||
|
||||
// For data source plugins. Route headers adds HTTP headers to the
|
||||
// proxied request.
|
||||
Headers *[]Header `json:"headers,omitempty"`
|
||||
|
||||
// TODO docs
|
||||
// TODO should this really be separate from TokenAuth?
|
||||
JwtTokenAuth *JWTTokenAuth `json:"jwtTokenAuth,omitempty"`
|
||||
|
||||
// For data source plugins. Route method matches the HTTP verb
|
||||
// like GET or POST. Multiple methods can be provided as a
|
||||
// comma-separated list.
|
||||
Method *string `json:"method,omitempty"`
|
||||
|
||||
// For data source plugins. The route path that is replaced by the
|
||||
// route URL field when proxying the call.
|
||||
Path *string `json:"path,omitempty"`
|
||||
ReqRole *string `json:"reqRole,omitempty"`
|
||||
ReqSignedIn *bool `json:"reqSignedIn,omitempty"`
|
||||
|
||||
// TODO docs
|
||||
TokenAuth *TokenAuth `json:"tokenAuth,omitempty"`
|
||||
|
||||
// For data source plugins. Route URL is where the request is
|
||||
// proxied to.
|
||||
Url *string `json:"url,omitempty"`
|
||||
UrlParams *[]URLParam `json:"urlParams,omitempty"`
|
||||
}
|
||||
|
||||
// TODO docs
|
||||
type TokenAuth struct {
|
||||
// Parameters for the token authentication request.
|
||||
Params map[string]interface{} `json:"params"`
|
||||
|
||||
// The list of scopes that your application should be granted
|
||||
// access to.
|
||||
Scopes *[]string `json:"scopes,omitempty"`
|
||||
|
||||
// URL to fetch the authentication token.
|
||||
Url *string `json:"url,omitempty"`
|
||||
}
|
||||
|
||||
// URLParam describes query string parameters for
|
||||
// a url in a plugin route
|
||||
type URLParam struct {
|
||||
Content string `json:"content"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user