srijeet0406 commented on code in PR #7432: URL: https://github.com/apache/trafficcontrol/pull/7432#discussion_r1158828141
########## CHANGELOG.md: ########## @@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). ## [unreleased] ### Added +- *Traffic Ops* Added cdni capabilities delete endpoint Review Comment: Could you pls add the PR number and link, like in the other changelog entries? ########## docs/source/api/v5/oc_ci_configuration.rst: ########## @@ -105,3 +105,62 @@ Response Structure "level": "success" } ]} + +``DELETE`` +======= Review Comment: The underline looks to be too short. ########## traffic_ops/traffic_ops_golang/cdni/shared.go: ########## @@ -200,6 +201,44 @@ func PutHostConfiguration(w http.ResponseWriter, r *http.Request) { api.WriteAlerts(w, r, http.StatusAccepted, alerts) } +// DeleteConfiguration deletes CDNi configuration for ucdn specified in JWT +func DeleteConfiguration(w http.ResponseWriter, r *http.Request) { + inf, userErr, sysErr, errCode := api.NewInfo(r, nil, nil) + if userErr != nil || sysErr != nil { + api.HandleErr(w, r, inf.Tx.Tx, errCode, userErr, sysErr) + return + } + defer inf.Close() + + if inf.Config.Cdni == nil || inf.Config.Secrets[0] == "" || inf.Config.Cdni.DCdnId == "" { Review Comment: If `inf.Config.Secrets` has a length of 0, the second condition check will cause a panic. Could you pls add a check for that as well? ########## docs/source/api/v5/oc_ci_configuration.rst: ########## @@ -105,3 +105,62 @@ Response Structure "level": "success" } ]} + +``DELETE`` +======= +Deletes the configuration for the :abbr:`uCDN (Upstream Content Delivery Network)`. This returns a 204 No Content status. + +.. note:: Users with the ``ICDN:UCDN-OVERRIDE`` permission will need to provide a "ucdn" query parameter to bypass the need for :abbr:`uCDN (Upstream Content Delivery Network)` information in the :abbr:`JWT (JSON Web Token)` and allow them to view all :abbr:`CDNi (Content Delivery Network Interconnect)` information. + +:Auth. Required: Yes +:Roles Required: "admin" or "operations" +:Permissions Required: CDNI:DELETE Review Comment: Shouldn't this be `CDNI-CAPACITY:DELETE` as specified in the actual route? -- 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]
