Skip to content

Commit 2392751

Browse files
committed
Initial work on documenting the API in the Swagger (Open API v2) format.
dashboard/swagger.json should be auto-generated through the tooling of go-swagger: https://goswagger.io/ $ swagger generate spec -o ./dashboard/swagger.json The API documentation can be previewed using the same tooling: $ swagger serve ./dashboard/swagger.json
1 parent e8c68ea commit 2392751

File tree

8 files changed

+2840
-1
lines changed

8 files changed

+2840
-1
lines changed

cluster/cluster.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,25 @@ import (
3434
"golang.org/x/crypto/ssh"
3535
)
3636

37+
// A Clusters is a collection of Cluster objects
38+
//
39+
// swagger:response clusters
40+
type ClustersResponse struct {
41+
// Cluster information message
42+
// in: body
43+
Body []Cluster
44+
}
45+
46+
// A Cluster has all the information associated with the configured cluster model
47+
// and its servers.
48+
//
49+
// swagger:response cluster
50+
type ClusterResponse struct {
51+
// Cluster information message
52+
// in: body
53+
Body Cluster
54+
}
55+
3756
type Cluster struct {
3857
Name string `json:"name"`
3958
Tenant string `json:"tenant"`
@@ -170,6 +189,8 @@ func (a QueryRuleSorter) Len() int { return len(a) }
170189
func (a QueryRuleSorter) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
171190
func (a QueryRuleSorter) Less(i, j int) bool { return a[i].Id < a[j].Id }
172191

192+
// The Agent describes the server where the cluster runs on.
193+
// swagger:response agent
173194
type Agent struct {
174195
Id string `json:"id"`
175196
HostName string `json:"hostName"`

cluster/crash.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
)
1919

2020
// Crash will store informations on a crash based on the replication stream
21+
// swagger:response crash
2122
type Crash struct {
2223
URL string
2324
FailoverMasterLogFile string
@@ -29,6 +30,8 @@ type Crash struct {
2930
ElectedMasterURL string
3031
}
3132

33+
// Collection of Crash reports
34+
// swagger:response crashList
3235
type crashList []*Crash
3336

3437
func (cluster *Cluster) newCrash(*Crash) (*Crash, error) {

0 commit comments

Comments
 (0)