/
structs.go
58 lines (47 loc) · 1.81 KB
/
structs.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package instance
import "github.com/kiali/kiali/graph/config/cytoscape"
// ResponseError is the structure for a failed Harbor API request.
type ResponseError struct {
Errors []struct {
Code string `json:"code"`
Message string `json:"message"`
} `json:"errors"`
}
// Traffic is the traffic configuration, to set the value to mark a edge as degraded and failure.
type Traffic struct {
Degraded float64 `json:"degraded"`
Failure float64 `json:"failure"`
}
// 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 Graph struct {
Elements *Elements `json:"elements"`
}
// Elements is the https://pkg.go.dev/github.com/kiali/kiali@v1.37.0/graph/config/cytoscape#Elements struct.
type Elements struct {
Nodes []*NodeWrapper `json:"nodes"`
Edges []*EdgeWrapper `json:"edges"`
}
// NodeWrapper is the https://pkg.go.dev/github.com/kiali/kiali@v1.37.0/graph/config/cytoscape#NodeWrapper struct.
type NodeWrapper struct {
Data *NodeData `json:"data"`
}
// NodeData is the https://pkg.go.dev/github.com/kiali/kiali@v1.37.0/graph/config/cytoscape#NodeData struct plus our
// additional fields.
type NodeData struct {
cytoscape.NodeData
NodeLabel string `json:"nodeLabel"`
NodeLabelFull string `json:"nodeLabelFull"`
NodeImage string `json:"nodeImage"`
}
// EdgeWrapper is the https://pkg.go.dev/github.com/kiali/kiali@v1.37.0/graph/config/cytoscape#EdgeWrapper struct.
type EdgeWrapper struct {
Data *EdgeData `json:"data"`
}
// EdgeData is the https://pkg.go.dev/github.com/kiali/kiali@v1.37.0/graph/config/cytoscape#EdgeData struct plus our
// additional fields.
type EdgeData struct {
cytoscape.EdgeData
EdgeType string `json:"edgeType"`
EdgeLabel string `json:"edgeLabel"`
}