controller

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: BSD-3-Clause Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Reconcile added in v0.4.0

func Reconcile(ctx context.Context, config Config, keycloakClient *KeycloakClient, grafanaClient *GrafanaClient, dashboards []Dashboard) error

Types

type Config added in v0.8.0

type Config struct {
	GrafanaDatasourceUrl      string
	GrafanaDatasourceUsername string
	GrafanaDatasourcePassword string
	GrafanaClearAutoAssignOrg bool
}

type Dashboard added in v0.5.0

type Dashboard struct {
	Folder string
	Data   map[string]interface{}
}

type GrafanaClient added in v0.4.0

type GrafanaClient struct {
	// contains filtered or unexported fields
}

func NewGrafanaClient added in v0.4.0

func NewGrafanaClient(baseURL string, cfg grafana.Config) (*GrafanaClient, error)

func (*GrafanaClient) AddOrgUser added in v0.4.0

func (this *GrafanaClient) AddOrgUser(orgID int64, user, role string) error

func (*GrafanaClient) CloseIdleConnections added in v0.4.0

func (this *GrafanaClient) CloseIdleConnections()

func (*GrafanaClient) CreateUser added in v0.4.0

func (this *GrafanaClient) CreateUser(user grafana.User) (int64, error)

func (*GrafanaClient) Dashboards added in v0.4.0

Ditto

func (*GrafanaClient) DataSource added in v0.4.0

func (this *GrafanaClient) DataSource(org *grafana.Org, id int64) (*grafana.DataSource, error)

Ditto

func (*GrafanaClient) DataSources added in v0.4.0

func (this *GrafanaClient) DataSources(org *grafana.Org) ([]*grafana.DataSource, error)

We don't just wrap this method, we also work around the bad orgID handling of the original library and Grafana API

func (*GrafanaClient) DeleteDataSource added in v0.4.0

func (this *GrafanaClient) DeleteDataSource(org *grafana.Org, id int64) error

Ditto

func (*GrafanaClient) DeleteOrg added in v0.4.0

func (this *GrafanaClient) DeleteOrg(id int64) error

func (*GrafanaClient) DeleteUser added in v0.4.0

func (this *GrafanaClient) DeleteUser(id int64) error

func (*GrafanaClient) Folders added in v0.5.0

func (this *GrafanaClient) Folders(org *grafana.Org) ([]grafana.Folder, error)

Ditto

func (*GrafanaClient) GetAutoAssignOrgId added in v0.4.0

func (this *GrafanaClient) GetAutoAssignOrgId() (int64, error)

func (*GrafanaClient) GetUserOrgs added in v0.4.0

func (this *GrafanaClient) GetUserOrgs(user grafana.User) ([]UserOrg, error)

This method is missing in the grafana-api-golang-client, that's the reason why we're wrapping that client at all

func (*GrafanaClient) GetUsername added in v0.4.0

func (this *GrafanaClient) GetUsername() string

func (*GrafanaClient) NewDashboard added in v0.4.0

func (this *GrafanaClient) NewDashboard(org *grafana.Org, dashboard grafana.Dashboard) (*grafana.DashboardSaveResponse, error)

Ditto

func (*GrafanaClient) NewDataSource added in v0.4.0

func (this *GrafanaClient) NewDataSource(org *grafana.Org, s *grafana.DataSource) (int64, error)

Ditto

func (*GrafanaClient) NewFolder added in v0.5.0

func (this *GrafanaClient) NewFolder(org *grafana.Org, folderName string) (grafana.Folder, error)

Ditto

func (*GrafanaClient) NewOrg added in v0.4.0

func (this *GrafanaClient) NewOrg(name string) (int64, error)

func (*GrafanaClient) Org added in v0.4.0

func (this *GrafanaClient) Org(id int64) (grafana.Org, error)

func (*GrafanaClient) OrgUsers added in v0.4.0

func (this *GrafanaClient) OrgUsers(orgID int64) ([]grafana.OrgUser, error)

func (*GrafanaClient) Orgs added in v0.4.0

func (this *GrafanaClient) Orgs() ([]grafana.Org, error)

