chUtils

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RoleGrantsQuery = "SELECT * FROM system.role_grants"
)

Variables

View Source
var (
	// 'aiven', 'aiven_monitoring', and 'avnadmin' are Aiven-managed users
	InternalAivenRoles = []string{"aiven", "aiven_monitoring", "avnadmin"}
	// "OR user_name IS NULL" is needed to include roles in the result
	QueryNonAivenPrivileges = fmt.Sprintf("SELECT * FROM system.grants WHERE user_name NOT IN('%s') OR user_name IS NULL", strings.Join(InternalAivenRoles, "', '"))
)

Functions

func ExecuteClickHouseQuery

func ExecuteClickHouseQuery(ctx context.Context, avnGen avngen.Client, project, serviceName, statement string) (*clickhouse.ServiceClickHouseQueryOut, error)

func QueryDatabases

func QueryDatabases(ctx context.Context, avnGen avngen.Client, projectName, serviceName string) ([]string, error)

func QueryGrantees

func QueryGrantees(ctx context.Context, avnGen avngen.Client, projectName, serviceName string) ([]string, error)

func QueryPrivileges

func QueryPrivileges(ctx context.Context, avnGen avngen.Client, projectName, serviceName string) (*clickhouse.ServiceClickHouseQueryOut, error)

func QueryRoleGrants

func QueryRoleGrants(ctx context.Context, avnGen avngen.Client, projectName, serviceName string) (*clickhouse.ServiceClickHouseQueryOut, error)

Types

type DatabaseAndTable

type DatabaseAndTable struct {
	Database string
	Table    string
}

func QueryTables

func QueryTables(ctx context.Context, avnGen avngen.Client, projectName, serviceName string) ([]DatabaseAndTable, error)

type Grant

type Grant interface {
	// Returns the 1. main part (privileges or roles), 2. grantees part and 3. query options
	ConstructParts(t StatementType) (string, string, string)
}

TODO: Move to clickhousegrant_types.go once the issue below is resolved See: https://github.com/kubernetes-sigs/controller-tools/issues/383

type StatementType

type StatementType string
const (
	GRANT  StatementType = "GRANT"
	REVOKE StatementType = "REVOKE"
)

Jump to

Keyboard shortcuts

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