clients

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

Package clients implements clients for services consumed by data inputs

Index

Constants

View Source
const (
	MetricQueryWildcardClusterID       = `\$CLUSTER_ID`
	MetricQueryWildcardClusterName     = `\$CLUSTER_NAME`
	MetricQueryWildcardClusterLocation = `\$CLUSTER_LOCATION`
	MetricQueryWildcardClusterProject  = `\$CLUSTER_PROJECT`
)

Variables

This section is empty.

Functions

func NewKubernetesClientBuilder

func NewKubernetesClientBuilder(ctx context.Context, kubeConfig *clientcmdapi.Config) *kubernetesClientBuilder

func NewMetricsClientBuilder

func NewMetricsClientBuilder(ctx context.Context) *metricsClientBuilder

func StringSliceContains

func StringSliceContains(hay []string, needle string) bool

Types

type KubernetesClient

type KubernetesClient interface {
	GetNamespaces() ([]string, error)
	GetFetchableResourceTypes() ([]*ResourceType, error)
	GetResources(toBeFetched []*ResourceType, namespaces []string) ([]*Resource, error)
	GetNamespacedResources(resourceType ResourceType, namespace string) ([]*Resource, error)
}

type KubernetesDiscoveryClient

type KubernetesDiscoveryClient interface {
	ServerGroupsAndResources() ([]*metav1.APIGroup, []*metav1.APIResourceList, error)
}

type Metric

type Metric struct {
	Name        string                 `json:"name"`
	ScalarValue float64                `json:"scalar"`
	VectorValue map[string]interface{} `json:"vector"`
}

type MetricQuery

type MetricQuery struct {
	Name  string
	Query string
}

type MetricsClient

type MetricsClient interface {
	GetMetric(query MetricQuery, clusterID string) (*Metric, error)
	GetMetricsForCluster(queries []MetricQuery, clusterID string) (map[string]Metric, error)
}

type Resource

type Resource struct {
	Type ResourceType
	Data map[string]interface{}
}

type ResourceType

type ResourceType struct {
	Group      string
	Version    string
	Name       string
	Namespaced bool
}

type TokenSource

type TokenSource interface {
	GetAuthToken() (string, error)
}

func NewGoogleTokenSource

func NewGoogleTokenSource(ctx context.Context) (TokenSource, error)

func NewGoogleTokenSourceWithCredentials

func NewGoogleTokenSourceWithCredentials(ctx context.Context, credentialsFile string) (TokenSource, error)

Jump to

Keyboard shortcuts

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