shamrickus commented on a change in pull request #4517: Collapse
cdns/{{ID}}/snapshot & snapshot/{{CDN}} to snapshot route
URL: https://github.com/apache/trafficcontrol/pull/4517#discussion_r396710093
##########
File path: traffic_ops/traffic_ops_golang/crconfig/handler.go
##########
@@ -123,61 +123,93 @@ func SnapshotOldGetHandler(w http.ResponseWriter, r
*http.Request) {
// SnapshotHandler creates the CRConfig JSON and writes it to the snapshot
table in the database.
func SnapshotHandler(w http.ResponseWriter, r *http.Request) {
- inf, userErr, sysErr, errCode := api.NewInfo(r, nil, []string{"id"})
+ snapshotHandler(w, r, false)
+}
+
+// SnapshotHandlerDeprecated creates the CRConfig JSON and writes it to the
snapshot table in the database for deprecated routes.
+func SnapshotHandlerDeprecated(w http.ResponseWriter, r *http.Request) {
+ snapshotHandler(w, r, true)
+}
+
+// SnapshotHandler creates the CRConfig JSON and writes it to the snapshot
table in the database.
+func snapshotHandler(w http.ResponseWriter, r *http.Request, deprecated bool) {
+ alt := "PUT /snapshots with either the query parameter cdn or cdnID"
+ writeErr := func(w http.ResponseWriter, r *http.Request, tx *sql.Tx,
statusCode int, userErr error, sysErr error, deprecated bool) {
Review comment:
This function exists in `api.HandleErrOptionalDeprecation`
----------------------------------------------------------------
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]
With regards,
Apache Git Services