diff --git a/CHANGELOG.md b/CHANGELOG.md index d4d063cef7..9e8327d2ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/traffic_ops/traffic_ops_golang/asn/asns.go b/traffic_ops/traffic_ops_golang/asn/asns.go index db6b3afeaa..61013db05d 100644 --- a/traffic_ops/traffic_ops_golang/asn/asns.go +++ b/traffic_ops/traffic_ops_golang/asn/asns.go @@ -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 } @@ -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 } @@ -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 } diff --git a/traffic_ops/traffic_ops_golang/cachegroup/cachegroups.go b/traffic_ops/traffic_ops_golang/cachegroup/cachegroups.go index f96ba19ff8..3e0839f618 100644 --- a/traffic_ops/traffic_ops_golang/cachegroup/cachegroups.go +++ b/traffic_ops/traffic_ops_golang/cachegroup/cachegroups.go @@ -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 } @@ -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 } @@ -1407,6 +1411,8 @@ func DeleteCacheGroup(w http.ResponseWriter, r *http.Request) { alerts := tc.CreateAlerts(tc.SuccessLevel, "cache group was deleted.") 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 } diff --git a/traffic_ops/traffic_ops_golang/cdn/cdns.go b/traffic_ops/traffic_ops_golang/cdn/cdns.go index 05a494b20e..2735dcef8b 100644 --- a/traffic_ops/traffic_ops_golang/cdn/cdns.go +++ b/traffic_ops/traffic_ops_golang/cdn/cdns.go @@ -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) @@ -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 } @@ -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 } @@ -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) { diff --git a/traffic_ops/traffic_ops_golang/cdnfederation/cdnfederations.go b/traffic_ops/traffic_ops_golang/cdnfederation/cdnfederations.go index 201c3ddee5..a94fb8ad11 100644 --- a/traffic_ops/traffic_ops_golang/cdnfederation/cdnfederations.go +++ b/traffic_ops/traffic_ops_golang/cdnfederation/cdnfederations.go @@ -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)) } @@ -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") } @@ -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") } diff --git a/traffic_ops/traffic_ops_golang/division/divisions.go b/traffic_ops/traffic_ops_golang/division/divisions.go index aa02ecacd0..521330cc74 100644 --- a/traffic_ops/traffic_ops_golang/division/divisions.go +++ b/traffic_ops/traffic_ops_golang/division/divisions.go @@ -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 } @@ -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 } @@ -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 } diff --git a/traffic_ops/traffic_ops_golang/origin/origins.go b/traffic_ops/traffic_ops_golang/origin/origins.go index 2dfa7d17d2..1663319285 100644 --- a/traffic_ops/traffic_ops_golang/origin/origins.go +++ b/traffic_ops/traffic_ops_golang/origin/origins.go @@ -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. @@ -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 } @@ -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 } diff --git a/traffic_ops/traffic_ops_golang/parameter/parameters.go b/traffic_ops/traffic_ops_golang/parameter/parameters.go index 6b745545c8..e447407999 100644 --- a/traffic_ops/traffic_ops_golang/parameter/parameters.go +++ b/traffic_ops/traffic_ops_golang/parameter/parameters.go @@ -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 } @@ -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 } @@ -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 } diff --git a/traffic_ops/traffic_ops_golang/physlocation/phys_locations.go b/traffic_ops/traffic_ops_golang/physlocation/phys_locations.go index 58568fe227..098998d1c2 100644 --- a/traffic_ops/traffic_ops_golang/physlocation/phys_locations.go +++ b/traffic_ops/traffic_ops_golang/physlocation/phys_locations.go @@ -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 } @@ -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 } @@ -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 } diff --git a/traffic_ops/traffic_ops_golang/profile/profiles.go b/traffic_ops/traffic_ops_golang/profile/profiles.go index efaa0380b4..ca0add8d09 100644 --- a/traffic_ops/traffic_ops_golang/profile/profiles.go +++ b/traffic_ops/traffic_ops_golang/profile/profiles.go @@ -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 } @@ -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 } @@ -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 } diff --git a/traffic_ops/traffic_ops_golang/profileparameter/profile_parameters.go b/traffic_ops/traffic_ops_golang/profileparameter/profile_parameters.go index 38951fa463..2d216835f6 100644 --- a/traffic_ops/traffic_ops_golang/profileparameter/profile_parameters.go +++ b/traffic_ops/traffic_ops_golang/profileparameter/profile_parameters.go @@ -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 } @@ -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 } diff --git a/traffic_ops/traffic_ops_golang/region/regions.go b/traffic_ops/traffic_ops_golang/region/regions.go index c02fbc2a1c..5805c9593a 100644 --- a/traffic_ops/traffic_ops_golang/region/regions.go +++ b/traffic_ops/traffic_ops_golang/region/regions.go @@ -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 } @@ -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 } @@ -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 } diff --git a/traffic_ops/traffic_ops_golang/servercapability/servercapability.go b/traffic_ops/traffic_ops_golang/servercapability/servercapability.go index a008c48eae..a4b824bc56 100644 --- a/traffic_ops/traffic_ops_golang/servercapability/servercapability.go +++ b/traffic_ops/traffic_ops_golang/servercapability/servercapability.go @@ -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 } @@ -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 } @@ -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 } diff --git a/traffic_ops/traffic_ops_golang/servicecategory/servicecategories.go b/traffic_ops/traffic_ops_golang/servicecategory/servicecategories.go index 58739888dc..5d9313dce7 100644 --- a/traffic_ops/traffic_ops_golang/servicecategory/servicecategories.go +++ b/traffic_ops/traffic_ops_golang/servicecategory/servicecategories.go @@ -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 } @@ -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 } @@ -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 } diff --git a/traffic_ops/traffic_ops_golang/types/types.go b/traffic_ops/traffic_ops_golang/types/types.go index 85d65768bf..2768a627df 100644 --- a/traffic_ops/traffic_ops_golang/types/types.go +++ b/traffic_ops/traffic_ops_golang/types/types.go @@ -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 } @@ -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 } @@ -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 }