grn

package
v0.0.0-...-fb7f86c Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2023 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

A GRN string is expressed in the format:

grn:${tenant_id}:${kind}/${id}

The format of the final id is defined by the owning service and not validated by the GRN parser. Prefer using UIDs where possible.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidGRN = errutil.NewBase(errutil.StatusValidationFailed, "grn.InvalidGRN")
)

Functions

This section is empty.

Types

type GRN

type GRN struct {
	// TenantID contains the ID of the tenant (in hosted grafana) or
	// organization (in other environments) the resource belongs to. This field
	// may be omitted for global Grafana resources which are not associated with
	// an organization.
	TenantID int64

	// The kind of resource being identified, for e.g. "dashboard" or "user".
	// The caller is responsible for validating the value.
	ResourceKind string

	// ResourceIdentifier is used by the underlying service to identify the
	// resource.
	ResourceIdentifier string
	// contains filtered or unexported fields
}

Grafana resource name. See also: https://github.com/grafana/grafana/blob/main/pkg/services/store/entity/entity.proto#L6 NOTE: This structure/format is still under active development and is subject to change

func MustParseStr

func MustParseStr(str string) GRN

MustParseStr is a wrapper around ParseStr that panics if the given input is not a valid GRN. This is intended for use in tests.

func ParseStr

func ParseStr(str string) (GRN, error)

ParseStr attempts to parse a string into a GRN. It returns an error if the given string does not match the GRN format, but does not validate the values.

func (*GRN) String

func (g *GRN) String() string

String returns a string representation of a grn in the format grn:tenantID:kind/resourceIdentifier

Jump to

Keyboard shortcuts

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