proxy

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2023 License: GPL-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SchemaPlural       string = "schemas"
	DatasetPlural      string = "datasets"
	LoadPatternPlural  string = "loadpatterns"
	PipelinePlural     string = "pipelines"
	ExperimentPlural   string = "experiments"
	PlantDCorePlural   string = "plantdcores"
	CostExporterPlural string = "costexporters"
)

Constants defining the plural names of various resources.

View Source
const (
	DATA_SOURCE_PROM  = "prometheus"
	DATA_SOURCE_REDIS = "redis"
)

Variables

This section is empty.

Functions

func AddFileToTar

func AddFileToTar(tw *tar.Writer, name string, content []byte) error

AddFileToTar adds a file with the given content to a tar.Writer.

func CheckPipelineHealth

func CheckPipelineHealth(ctx context.Context, c client.Client, URL string, HealthCheckEndpoint string) error

CheckPipelineHealth checks the health of a pipeline.

func CreateNamespace

func CreateNamespace(ctx context.Context, client client.Client, namespaceName string) (namespaceExists, creationFailed error)

CreateNamespace creates a new namespace with the provided name.

func CreateObject

func CreateObject(ctx context.Context, c client.Client, newObj client.Object, kind string) (objectExists, creationFailed error)

CreateObject creates a new object of the provided kind.

func DeleteNamespace

func DeleteNamespace(ctx context.Context, client client.Client, namespaceName string) (namespaceNotFound, deletionFailed error)

DeleteNamespace deletes the namespace with the provided name.

func DeleteObject

func DeleteObject(ctx context.Context, c client.Client, kind, namespace, name string) (objectNotFound, deletionFailed error)

DeleteObject deletes an existing object of the provided kind, namespace, and name.

func ForObject

func ForObject(kind string) client.Object

ForObject returns a client.Object instance based on the provided kind.

func ForObjectList

func ForObjectList(kind string) client.ObjectList

ForObjectList returns a client.ObjectList instance based on the provided kind.

func GetDataset

func GetDataset(ctx context.Context, c client.Client, namespace string, name string) (*windtunnelv1alpha1.DataSet, error)

GetDataset retrieves a DataSet object by namespace and name.

func GetIndexByName

func GetIndexByName(schemas []windtunnelv1alpha1.SchemaSelector, schemaName string) (int, bool)

GetIndexByName retrieves the index of a schema by name from a list of schema selectors.

func GetObject

func GetObject(ctx context.Context, c client.Client, kind, namespace, name string) (client.Object, error)

GetObject retrieves an object of the provided kind, namespace, and name.

func GetObjectList

func GetObjectList(ctx context.Context, c client.Client, kind, namespace string) (client.ObjectList, error)

GetObjectList retrieves a list of objects of the provided kind and namespace.

func GetSampleDataset

func GetSampleDataset(ctx context.Context, c client.Client, namespace string, datasetName string) (string, *bytes.Buffer, error)

GetSampleDataset generates a sample dataset based on the provided dataset name.

func GetSchema

func GetSchema(ctx context.Context, c client.Client, namespace string, name string) (*windtunnelv1alpha1.Schema, error)

GetSchema retrieves a Schema object by namespace and name.

func ListNamespaces

func ListNamespaces(ctx context.Context, client client.Client) (*corev1.NamespaceList, error)

ListNamespaces retrieves a list of all namespaces.

func SampleValueToFloatPointer

func SampleValueToFloatPointer(v model.SampleValue) *float64

func UpdateObject

func UpdateObject(ctx context.Context, c client.Client, updated client.Object, kind string) (notFound, updationFailed error)

UpdateObject updates an existing object of the provided kind.

Types

type CustomResourceMeta

type CustomResourceMeta struct {
	Namespace string `json:"namespace,omitempty"`
	Name      string `json:"name,omitempty"`
	Kind      string `json:"kind,omitempty"`
}

CustomResourceMeta represents metadata information for a custom resource.

type CustomResourceWrapper

type CustomResourceWrapper struct {
	client.Object
}

CustomResourceWrapper is a wrapper for a custom resource that implements the client.Object interface.

type ExportResourcesInfo

type ExportResourcesInfo struct {
	Metadata []CustomResourceMeta `json:"metadata,omitempty"`
}

ExportResourcesInfo represents information about custom resources to be exported.

type HealthCheckMeta

type HealthCheckMeta struct {
	URL                 string `json:"url,omitempty"`
	HealthCheckEndpoint string `json:"healthCheckEndpoint,omitempty"`
}

HealthCheckMeta represents metadata for health check information.

type LabelSelector

type LabelSelector struct {
	TargetLabels []string
}

func NewLabelSelector

func NewLabelSelector(labels []string) *LabelSelector

func (*LabelSelector) GetSeriesFromMetric

func (s *LabelSelector) GetSeriesFromMetric(labelSet model.Metric) string

type NamespaceInfo

type NamespaceInfo struct {
	Name      string `json:"name,omitempty"`
	Namespace string `json:"namespace,omitempty"`
}

NamespaceInfo represents information about a namespace.

type QueryAgent

type QueryAgent struct {
	PromAPI v1.API
}

func NewQueryAgent

func NewQueryAgent(url string) (*QueryAgent, error)

func (*QueryAgent) QueryBiChann

func (c *QueryAgent) QueryBiChann(ctx context.Context, req *QueryRequest) (*QueryResult, error)

func (*QueryAgent) QueryBiChannProm

func (c *QueryAgent) QueryBiChannProm(ctx context.Context, req *QueryRequest) (*QueryResult, error)

func (*QueryAgent) QueryBiChannRedis

func (c *QueryAgent) QueryBiChannRedis(ctx context.Context, req *QueryRequest) (*QueryResult, error)

func (*QueryAgent) QueryTriChann

func (c *QueryAgent) QueryTriChann(ctx context.Context, req *QueryRequest) (*QueryResult, error)

func (*QueryAgent) QueryTriChannProm

func (c *QueryAgent) QueryTriChannProm(ctx context.Context, req *QueryRequest) (*QueryResult, error)

func (*QueryAgent) QueryTriChannRedis

func (c *QueryAgent) QueryTriChannRedis(ctx context.Context, req *QueryRequest) (*QueryResult, error)

type QueryClient

type QueryClient interface {
	QueryBiChann(ctx context.Context, req *QueryRequest) (*QueryResult, error)
	QueryTriChann(ctx context.Context, req *QueryRequest) (*QueryResult, error)
}

type QueryParam

type QueryParam struct {
	Query          string        `json:"query,omitempty"`
	StartTimestamp UnixTimestamp `json:"start,omitempty"`
	EndTimestamp   UnixTimestamp `json:"end,omitempty"`
	Step           int64         `json:"step,omitempty"`
	LabelSelector  []string      `json:"labelSelector,omitempty"`
	Keys           []string      `json:"keys,omitempty"`
}

type QueryRequest

type QueryRequest struct {
	Source string     `json:"source"`
	Param  QueryParam `json:"params"`
}

type QueryResult

type QueryResult struct {
	Result []ResultPoint `json:"result"`
}

type ResultPoint

type ResultPoint struct {
	Series string   `json:"series"`
	ValueY *float64 `json:"y"`
	ValueX *float64 `json:"x"`
}

type UnixTimestamp

type UnixTimestamp struct {
	time.Time
}

func (*UnixTimestamp) UnmarshalJSON

func (ts *UnixTimestamp) UnmarshalJSON(b []byte) (err error)

Jump to

Keyboard shortcuts

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