proxy

package
v1.6.4 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2024 License: GPL-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SchemaKind       string = "Schema"
	DatasetKind      string = "DataSet"
	LoadPatternKind  string = "LoadPattern"
	PipelineKind     string = "Pipeline"
	ExperimentKind   string = "Experiment"
	PlantDCoreKind   string = "PlantDCore"
	CostExporterKind string = "CostExporter"
	TrafficModelKind string = "TrafficModel"
	DigitalTwinKind  string = "DigitalTwin"
	SimulationKind   string = "Simulation"
	NetCostKind      string = "NetCost"
	ScenarioKind     string = "Scenario"
)

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 []*ResourceLocator) (*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 ListKinds added in v1.4.0

func ListKinds() []string

func ListNamespaces

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

ListNamespaces retrieves a list of all namespaces.

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 BiChanDataPoint added in v1.3.0

type BiChanDataPoint struct {
	Series string   `json:"series"`
	ValueY *float64 `json:"y"`
}

BiChanDataPoint defines the data point in bi-channel data. Using `*float64` instead of `float64` to avoid getting empty result from JSON marshaling.

type BiChanResponse added in v1.3.0

type BiChanResponse struct {
	// Result is a list of BiChanDataPoint
	Result []*BiChanDataPoint `json:"result"`
}

BiChanResponse defines the response to send for bi-channel data.

type ChanType added in v1.3.0

type ChanType int8

ChanType is the type of channel number per data point in response data

const (
	BiChan ChanType = iota
	TriChan
)

type CheckHTTPHealthRequest added in v1.3.0

type CheckHTTPHealthRequest struct {
	URL string `json:"url,omitempty"`
}

CheckHTTPHealthRequest defines the request to check health of a URL using HTTP protocol.

type ErrorResponse added in v1.3.0

type ErrorResponse struct {
	Message string `json:"message,omitempty"`
}

ErrorResponse defines the response to send when error occurs.

type ImportStatistics added in v1.4.0

type ImportStatistics struct {
	// NumSucceeded is the number of resources that are successfully imported
	NumSucceeded int `json:"numSucceeded"`
	// NumFailed is the number of resources that failed to be imported
	NumFailed int `json:"numFailed"`
	// ErrorMessages contains the error messages if any
	ErrorMessages []string `json:"errors"`
}

ImportStatistics contains the statistical result of importing resources.

func ImportResources added in v1.1.0

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

type LabelSelector

type LabelSelector struct {
	TargetLabels []string
	// contains filtered or unexported fields
}

func NewLabelSelector

func NewLabelSelector(labels []string) *LabelSelector

func (*LabelSelector) GetSeriesFromPromMetric added in v1.3.0

func (ls *LabelSelector) GetSeriesFromPromMetric(m model.Metric) (string, error)

func (*LabelSelector) GetSeriesFromRedisRange added in v1.3.0

func (ls *LabelSelector) GetSeriesFromRedisRange(r redistimeseries.Range) (string, error)

type PromRequest added in v1.3.0

type PromRequest 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"`
}

PromRequest contains the parameters for making a "Query" or "QueryRange" request to Prometheus.

type QueryAgent

type QueryAgent struct {
	PromAPI       prometheusv1.API
	RedisClient   *redis.Client
	RedisTSClient *redistimeseries.Client
}

func NewQueryAgent

func NewQueryAgent() (*QueryAgent, error)

func (*QueryAgent) PromQuery added in v1.3.0

func (qa *QueryAgent) PromQuery(ctx context.Context, req *PromRequest) (*BiChanResponse, error)

func (*QueryAgent) PromQueryRange added in v1.3.0

func (qa *QueryAgent) PromQueryRange(ctx context.Context, req *PromRequest) (*TriChanResponse, error)

func (*QueryAgent) RedisGet added in v1.4.0

func (qa *QueryAgent) RedisGet(ctx context.Context, req *RedisRequest) (*RawResponse, error)

func (*QueryAgent) RedisTSMultiGet added in v1.3.0

func (qa *QueryAgent) RedisTSMultiGet(ctx context.Context, req *RedisTSRequest) (*BiChanResponse, error)

func (*QueryAgent) RedisTSMultiRange added in v1.3.0

func (qa *QueryAgent) RedisTSMultiRange(ctx context.Context, req *RedisTSRequest) (*TriChanResponse, error)

type RawResponse added in v1.4.0

type RawResponse struct {
	// Result is a string
	Result string `json:"result"`
}

RawResponse defines the response to send for raw data.

type RedisRequest added in v1.4.0

type RedisRequest struct {
	Key string `json:"key,omitempty"`
}

RedisRequest contains the parameters for executing a "Get" command on Redis.

type RedisTSRequest added in v1.3.0

type RedisTSRequest struct {
	Filters        []string      `json:"filters,omitempty"`
	StartTimestamp UnixTimestamp `json:"start,omitempty"`
	EndTimestamp   UnixTimestamp `json:"end,omitempty"`
	LabelSelector  []string      `json:"labelSelector,omitempty"`
}

RedisTSRequest contains the parameters for executing a "MultiGet" or "MultiRange" command to Redis Time Series.

type ResourceLocator added in v1.4.0

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

ResourceLocator contains the kind, namespace, and name that are necessary to locate a unique resource to export. Note that the group and version are fixed across all resources and are thus omitted.

func ListResources added in v1.4.0

func ListResources(ctx context.Context, c client.Client) ([]*ResourceLocator, error)

type SourceType added in v1.3.0

type SourceType int8

SourceType is the type of data source

const (
	Prometheus SourceType = iota
	Redis
	RedisTimeSeries
)

type TriChanDataPoint added in v1.3.0

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

TriChanDataPoint defines the data point in tri-channel data. Using `*float64` instead of `float64` to avoid getting empty result from JSON marshaling.

type TriChanResponse added in v1.3.0

type TriChanResponse struct {
	// Result is a list of TriChanDataPoint
	Result []*TriChanDataPoint `json:"result"`
}

TriChanResponse defines the response to send for tri-channel data.

type UnixTimestamp

type UnixTimestamp struct {
	time.Time
}

UnixTimestamp is the Unix timestamp in second.

func (*UnixTimestamp) UnmarshalJSON

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

Jump to

Keyboard shortcuts

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