ocket8888 commented on a change in pull request #4774:
URL: https://github.com/apache/trafficcontrol/pull/4774#discussion_r441050389



##########
File path: traffic_ops/traffic_ops_golang/crconfig/handler.go
##########
@@ -78,6 +79,33 @@ func SnapshotGetHandler(w http.ResponseWriter, r 
*http.Request) {
        w.Write([]byte(`{"response":` + snapshot + `}`))
 }
 
+func SnapshotGetMonitoringLegacyHandler(w http.ResponseWriter, r 
*http.Request) {
+       inf, userErr, sysErr, errCode := api.NewInfo(r, []string{"cdn"}, nil)
+       if userErr != nil || sysErr != nil {
+               api.HandleErr(w, r, inf.Tx.Tx, errCode, userErr, sysErr)
+               return
+       }
+       defer inf.Close()
+
+       snapshot, cdnExists, err := GetSnapshotMonitoring(inf.Tx.Tx, 
inf.Params["cdn"])
+
+       if err != nil {
+               api.HandleErr(w, r, inf.Tx.Tx, http.StatusInternalServerError, 
nil, errors.New("getting snapshot: "+err.Error()))
+               return
+       }
+       if !cdnExists {
+               api.HandleErr(w, r, inf.Tx.Tx, http.StatusNotFound, 
errors.New("CDN not found"), nil)
+               return
+       }
+       var data tc.TrafficMonitorConfig
+       if err := json.Unmarshal([]byte(snapshot), &data); err != nil {
+               api.HandleErr(w, r, inf.Tx.Tx, http.StatusInternalServerError, 
nil, errors.New("getting snapshot: "+err.Error()))
+               return
+       }
+       convertedData := data.ToLegacyConfig()

Review comment:
       Compile error:
   ```
   traffic_ops/traffic_ops_golang/crconfig/handler.go:105:23: 
data.ToLegacyConfig undefined (type tc.TrafficMonitorConfig has no field or 
method ToLegacyConfig)
   ```




----------------------------------------------------------------
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:
[email protected]


Reply via email to