instance

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Address  string `json:"address"`
	Username string `json:"username"`
	Password string `json:"password"`
	Token    string `json:"token"`
}

Config is the structure of the configuration for a single Harbor database instance.

type EdgeData

type EdgeData struct {
	cytoscape.EdgeData

	EdgeType  string `json:"edgeType"`
	EdgeLabel string `json:"edgeLabel"`
}

EdgeData is the https://pkg.go.dev/github.com/kiali/kiali@v1.37.0/graph/config/cytoscape#EdgeData struct plus our additional fields.

type EdgeWrapper

type EdgeWrapper struct {
	Data *EdgeData `json:"data"`
}

EdgeWrapper is the https://pkg.go.dev/github.com/kiali/kiali@v1.37.0/graph/config/cytoscape#EdgeWrapper struct.

type Elements

type Elements struct {
	Nodes []*NodeWrapper `json:"nodes"`
	Edges []*EdgeWrapper `json:"edges"`
}

Elements is the https://pkg.go.dev/github.com/kiali/kiali@v1.37.0/graph/config/cytoscape#Elements struct.

type Graph

type Graph struct {
	Elements *Elements `json:"elements"`
}

Graph is the structure of the returned topology graph from Kiali. We have to implement it by ourselve, because we have to add some additional fields, which are required by the React UI.

type Instance

type Instance interface {
	GetName() string
	GetNamespaces(ctx context.Context) ([]models.Namespace, error)
	GetGraph(ctx context.Context, duration int64, graphType, groupBy string, injectServiceNodes bool, appenders, namespaces []string) (*Graph, error)
	GetMetrics(ctx context.Context, url string) (*map[string]any, error)
}

func New

func New(name string, options map[string]any) (Instance, error)

New returns a new Kiali instance for the given configuration.

type MockInstance

type MockInstance struct {
	mock.Mock
}

MockInstance is an autogenerated mock type for the Instance type

func NewMockInstance

func NewMockInstance(t NewMockInstanceT) *MockInstance

NewMockInstance creates a new instance of MockInstance. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockInstance) GetGraph

func (_m *MockInstance) GetGraph(ctx context.Context, duration int64, graphType string, groupBy string, injectServiceNodes bool, appenders []string, namespaces []string) (*Graph, error)

GetGraph provides a mock function with given fields: ctx, duration, graphType, groupBy, injectServiceNodes, appenders, namespaces

func (*MockInstance) GetMetrics

func (_m *MockInstance) GetMetrics(ctx context.Context, url string) (*map[string]interface{}, error)

GetMetrics provides a mock function with given fields: ctx, url

func (*MockInstance) GetName

func (_m *MockInstance) GetName() string

GetName provides a mock function with given fields:

func (*MockInstance) GetNamespaces

func (_m *MockInstance) GetNamespaces(ctx context.Context) ([]models.Namespace, error)

GetNamespaces provides a mock function with given fields: ctx

type NewMockInstanceT

type NewMockInstanceT interface {
	mock.TestingT
	Cleanup(func())
}

type NodeData

type NodeData struct {
	cytoscape.NodeData

	NodeLabel     string `json:"nodeLabel"`
	NodeLabelFull string `json:"nodeLabelFull"`
	NodeImage     string `json:"nodeImage"`
}

NodeData is the https://pkg.go.dev/github.com/kiali/kiali@v1.37.0/graph/config/cytoscape#NodeData struct plus our additional fields.

type NodeWrapper

type NodeWrapper struct {
	Data *NodeData `json:"data"`
}

NodeWrapper is the https://pkg.go.dev/github.com/kiali/kiali@v1.37.0/graph/config/cytoscape#NodeWrapper struct.

type ResponseError

type ResponseError struct {
	Errors []struct {
		Code    string `json:"code"`
		Message string `json:"message"`
	} `json:"errors"`
}

ResponseError is the structure for a failed Harbor API request.

type Traffic

type Traffic struct {
	Degraded float64 `json:"degraded"`
	Failure  float64 `json:"failure"`
}

Traffic is the traffic configuration, to set the value to mark a edge as degraded and failure.

Jump to

Keyboard shortcuts

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