mhoppa commented on a change in pull request #4378: updated API to version 2.x
URL: https://github.com/apache/trafficcontrol/pull/4378#discussion_r377798619
 
 

 ##########
 File path: traffic_ops/traffic_ops_golang/routing/routes.go
 ##########
 @@ -133,472 +134,913 @@ func Routes(d ServerData) ([]Route, []RawRoute, 
http.Handler, error) {
                // 1.1 and 1.2 routes are simply a Go replacement for the 
equivalent Perl route. They may or may not conform with the API guidelines 
(https://cwiki.apache.org/confluence/display/TC/API+Guidelines).
                // 1.3 routes exist only in Go. There is NO equivalent Perl 
route. They should conform with the API guidelines 
(https://cwiki.apache.org/confluence/display/TC/API+Guidelines).
 
+               // 2.x routes exist only in Go. There is NO equivalent Perl 
route. They should conform with the API guidelines 
(https://cwiki.apache.org/confluence/display/TC/API+Guidelines).
+
                // NOTE: Route IDs are immutable and unique. DO NOT change the 
ID of an existing Route; otherwise, existing
                // configurations may break. New Route IDs can be any integer 
between 0 and 2147483647 (inclusive), as long as
                // it's unique.
 
                // API Capability
-               {1.1, http.MethodGet, `api_capabilities/?(\.json)?$`, 
apicapability.GetAPICapabilitiesHandler, auth.PrivLevelReadOnly, Authenticated, 
nil, 1813206589, perlBypass},
+               {api.Version{2, 0}, http.MethodGet, 
`api_capabilities/?(\.json)?$`, apicapability.GetAPICapabilitiesHandler, 
auth.PrivLevelReadOnly, Authenticated, nil, 2813206589, noPerlBypass},
+
+               //ASN: CRUD
+               {api.Version{2, 0}, http.MethodGet, `asns/?(\.json)?$`, 
api.ReadHandler(&asn.TOASNV11{}), auth.PrivLevelReadOnly, Authenticated, nil, 
273877722, noPerlBypass},
+               {api.Version{2, 0}, http.MethodGet, `asns/{id}$`, 
api.ReadHandler(&asn.TOASNV11{}), auth.PrivLevelReadOnly, Authenticated, nil, 
223008984, noPerlBypass},
+               {api.Version{2, 0}, http.MethodPut, `asns/{id}$`, 
api.UpdateHandler(&asn.TOASNV11{}), auth.PrivLevelOperations, Authenticated, 
nil, 2951198629, noPerlBypass},
+               {api.Version{2, 0}, http.MethodPost, `asns/?$`, 
api.CreateHandler(&asn.TOASNV11{}), auth.PrivLevelOperations, Authenticated, 
nil, 2999492188, noPerlBypass},
+               {api.Version{2, 0}, http.MethodDelete, `asns/{id}$`, 
api.DeleteHandler(&asn.TOASNV11{}), auth.PrivLevelOperations, Authenticated, 
nil, 2672524769, noPerlBypass},
+
+               // Traffic Stats access
+               {api.Version{2, 0}, http.MethodGet, `deliveryservice_stats`, 
trafficstats.GetDSStats, auth.PrivLevelReadOnly, Authenticated, nil, 
2319569028, noPerlBypass},
+               {api.Version{2, 0}, http.MethodGet, `cache_stats`, 
trafficstats.GetCacheStats, auth.PrivLevelReadOnly, Authenticated, nil, 
2497997906, noPerlBypass},
+               {api.Version{2, 0}, http.MethodGet, 
`current_stats/?(\.json)?$`, trafficstats.GetCurrentStats, 
auth.PrivLevelReadOnly, Authenticated, nil, 2785442893, noPerlBypass},
+
+               {api.Version{2, 0}, http.MethodGet, `caches/stats/?(\.json)?$`, 
cachesstats.Get, auth.PrivLevelReadOnly, Authenticated, nil, 2813206588, 
noPerlBypass},
+
+               //CacheGroup: CRUD
+               {api.Version{2, 0}, http.MethodGet, 
`cachegroups/trimmed/?(\.json)?$`, cachegroup.GetTrimmed, 
auth.PrivLevelReadOnly, Authenticated, nil, 229527916, noPerlBypass},
+               {api.Version{2, 0}, http.MethodGet, `cachegroups/?(\.json)?$`, 
api.ReadHandler(&cachegroup.TOCacheGroup{}), auth.PrivLevelReadOnly, 
Authenticated, nil, 223079110, noPerlBypass},
+               {api.Version{2, 0}, http.MethodGet, `cachegroups/{id}$`, 
api.ReadHandler(&cachegroup.TOCacheGroup{}), auth.PrivLevelReadOnly, 
Authenticated, nil, 291886338, noPerlBypass},
+               {api.Version{2, 0}, http.MethodPut, `cachegroups/{id}$`, 
api.UpdateHandler(&cachegroup.TOCacheGroup{}), auth.PrivLevelOperations, 
Authenticated, nil, 212954546, noPerlBypass},
+               {api.Version{2, 0}, http.MethodPost, `cachegroups/?$`, 
api.CreateHandler(&cachegroup.TOCacheGroup{}), auth.PrivLevelOperations, 
Authenticated, nil, 22982665, noPerlBypass},
+               {api.Version{2, 0}, http.MethodDelete, `cachegroups/{id}$`, 
api.DeleteHandler(&cachegroup.TOCacheGroup{}), auth.PrivLevelOperations, 
Authenticated, nil, 227869365, noPerlBypass},
+
+               {api.Version{2, 0}, http.MethodPost, 
`cachegroups/{id}/queue_update$`, cachegroup.QueueUpdates, 
auth.PrivLevelOperations, Authenticated, nil, 2071644110, noPerlBypass},
+               {api.Version{2, 0}, http.MethodPost, 
`cachegroups/{id}/deliveryservices/?$`, cachegroup.DSPostHandler, 
auth.PrivLevelOperations, Authenticated, nil, 2520240431, noPerlBypass},
+
+               //CacheGroup Parameters: CRUD
+               {api.Version{2, 0}, http.MethodGet, 
`cachegroups/{id}/parameters/?(\.json)?$`, 
api.ReadHandler(&cachegroupparameter.TOCacheGroupParameter{}), 
auth.PrivLevelReadOnly, Authenticated, nil, 212449723, noPerlBypass},
+               {api.Version{2, 0}, http.MethodGet, 
`cachegroups/{id}/unassigned_parameters/?(\.json)?$`, 
api.ReadHandler(&cachegroupparameter.TOCacheGroupUnassignedParameter{}), 
auth.PrivLevelReadOnly, Authenticated, nil, 2457339250, noPerlBypass},
+               {api.Version{2, 0}, http.MethodDelete, 
`cachegroupparameters/{cachegroupID}/{parameterId}$`, 
api.DeleteHandler(&cachegroupparameter.TOCacheGroupParameter{}), 
auth.PrivLevelOperations, Authenticated, nil, 212449733, noPerlBypass},
+
+               //Capabilities
+               {api.Version{2, 0}, http.MethodGet, `capabilities(/|\.json)?$`, 
capabilities.Read, auth.PrivLevelReadOnly, Authenticated, nil, 2008135, 
noPerlBypass},
+               {api.Version{2, 0}, http.MethodPost, 
`capabilities(/|\.json)?$`, capabilities.Create, auth.PrivLevelOperations, 
Authenticated, nil, 2, noPerlBypass},
+
+               //CDN
+               {api.Version{2, 0}, http.MethodGet, 
`cdns/name/{name}/sslkeys/?(\.json)?$`, cdn.GetSSLKeys, auth.PrivLevelAdmin, 
Authenticated, nil, 2278581772, noPerlBypass},
+               {api.Version{2, 0}, http.MethodGet, `cdns/metric_types`, 
notImplementedHandler, 0, NoAuth, nil, 283165463, noPerlBypass}, // MUST NOT 
end in $, because the 1.x route is longer
+
+               {api.Version{2, 0}, http.MethodGet, `cdns/capacity$`, 
cdn.GetCapacity, auth.PrivLevelReadOnly, Authenticated, nil, 297185281, 
noPerlBypass},
+
+               {api.Version{2, 0}, http.MethodGet, 
`cdns/{name}/health/?(\.json)?$`, cdn.GetNameHealth, auth.PrivLevelReadOnly, 
Authenticated, nil, 2135348194, noPerlBypass},
+               {api.Version{2, 0}, http.MethodGet, `cdns/health/?(\.json)?$`, 
cdn.GetHealth, auth.PrivLevelReadOnly, Authenticated, nil, 2085381134, 
noPerlBypass},
+
+               {api.Version{2, 0}, http.MethodGet, `cdns/domains/?(\.json)?$`, 
cdn.DomainsHandler, auth.PrivLevelReadOnly, Authenticated, nil, 226902560, 
noPerlBypass},
+               {api.Version{2, 0}, http.MethodGet, `cdns/routing$`, 
cdn.GetRouting, auth.PrivLevelReadOnly, Authenticated, nil, 26722982, 
noPerlBypass},
+
+               //CDN: CRUD
+               {api.Version{2, 0}, http.MethodGet, 
`cdns/name/{name}/?(\.json)?$`, api.ReadHandler(&cdn.TOCDN{}), 
auth.PrivLevelReadOnly, Authenticated, nil, 2235233288, noPerlBypass},
+               {api.Version{2, 0}, http.MethodDelete, `cdns/name/{name}$`, 
cdn.DeleteName, auth.PrivLevelOperations, Authenticated, nil, 208804959, 
noPerlBypass},
+
+               //CDN: queue updates
+               {api.Version{2, 0}, http.MethodPost, `cdns/{id}/queue_update$`, 
cdn.Queue, auth.PrivLevelOperations, Authenticated, nil, 221515980, 
noPerlBypass},
+               {api.Version{2, 0}, http.MethodPost, 
`cdns/dnsseckeys/generate(\.json)?$`, cdn.CreateDNSSECKeys, 
auth.PrivLevelAdmin, Authenticated, nil, 275336, noPerlBypass},
+               {api.Version{2, 0}, http.MethodGet, 
`cdns/name/{name}/dnsseckeys/delete/?(\.json)?$`, cdn.DeleteDNSSECKeys, 
auth.PrivLevelAdmin, Authenticated, nil, 271104207, noPerlBypass},
+               {api.Version{2, 0}, http.MethodGet, 
`cdns/name/{name}/dnsseckeys/?(\.json)?$`, cdn.GetDNSSECKeys, 
auth.PrivLevelAdmin, Authenticated, nil, 279010609, noPerlBypass},
+
+               {api.Version{2, 0}, http.MethodGet, 
`cdns/dnsseckeys/refresh/?(\.json)?$`, cdn.RefreshDNSSECKeys, 
auth.PrivLevelOperations, Authenticated, nil, 2771997116, noPerlBypass},
+
+               //CDN: Monitoring: Traffic Monitor
+               {api.Version{2, 0}, http.MethodGet, 
`cdns/{cdn}/configs/monitoring(\.json)?$`, 
crconfig.SnapshotGetMonitoringHandler, auth.PrivLevelReadOnly, Authenticated, 
nil, 2240847892, noPerlBypass},
+
+               //Database dumps
+               {api.Version{2, 0}, http.MethodGet, `dbdump/?`, dbdump.DBDump, 
auth.PrivLevelAdmin, Authenticated, nil, 224016647, noPerlBypass},
+
+               //Division: CRUD
+               {api.Version{2, 0}, http.MethodGet, `divisions/?(\.json)?$`, 
api.ReadHandler(&division.TODivision{}), auth.PrivLevelReadOnly, Authenticated, 
nil, 2085181534, noPerlBypass},
+               {api.Version{2, 0}, http.MethodGet, `divisions/{id}$`, 
api.ReadHandler(&division.TODivision{}), auth.PrivLevelReadOnly, Authenticated, 
nil, 2241497902, noPerlBypass},
+               {api.Version{2, 0}, http.MethodPut, `divisions/{id}$`, 
api.UpdateHandler(&division.TODivision{}), auth.PrivLevelOperations, 
Authenticated, nil, 206369140, noPerlBypass},
+               {api.Version{2, 0}, http.MethodPost, `divisions/?$`, 
api.CreateHandler(&division.TODivision{}), auth.PrivLevelOperations, 
Authenticated, nil, 253713800, noPerlBypass},
+               {api.Version{2, 0}, http.MethodDelete, `divisions/{id}$`, 
api.DeleteHandler(&division.TODivision{}), auth.PrivLevelOperations, 
Authenticated, nil, 2325382237, noPerlBypass},
+
+               {api.Version{2, 0}, http.MethodGet, `logs/?(\.json)?$`, 
logs.Get, auth.PrivLevelReadOnly, Authenticated, nil, 248340550, noPerlBypass},
+               {api.Version{2, 0}, http.MethodGet, 
`logs/{days}/days/?(\.json)?$`, logs.Get, auth.PrivLevelReadOnly, 
Authenticated, nil, 2192414145, noPerlBypass},
+               {api.Version{2, 0}, http.MethodGet, 
`logs/newcount/?(\.json)?$`, logs.GetNewCount, auth.PrivLevelReadOnly, 
Authenticated, nil, 2405833012, noPerlBypass},
+
+               //HWInfo
+               {api.Version{2, 0}, http.MethodGet, `hwinfo/?(\.json)?$`, 
hwinfo.Get, auth.PrivLevelReadOnly, Authenticated, nil, 221685998, 
noPerlBypass},
+
+               //Content invalidation jobs
+               {api.Version{2, 0}, http.MethodGet, `jobs(/|\.json/?)?$`, 
api.ReadHandler(&invalidationjobs.InvalidationJob{}), auth.PrivLevelReadOnly, 
Authenticated, nil, 2966782041, noPerlBypass},
+               {api.Version{2, 0}, http.MethodDelete, `jobs/?$`, 
invalidationjobs.Delete, auth.PrivLevelPortal, Authenticated, nil, 216780776, 
noPerlBypass},
+               {api.Version{2, 0}, http.MethodPut, `jobs/?$`, 
invalidationjobs.Update, auth.PrivLevelPortal, Authenticated, nil, 286134226, 
noPerlBypass},
+               {api.Version{2, 0}, http.MethodPost, `jobs/?`, 
invalidationjobs.Create, auth.PrivLevelPortal, Authenticated, nil, 20450955, 
noPerlBypass},
+               {api.Version{2, 0}, http.MethodPost, 
`user/current/jobs(/|\.json/?)?$`, invalidationjobs.CreateUserJob, 
auth.PrivLevelPortal, Authenticated, nil, 211328688, noPerlBypass},
+               {api.Version{2, 0}, http.MethodGet, 
`user/current/jobs(/|\.json/?)?$`, invalidationjobs.GetUserJobs, 
auth.PrivLevelReadOnly, Authenticated, nil, 249163540, noPerlBypass},
 
 Review comment:
   deprecated please remove

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to