proxy

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2023 License: GPL-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DATA_SOURCE_PROM  = "prometheus"
	DATA_SOURCE_REDIS = "redis"
)
View Source
const (
	SchemaKind       string = "Schema"
	DatasetKind      string = "DataSet"
	LoadPatternKind  string = "LoadPattern"
	PipelineKind     string = "Pipeline"
	ExperimentKind   string = "Experiment"
	PlantDCoreKind   string = "PlantDCore"
	CostExporterKind string = "CostExporter"
)

Constants defining the possible Kind names that can be used in the schema.GroupVersionKind struct.

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 AddFileToZip added in v1.1.0

func AddFileToZip(zw *zip.Writer, name string, content []byte) error

AddFileToZip adds a file with the given content to a zip.Writer.

func CreateNamespace

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

CreateNamespace creates a new namespace with the provided name.

func CreateObject

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

CreateObject creates a new object of the provided kind, namespace, name. Only the spec field of the obj parameter will be used.

func DeleteNamespace

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

DeleteNamespace deletes the namespace with the provided name.

func DeleteObject

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

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

func ExportResources added in v1.1.0

func ExportResources(ctx context.Context, c client.Client, resInfoList []ResourceInfo) (*bytes.Buffer, error)

func ForObject

func ForObject(kind string) (client.Object, error)

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

func GetDataSet added in v1.1.0

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 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, name.

func GetObjectList

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

GetObjectList retrieves a list of objects of the provided kind.

func GetSampleDataSet added in v1.1.0

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, kind, namespace, name string, obj client.Object) error

UpdateObject updates an existing object of the provided kind, namespace, name. Only the spec field of the obj parameter will be used.

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 ImportResourcesStatistics added in v1.1.0

type ImportResourcesStatistics struct {
	NumSucceeded  int      `json:"numSucceeded"`
	NumFailed     int      `json:"numFailed"`
	ErrorMessages []string `json:"errors"`
}

func ImportResources added in v1.1.0

func ImportResources(ctx context.Context, c client.Client, buf *bytes.Buffer) (*ImportResourcesStatistics, error)

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 prometheusv1.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 ResourceInfo added in v1.1.0

type ResourceInfo struct {
	Kind string
	types.NamespacedName
}

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