You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2020/05/01 18:00:51 UTC

[GitHub] [trafficcontrol] shamrickus commented on a change in pull request #4674: updated servers/details for multiple interfaces

shamrickus commented on a change in pull request #4674:
URL: https://github.com/apache/trafficcontrol/pull/4674#discussion_r418660808



##########
File path: traffic_ops/traffic_ops_golang/server/detail.go
##########
@@ -92,16 +114,36 @@ func GetDetailParamHandler(w http.ResponseWriter, r *http.Request) {
 			return
 		}
 	}
-	servers, err := getDetailServers(inf.Tx.Tx, inf.User, hostName, physLocationID, util.CamelToSnakeCase(orderBy), limit)
+	servers, err := getDetailServers(inf.Tx.Tx, inf.User, hostName, physLocationID, util.CamelToSnakeCase(orderBy), limit, *inf.Version)
 	respVals := map[string]interface{}{
 		"orderby": orderBy,
 		"limit":   limit,
 		"size":    len(servers),
 	}
+
+	if inf.Version.Major < 3 {
+		v11ServerList := []tc.ServerDetailV11{}
+		for _, server := range servers {

Review comment:
       Can extract this for loop to a function for reuse  (such as on line 57).  Alternatively, the version on line 57 can be optimized to break after the first iteration (or something to that affect) as the consequent iterations do not appear to have any affect.

##########
File path: docs/source/api/v3/servers_details.rst
##########
@@ -159,7 +158,37 @@ Response Structure
 				"tcpPort": 80,
 				"type": "EDGE",
 				"xmppId": "edge",
-				"xmppPasswd": ""
+				"xmppPasswd": "",
+				"interfaces": [{
+					"ipAddresses": [
+						{
+							"address": "172.16.239.101",
+							"gateway": "",
+							"service_address": false
+						}
+					],
+						"max_bandwidth": 0,

Review comment:
       Inconsistent spacing with line 186

##########
File path: lib/go-tc/servers.go
##########
@@ -286,3 +315,88 @@ type ServerQueueUpdate struct {
 	ServerID util.JSONIntStr `json:"serverId"`
 	Action   string          `json:"action"`
 }
+
+// ServerInterface is the data associated with an interface
+type ServerInterface struct {

Review comment:
       This struct doesn't appear to have any usages (across the entire repo)




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org