mhoppa commented on a change in pull request #4378: updated API to version 2.x
URL: https://github.com/apache/trafficcontrol/pull/4378#discussion_r377787415
##########
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},
Review comment:
on merge to master make sure to include cachegroupparameters POST/GET here
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services