github.com/altipla-consulting/ravendb-go-client@v0.1.3/get_database_topology_command.go (about) 1 package ravendb 2 3 import ( 4 "net/http" 5 "strings" 6 ) 7 8 var ( 9 _ RavenCommand = &GetDatabaseTopologyCommand{} 10 ) 11 12 type GetDatabaseTopologyCommand struct { 13 RavenCommandBase 14 15 Result *Topology 16 } 17 18 func NewGetDatabaseTopologyCommand() *GetDatabaseTopologyCommand { 19 cmd := &GetDatabaseTopologyCommand{ 20 RavenCommandBase: NewRavenCommandBase(), 21 } 22 cmd.IsReadRequest = true 23 return cmd 24 } 25 26 func (c *GetDatabaseTopologyCommand) createRequest(node *ServerNode) (*http.Request, error) { 27 url := node.URL + "/topology?name=" + node.Database 28 if strings.Contains(strings.ToLower(node.URL), ".fiddler") { 29 // we want to keep the '.fiddler' stuff there so we'll keep tracking request 30 // so we are going to ask the server to respect it 31 url += "&localUrl=" + urlUtilsEscapeDataString(node.URL) 32 } 33 return newHttpGet(url) 34 } 35 36 func (c *GetDatabaseTopologyCommand) setResponse(response []byte, fromCache bool) error { 37 return jsonUnmarshal(response, &c.Result) 38 }