Skip to content

Commit

Permalink
Fixed missing changelog entries for v5 routes (#7890)
Browse files Browse the repository at this point in the history
* Fixed ASN routes to produce changelog entries

* Adding missing changelog entries to v5 routes

* updated changelog

---------

Co-authored-by: Chatterjee, Srijeet <srijeet_chatterjee@comcast.com>
(cherry picked from commit 63c6471)
  • Loading branch information
rimashah25 committed Jan 3, 2024
1 parent 40352c1 commit 5d710b8
Show file tree
Hide file tree
Showing 15 changed files with 90 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- [#7814](https://github.com/apache/trafficcontrol/issues/7814) All Go components: Updated the module path to [`github.com/apache/trafficcontrol/v8`](https://pkg.go.dev/github.com/apache/trafficcontrol/v8). Module https://pkg.go.dev/github.com/apache/trafficcontrol will not receive further updates.

### Fixed
- [#7885](https://github.com/apache/trafficcontrol/pull/7885) *Traffic Portal* Fixed the issue where Compare Profiles page was not being displayed.
- [#7890](https://github.com/apache/trafficcontrol/pull/7890) *Traffic Ops*: Fixed missing changelog entries to v5 routes.
- [#7885](https://github.com/apache/trafficcontrol/pull/7885) *Traffic Portal*: Fixed the issue where Compare Profiles page was not being displayed.
- [#7879](https://github.com/apache/trafficcontrol/7879) *Traffic Ops, Traffic Portal*: Fixed broken capability links for delivery service and added required capability as a column in DS table.
- [#7878](https://github.com/apache/trafficcontrol/pull/7878) *Traffic Ops, Traffic Portal*: Fixed the case where TO was failing to assign delivery services to a server, due to a bug in the way the list of preexisting delivery services was being returned.
- [#7819](https://github.com/apache/trafficcontrol/pull/7819) *Traffic Ops*: API v5 routes should not use `privLevel` comparisons.
Expand Down
6 changes: 6 additions & 0 deletions traffic_ops/traffic_ops_golang/asn/asns.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,8 @@ func Create(w http.ResponseWriter, r *http.Request) {
alerts := tc.CreateAlerts(tc.SuccessLevel, "asn was created.")
w.Header().Set(rfc.Location, fmt.Sprintf("/api/%s/asns?id=%d", inf.Version, asn.ID))
api.WriteAlertsObj(w, r, http.StatusCreated, alerts, asn)
changeLogMsg := fmt.Sprintf("ASN: %d, ID:%d, ACTION: Created asn", asn.ASN, asn.ID)
api.CreateChangeLogRawTx(api.Created, changeLogMsg, inf.User, tx)
return
}

Expand Down Expand Up @@ -372,6 +374,8 @@ func Update(w http.ResponseWriter, r *http.Request) {

alerts := tc.CreateAlerts(tc.SuccessLevel, "asn was updated")
api.WriteAlertsObj(w, r, http.StatusOK, alerts, asn)
changeLogMsg := fmt.Sprintf("ASN: %d, ID:%d, ACTION: Updated asn", asn.ASN, asn.ID)
api.CreateChangeLogRawTx(api.Updated, changeLogMsg, inf.User, tx)
return
}

Expand Down Expand Up @@ -417,6 +421,8 @@ func Delete(w http.ResponseWriter, r *http.Request) {
}
alerts := tc.CreateAlerts(tc.SuccessLevel, "asn was deleted.")
api.WriteAlerts(w, r, http.StatusOK, alerts)
changeLogMsg := fmt.Sprintf("ID: %s, ACTION: Deleted asn", id)
api.CreateChangeLogRawTx(api.Deleted, changeLogMsg, inf.User, tx)
return
}

Expand Down
6 changes: 6 additions & 0 deletions traffic_ops/traffic_ops_golang/cachegroup/cachegroups.go
Original file line number Diff line number Diff line change
Expand Up @@ -1193,6 +1193,8 @@ func CreateCacheGroup(w http.ResponseWriter, r *http.Request) {
alerts := tc.CreateAlerts(tc.SuccessLevel, "cache group was created.")
w.Header().Set(rfc.Location, fmt.Sprintf("/api/%s/cachegroups?name=%s", inf.Version, *cg.Name))
api.WriteAlertsObj(w, r, http.StatusCreated, alerts, cg)
changeLogMsg := fmt.Sprintf("CACHEGROUP: %s, ID:%d, ACTION: Created cachegroup", *cg.Name, *cg.ID)
api.CreateChangeLogRawTx(api.Created, changeLogMsg, inf.User, tx)
return
}

Expand Down Expand Up @@ -1334,6 +1336,8 @@ func UpdateCacheGroup(w http.ResponseWriter, r *http.Request) {

alerts := tc.CreateAlerts(tc.SuccessLevel, "cache group was updated")
api.WriteAlertsObj(w, r, http.StatusOK, alerts, cg)
changeLogMsg := fmt.Sprintf("CACHEGROUP: %s, ID:%d, ACTION: Updated cachegroup", *cg.Name, *cg.ID)
api.CreateChangeLogRawTx(api.Updated, changeLogMsg, inf.User, tx)
return
}

Expand Down Expand Up @@ -1408,6 +1412,8 @@ func DeleteCacheGroup(w http.ResponseWriter, r *http.Request) {
alertMessage := fmt.Sprintf("%s was deleted.", ID)
alerts := tc.CreateAlerts(tc.SuccessLevel, alertMessage)
api.WriteAlerts(w, r, http.StatusOK, alerts)
changeLogMsg := fmt.Sprintf("ID:%d, ACTION: Deleted cachegroup", id)
api.CreateChangeLogRawTx(api.Deleted, changeLogMsg, inf.User, tx)
return
}

Expand Down
9 changes: 8 additions & 1 deletion traffic_ops/traffic_ops_golang/cdn/cdns.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ func Create(w http.ResponseWriter, r *http.Request) {
api.HandleErr(w, r, tx, code, usrErr, sysErr)
return
}
if rows.Next() {
defer rows.Close()
for rows.Next() {
if err = rows.Scan(&cdn.ID, &cdn.LastUpdated); err != nil {
usrErr, sysErr, code := api.ParseDBError(err)
api.HandleErr(w, r, tx, code, usrErr, sysErr)
Expand All @@ -162,6 +163,8 @@ func Create(w http.ResponseWriter, r *http.Request) {
alerts := tc.CreateAlerts(tc.SuccessLevel, "cdn was created.")
w.Header().Set(rfc.Location, fmt.Sprintf("/api/%s/cdns?name=%s", inf.Version, cdn.Name))
api.WriteAlertsObj(w, r, http.StatusCreated, alerts, cdn)
changeLogMsg := fmt.Sprintf("CDN: %s, ID:%d, ACTION: Created cdn", cdn.Name, cdn.ID)
api.CreateChangeLogRawTx(api.Created, changeLogMsg, inf.User, tx)
return
}

Expand Down Expand Up @@ -221,6 +224,8 @@ WHERE id=$5 RETURNING last_updated, id`
}
alerts := tc.CreateAlerts(tc.SuccessLevel, "cdn was updated.")
api.WriteAlertsObj(w, r, http.StatusOK, alerts, cdn)
changeLogMsg := fmt.Sprintf("CDN: %s, ID:%d, ACTION: Updated cdn", cdn.Name, cdn.ID)
api.CreateChangeLogRawTx(api.Updated, changeLogMsg, inf.User, tx)
return
}

Expand Down Expand Up @@ -271,6 +276,8 @@ func Delete(w http.ResponseWriter, r *http.Request) {
}

api.WriteAlerts(w, r, http.StatusOK, tc.CreateAlerts(tc.SuccessLevel, "cdn was deleted."))
changeLogMsg := fmt.Sprintf("ID:%d, ACTION: Deleted cdn", id)
api.CreateChangeLogRawTx(api.Deleted, changeLogMsg, inf.User, tx)
return
}
func validateRequest(r *http.Request, v *api.Version) (tc.CDNV5, error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,8 @@ func Create(inf *api.APIInfo) (int, error, error) {
userErr, sysErr, code := api.ParseDBError(err)
return code, userErr, fmt.Errorf("inserting a CDN Federation: %w", sysErr)
}

changeLogMsg := fmt.Sprintf("CDNFEDERATION: %s, ID:%d, ACTION: Created cdnFederation", fed.CName, fed.ID)
api.CreateChangeLogRawTx(api.Created, changeLogMsg, inf.User, inf.Tx.Tx)
return inf.WriteCreatedResponse(fed, "Federation was created", "federations/"+strconv.Itoa(fed.ID))
}

Expand Down Expand Up @@ -671,6 +672,8 @@ func Update(inf *api.APIInfo) (int, error, error) {
return code, userErr, sysErr
}

changeLogMsg := fmt.Sprintf("CDNFEDERATION: %s, ID:%d, ACTION: Updated cdnFederation", fed.CName, id)
api.CreateChangeLogRawTx(api.Updated, changeLogMsg, inf.User, inf.Tx.Tx)
return inf.WriteSuccessResponse(fed, "Federation was updated")
}

Expand All @@ -684,6 +687,7 @@ func Delete(inf *api.APIInfo) (int, error, error) {
userErr, sysErr, code := api.ParseDBError(err)
return code, userErr, sysErr
}

changeLogMsg := fmt.Sprintf("CDNFEDERATION:%s, ID:%d, ACTION: Deleted cdnFederation", fed.CName, fed.ID)
api.CreateChangeLogRawTx(api.Deleted, changeLogMsg, inf.User, inf.Tx.Tx)
return inf.WriteSuccessResponse(fed, "Federation was deleted")
}
6 changes: 6 additions & 0 deletions traffic_ops/traffic_ops_golang/division/divisions.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,8 @@ func CreateDivision(w http.ResponseWriter, r *http.Request) {
alerts := tc.CreateAlerts(tc.SuccessLevel, "division was created.")
w.Header().Set(rfc.Location, fmt.Sprintf("/api/%s/divisons?name=%s", inf.Version, div.Name))
api.WriteAlertsObj(w, r, http.StatusCreated, alerts, div)
changeLogMsg := fmt.Sprintf("DIVISION: %s, ID:%d, ACTION: Created division", div.Name, div.ID)
api.CreateChangeLogRawTx(api.Created, changeLogMsg, inf.User, tx)
return
}

Expand Down Expand Up @@ -297,6 +299,8 @@ func UpdateDivision(w http.ResponseWriter, r *http.Request) {
}
alerts := tc.CreateAlerts(tc.SuccessLevel, "division was updated")
api.WriteAlertsObj(w, r, http.StatusOK, alerts, div)
changeLogMsg := fmt.Sprintf("DIVISION: %s, ID:%d, ACTION: Updated division", div.Name, div.ID)
api.CreateChangeLogRawTx(api.Updated, changeLogMsg, inf.User, tx)
return
}

Expand Down Expand Up @@ -350,6 +354,8 @@ func DeleteDivision(w http.ResponseWriter, r *http.Request) {
}
alerts := tc.CreateAlerts(tc.SuccessLevel, "division was deleted.")
api.WriteAlertsObj(w, r, http.StatusOK, alerts, inf.Params)
changeLogMsg := fmt.Sprintf("ID:%s, ACTION: Deleted division", id)
api.CreateChangeLogRawTx(api.Deleted, changeLogMsg, inf.User, tx)
return
}

Expand Down
6 changes: 6 additions & 0 deletions traffic_ops/traffic_ops_golang/origin/origins.go
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,8 @@ func Create(w http.ResponseWriter, r *http.Request) {
alerts := tc.CreateAlerts(tc.SuccessLevel, "origin was created.")
w.Header().Set(rfc.Location, fmt.Sprintf("/api/%s/origins?id=%d", inf.Version, org.ID))
api.WriteAlertsObj(w, r, http.StatusCreated, alerts, org)
changeLogMsg := fmt.Sprintf("ORIGIN: %s, ID:%d, ACTION: Created origin", org.Name, org.ID)
api.CreateChangeLogRawTx(api.Created, changeLogMsg, inf.User, tx.Tx)
}

// Update a Origin for APIv5.
Expand Down Expand Up @@ -670,6 +672,8 @@ func Update(w http.ResponseWriter, r *http.Request) {
origin.ID = requestedOriginId
alerts := tc.CreateAlerts(tc.SuccessLevel, "origin was updated.")
api.WriteAlertsObj(w, r, http.StatusOK, alerts, origin)
changeLogMsg := fmt.Sprintf("ORIGIN: %s, ID:%d, ACTION: Updated origin", origin.Name, origin.ID)
api.CreateChangeLogRawTx(api.Updated, changeLogMsg, inf.User, tx.Tx)
return
}

Expand Down Expand Up @@ -741,6 +745,8 @@ func Delete(w http.ResponseWriter, r *http.Request) {

alerts := tc.CreateAlerts(tc.SuccessLevel, "origin was deleted.")
api.WriteAlerts(w, r, http.StatusOK, alerts)
changeLogMsg := fmt.Sprintf("ID:%d, ACTION: Deleted origin", origin.ID)
api.CreateChangeLogRawTx(api.Deleted, changeLogMsg, inf.User, tx)
return
}

Expand Down
8 changes: 8 additions & 0 deletions traffic_ops/traffic_ops_golang/parameter/parameters.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,10 @@ func CreateParameter(w http.ResponseWriter, r *http.Request) {
}
alerts := tc.CreateAlerts(tc.SuccessLevel, "All Requested Parameters were created.")
api.WriteAlertsObj(w, r, http.StatusCreated, alerts, objParam)
for _, param := range params {
changeLogMsg := fmt.Sprintf("PARAMETER: %s, ID:%d, ACTION: Created parameter", param.Name, param.ID)
api.CreateChangeLogRawTx(api.Created, changeLogMsg, inf.User, tx)
}
return
}

Expand Down Expand Up @@ -489,6 +493,8 @@ func UpdateParameter(w http.ResponseWriter, r *http.Request) {
}
alerts := tc.CreateAlerts(tc.SuccessLevel, "parameter was updated")
api.WriteAlertsObj(w, r, http.StatusOK, alerts, parameter)
changeLogMsg := fmt.Sprintf("PARAMETER: %s, ID:%d, ACTION: Updated parameter", parameter.Name, parameter.ID)
api.CreateChangeLogRawTx(api.Updated, changeLogMsg, inf.User, tx)
return
}

Expand Down Expand Up @@ -533,6 +539,8 @@ func DeleteParameter(w http.ResponseWriter, r *http.Request) {
alerts := tc.CreateAlerts(tc.SuccessLevel, "parameter"+
" was deleted.")
api.WriteAlerts(w, r, http.StatusOK, alerts)
changeLogMsg := fmt.Sprintf("ID:%s, ACTION: Deleted parameter", id)
api.CreateChangeLogRawTx(api.Deleted, changeLogMsg, inf.User, tx)
return
}

Expand Down
6 changes: 6 additions & 0 deletions traffic_ops/traffic_ops_golang/physlocation/phys_locations.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,8 @@ func CreatePhysLocation(w http.ResponseWriter, r *http.Request) {
alerts := tc.CreateAlerts(tc.SuccessLevel, "physLocation was created.")
w.Header().Set(rfc.Location, fmt.Sprintf("/api/%s/phys_locations?name=%s", inf.Version, physLocation.Name))
api.WriteAlertsObj(w, r, http.StatusCreated, alerts, physLocation)
changeLogMsg := fmt.Sprintf("PHYSLOCATION: %s, ID:%d, ACTION: Created physLocation", physLocation.Name, physLocation.ID)
api.CreateChangeLogRawTx(api.Created, changeLogMsg, inf.User, tx)
return
}

Expand Down Expand Up @@ -454,6 +456,8 @@ func UpdatePhysLocation(w http.ResponseWriter, r *http.Request) {
}
alerts := tc.CreateAlerts(tc.SuccessLevel, "physLocation was updated")
api.WriteAlertsObj(w, r, http.StatusOK, alerts, physLocation)
changeLogMsg := fmt.Sprintf("PHYSLOCATION: %s, ID:%d, ACTION: Updated physLocation", physLocation.Name, physLocation.ID)
api.CreateChangeLogRawTx(api.Updated, changeLogMsg, inf.User, tx)
return
}

Expand Down Expand Up @@ -506,6 +510,8 @@ func DeletePhysLocation(w http.ResponseWriter, r *http.Request) {
}
alerts := tc.CreateAlerts(tc.SuccessLevel, "phys_location was deleted.")
api.WriteAlerts(w, r, http.StatusOK, alerts)
changeLogMsg := fmt.Sprintf("ID:%s, ACTION: Deleted physLocation", id)
api.CreateChangeLogRawTx(api.Deleted, changeLogMsg, inf.User, tx)
return
}

Expand Down
6 changes: 6 additions & 0 deletions traffic_ops/traffic_ops_golang/profile/profiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,8 @@ func Create(w http.ResponseWriter, r *http.Request) {
alerts := tc.CreateAlerts(tc.SuccessLevel, "profile was created.")
w.Header().Set(rfc.Location, fmt.Sprintf("/api/%s/profiles?id=%d", inf.Version, profile.ID))
api.WriteAlertsObj(w, r, http.StatusCreated, alerts, profile)
changeLogMsg := fmt.Sprintf("PROFILE: %s, ID:%d, ACTION: Created profile", profile.Name, profile.ID)
api.CreateChangeLogRawTx(api.Created, changeLogMsg, inf.User, tx)
return
}

Expand Down Expand Up @@ -572,6 +574,8 @@ func Update(w http.ResponseWriter, r *http.Request) {

alerts := tc.CreateAlerts(tc.SuccessLevel, "profile was updated")
api.WriteAlertsObj(w, r, http.StatusOK, alerts, profile)
changeLogMsg := fmt.Sprintf("PROFILE: %s, ID:%d, ACTION: Updated profile", profile.Name, profile.ID)
api.CreateChangeLogRawTx(api.Updated, changeLogMsg, inf.User, tx)
return
}

Expand Down Expand Up @@ -633,6 +637,8 @@ func Delete(w http.ResponseWriter, r *http.Request) {
}
alerts := tc.CreateAlerts(tc.SuccessLevel, "profile was deleted.")
api.WriteAlerts(w, r, http.StatusOK, alerts)
changeLogMsg := fmt.Sprintf("ID:%d, ACTION: Deleted profile", id)
api.CreateChangeLogRawTx(api.Deleted, changeLogMsg, inf.User, tx)
return
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,10 @@ func CreateProfileParameter(w http.ResponseWriter, r *http.Request) {
}
alerts := tc.CreateAlerts(tc.SuccessLevel, "All Requested ProfileParameters were created.")
api.WriteAlertsObj(w, r, http.StatusCreated, alerts, objProfileParams)
for _, profileParam := range profileParams {
changeLogMsg := fmt.Sprintf("PROFILEPARAMETER Profile ID: %d, ParameterID:%d, ACTION: Created profileParameter", profileParam.ProfileID, profileParam.ParameterID)
api.CreateChangeLogRawTx(api.Created, changeLogMsg, inf.User, tx)
}
return

}
Expand Down Expand Up @@ -471,6 +475,8 @@ func DeleteProfileParameter(w http.ResponseWriter, r *http.Request) {
alerts := tc.CreateAlerts(tc.SuccessLevel, "profile_parameter"+
" was deleted.")
api.WriteAlerts(w, r, http.StatusOK, alerts)
changeLogMsg := fmt.Sprintf("PROFILEPARAMETER Profile ID: %s, ParameterID:%s, ACTION: Deleted profileParameter", profileID, parameterID)
api.CreateChangeLogRawTx(api.Deleted, changeLogMsg, inf.User, tx)
return
}

Expand Down
6 changes: 6 additions & 0 deletions traffic_ops/traffic_ops_golang/region/regions.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,8 @@ func Create(w http.ResponseWriter, r *http.Request) {
}
alerts := tc.CreateAlerts(tc.SuccessLevel, "region is created.")
api.WriteAlertsObj(w, r, http.StatusCreated, alerts, rg)
changeLogMsg := fmt.Sprintf("REGION: %s, ID:%d, ACTION: Created region", rg.Name, rg.ID)
api.CreateChangeLogRawTx(api.Created, changeLogMsg, inf.User, tx)
return
}

Expand Down Expand Up @@ -350,6 +352,8 @@ func Update(w http.ResponseWriter, r *http.Request) {

alerts := tc.CreateAlerts(tc.SuccessLevel, "region was updated")
api.WriteAlertsObj(w, r, http.StatusOK, alerts, rg)
changeLogMsg := fmt.Sprintf("REGION: %s, ID:%d, ACTION: Updated region", rg.Name, rg.ID)
api.CreateChangeLogRawTx(api.Updated, changeLogMsg, inf.User, tx)
return
}

Expand Down Expand Up @@ -425,6 +429,8 @@ func Delete(w http.ResponseWriter, r *http.Request) {
}
alerts := tc.CreateAlerts(tc.SuccessLevel, "region was deleted.")
api.WriteAlerts(w, r, http.StatusOK, alerts)
changeLogMsg := fmt.Sprintf("ID:%s, ACTION: Deleted region", requestedRegionId)
api.CreateChangeLogRawTx(api.Deleted, changeLogMsg, inf.User, tx)
return
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@ func UpdateServerCapability(w http.ResponseWriter, r *http.Request) {
}
alerts := tc.CreateAlerts(tc.SuccessLevel, "server capability was updated")
api.WriteAlertsObj(w, r, http.StatusOK, alerts, sc)
changeLogMsg := fmt.Sprintf("CAPABILITY NAME:%s, ACTION: Updated serverCapability", sc.Name)
api.CreateChangeLogRawTx(api.Updated, changeLogMsg, inf.User, tx)
return
}

Expand Down Expand Up @@ -284,6 +286,8 @@ func CreateServerCapability(w http.ResponseWriter, r *http.Request) {
alerts := tc.CreateAlerts(tc.SuccessLevel, "server capability was created.")
w.Header().Set(rfc.Location, fmt.Sprintf("/api/%s/server_capabilities?name=%s", inf.Version, sc.Name))
api.WriteAlertsObj(w, r, http.StatusCreated, alerts, sc)
changeLogMsg := fmt.Sprintf("CAPABILITY NAME:%s, ACTION: Created serverCapability", sc.Name)
api.CreateChangeLogRawTx(api.Created, changeLogMsg, inf.User, tx)
return
}

Expand Down Expand Up @@ -337,6 +341,8 @@ func DeleteServerCapability(w http.ResponseWriter, r *http.Request) {
}
alerts := tc.CreateAlerts(tc.SuccessLevel, "server capability was deleted.")
api.WriteAlertsObj(w, r, http.StatusOK, alerts, name)
changeLogMsg := fmt.Sprintf("CAPABILITY NAME:%s, ACTION: Deleted serverCapability", name)
api.CreateChangeLogRawTx(api.Deleted, changeLogMsg, inf.User, tx)
return
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,8 @@ func CreateServiceCategory(w http.ResponseWriter, r *http.Request) {
alerts := tc.CreateAlerts(tc.SuccessLevel, "service category was created.")
w.Header().Set(rfc.Location, fmt.Sprintf("/api/%s/service_category?name=%s", inf.Version, sc.Name))
api.WriteAlertsObj(w, r, http.StatusCreated, alerts, sc)
changeLogMsg := fmt.Sprintf("SERVICECATEGORY: %s ACTION: Created serviceCategory", sc.Name)
api.CreateChangeLogRawTx(api.Created, changeLogMsg, inf.User, tx)
return
}

Expand Down Expand Up @@ -380,6 +382,8 @@ func UpdateServiceCategory(w http.ResponseWriter, r *http.Request) {
}
alerts := tc.CreateAlerts(tc.SuccessLevel, "service category was updated")
api.WriteAlertsObj(w, r, http.StatusOK, alerts, sc)
changeLogMsg := fmt.Sprintf("SERVICECATEGORY: %s, ACTION: Updated serviceCategory", sc.Name)
api.CreateChangeLogRawTx(api.Updated, changeLogMsg, inf.User, tx)
return
}

Expand Down Expand Up @@ -432,6 +436,8 @@ func DeleteServiceCategory(w http.ResponseWriter, r *http.Request) {
alertMessage := fmt.Sprintf("%s was deleted.", name)
alerts := tc.CreateAlerts(tc.SuccessLevel, alertMessage)
api.WriteAlerts(w, r, http.StatusOK, alerts)
changeLogMsg := fmt.Sprintf("SERVICECATEGORY: %s, ACTION: Deleted serviceCategory", name)
api.CreateChangeLogRawTx(api.Deleted, changeLogMsg, inf.User, tx)
return
}

Expand Down
6 changes: 6 additions & 0 deletions traffic_ops/traffic_ops_golang/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,8 @@ func Create(w http.ResponseWriter, r *http.Request) {
alerts := tc.CreateAlerts(tc.SuccessLevel, "type was created.")
w.Header().Set(rfc.Location, fmt.Sprintf("/api/%s/type?name=%s", inf.Version, typ.Name))
api.WriteAlertsObj(w, r, http.StatusCreated, alerts, typ)
changeLogMsg := fmt.Sprintf("TYPE: %s, ID:%d, ACTION: Created type", typ.Name, typ.ID)
api.CreateChangeLogRawTx(api.Created, changeLogMsg, inf.User, tx)
return
}

Expand Down Expand Up @@ -373,6 +375,8 @@ func Update(w http.ResponseWriter, r *http.Request) {
}
alerts := tc.CreateAlerts(tc.SuccessLevel, "type was updated")
api.WriteAlertsObj(w, r, http.StatusOK, alerts, typ)
changeLogMsg := fmt.Sprintf("TYPE: %s, ID:%d, ACTION: Updated type", typ.Name, typ.ID)
api.CreateChangeLogRawTx(api.Updated, changeLogMsg, inf.User, tx)
return
}

Expand Down Expand Up @@ -418,6 +422,8 @@ func Delete(w http.ResponseWriter, r *http.Request) {
alertMessage := fmt.Sprintf("type was deleted.")
alerts := tc.CreateAlerts(tc.SuccessLevel, alertMessage)
api.WriteAlerts(w, r, http.StatusOK, alerts)
changeLogMsg := fmt.Sprintf("ID:%s, ACTION: Deleted type", id)
api.CreateChangeLogRawTx(api.Deleted, changeLogMsg, inf.User, tx)
return
}

Expand Down

0 comments on commit 5d710b8

Please sign in to comment.