mattjackson220 commented on a change in pull request #4477: Deprecate 
parameters/profile/:name
URL: https://github.com/apache/trafficcontrol/pull/4477#discussion_r391798341
 
 

 ##########
 File path: 
traffic_ops/traffic_ops_golang/profileparameter/parameterprofilebyname.go
 ##########
 @@ -22,20 +22,59 @@ package profileparameter
 import (
        "database/sql"
        "errors"
+       "github.com/apache/trafficcontrol/lib/go-util"
        "net/http"
 
        "github.com/apache/trafficcontrol/lib/go-tc"
        "github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/api"
 )
 
+const API_PROFILES_NAME_NAME_PARAMETERS = "profiles/name/:name/parameters"
+
+func GetProfileNameDeprecated(w http.ResponseWriter, r *http.Request) {
+       getProfileName(w, r, true)
+}
+
 func GetProfileName(w http.ResponseWriter, r *http.Request) {
+       getProfileName(w, r, false)
+}
+
+func deprecationString(deprecated bool) *string {
 
 Review comment:
   just to clean up a bit and get rid of some of the ifs, what are your 
thoughts on something like this instead?
   `func handleLocalErr(w http.ResponseWriter, r *http.Request, tx *sql.Tx, 
errCode int, userErr error, sysErr error, deprecated bool) {
        if deprecated {
                api.HandleDeprecatedErr(w, r, tx, errCode, userErr, sysErr, 
util.StrPtr(API_PROFILES_NAME_NAME_PARAMETERS))
        } else {
                api.HandleErr(w, r, tx, errCode, userErr, sysErr)
        }
   }`

----------------------------------------------------------------
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

Reply via email to