srijeet0406 commented on code in PR #7720:
URL: https://github.com/apache/trafficcontrol/pull/7720#discussion_r1302067054
##########
traffic_ops/traffic_ops_golang/deliveryservice/servers/servers.go:
##########
@@ -170,7 +170,30 @@ func ReadDSSHandler(w http.ResponseWriter, r
*http.Request) {
if err == nil && results == nil {
w.WriteHeader(http.StatusNotModified)
}
- api.WriteRespRaw(w, r, results)
+ if inf.Version.GreaterThanOrEqualTo(&api.Version{
+ Major: 5,
+ Minor: 0,
+ }) {
+ var resultsV5 tc.DeliveryServiceServerResponseV5
+ resultsV5.Limit = results.Limit
+ resultsV5.Orderby = results.Orderby
+ resultsV5.Size = results.Size
+ resultsV5.Alerts = results.Alerts
+ resultsV5.Response = *upgrade(results.Response)
+ api.WriteRespRaw(w, r, resultsV5)
+ } else {
+ api.WriteRespRaw(w, r, results)
+ }
+}
+
+func upgrade(dsServers []tc.DeliveryServiceServer)
*[]tc.DeliveryServiceServerV5 {
+ dsServersV5 := make([]tc.DeliveryServiceServerV5, len(dsServers))
+ for i, s := range dsServers {
+ dsServersV5[i].Server = s.Server
+ dsServersV5[i].DeliveryService = s.DeliveryService
+ dsServersV5[i].LastUpdated, _ =
util.ConvertTimeFormat(s.LastUpdated.Time, time.RFC3339)
Review Comment:
In my latest commit, I have ensured that if there is an error, the time will
just be set to `s.LastUpdated.Time`.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]