jagan-parthiban commented on code in PR #7738:
URL: https://github.com/apache/trafficcontrol/pull/7738#discussion_r1302332531
##########
lib/go-tc/profile_parameters.go:
##########
@@ -59,3 +61,50 @@ type ProfileParameterNullable struct {
Parameter *string `json:"parameter" db:"parameter"`
ParameterID *int `json:"parameterId" db:"parameter_id"`
}
+
+// ProfileParametersResponseV5 is the type of the response from Traffic Ops to
+// GET requests made to its /profileparameters API endpoint.
+type ProfileParametersResponseV5 struct {
+ Response []ProfileParameterV5 `json:"response"`
+ Alerts
+}
+
+// ProfileParameterResponseV5 is a single ProfileParameter response for Create
to
+// depict what changed.
+// swagger:response ProfileParameterResponse
+// in: body
+type ProfileParameterResponseV5 struct {
+ // in: body
+ Response ProfileParameterV5 `json:"response"`
+ Alerts
+}
+
+// ProfileParameterV5 is the latest minor version of the major version 5
+type ProfileParameterV5 ProfileParameterV50
+
+// ProfileParameterV50 is a representation of a relationship between a
Parameter
+// and a Profile to which it is assigned.
+//
+// Note that not all unique identifiers for each represented object in this
+// relationship structure are guaranteed to be populated by the Traffic Ops
+// API.
+type ProfileParameterV50 struct {
+ LastUpdated time.Time `json:"lastUpdated"`
+ Profile string `json:"profile"`
+ ProfileID int `json:"profileId"`
+ Parameter string `json:"parameter"`
+ ParameterID int `json:"parameterId"`
+}
+
+// ProfileParameterNullableV5 is the latest minor version of the major version
5
Review Comment:
Fixed It.
##########
traffic_ops/traffic_ops_golang/profileparameter/profile_parameters.go:
##########
@@ -212,3 +219,301 @@ func deleteQuery() string {
WHERE profile=:profile_id and parameter=:parameter_id`
return query
}
+
+func GetProfileParameter(w http.ResponseWriter, r *http.Request) {
+ var runSecond bool
+ var maxTime time.Time
+ inf, userErr, sysErr, errCode := api.NewInfo(r, nil, nil)
+ tx := inf.Tx
+ if userErr != nil || sysErr != nil {
+ api.HandleErr(w, r, tx.Tx, errCode, userErr, sysErr)
+ return
+ }
+ defer inf.Close()
+
+ // Query Parameters to Database Query column mappings
+ queryParamsToQueryCols := map[string]dbhelpers.WhereColumnInfo{
+ "profileId": {Column: "pp.profile"},
+ "parameterId": {Column: "pp.parameter"},
+ "lastUpdated": {Column: "pp.last_updated"},
+ }
+ if _, ok := inf.Params["orderby"]; !ok {
+ inf.Params["orderby"] = "parameter"
+ }
+ where, orderBy, pagination, queryValues, errs :=
dbhelpers.BuildWhereAndOrderByAndPagination(inf.Params, queryParamsToQueryCols)
+ if len(errs) > 0 {
+ api.HandleErr(w, r, tx.Tx, http.StatusBadRequest,
util.JoinErrs(errs), nil)
+ }
Review Comment:
Fixed It.
--
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]