github.com/altipla-consulting/ravendb-go-client@v0.1.3/get_cluster_topology_command.go (about) 1 package ravendb 2 3 import ( 4 "net/http" 5 ) 6 7 var ( 8 _ RavenCommand = &GetClusterTopologyCommand{} 9 ) 10 11 type GetClusterTopologyCommand struct { 12 RavenCommandBase 13 Result *ClusterTopologyResponse 14 } 15 16 func NewGetClusterTopologyCommand() *GetClusterTopologyCommand { 17 cmd := &GetClusterTopologyCommand{ 18 RavenCommandBase: NewRavenCommandBase(), 19 } 20 cmd.IsReadRequest = true 21 return cmd 22 } 23 24 func (c *GetClusterTopologyCommand) createRequest(node *ServerNode) (*http.Request, error) { 25 url := node.URL + "/cluster/topology" 26 return newHttpGet(url) 27 } 28 29 func (c *GetClusterTopologyCommand) setResponse(response []byte, fromCache bool) error { 30 if len(response) == 0 { 31 return throwInvalidResponse() 32 } 33 return jsonUnmarshal(response, &c.Result) 34 }