Files
grafana/pkg/kinds/accesspolicy/accesspolicy_spec_gen.go
T
Selene 7151ea6abc Codegen: Generate Golang code using cog (#98812)
* Use cog for Go types

* Delete old generation code

* Fix plugins generation

* workspaces update

* Update datasources with new generated code

* More fixes

* Update swagger and openapi specs

* Fixes

* More files...

* Update workspace

* More fixes...

* Remove unused functions
2025-01-14 15:58:38 +01:00

80 lines
2.0 KiB
Go

// Code generated - EDITING IS FUTILE. DO NOT EDIT.
//
// Generated by:
// kinds/gen.go
// Using jennies:
// GoResourceTypes
//
// Run 'make gen-cue' from repository root to regenerate.
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
package accesspolicy
type ResourceRef struct {
// explicit resource or folder will cascade
Kind string `json:"kind"`
Name string `json:"name"`
}
// NewResourceRef creates a new ResourceRef object.
func NewResourceRef() *ResourceRef {
return &ResourceRef{}
}
type RoleRef struct {
// Policies can apply to roles, teams, or users
// Applying policies to individual users is supported, but discouraged
Kind RoleRefKind `json:"kind"`
Name string `json:"name"`
// temporary
Xname string `json:"xname"`
}
// NewRoleRef creates a new RoleRef object.
func NewRoleRef() *RoleRef {
return &RoleRef{}
}
type AccessRule struct {
// The kind this rule applies to (dashboards, alert, etc)
Kind string `json:"kind"`
// READ, WRITE, CREATE, DELETE, ...
// should move to k8s style verbs like: "get", "list", "watch", "create", "update", "patch", "delete"
Verb string `json:"verb"`
// Specific sub-elements like "alert.rules" or "dashboard.permissions"????
Target *string `json:"target,omitempty"`
}
// NewAccessRule creates a new AccessRule object.
func NewAccessRule() *AccessRule {
return &AccessRule{}
}
type Spec struct {
// The scope where these policies should apply
Scope ResourceRef `json:"scope"`
// The role that must apply this policy
Role RoleRef `json:"role"`
// The set of rules to apply. Note that * is required to modify
// access policy rules, and that "none" will reject all actions
Rules []AccessRule `json:"rules"`
}
// NewSpec creates a new Spec object.
func NewSpec() *Spec {
return &Spec{
Scope: *NewResourceRef(),
Role: *NewRoleRef(),
}
}
type RoleRefKind string
const (
RoleRefKindRole RoleRefKind = "Role"
RoleRefKindBuiltinRole RoleRefKind = "BuiltinRole"
RoleRefKindTeam RoleRefKind = "Team"
RoleRefKindUser RoleRefKind = "User"
)