func (*GrafanaClient) RemoveOrgUser added in v0.4.0

func (this *GrafanaClient) RemoveOrgUser(orgID, userID int64) error

func (*GrafanaClient) UpdateDataSource added in v0.4.0

func (this *GrafanaClient) UpdateDataSource(org *grafana.Org, s *grafana.DataSource) error

Ditto

func (*GrafanaClient) UpdateOrg added in v0.4.0

func (this *GrafanaClient) UpdateOrg(id int64, name string) error

func (*GrafanaClient) UpdateOrgUser added in v0.4.0

func (this *GrafanaClient) UpdateOrgUser(orgID, userID int64, role string) error

func (*GrafanaClient) UserUpdate added in v0.4.0

func (this *GrafanaClient) UserUpdate(u grafana.User) error

func (*GrafanaClient) Users added in v0.4.0

func (this *GrafanaClient) Users() (users []grafana.UserSearch, err error)

type GrafanaPermissionSpec added in v0.4.0

type GrafanaPermissionSpec struct {
	Uid            string
	PermittedRoles []string
}

type KeycloakClient added in v0.4.0

type KeycloakClient struct {
	// contains filtered or unexported fields
}

func NewKeycloakClient added in v0.4.0

func NewKeycloakClient(baseURL string, realm string, username string, password string, clientId string, adminGroupPath string) (*KeycloakClient, error)

func (*KeycloakClient) CloseIdleConnections added in v0.4.0

func (this *KeycloakClient) CloseIdleConnections()

func (*KeycloakClient) GetGroupMemberships added in v0.4.0

func (this *KeycloakClient) GetGroupMemberships(token string, users []*KeycloakUser) (map[*KeycloakUser][]*KeycloakGroup, error)

func (*KeycloakClient) GetGroups added in v0.4.0

func (this *KeycloakClient) GetGroups(token string) ([]*KeycloakGroup, error)

func (*KeycloakClient) GetOrganizations added in v0.4.0

func (this *KeycloakClient) GetOrganizations(token string) ([]*KeycloakGroup, error)

This returns all Keycloak groups with two-level path "/organizations/[ORGNAME]", but not "/organizations/[ORGNAME]/[TEAMNAME]" The returned groups may have subgroups (teams), but the subgroups themselves are not part of the list.

func (*KeycloakClient) GetToken added in v0.4.0

func (this *KeycloakClient) GetToken() (string, error)

func (*KeycloakClient) GetUsers added in v0.4.0

func (this *KeycloakClient) GetUsers(token string) ([]*KeycloakUser, error)

type KeycloakGroup added in v0.4.0

type KeycloakGroup struct {
	Id         string               `json:"id"`
	Name       string               `json:"name"`
	Path       string               `json:"path"`
	SubGroups  []*KeycloakGroup     `json:"subGroups"`
	Attributes *map[string][]string `json:"attributes"`
	// contains filtered or unexported fields
}

func (*KeycloakGroup) GetDisplayNameAttribute added in v0.4.0

func (this *KeycloakGroup) GetDisplayNameAttribute() string

func (*KeycloakGroup) GetOrganizationName added in v0.4.0

func (this *KeycloakGroup) GetOrganizationName() string

func (*KeycloakGroup) GetPathElements added in v0.4.0

func (this *KeycloakGroup) GetPathElements() []string

func (*KeycloakGroup) IsSameOrganization added in v0.4.0

func (this *KeycloakGroup) IsSameOrganization(other *KeycloakGroup) bool

type KeycloakUser added in v0.4.0

type KeycloakUser struct {
	Id        string `json:"id"`
	FirstName string `json:"firstName"`
	LastName  string `json:"lastName"`
	Email     string `json:"email"`
	Username  string `json:"username"`
}

func (*KeycloakUser) GetDisplayName added in v0.4.0

func (this *KeycloakUser) GetDisplayName() string

type UserOrg added in v0.4.0

type UserOrg struct {
	OrgID int64  `json:"orgId"`
	Name  string `json:"name"`
	Role  string `json:"role"`
}

Jump to

Keyboard shortcuts

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