Loading go-apps/meep-tm/server/bwm/bwm.go +16 −16 Original line number Original line Diff line number Diff line Loading @@ -76,7 +76,7 @@ type sessionFilterListCheck struct { type BwAllocInfoResp struct { type BwAllocInfoResp struct { AppInstanceId []string AppInstanceId []string AllocationId []string SessionId []string AppName []string AppName []string SessionList []BwInfo SessionList []BwInfo } } Loading Loading @@ -642,7 +642,7 @@ func bandwidthAllocationListGet(w http.ResponseWriter, r *http.Request) { u, _ := url.Parse(r.URL.String()) u, _ := url.Parse(r.URL.String()) q := u.Query() q := u.Query() validParams := []string{"app_instance_id", "app_name", "allocation_id"} validParams := []string{"app_instance_id", "app_name", "session_id"} err := validateQueryParams(q, validParams) err := validateQueryParams(q, validParams) if err != nil { if err != nil { errHandlerProblemDetails(w, err.Error(), http.StatusBadRequest) errHandlerProblemDetails(w, err.Error(), http.StatusBadRequest) Loading @@ -651,17 +651,17 @@ func bandwidthAllocationListGet(w http.ResponseWriter, r *http.Request) { appInstanceId := q["app_instance_id"] appInstanceId := q["app_instance_id"] appName := q["app_name"] appName := q["app_name"] allocationId := q["allocation_id"] sessionId := q["session_id"] bwInfoList := &BwAllocInfoResp{ bwInfoList := &BwAllocInfoResp{ AppInstanceId: appInstanceId, AppInstanceId: appInstanceId, AppName: appName, AppName: appName, AllocationId: allocationId, SessionId: sessionId, SessionList: make([]BwInfo, 0), SessionList: make([]BwInfo, 0), } } // Make sure only 1 or none of the following are present: appInstanceId, appName, allocationId // Make sure only 1 or none of the following are present: appInstanceId, appName, allocationId err = validateMtsSesInfoQueryParams(appInstanceId, appName, allocationId) err = validateMtsSesInfoQueryParams(appInstanceId, appName, sessionId) if err != nil { if err != nil { errHandlerProblemDetails(w, err.Error(), http.StatusBadRequest) errHandlerProblemDetails(w, err.Error(), http.StatusBadRequest) return return Loading Loading @@ -1376,10 +1376,10 @@ func populateBwInfo(key string, jsonInfo string, bwInfoList interface{}) error { paramFound := false paramFound := false if len(resp.AllocationId) > 0 { if len(resp.AppInstanceId) > 0 { paramFound = false paramFound = false for _, QueryAllocationId := range resp.AllocationId { for _, QueryAppInstanceId := range resp.AppInstanceId { if bwInfo.AllocationId == QueryAllocationId { if bwInfo.AppInsId == QueryAppInstanceId { paramFound = true paramFound = true } } } } Loading @@ -1388,10 +1388,10 @@ func populateBwInfo(key string, jsonInfo string, bwInfoList interface{}) error { } } } } if len(resp.AppInstanceId) > 0 { if len(resp.AppName) > 0 { paramFound = false paramFound = false for _, QueryAppInstanceId := range resp.AppInstanceId { for _, QueryAppName := range resp.AppName { if bwInfo.AppInsId == QueryAppInstanceId { if bwInfo.AppName == QueryAppName { paramFound = true paramFound = true } } } } Loading @@ -1400,10 +1400,10 @@ func populateBwInfo(key string, jsonInfo string, bwInfoList interface{}) error { } } } } if len(resp.AppInstanceId) > 0 { if len(resp.SessionId) > 0 { paramFound = false paramFound = false for _, QueryAppName := range resp.AppName { for _, QueryAllocationId := range resp.SessionId { if bwInfo.AppName == QueryAppName { if bwInfo.AllocationId == QueryAllocationId { paramFound = true paramFound = true } } } } Loading Loading @@ -2051,7 +2051,7 @@ func validateQueryParams(params url.Values, validParams []string) error { none should be provided in the request none should be provided in the request * @return {error} error An error will be return if occurs * @return {error} error An error will be return if occurs */ */ func validateMtsSesInfoQueryParams(appInstanceId []string, appName []string, allocationId []string) error { func validateMtsSesInfoQueryParams(appInstanceId []string, appName []string, sessionId []string) error { count := 0 count := 0 if len(appInstanceId) != 0 { if len(appInstanceId) != 0 { count++ count++ Loading @@ -2059,7 +2059,7 @@ func validateMtsSesInfoQueryParams(appInstanceId []string, appName []string, all if len(appName) != 0 { if len(appName) != 0 { count++ count++ } } if len(allocationId) != 0 { if len(sessionId) != 0 { count++ count++ } } if count > 1 { if count > 1 { Loading Loading
go-apps/meep-tm/server/bwm/bwm.go +16 −16 Original line number Original line Diff line number Diff line Loading @@ -76,7 +76,7 @@ type sessionFilterListCheck struct { type BwAllocInfoResp struct { type BwAllocInfoResp struct { AppInstanceId []string AppInstanceId []string AllocationId []string SessionId []string AppName []string AppName []string SessionList []BwInfo SessionList []BwInfo } } Loading Loading @@ -642,7 +642,7 @@ func bandwidthAllocationListGet(w http.ResponseWriter, r *http.Request) { u, _ := url.Parse(r.URL.String()) u, _ := url.Parse(r.URL.String()) q := u.Query() q := u.Query() validParams := []string{"app_instance_id", "app_name", "allocation_id"} validParams := []string{"app_instance_id", "app_name", "session_id"} err := validateQueryParams(q, validParams) err := validateQueryParams(q, validParams) if err != nil { if err != nil { errHandlerProblemDetails(w, err.Error(), http.StatusBadRequest) errHandlerProblemDetails(w, err.Error(), http.StatusBadRequest) Loading @@ -651,17 +651,17 @@ func bandwidthAllocationListGet(w http.ResponseWriter, r *http.Request) { appInstanceId := q["app_instance_id"] appInstanceId := q["app_instance_id"] appName := q["app_name"] appName := q["app_name"] allocationId := q["allocation_id"] sessionId := q["session_id"] bwInfoList := &BwAllocInfoResp{ bwInfoList := &BwAllocInfoResp{ AppInstanceId: appInstanceId, AppInstanceId: appInstanceId, AppName: appName, AppName: appName, AllocationId: allocationId, SessionId: sessionId, SessionList: make([]BwInfo, 0), SessionList: make([]BwInfo, 0), } } // Make sure only 1 or none of the following are present: appInstanceId, appName, allocationId // Make sure only 1 or none of the following are present: appInstanceId, appName, allocationId err = validateMtsSesInfoQueryParams(appInstanceId, appName, allocationId) err = validateMtsSesInfoQueryParams(appInstanceId, appName, sessionId) if err != nil { if err != nil { errHandlerProblemDetails(w, err.Error(), http.StatusBadRequest) errHandlerProblemDetails(w, err.Error(), http.StatusBadRequest) return return Loading Loading @@ -1376,10 +1376,10 @@ func populateBwInfo(key string, jsonInfo string, bwInfoList interface{}) error { paramFound := false paramFound := false if len(resp.AllocationId) > 0 { if len(resp.AppInstanceId) > 0 { paramFound = false paramFound = false for _, QueryAllocationId := range resp.AllocationId { for _, QueryAppInstanceId := range resp.AppInstanceId { if bwInfo.AllocationId == QueryAllocationId { if bwInfo.AppInsId == QueryAppInstanceId { paramFound = true paramFound = true } } } } Loading @@ -1388,10 +1388,10 @@ func populateBwInfo(key string, jsonInfo string, bwInfoList interface{}) error { } } } } if len(resp.AppInstanceId) > 0 { if len(resp.AppName) > 0 { paramFound = false paramFound = false for _, QueryAppInstanceId := range resp.AppInstanceId { for _, QueryAppName := range resp.AppName { if bwInfo.AppInsId == QueryAppInstanceId { if bwInfo.AppName == QueryAppName { paramFound = true paramFound = true } } } } Loading @@ -1400,10 +1400,10 @@ func populateBwInfo(key string, jsonInfo string, bwInfoList interface{}) error { } } } } if len(resp.AppInstanceId) > 0 { if len(resp.SessionId) > 0 { paramFound = false paramFound = false for _, QueryAppName := range resp.AppName { for _, QueryAllocationId := range resp.SessionId { if bwInfo.AppName == QueryAppName { if bwInfo.AllocationId == QueryAllocationId { paramFound = true paramFound = true } } } } Loading Loading @@ -2051,7 +2051,7 @@ func validateQueryParams(params url.Values, validParams []string) error { none should be provided in the request none should be provided in the request * @return {error} error An error will be return if occurs * @return {error} error An error will be return if occurs */ */ func validateMtsSesInfoQueryParams(appInstanceId []string, appName []string, allocationId []string) error { func validateMtsSesInfoQueryParams(appInstanceId []string, appName []string, sessionId []string) error { count := 0 count := 0 if len(appInstanceId) != 0 { if len(appInstanceId) != 0 { count++ count++ Loading @@ -2059,7 +2059,7 @@ func validateMtsSesInfoQueryParams(appInstanceId []string, appName []string, all if len(appName) != 0 { if len(appName) != 0 { count++ count++ } } if len(allocationId) != 0 { if len(sessionId) != 0 { count++ count++ } } if count > 1 { if count > 1 { Loading