dmohan001c commented on a change in pull request #6003:
URL: https://github.com/apache/trafficcontrol/pull/6003#discussion_r700000359



##########
File path: traffic_ops/v2-client/profile.go
##########
@@ -164,7 +164,8 @@ func (to *Session) GetProfileByName(name string) 
([]tc.Profile, ReqInf, error) {
 
 // GetProfileByParameter GETs a Profile by the Profile "param".
 func (to *Session) GetProfileByParameter(param string) ([]tc.Profile, ReqInf, 
error) {
-       URI := fmt.Sprintf("%s?param=%s", API_PROFILES, url.QueryEscape(param))
+       paramId, _ := strconv.Atoi(url.QueryEscape(param))

Review comment:
       I don't think a new client is required, and I verified all the existing 
call to this method are passed.

##########
File path: traffic_ops/v3-client/profile.go
##########
@@ -127,7 +127,7 @@ func (to *Session) GetProfileByName(name string) 
([]tc.Profile, toclientlib.ReqI
 }
 
 func (to *Session) GetProfileByParameterWithHdr(param string, header 
http.Header) ([]tc.Profile, toclientlib.ReqInf, error) {
-       URI := fmt.Sprintf("%s?param=%s", APIProfiles, url.QueryEscape(param))
+       URI := fmt.Sprintf("%s?param=%s", APIProfiles, param)

Review comment:
       Fixed.

##########
File path: traffic_ops/v2-client/profile.go
##########
@@ -164,7 +164,8 @@ func (to *Session) GetProfileByName(name string) 
([]tc.Profile, ReqInf, error) {
 
 // GetProfileByParameter GETs a Profile by the Profile "param".
 func (to *Session) GetProfileByParameter(param string) ([]tc.Profile, ReqInf, 
error) {
-       URI := fmt.Sprintf("%s?param=%s", API_PROFILES, url.QueryEscape(param))
+       paramId, _ := strconv.Atoi(url.QueryEscape(param))

Review comment:
       I don't want to create a new method, since the bug fixes requires the 
existing method to be changed to accept int parameters, and I verified the 
existing methods call are updated as per new fix.

##########
File path: traffic_ops/v2-client/profile.go
##########
@@ -164,7 +164,8 @@ func (to *Session) GetProfileByName(name string) 
([]tc.Profile, ReqInf, error) {
 
 // GetProfileByParameter GETs a Profile by the Profile "param".
 func (to *Session) GetProfileByParameter(param string) ([]tc.Profile, ReqInf, 
error) {
-       URI := fmt.Sprintf("%s?param=%s", API_PROFILES, url.QueryEscape(param))
+       paramId, _ := strconv.Atoi(url.QueryEscape(param))

Review comment:
       I don't think a new client is required, and I verified all the existing 
call to this method are passed.

##########
File path: traffic_ops/v2-client/profile.go
##########
@@ -164,7 +164,8 @@ func (to *Session) GetProfileByName(name string) 
([]tc.Profile, ReqInf, error) {
 
 // GetProfileByParameter GETs a Profile by the Profile "param".
 func (to *Session) GetProfileByParameter(param string) ([]tc.Profile, ReqInf, 
error) {
-       URI := fmt.Sprintf("%s?param=%s", API_PROFILES, url.QueryEscape(param))
+       paramId, _ := strconv.Atoi(url.QueryEscape(param))

Review comment:
       If we keep the existing methods as per your advice, if someone 
accidentally calls the existing method, it will throw an error, since that API 
is not anymore supported string.

##########
File path: traffic_ops/v2-client/profile.go
##########
@@ -164,7 +164,8 @@ func (to *Session) GetProfileByName(name string) 
([]tc.Profile, ReqInf, error) {
 
 // GetProfileByParameter GETs a Profile by the Profile "param".
 func (to *Session) GetProfileByParameter(param string) ([]tc.Profile, ReqInf, 
error) {
-       URI := fmt.Sprintf("%s?param=%s", API_PROFILES, url.QueryEscape(param))
+       paramId, _ := strconv.Atoi(url.QueryEscape(param))

Review comment:
       If we keep the existing methods as per your advice, if someone 
accidentally calls the existing method, it will throw an error, since that API 
is not anymore supporting string.

##########
File path: traffic_ops/v2-client/profile.go
##########
@@ -164,7 +164,8 @@ func (to *Session) GetProfileByName(name string) 
([]tc.Profile, ReqInf, error) {
 
 // GetProfileByParameter GETs a Profile by the Profile "param".
 func (to *Session) GetProfileByParameter(param string) ([]tc.Profile, ReqInf, 
error) {
-       URI := fmt.Sprintf("%s?param=%s", API_PROFILES, url.QueryEscape(param))
+       paramId, _ := strconv.Atoi(url.QueryEscape(param))

Review comment:
       I don't want to create a new method, since the bug fixes require the API 
to accept int parameters(there is no change in method signature), If we keep 
the existing methods as per your advice, if someone accidentally calls the 
method, it will throw an error since that API is not anymore supporting string.

##########
File path: traffic_ops/v2-client/profile.go
##########
@@ -164,7 +164,8 @@ func (to *Session) GetProfileByName(name string) 
([]tc.Profile, ReqInf, error) {
 
 // GetProfileByParameter GETs a Profile by the Profile "param".
 func (to *Session) GetProfileByParameter(param string) ([]tc.Profile, ReqInf, 
error) {
-       URI := fmt.Sprintf("%s?param=%s", API_PROFILES, url.QueryEscape(param))
+       paramId, _ := strconv.Atoi(url.QueryEscape(param))

Review comment:
       If we keep the existing methods as per your advice, if someone 
accidentally calls the existing method, it will throw an error, since that API 
is not anymore supporting string.




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


Reply via email to