Kindsys: Simpler PascalCase name handling (#62150)
This commit is contained in:
@@ -2,11 +2,11 @@
|
||||
keywords:
|
||||
- grafana
|
||||
- schema
|
||||
title: Serviceaccount kind
|
||||
title: ServiceAccount kind
|
||||
---
|
||||
> Both documentation generation and kinds schemas are in active development and subject to change without prior notice.
|
||||
|
||||
# Serviceaccount kind
|
||||
# ServiceAccount kind
|
||||
|
||||
## Maturity: merged
|
||||
## Version: 0.0
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package kind
|
||||
|
||||
name: "Serviceaccount"
|
||||
name: "ServiceAccount"
|
||||
maturity: "merged"
|
||||
|
||||
lineage: seqs: [
|
||||
|
||||
@@ -101,14 +101,14 @@ export type {
|
||||
QueryHistoryPreference
|
||||
} from './raw/preferences/x/preferences_types.gen';
|
||||
|
||||
// Raw generated types from Serviceaccount kind.
|
||||
// Raw generated types from ServiceAccount kind.
|
||||
export type {
|
||||
Serviceaccount,
|
||||
ServiceAccount,
|
||||
OrgRole
|
||||
} from './raw/serviceaccount/x/serviceaccount_types.gen';
|
||||
|
||||
// Raw generated enums and default consts from serviceaccount kind.
|
||||
export { defaultServiceaccount } from './raw/serviceaccount/x/serviceaccount_types.gen';
|
||||
export { defaultServiceAccount } from './raw/serviceaccount/x/serviceaccount_types.gen';
|
||||
|
||||
// Raw generated types from Team kind.
|
||||
export type { Team } from './raw/team/x/team_types.gen';
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
export type OrgRole = ('Admin' | 'Editor' | 'Viewer');
|
||||
|
||||
export interface Serviceaccount {
|
||||
export interface ServiceAccount {
|
||||
/**
|
||||
* AccessControl metadata associated with a given resource.
|
||||
*/
|
||||
@@ -66,6 +66,6 @@ export interface Serviceaccount {
|
||||
updated?: number;
|
||||
}
|
||||
|
||||
export const defaultServiceaccount: Partial<Serviceaccount> = {
|
||||
export const defaultServiceAccount: Partial<ServiceAccount> = {
|
||||
teams: [],
|
||||
};
|
||||
|
||||
@@ -24,7 +24,8 @@ func (j GoTypesJenny) Generate(sfg SchemaForGen) (*codejen.File, error) {
|
||||
b, err := gocode.GenerateTypesOpenAPI(sfg.Schema, &gocode.TypeConfigOpenAPI{
|
||||
// TODO will need to account for sanitizing e.g. dashes here at some point
|
||||
Config: &openapi.Config{
|
||||
Group: sfg.IsGroup,
|
||||
Group: sfg.IsGroup,
|
||||
RootName: sfg.Name,
|
||||
Config: &copenapi.Config{
|
||||
ExpandReferences: j.ExpandReferences,
|
||||
},
|
||||
|
||||
@@ -10,6 +10,22 @@
|
||||
|
||||
package dashboard
|
||||
|
||||
// Defines values for Style.
|
||||
const (
|
||||
StyleDark Style = "dark"
|
||||
|
||||
StyleLight Style = "light"
|
||||
)
|
||||
|
||||
// Defines values for Timezone.
|
||||
const (
|
||||
TimezoneBrowser Timezone = "browser"
|
||||
|
||||
TimezoneEmpty Timezone = ""
|
||||
|
||||
TimezoneUtc Timezone = "utc"
|
||||
)
|
||||
|
||||
// Defines values for CursorSync.
|
||||
const (
|
||||
CursorSyncN0 CursorSync = 0
|
||||
@@ -151,22 +167,6 @@ const (
|
||||
VariableTypeTextbox VariableType = "textbox"
|
||||
)
|
||||
|
||||
// Defines values for Style.
|
||||
const (
|
||||
StyleDark Style = "dark"
|
||||
|
||||
StyleLight Style = "light"
|
||||
)
|
||||
|
||||
// Defines values for Timezone.
|
||||
const (
|
||||
TimezoneBrowser Timezone = "browser"
|
||||
|
||||
TimezoneEmpty Timezone = ""
|
||||
|
||||
TimezoneUtc Timezone = "utc"
|
||||
)
|
||||
|
||||
// TODO docs
|
||||
// FROM: AnnotationQuery in grafana-data/src/types/annotations.ts
|
||||
type AnnotationQuery struct {
|
||||
@@ -207,6 +207,111 @@ type AnnotationTarget struct {
|
||||
Type string `json:"type"`
|
||||
}
|
||||
|
||||
// Dashboard defines model for Dashboard.
|
||||
type Dashboard struct {
|
||||
// TODO docs
|
||||
Annotations *struct {
|
||||
List *[]AnnotationQuery `json:"list,omitempty"`
|
||||
} `json:"annotations,omitempty"`
|
||||
|
||||
// Description of dashboard.
|
||||
Description *string `json:"description,omitempty"`
|
||||
|
||||
// Whether a dashboard is editable or not.
|
||||
Editable bool `json:"editable"`
|
||||
|
||||
// The month that the fiscal year starts on. 0 = January, 11 = December
|
||||
FiscalYearStartMonth *int `json:"fiscalYearStartMonth,omitempty"`
|
||||
GnetId *string `json:"gnetId,omitempty"`
|
||||
|
||||
// 0 for no shared crosshair or tooltip (default).
|
||||
// 1 for shared crosshair.
|
||||
// 2 for shared crosshair AND shared tooltip.
|
||||
GraphTooltip CursorSync `json:"graphTooltip"`
|
||||
|
||||
// Unique numeric identifier for the dashboard.
|
||||
// TODO must isolate or remove identifiers local to a Grafana instance...?
|
||||
Id *int64 `json:"id,omitempty"`
|
||||
|
||||
// TODO docs
|
||||
Links *[]Link `json:"links,omitempty"`
|
||||
|
||||
// TODO docs
|
||||
LiveNow *bool `json:"liveNow,omitempty"`
|
||||
Panels *[]interface{} `json:"panels,omitempty"`
|
||||
|
||||
// TODO docs
|
||||
Refresh *interface{} `json:"refresh,omitempty"`
|
||||
|
||||
// Version of the current dashboard data
|
||||
Revision int `json:"revision"`
|
||||
|
||||
// Version of the JSON schema, incremented each time a Grafana update brings
|
||||
// changes to said schema.
|
||||
// TODO this is the existing schema numbering system. It will be replaced by Thema's themaVersion
|
||||
SchemaVersion int `json:"schemaVersion"`
|
||||
|
||||
// TODO docs
|
||||
Snapshot *Snapshot `json:"snapshot,omitempty"`
|
||||
|
||||
// Theme of dashboard.
|
||||
Style Style `json:"style"`
|
||||
|
||||
// Tags associated with dashboard.
|
||||
Tags *[]string `json:"tags,omitempty"`
|
||||
|
||||
// TODO docs
|
||||
Templating *struct {
|
||||
List *[]VariableModel `json:"list,omitempty"`
|
||||
} `json:"templating,omitempty"`
|
||||
|
||||
// Time range for dashboard, e.g. last 6 hours, last 7 days, etc
|
||||
Time *struct {
|
||||
From string `json:"from"`
|
||||
To string `json:"to"`
|
||||
} `json:"time,omitempty"`
|
||||
|
||||
// TODO docs
|
||||
// TODO this appears to be spread all over in the frontend. Concepts will likely need tidying in tandem with schema changes
|
||||
Timepicker *struct {
|
||||
// Whether timepicker is collapsed or not.
|
||||
Collapse bool `json:"collapse"`
|
||||
|
||||
// Whether timepicker is enabled or not.
|
||||
Enable bool `json:"enable"`
|
||||
|
||||
// Whether timepicker is visible or not.
|
||||
Hidden bool `json:"hidden"`
|
||||
|
||||
// Selectable intervals for auto-refresh.
|
||||
RefreshIntervals []string `json:"refresh_intervals"`
|
||||
|
||||
// TODO docs
|
||||
TimeOptions []string `json:"time_options"`
|
||||
} `json:"timepicker,omitempty"`
|
||||
|
||||
// Timezone of dashboard,
|
||||
Timezone *Timezone `json:"timezone,omitempty"`
|
||||
|
||||
// Title of dashboard.
|
||||
Title *string `json:"title,omitempty"`
|
||||
|
||||
// Unique dashboard identifier that can be generated by anyone. string (8-40)
|
||||
Uid *string `json:"uid,omitempty"`
|
||||
|
||||
// Version of the dashboard, incremented each time the dashboard is updated.
|
||||
Version *int `json:"version,omitempty"`
|
||||
|
||||
// TODO docs
|
||||
WeekStart *string `json:"weekStart,omitempty"`
|
||||
}
|
||||
|
||||
// Theme of dashboard.
|
||||
type Style string
|
||||
|
||||
// Timezone of dashboard,
|
||||
type Timezone string
|
||||
|
||||
// 0 for no shared crosshair or tooltip (default).
|
||||
// 1 for shared crosshair.
|
||||
// 2 for shared crosshair AND shared tooltip.
|
||||
@@ -670,108 +775,3 @@ type VariableModel struct {
|
||||
// TODO docs
|
||||
// TODO this implies some wider pattern/discriminated union, probably?
|
||||
type VariableType string
|
||||
|
||||
// Dashboard defines model for dashboard.
|
||||
type Dashboard struct {
|
||||
// TODO docs
|
||||
Annotations *struct {
|
||||
List *[]AnnotationQuery `json:"list,omitempty"`
|
||||
} `json:"annotations,omitempty"`
|
||||
|
||||
// Description of dashboard.
|
||||
Description *string `json:"description,omitempty"`
|
||||
|
||||
// Whether a dashboard is editable or not.
|
||||
Editable bool `json:"editable"`
|
||||
|
||||
// The month that the fiscal year starts on. 0 = January, 11 = December
|
||||
FiscalYearStartMonth *int `json:"fiscalYearStartMonth,omitempty"`
|
||||
GnetId *string `json:"gnetId,omitempty"`
|
||||
|
||||
// 0 for no shared crosshair or tooltip (default).
|
||||
// 1 for shared crosshair.
|
||||
// 2 for shared crosshair AND shared tooltip.
|
||||
GraphTooltip CursorSync `json:"graphTooltip"`
|
||||
|
||||
// Unique numeric identifier for the dashboard.
|
||||
// TODO must isolate or remove identifiers local to a Grafana instance...?
|
||||
Id *int64 `json:"id,omitempty"`
|
||||
|
||||
// TODO docs
|
||||
Links *[]Link `json:"links,omitempty"`
|
||||
|
||||
// TODO docs
|
||||
LiveNow *bool `json:"liveNow,omitempty"`
|
||||
Panels *[]interface{} `json:"panels,omitempty"`
|
||||
|
||||
// TODO docs
|
||||
Refresh *interface{} `json:"refresh,omitempty"`
|
||||
|
||||
// Version of the current dashboard data
|
||||
Revision int `json:"revision"`
|
||||
|
||||
// Version of the JSON schema, incremented each time a Grafana update brings
|
||||
// changes to said schema.
|
||||
// TODO this is the existing schema numbering system. It will be replaced by Thema's themaVersion
|
||||
SchemaVersion int `json:"schemaVersion"`
|
||||
|
||||
// TODO docs
|
||||
Snapshot *Snapshot `json:"snapshot,omitempty"`
|
||||
|
||||
// Theme of dashboard.
|
||||
Style Style `json:"style"`
|
||||
|
||||
// Tags associated with dashboard.
|
||||
Tags *[]string `json:"tags,omitempty"`
|
||||
|
||||
// TODO docs
|
||||
Templating *struct {
|
||||
List *[]VariableModel `json:"list,omitempty"`
|
||||
} `json:"templating,omitempty"`
|
||||
|
||||
// Time range for dashboard, e.g. last 6 hours, last 7 days, etc
|
||||
Time *struct {
|
||||
From string `json:"from"`
|
||||
To string `json:"to"`
|
||||
} `json:"time,omitempty"`
|
||||
|
||||
// TODO docs
|
||||
// TODO this appears to be spread all over in the frontend. Concepts will likely need tidying in tandem with schema changes
|
||||
Timepicker *struct {
|
||||
// Whether timepicker is collapsed or not.
|
||||
Collapse bool `json:"collapse"`
|
||||
|
||||
// Whether timepicker is enabled or not.
|
||||
Enable bool `json:"enable"`
|
||||
|
||||
// Whether timepicker is visible or not.
|
||||
Hidden bool `json:"hidden"`
|
||||
|
||||
// Selectable intervals for auto-refresh.
|
||||
RefreshIntervals []string `json:"refresh_intervals"`
|
||||
|
||||
// TODO docs
|
||||
TimeOptions []string `json:"time_options"`
|
||||
} `json:"timepicker,omitempty"`
|
||||
|
||||
// Timezone of dashboard,
|
||||
Timezone *Timezone `json:"timezone,omitempty"`
|
||||
|
||||
// Title of dashboard.
|
||||
Title *string `json:"title,omitempty"`
|
||||
|
||||
// Unique dashboard identifier that can be generated by anyone. string (8-40)
|
||||
Uid *string `json:"uid,omitempty"`
|
||||
|
||||
// Version of the dashboard, incremented each time the dashboard is updated.
|
||||
Version *int `json:"version,omitempty"`
|
||||
|
||||
// TODO docs
|
||||
WeekStart *string `json:"weekStart,omitempty"`
|
||||
}
|
||||
|
||||
// Theme of dashboard.
|
||||
type Style string
|
||||
|
||||
// Timezone of dashboard,
|
||||
type Timezone string
|
||||
|
||||
@@ -19,6 +19,24 @@ const (
|
||||
ItemTypeDashboardByUid ItemType = "dashboard_by_uid"
|
||||
)
|
||||
|
||||
// Playlist defines model for Playlist.
|
||||
type Playlist struct {
|
||||
// Interval sets the time between switching views in a playlist.
|
||||
// FIXME: Is this based on a standardized format or what options are available? Can datemath be used?
|
||||
Interval string `json:"interval"`
|
||||
|
||||
// The ordered list of items that the playlist will iterate over.
|
||||
// FIXME! This should not be optional, but changing it makes the godegen awkward
|
||||
Items *[]Item `json:"items,omitempty"`
|
||||
|
||||
// Name of the playlist.
|
||||
Name string `json:"name"`
|
||||
|
||||
// Unique playlist identifier. Generated on creation, either by the
|
||||
// creator of the playlist of by the application.
|
||||
Uid string `json:"uid"`
|
||||
}
|
||||
|
||||
// Item defines model for Item.
|
||||
type Item struct {
|
||||
// Title is an unused property -- it will be removed in the future
|
||||
@@ -40,21 +58,3 @@ type Item struct {
|
||||
|
||||
// Type of the item.
|
||||
type ItemType string
|
||||
|
||||
// Playlist defines model for playlist.
|
||||
type Playlist struct {
|
||||
// Interval sets the time between switching views in a playlist.
|
||||
// FIXME: Is this based on a standardized format or what options are available? Can datemath be used?
|
||||
Interval string `json:"interval"`
|
||||
|
||||
// The ordered list of items that the playlist will iterate over.
|
||||
// FIXME! This should not be optional, but changing it makes the godegen awkward
|
||||
Items *[]Item `json:"items,omitempty"`
|
||||
|
||||
// Name of the playlist.
|
||||
Name string `json:"name"`
|
||||
|
||||
// Unique playlist identifier. Generated on creation, either by the
|
||||
// creator of the playlist of by the application.
|
||||
Uid string `json:"uid"`
|
||||
}
|
||||
|
||||
@@ -10,13 +10,7 @@
|
||||
|
||||
package preferences
|
||||
|
||||
// QueryHistoryPreference defines model for QueryHistoryPreference.
|
||||
type QueryHistoryPreference struct {
|
||||
// one of: '' | 'query' | 'starred';
|
||||
HomeTab *string `json:"homeTab,omitempty"`
|
||||
}
|
||||
|
||||
// Preferences defines model for preferences.
|
||||
// Preferences defines model for Preferences.
|
||||
type Preferences struct {
|
||||
// UID for the home dashboard
|
||||
HomeDashboardUID *string `json:"homeDashboardUID,omitempty"`
|
||||
@@ -35,3 +29,9 @@ type Preferences struct {
|
||||
// day of the week (sunday, monday, etc)
|
||||
WeekStart *string `json:"weekStart,omitempty"`
|
||||
}
|
||||
|
||||
// QueryHistoryPreference defines model for QueryHistoryPreference.
|
||||
type QueryHistoryPreference struct {
|
||||
// one of: '' | 'query' | 'starred';
|
||||
HomeTab *string `json:"homeTab,omitempty"`
|
||||
}
|
||||
|
||||
@@ -23,9 +23,9 @@ const rootrel string = "kinds/serviceaccount"
|
||||
|
||||
// TODO standard generated docs
|
||||
type Kind struct {
|
||||
lin thema.ConvergentLineage[*Serviceaccount]
|
||||
lin thema.ConvergentLineage[*ServiceAccount]
|
||||
jcodec vmux.Codec
|
||||
valmux vmux.ValueMux[*Serviceaccount]
|
||||
valmux vmux.ValueMux[*ServiceAccount]
|
||||
decl kindsys.Decl[kindsys.CoreProperties]
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ func NewKind(rt *thema.Runtime, opts ...thema.BindOption) (*Kind, error) {
|
||||
// Get the thema.Schema that the meta says is in the current version (which
|
||||
// codegen ensures is always the latest)
|
||||
cursch := thema.SchemaP(lin, k.decl.Properties.CurrentVersion)
|
||||
tsch, err := thema.BindType[*Serviceaccount](cursch, &Serviceaccount{})
|
||||
tsch, err := thema.BindType[*ServiceAccount](cursch, &ServiceAccount{})
|
||||
if err != nil {
|
||||
// Should be unreachable, modulo bugs in the Thema->Go code generator
|
||||
return nil, err
|
||||
@@ -78,18 +78,18 @@ func (k *Kind) Lineage() thema.Lineage {
|
||||
}
|
||||
|
||||
// TODO standard generated docs
|
||||
func (k *Kind) ConvergentLineage() thema.ConvergentLineage[*Serviceaccount] {
|
||||
func (k *Kind) ConvergentLineage() thema.ConvergentLineage[*ServiceAccount] {
|
||||
return k.lin
|
||||
}
|
||||
|
||||
// JSONValueMux is a version multiplexer that maps a []byte containing JSON data
|
||||
// at any schematized dashboard version to an instance of Serviceaccount.
|
||||
// at any schematized dashboard version to an instance of ServiceAccount.
|
||||
//
|
||||
// Validation and translation errors emitted from this func will identify the
|
||||
// input bytes as "dashboard.json".
|
||||
//
|
||||
// This is a thin wrapper around Thema's [vmux.ValueMux].
|
||||
func (k *Kind) JSONValueMux(b []byte) (*Serviceaccount, thema.TranslationLacunas, error) {
|
||||
func (k *Kind) JSONValueMux(b []byte) (*ServiceAccount, thema.TranslationLacunas, error) {
|
||||
return k.valmux(b)
|
||||
}
|
||||
|
||||
|
||||
@@ -22,8 +22,8 @@ const (
|
||||
// OrgRole is a Grafana Organization Role which can be 'Viewer', 'Editor', 'Admin'.
|
||||
type OrgRole string
|
||||
|
||||
// Serviceaccount defines model for serviceaccount.
|
||||
type Serviceaccount struct {
|
||||
// ServiceAccount defines model for ServiceAccount.
|
||||
type ServiceAccount struct {
|
||||
// AccessControl metadata associated with a given resource.
|
||||
AccessControl map[string]bool `json:"accessControl,omitempty"`
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ const (
|
||||
// Permission defines model for Permission.
|
||||
type Permission int
|
||||
|
||||
// Team defines model for team.
|
||||
// Team defines model for Team.
|
||||
type Team struct {
|
||||
// AccessControl metadata associated with a given resource.
|
||||
AccessControl map[string]bool `json:"accessControl,omitempty"`
|
||||
|
||||
@@ -71,7 +71,7 @@ var plannedCoreKinds = []string{
|
||||
"Folder",
|
||||
"DataSource",
|
||||
"APIKey",
|
||||
"Serviceaccount",
|
||||
"ServiceAccount",
|
||||
"Thumb",
|
||||
"Query",
|
||||
"QueryHistory",
|
||||
|
||||
@@ -1345,9 +1345,9 @@
|
||||
},
|
||||
"machineName": "serviceaccount",
|
||||
"maturity": "merged",
|
||||
"name": "Serviceaccount",
|
||||
"name": "ServiceAccount",
|
||||
"pluralMachineName": "serviceaccounts",
|
||||
"pluralName": "Serviceaccounts"
|
||||
"pluralName": "ServiceAccounts"
|
||||
},
|
||||
"statpanelcfg": {
|
||||
"category": "composable",
|
||||
|
||||
@@ -14,7 +14,6 @@ import (
|
||||
|
||||
"cuelang.org/go/cue/cuecontext"
|
||||
"github.com/dave/dst"
|
||||
"github.com/dave/dst/dstutil"
|
||||
"github.com/grafana/codejen"
|
||||
"github.com/grafana/grafana/pkg/codegen"
|
||||
"github.com/grafana/grafana/pkg/cuectx"
|
||||
@@ -62,9 +61,7 @@ func (j *jennytypego) JennyName() string {
|
||||
}
|
||||
|
||||
func (j *jennytypego) Generate(lin thema.Lineage) (*codejen.File, error) {
|
||||
f, err := codegen.GoTypesJenny{ApplyFuncs: []dstutil.ApplyFunc{
|
||||
codegen.PrefixReplacer("Plugindef", "PluginDef"),
|
||||
}}.Generate(codegen.SchemaForGen{
|
||||
f, err := codegen.GoTypesJenny{}.Generate(codegen.SchemaForGen{
|
||||
Name: "PluginDef",
|
||||
Schema: lin.Latest(),
|
||||
IsGroup: false,
|
||||
|
||||
@@ -55,19 +55,7 @@ const (
|
||||
IncludeTypeSecretsmanager IncludeType = "secretsmanager"
|
||||
)
|
||||
|
||||
// Defines values for ReleaseState.
|
||||
const (
|
||||
ReleaseStateAlpha ReleaseState = "alpha"
|
||||
|
||||
ReleaseStateBeta ReleaseState = "beta"
|
||||
|
||||
ReleaseStateDeprecated ReleaseState = "deprecated"
|
||||
|
||||
ReleaseStateStable ReleaseState = "stable"
|
||||
)
|
||||
|
||||
// Defines values for Category.
|
||||
// Defines values for PlugindefCategory.
|
||||
const (
|
||||
CategoryCloud Category = "cloud"
|
||||
|
||||
@@ -87,7 +75,6 @@ const (
|
||||
)
|
||||
|
||||
// Defines values for Type.
|
||||
// Defines values for PlugindefType.
|
||||
const (
|
||||
TypeApp Type = "app"
|
||||
|
||||
@@ -100,6 +87,17 @@ const (
|
||||
TypeSecretsmanager Type = "secretsmanager"
|
||||
)
|
||||
|
||||
// Defines values for ReleaseState.
|
||||
const (
|
||||
ReleaseStateAlpha ReleaseState = "alpha"
|
||||
|
||||
ReleaseStateBeta ReleaseState = "beta"
|
||||
|
||||
ReleaseStateDeprecated ReleaseState = "deprecated"
|
||||
|
||||
ReleaseStateStable ReleaseState = "stable"
|
||||
)
|
||||
|
||||
// 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.
|
||||
@@ -274,94 +272,7 @@ type Permission struct {
|
||||
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.
|
||||
// PluginDef defines model for plugindef.
|
||||
// PluginDef defines model for PluginDef.
|
||||
type PluginDef struct {
|
||||
// For data source plugins, if the plugin supports alerting.
|
||||
Alerting *bool `json:"alerting,omitempty"`
|
||||
@@ -496,3 +407,89 @@ type Category string
|
||||
// type indicates which type of Grafana plugin this is, of the defined
|
||||
// set of Grafana plugin types.
|
||||
type Type string
|
||||
|
||||
// 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"`
|
||||
}
|
||||
|
||||
@@ -64,8 +64,8 @@ func (b *Base) Preferences() *preferences.Kind {
|
||||
return b.preferences
|
||||
}
|
||||
|
||||
// Serviceaccount returns the [kindsys.Interface] implementation for the serviceaccount kind.
|
||||
func (b *Base) Serviceaccount() *serviceaccount.Kind {
|
||||
// ServiceAccount returns the [kindsys.Interface] implementation for the serviceaccount kind.
|
||||
func (b *Base) ServiceAccount() *serviceaccount.Kind {
|
||||
return b.serviceaccount
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user