Skip to content

Commit

Permalink
Merge pull request #2224 from openziti/fix-raft-list-prop-name
Browse files Browse the repository at this point in the history
Change raft list REST property name from values to data to match rest of REST spec. Fixes #2191
  • Loading branch information
plorenz authored Jul 12, 2024
2 parents dd90eb3 + f25b6ad commit 98b2191
Show file tree
Hide file tree
Showing 11 changed files with 98 additions and 110 deletions.
4 changes: 3 additions & 1 deletion controller/api_impl/raft_router.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ func (r *RaftRouter) listMembers(n *network.Network, rc api.RequestContext) {
if err != nil {
rc.Respond(rest_model.RaftMemberListResponse{}, http.StatusInternalServerError)
}
readOnly := raftController.Mesh.IsReadOnly()
for _, member := range members {
vals = append(vals, &rest_model.RaftMemberListValue{
Address: &member.Addr,
Expand All @@ -97,11 +98,12 @@ func (r *RaftRouter) listMembers(n *network.Network, rc api.RequestContext) {
Leader: &member.Leader,
Version: &member.Version,
Voter: &member.Voter,
ReadOnly: &readOnly,
})
}

rc.Respond(rest_model.RaftMemberListResponse{
Values: vals,
Data: vals,
}, http.StatusOK)

} else {
Expand Down
35 changes: 0 additions & 35 deletions controller/rest_model/raft_member_list_request.go

This file was deleted.

36 changes: 18 additions & 18 deletions controller/rest_model/raft_member_list_response.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions controller/rest_model/raft_member_list_value.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 12 additions & 10 deletions controller/rest_server/embedded_spec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions controller/specs/swagger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1955,8 +1955,6 @@ definitions:
###################################################################
# Raft
##################################################################
raftMemberListRequest:
type: object
raftMemberListValue:
type: object
required:
Expand All @@ -1966,6 +1964,7 @@ definitions:
- leader
- version
- connected
- readOnly
properties:
id:
type: string
Expand All @@ -1979,13 +1978,16 @@ definitions:
type: string
connected:
type: boolean
readOnly:
type: boolean
raftMemberListResponse:
type: object
properties:
values:
data:
type: array
items:
$ref: '#/definitions/raftMemberListValue'




4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ require (
github.com/go-openapi/jsonreference v0.21.0 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/gomarkdown/markdown v0.0.0-20230922112808-5421fefb8386 // indirect
github.com/gorilla/schema v1.3.0 // indirect
github.com/gorilla/schema v1.4.1 // indirect
github.com/gorilla/securecookie v1.1.2 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-msgpack v0.5.5 // indirect
Expand Down Expand Up @@ -159,7 +159,7 @@ require (
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/rodaine/table v1.0.1 // indirect
github.com/rs/cors v1.10.1 // indirect
github.com/rs/cors v1.11.0 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/shoenig/go-m1cpu v0.1.6 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,8 @@ github.com/gorilla/handlers v1.5.2 h1:cLTUSsNkgcwhgRqvCNmdbRWG0A3N4F+M2nWKdScwyE
github.com/gorilla/handlers v1.5.2/go.mod h1:dX+xVpaxdSw+q0Qek8SSsl3dfMk3jNddUkMzo0GtH0w=
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
github.com/gorilla/schema v1.3.0 h1:rbciOzXAx3IB8stEFnfTwO3sYa6EWlQk79XdyustPDA=
github.com/gorilla/schema v1.3.0/go.mod h1:Dg5SSm5PV60mhF2NFaTV1xuYYj8tV8NOPRo4FggUMnM=
github.com/gorilla/schema v1.4.1 h1:jUg5hUjCSDZpNGLuXQOgIWGdlgrIdYvgQ0wZtdK1M3E=
github.com/gorilla/schema v1.4.1/go.mod h1:Dg5SSm5PV60mhF2NFaTV1xuYYj8tV8NOPRo4FggUMnM=
github.com/gorilla/securecookie v1.1.2 h1:YCIWL56dvtr73r6715mJs5ZvhtnY73hBvEF8kXD8ePA=
github.com/gorilla/securecookie v1.1.2/go.mod h1:NfCASbcHqRSY+3a8tlWJwsQap2VX5pwzwo4h3eOamfo=
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
Expand Down Expand Up @@ -659,8 +659,8 @@ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
github.com/rs/cors v1.10.1 h1:L0uuZVXIKlI1SShY2nhFfo44TYvDPQ1w4oFkUJNfhyo=
github.com/rs/cors v1.10.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU=
github.com/rs/cors v1.11.0 h1:0B9GE/r9Bc2UxRMMtymBkHTenPkHDv0CW4Y98GBY+po=
github.com/rs/cors v1.11.0/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU=
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/russross/blackfriday v1.6.0 h1:KqfZb0pUVN2lYqZUYRddxF4OR8ZMURnJIG5Y3VRLtww=
github.com/russross/blackfriday v1.6.0/go.mod h1:ti0ldHuxg49ri4ksnFxlkCfN+hvslNlmVHqNRXXJNAY=
Expand Down
6 changes: 3 additions & 3 deletions ziti/cmd/fabric/raft.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ func (self *raftListMembersAction) run(cmd *cobra.Command, _ []string) error {

t := table.NewWriter()
t.SetStyle(table.StyleRounded)
t.AppendHeader(table.Row{"Id", "Address", "Voter", "Leader", "Version", "Connected"})
for _, m := range members.Payload.Values {
t.AppendRow(table.Row{*m.ID, *m.Address, *m.Voter, *m.Leader, *m.Version, *m.Connected})
t.AppendHeader(table.Row{"Id", "Address", "Voter", "Leader", "Version", "Connected", "ReadOnly"})
for _, m := range members.Payload.Data {
t.AppendRow(table.Row{*m.ID, *m.Address, *m.Voter, *m.Leader, *m.Version, *m.Connected, m.ReadOnly != nil && *m.ReadOnly})
}
api.RenderTable(&api.Options{
CommonOptions: self.CommonOptions,
Expand Down
Loading

0 comments on commit 98b2191

Please sign in to comment.