labels

package
v0.0.0-...-1825ddb Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2021 License: Apache-2.0 Imports: 2 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Label

type Label interface {
	MarshalJSON() ([]byte, error)
	String() string
}

Label represents a returned Resource Type label from the API

type Metric

type Metric struct {
	Key  string `json:"key" json:"key"`
	Desc string `json:"description" json:"description"`
}

Metric string type to extend extra helper functions

var (
	//MetricTopic is a static def for the Topic Label
	MetricTopic Metric = NewMetric("metric.topic")
	//MetricType is a static def for the Type Label
	MetricType Metric = NewMetric("metric.type")
	//MetricPartition is a static def for the Partition Label
	MetricPartition Metric = NewMetric("metric.partition")

	//KnownMetrics is a collection of all the available MetricLabels
	KnownMetrics []Metric = []Metric{
		MetricTopic,
		MetricType,
		MetricPartition,
	}
)

func NewMetric

func NewMetric(name string) Metric

NewMetric creates a new Metric Label using a given name

func (Metric) Equals

func (m Metric) Equals(label Metric) bool

Equals tests if the MetricLabel is equal to a string representation

func (Metric) IsValid

func (m Metric) IsValid() bool

IsValid checks in the current label is a valid, available, and known label

func (Metric) MarshalJSON

func (l Metric) MarshalJSON() ([]byte, error)

func (Metric) String

func (l Metric) String() string

type Resource

type Resource struct {
	Key  string `json:"key"`
	Desc string `json:"description"`
}

Resource struct to represent a Resource Label

var (
	//ResourceKafka is a static reference for a Kafka Cluster's ID
	ResourceKafka          Resource = newResource("kafka.id")
	ResourceConnector      Resource = newResource("connector.id")
	ResourceKSQL           Resource = newResource("ksql.id")
	ResourceSchemaRegistry Resource = newResource("schema_registry.id")

	//KnownResources is a collection of known resource labels at this time
	KnownResources []Resource = []Resource{
		ResourceKafka,
		ResourceConnector,
		ResourceKSQL,
		ResourceSchemaRegistry,
	}
)

func (Resource) MarshalJSON

func (l Resource) MarshalJSON() ([]byte, error)

func (Resource) String

func (l Resource) String() string

Jump to

Keyboard shortcuts

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