This is an automated email from the ASF dual-hosted git repository.

mitchell852 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-trafficcontrol.git


The following commit(s) were added to refs/heads/master by this push:
     new a53fe5c  Add TO Go 1.1 routes
a53fe5c is described below

commit a53fe5cfa996ac2a9433b048d2bc2c423ed036ec
Author: Robert Butts <r...@apache.org>
AuthorDate: Thu May 3 13:51:19 2018 -0600

    Add TO Go 1.1 routes
    
    Specifically, changes routes to be 1.1, which implicitly serve 1.2+,
    and adds the one different 1.1 ASNs route.
---
 traffic_ops/traffic_ops_golang/asn/asns.go | 104 ++++++++++++++++----
 traffic_ops/traffic_ops_golang/routes.go   | 153 ++++++++++++++---------------
 2 files changed, 159 insertions(+), 98 deletions(-)

diff --git a/traffic_ops/traffic_ops_golang/asn/asns.go 
b/traffic_ops/traffic_ops_golang/asn/asns.go
index 4a5db67..ff77b44 100644
--- a/traffic_ops/traffic_ops_golang/asn/asns.go
+++ b/traffic_ops/traffic_ops_golang/asn/asns.go
@@ -21,8 +21,10 @@ package asn
 
 import (
        "errors"
+       "net/http"
        "fmt"
        "strconv"
+       "encoding/json"
 
        "github.com/apache/incubator-trafficcontrol/lib/go-log"
        "github.com/apache/incubator-trafficcontrol/lib/go-tc"
@@ -39,33 +41,40 @@ import (
 const ASNsPrivLevel = 10
 
 //we need a type alias to define functions on
-type TOASN tc.ASNNullable
+type TOASNV11 tc.ASNNullable
 
-//the refType is passed into the handlers where a copy of its type is used to 
decode the json.
-var refType = TOASN(tc.ASNNullable{})
+type TOASNV12 TOASNV11
 
-func GetRefType() *TOASN {
-       return &refType
+func GetRefTypeV11() *TOASNV11 {
+       asn := TOASNV11(tc.ASNNullable{})
+       return &asn
 }
 
-func (asn TOASN) GetKeyFieldsInfo() []api.KeyFieldInfo {
+func GetRefTypeV12() *TOASNV12 {
+       asn := TOASNV12(tc.ASNNullable{})
+       return &asn
+}
+
+func (asn TOASNV11) GetKeyFieldsInfo() []api.KeyFieldInfo {
        return []api.KeyFieldInfo{{"id", api.GetIntKey}}
 }
 
+// func (asn TOASNV12) GetKeyFieldsInfo() []api.KeyFieldInfo { return 
TOASNV11(asn).GetKeyFieldsInfo() }
+
 //Implementation of the Identifier, Validator interface functions
-func (asn TOASN) GetKeys() (map[string]interface{}, bool) {
+func (asn TOASNV11) GetKeys() (map[string]interface{}, bool) {
        if asn.ID == nil {
                return map[string]interface{}{"id": 0}, false
        }
        return map[string]interface{}{"id": *asn.ID}, true
 }
 
-func (asn *TOASN) SetKeys(keys map[string]interface{}) {
+func (asn *TOASNV11) SetKeys(keys map[string]interface{}) {
        i, _ := keys["id"].(int) //this utilizes the non panicking type 
assertion, if the thrown away ok variable is false i will be the zero of the 
type, 0 here.
        asn.ID = &i
 }
 
-func (asn TOASN) GetAuditName() string {
+func (asn TOASNV11) GetAuditName() string {
        if asn.ASN != nil {
                return strconv.Itoa(*asn.ASN)
        }
@@ -75,11 +84,11 @@ func (asn TOASN) GetAuditName() string {
        return "unknown"
 }
 
-func (asn TOASN) GetType() string {
+func (asn TOASNV11) GetType() string {
        return "asn"
 }
 
-func (asn TOASN) Validate(db *sqlx.DB) []error {
+func (asn TOASNV11) Validate(db *sqlx.DB) []error {
        errs := validation.Errors{
                "asn":          validation.Validate(asn.ASN, validation.NotNil, 
validation.Min(0)),
                "cachegroupId": validation.Validate(asn.CachegroupID, 
validation.NotNil, validation.Min(0)),
@@ -87,14 +96,14 @@ func (asn TOASN) Validate(db *sqlx.DB) []error {
        return tovalidate.ToErrors(errs)
 }
 
-//The TOASN implementation of the Creator interface
+//The TOASNV11 implementation of the Creator interface
 //all implementations of Creator should use transactions and return the proper 
errorType
 //ParsePQUniqueConstraintError is used to determine if a asn with conflicting 
values exists
 //if so, it will return an errorType of DataConflict and the type should be 
appended to the
 //generic error message returned
 //The insert sql returns the id and lastUpdated values of the newly inserted 
asn and have
 //to be added to the struct
-func (asn *TOASN) Create(db *sqlx.DB, user auth.CurrentUser) (error, 
tc.ApiErrorType) {
+func (asn *TOASNV11) Create(db *sqlx.DB, user auth.CurrentUser) (error, 
tc.ApiErrorType) {
        rollbackTransaction := true
        tx, err := db.Beginx()
        defer func() {
@@ -156,9 +165,64 @@ func (asn *TOASN) Create(db *sqlx.DB, user 
auth.CurrentUser) (error, tc.ApiError
        return nil, tc.NoError
 }
 
-func (asn *TOASN) Read(db *sqlx.DB, parameters map[string]string, user 
auth.CurrentUser) ([]interface{}, []error, tc.ApiErrorType) {
-       var rows *sqlx.Rows
+func (asn *TOASNV12) Read(db *sqlx.DB, parameters map[string]string, user 
auth.CurrentUser) ([]interface{}, []error, tc.ApiErrorType) {
+       asns, err, errType := read(db, parameters, user)
+       if len(err) > 0 {
+               return nil, err, errType
+       }
+       iasns := make([]interface{}, len(asns), len(asns))
+       for i, readASN := range asns {
+               iasns[i] = readASN
+       }
+       return iasns, err, errType
+}
+
+// Read implements the /api/1.1/asns/id route for reading individual ASNs.
+// Note this does NOT correctly implement the 1.1 API for all ASNs, because 
that route is in a different format than the CRUD utilities and all other 
routes.
+// The /api/1.1/asns route MUST call V11ReadAll, not this function, to 
correctly implement the 1.1 API.
+func (asn *TOASNV11) Read(db *sqlx.DB, params map[string]string, user 
auth.CurrentUser) ([]interface{}, []error, tc.ApiErrorType) {
+       v12 := TOASNV12(*asn)
+       return v12.Read(db, params, user)
+}
+
+// V11ReadAll implements the asns 1.1 route, which is different from the 1.1 
route for a single ASN and from 1.2+ routes, in that it wraps the content in an 
additional "asns" object.
+func V11ReadAll(db *sqlx.DB) http.HandlerFunc {
+       return func(w http.ResponseWriter, r *http.Request) {
+               handleErrs := tc.GetHandleErrorsFunc(w, r)
+               ctx := r.Context()
+               params, err := api.GetCombinedParams(r)
+               if err != nil {
+                       handleErrs(http.StatusInternalServerError, err)
+                       return
+               }
+               user, err := auth.GetCurrentUser(ctx)
+               if err != nil {
+                       log.Errorf("unable to retrieve current user from 
context: %s", err)
+                       handleErrs(http.StatusInternalServerError, err)
+                       return
+               }
+               asns, errs, errType := read(db, params, *user)
+               if len(errs) > 0 {
+                       tc.HandleErrorsWithType(errs, errType, handleErrs)
+                       return
+               }
+               resp := struct {
+                       Response struct {
+                               ASNs []TOASNV12 `json:"asns"`
+                       } `json:"response"`
+               }{Response: struct {ASNs []TOASNV12  `json:"asns"` }{ASNs: 
asns}}
+
+               respBts, err := json.Marshal(resp)
+               if err != nil {
+                       handleErrs(http.StatusInternalServerError, err)
+                       return
+               }
+               w.Header().Set("Content-Type", "application/json")
+               fmt.Fprintf(w, "%s", respBts)
+       }
+}
 
+func read(db *sqlx.DB, parameters map[string]string, user auth.CurrentUser) 
([]TOASNV12, []error, tc.ApiErrorType) {
        // Query Parameters to Database Query column mappings
        // see the fields mapped in the SQL query
        queryParamsToQueryCols := map[string]dbhelpers.WhereColumnInfo{
@@ -182,9 +246,9 @@ func (asn *TOASN) Read(db *sqlx.DB, parameters 
map[string]string, user auth.Curr
        }
        defer rows.Close()
 
-       ASNs := []interface{}{}
+       ASNs := []TOASNV12{}
        for rows.Next() {
-               var s TOASN
+               var s TOASNV12
                if err = rows.StructScan(&s); err != nil {
                        log.Errorf("error parsing ASN rows: %v", err)
                        return nil, []error{err}, tc.SystemError
@@ -207,12 +271,12 @@ FROM asn a JOIN cachegroup c ON a.cachegroup = c.id`
        return query
 }
 
-//The TOASN implementation of the Updater interface
+//The TOASNV11 implementation of the Updater interface
 //all implementations of Updater should use transactions and return the proper 
errorType
 //ParsePQUniqueConstraintError is used to determine if a asn with conflicting 
values exists
 //if so, it will return an errorType of DataConflict and the type should be 
appended to the
 //generic error message returned
-func (asn *TOASN) Update(db *sqlx.DB, user auth.CurrentUser) (error, 
tc.ApiErrorType) {
+func (asn *TOASNV11) Update(db *sqlx.DB, user auth.CurrentUser) (error, 
tc.ApiErrorType) {
        rollbackTransaction := true
        tx, err := db.Beginx()
        defer func() {
@@ -274,7 +338,7 @@ func (asn *TOASN) Update(db *sqlx.DB, user 
auth.CurrentUser) (error, tc.ApiError
 
 //The ASN implementation of the Deleter interface
 //all implementations of Deleter should use transactions and return the proper 
errorType
-func (asn *TOASN) Delete(db *sqlx.DB, user auth.CurrentUser) (error, 
tc.ApiErrorType) {
+func (asn *TOASNV11) Delete(db *sqlx.DB, user auth.CurrentUser) (error, 
tc.ApiErrorType) {
        rollbackTransaction := true
        tx, err := db.Beginx()
        defer func() {
diff --git a/traffic_ops/traffic_ops_golang/routes.go 
b/traffic_ops/traffic_ops_golang/routes.go
index 4ba5bee..b82fa59 100644
--- a/traffic_ops/traffic_ops_golang/routes.go
+++ b/traffic_ops/traffic_ops_golang/routes.go
@@ -72,114 +72,111 @@ func Routes(d ServerData) ([]Route, []RawRoute, 
http.Handler, error) {
        proxyHandler := rootHandler(d)
 
        routes := []Route{
-
-               // ************************************************** 1.2 
Routes 
*************************************************************************************
-               // 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.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 a Go. There is NO equivalent Perl 
route. They should conform with the API guidelines 
(https://cwiki.apache.org/confluence/display/TC/API+Guidelines).
 
                //ASN: CRUD
-               {1.2, http.MethodGet, `asns/?(\.json)?$`, 
api.ReadHandler(asn.GetRefType(), d.DB), auth.PrivLevelReadOnly, Authenticated, 
nil},
-               {1.2, http.MethodGet, `asns/{id}$`, 
api.ReadHandler(asn.GetRefType(), d.DB), auth.PrivLevelReadOnly, Authenticated, 
nil},
-               {1.2, http.MethodPut, `asns/{id}$`, 
api.UpdateHandler(asn.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
-               {1.2, http.MethodPost, `asns/?$`, 
api.CreateHandler(asn.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
-               {1.2, http.MethodDelete, `asns/{id}$`, 
api.DeleteHandler(asn.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
+               {1.2, http.MethodGet, `asns/?(\.json)?$`, 
api.ReadHandler(asn.GetRefTypeV12(), d.DB), auth.PrivLevelReadOnly, 
Authenticated, nil},
+               {1.1, http.MethodGet, `asns/?(\.json)?$`, asn.V11ReadAll(d.DB), 
auth.PrivLevelReadOnly, Authenticated, nil},
+               {1.1, http.MethodGet, `asns/{id}$`, 
api.ReadHandler(asn.GetRefTypeV11(), d.DB), auth.PrivLevelReadOnly, 
Authenticated, nil},
+               {1.1, http.MethodPut, `asns/{id}$`, 
api.UpdateHandler(asn.GetRefTypeV11(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
+               {1.1, http.MethodPost, `asns/?$`, 
api.CreateHandler(asn.GetRefTypeV11(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
+               {1.1, http.MethodDelete, `asns/{id}$`, 
api.DeleteHandler(asn.GetRefTypeV11(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
 
                //CacheGroup: CRUD
-               {1.2, http.MethodGet, `cachegroups/?(\.json)?$`, 
api.ReadHandler(cachegroup.GetRefType(), d.DB), auth.PrivLevelReadOnly, 
Authenticated, nil},
-               {1.2, http.MethodGet, `cachegroups/{id}$`, 
api.ReadHandler(cachegroup.GetRefType(), d.DB), auth.PrivLevelReadOnly, 
Authenticated, nil},
-               {1.2, http.MethodPut, `cachegroups/{id}$`, 
api.UpdateHandler(cachegroup.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
-               {1.2, http.MethodPost, `cachegroups/?$`, 
api.CreateHandler(cachegroup.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
-               {1.2, http.MethodDelete, `cachegroups/{id}$`, 
api.DeleteHandler(cachegroup.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
+               {1.1, http.MethodGet, `cachegroups/?(\.json)?$`, 
api.ReadHandler(cachegroup.GetRefType(), d.DB), auth.PrivLevelReadOnly, 
Authenticated, nil},
+               {1.1, http.MethodGet, `cachegroups/{id}$`, 
api.ReadHandler(cachegroup.GetRefType(), d.DB), auth.PrivLevelReadOnly, 
Authenticated, nil},
+               {1.1, http.MethodPut, `cachegroups/{id}$`, 
api.UpdateHandler(cachegroup.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
+               {1.1, http.MethodPost, `cachegroups/?$`, 
api.CreateHandler(cachegroup.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
+               {1.1, http.MethodDelete, `cachegroups/{id}$`, 
api.DeleteHandler(cachegroup.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
 
                //CDN
-               {1.2, http.MethodGet, `cdns/capacity$`, 
handlerToFunc(proxyHandler), 0, NoAuth, []Middleware{}},
-               {1.2, http.MethodGet, `cdns/configs$`, 
handlerToFunc(proxyHandler), 0, NoAuth, []Middleware{}},
-               {1.2, http.MethodGet, `cdns/domains$`, 
handlerToFunc(proxyHandler), 0, NoAuth, []Middleware{}},
-               {1.2, http.MethodGet, `cdns/health$`, 
handlerToFunc(proxyHandler), 0, NoAuth, []Middleware{}},
-               {1.2, http.MethodGet, `cdns/routing$`, 
handlerToFunc(proxyHandler), 0, NoAuth, []Middleware{}},
+               {1.1, http.MethodGet, `cdns/capacity$`, 
handlerToFunc(proxyHandler), 0, NoAuth, []Middleware{}},
+               {1.1, http.MethodGet, `cdns/configs$`, 
handlerToFunc(proxyHandler), 0, NoAuth, []Middleware{}},
+               {1.1, http.MethodGet, `cdns/domains$`, 
handlerToFunc(proxyHandler), 0, NoAuth, []Middleware{}},
+               {1.1, http.MethodGet, `cdns/health$`, 
handlerToFunc(proxyHandler), 0, NoAuth, []Middleware{}},
+               {1.1, http.MethodGet, `cdns/routing$`, 
handlerToFunc(proxyHandler), 0, NoAuth, []Middleware{}},
 
                //CDN: CRUD
-               {1.2, http.MethodGet, `cdns/?(\.json)?$`, 
api.ReadHandler(cdn.GetRefType(), d.DB), auth.PrivLevelReadOnly, Authenticated, 
nil},
-               {1.2, http.MethodGet, `cdns/{id}$`, 
api.ReadHandler(cdn.GetRefType(), d.DB), auth.PrivLevelReadOnly, Authenticated, 
nil},
-               {1.2, http.MethodPut, `cdns/{id}$`, 
api.UpdateHandler(cdn.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
-               {1.2, http.MethodPost, `cdns/?$`, 
api.CreateHandler(cdn.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
-               {1.2, http.MethodDelete, `cdns/{id}$`, 
api.DeleteHandler(cdn.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
+               {1.1, http.MethodGet, `cdns/?(\.json)?$`, 
api.ReadHandler(cdn.GetRefType(), d.DB), auth.PrivLevelReadOnly, Authenticated, 
nil},
+               {1.1, http.MethodGet, `cdns/{id}$`, 
api.ReadHandler(cdn.GetRefType(), d.DB), auth.PrivLevelReadOnly, Authenticated, 
nil},
+               {1.1, http.MethodPut, `cdns/{id}$`, 
api.UpdateHandler(cdn.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
+               {1.1, http.MethodPost, `cdns/?$`, 
api.CreateHandler(cdn.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
+               {1.1, http.MethodDelete, `cdns/{id}$`, 
api.DeleteHandler(cdn.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
 
                //CDN: Monitoring: Traffic Monitor
-               {1.2, http.MethodGet, 
`cdns/{name}/configs/monitoring(\.json)?$`, monitoringHandler(d.DB), 
auth.PrivLevelReadOnly, Authenticated, nil},
+               {1.1, http.MethodGet, 
`cdns/{name}/configs/monitoring(\.json)?$`, monitoringHandler(d.DB), 
auth.PrivLevelReadOnly, Authenticated, nil},
 
                //Division: CRUD
-               {1.2, http.MethodGet, `divisions/?(\.json)?$`, 
api.ReadHandler(division.GetRefType(), d.DB), auth.PrivLevelReadOnly, 
Authenticated, nil},
-               {1.2, http.MethodGet, `divisions/{id}$`, 
api.ReadHandler(division.GetRefType(), d.DB), auth.PrivLevelReadOnly, 
Authenticated, nil},
-               {1.2, http.MethodPut, `divisions/{id}$`, 
api.UpdateHandler(division.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
-               {1.2, http.MethodPost, `divisions/?$`, 
api.CreateHandler(division.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
-               {1.2, http.MethodDelete, `divisions/{id}$`, 
api.DeleteHandler(division.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
+               {1.1, http.MethodGet, `divisions/?(\.json)?$`, 
api.ReadHandler(division.GetRefType(), d.DB), auth.PrivLevelReadOnly, 
Authenticated, nil},
+               {1.1, http.MethodGet, `divisions/{id}$`, 
api.ReadHandler(division.GetRefType(), d.DB), auth.PrivLevelReadOnly, 
Authenticated, nil},
+               {1.1, http.MethodPut, `divisions/{id}$`, 
api.UpdateHandler(division.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
+               {1.1, http.MethodPost, `divisions/?$`, 
api.CreateHandler(division.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
+               {1.1, http.MethodDelete, `divisions/{id}$`, 
api.DeleteHandler(division.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
 
                //HWInfo
-               {1.2, http.MethodGet, `hwinfo-wip/?(\.json)?$`, 
hwinfo.HWInfoHandler(d.DB), auth.PrivLevelReadOnly, Authenticated, nil},
+               {1.1, http.MethodGet, `hwinfo-wip/?(\.json)?$`, 
hwinfo.HWInfoHandler(d.DB), auth.PrivLevelReadOnly, Authenticated, nil},
 
                //Parameter: CRUD
-               {1.2, http.MethodGet, `parameters/?(\.json)?$`, 
api.ReadHandler(parameter.GetRefType(), d.DB), auth.PrivLevelReadOnly, 
Authenticated, nil},
-               {1.2, http.MethodGet, `parameters/{id}$`, 
api.ReadHandler(parameter.GetRefType(), d.DB), auth.PrivLevelReadOnly, 
Authenticated, nil},
-               {1.2, http.MethodPut, `parameters/{id}$`, 
api.UpdateHandler(parameter.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
-               {1.2, http.MethodPost, `parameters/?$`, 
api.CreateHandler(parameter.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
-               {1.2, http.MethodDelete, `parameters/{id}$`, 
api.DeleteHandler(parameter.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
+               {1.1, http.MethodGet, `parameters/?(\.json)?$`, 
api.ReadHandler(parameter.GetRefType(), d.DB), auth.PrivLevelReadOnly, 
Authenticated, nil},
+               {1.1, http.MethodGet, `parameters/{id}$`, 
api.ReadHandler(parameter.GetRefType(), d.DB), auth.PrivLevelReadOnly, 
Authenticated, nil},
+               {1.1, http.MethodPut, `parameters/{id}$`, 
api.UpdateHandler(parameter.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
+               {1.1, http.MethodPost, `parameters/?$`, 
api.CreateHandler(parameter.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
+               {1.1, http.MethodDelete, `parameters/{id}$`, 
api.DeleteHandler(parameter.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
 
                //Phys_Location: CRUD
-               {1.2, http.MethodGet, `phys_locations/?(\.json)?$`, 
api.ReadHandler(physlocation.GetRefType(), d.DB), auth.PrivLevelReadOnly, 
Authenticated, nil},
-               {1.2, http.MethodGet, `phys_locations/{id}$`, 
api.ReadHandler(physlocation.GetRefType(), d.DB), auth.PrivLevelReadOnly, 
Authenticated, nil},
-               {1.2, http.MethodPut, `phys_locations/{id}$`, 
api.UpdateHandler(physlocation.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
-               {1.2, http.MethodPost, `phys_locations/?$`, 
api.CreateHandler(physlocation.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
-               {1.2, http.MethodDelete, `phys_locations/{id}$`, 
api.DeleteHandler(physlocation.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
+               {1.1, http.MethodGet, `phys_locations/?(\.json)?$`, 
api.ReadHandler(physlocation.GetRefType(), d.DB), auth.PrivLevelReadOnly, 
Authenticated, nil},
+               {1.1, http.MethodGet, `phys_locations/{id}$`, 
api.ReadHandler(physlocation.GetRefType(), d.DB), auth.PrivLevelReadOnly, 
Authenticated, nil},
+               {1.1, http.MethodPut, `phys_locations/{id}$`, 
api.UpdateHandler(physlocation.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
+               {1.1, http.MethodPost, `phys_locations/?$`, 
api.CreateHandler(physlocation.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
+               {1.1, http.MethodDelete, `phys_locations/{id}$`, 
api.DeleteHandler(physlocation.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
 
                //Ping
-               {1.2, http.MethodGet, `ping$`, ping.PingHandler(), 0, NoAuth, 
nil},
+               {1.1, http.MethodGet, `ping$`, ping.PingHandler(), 0, NoAuth, 
nil},
 
                //Profile: CRUD
-               {1.2, http.MethodGet, `profiles/?(\.json)?$`, 
api.ReadHandler(profile.GetRefType(), d.DB), auth.PrivLevelReadOnly, 
Authenticated, nil},
-               {1.2, http.MethodGet, `profiles/{id}$`, 
api.ReadHandler(profile.GetRefType(), d.DB), auth.PrivLevelReadOnly, 
Authenticated, nil},
-               {1.2, http.MethodPut, `profiles/{id}$`, 
api.UpdateHandler(profile.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
-               {1.2, http.MethodPost, `profiles/?$`, 
api.CreateHandler(profile.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
-               {1.2, http.MethodDelete, `profiles/{id}$`, 
api.DeleteHandler(profile.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
+               {1.1, http.MethodGet, `profiles/?(\.json)?$`, 
api.ReadHandler(profile.GetRefType(), d.DB), auth.PrivLevelReadOnly, 
Authenticated, nil},
+               {1.1, http.MethodGet, `profiles/{id}$`, 
api.ReadHandler(profile.GetRefType(), d.DB), auth.PrivLevelReadOnly, 
Authenticated, nil},
+               {1.1, http.MethodPut, `profiles/{id}$`, 
api.UpdateHandler(profile.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
+               {1.1, http.MethodPost, `profiles/?$`, 
api.CreateHandler(profile.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
+               {1.1, http.MethodDelete, `profiles/{id}$`, 
api.DeleteHandler(profile.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
 
                //Region: CRUD
-               {1.2, http.MethodGet, `regions/?(\.json)?$`, 
api.ReadHandler(region.GetRefType(), d.DB), auth.PrivLevelReadOnly, 
Authenticated, nil},
-               {1.2, http.MethodGet, `regions/{id}$`, 
api.ReadHandler(region.GetRefType(), d.DB), auth.PrivLevelReadOnly, 
Authenticated, nil},
-               {1.2, http.MethodPut, `regions/{id}$`, 
api.UpdateHandler(region.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
-               {1.2, http.MethodPost, `regions/?$`, 
api.CreateHandler(region.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
-               {1.2, http.MethodDelete, `regions/{id}$`, 
api.DeleteHandler(region.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
+               {1.1, http.MethodGet, `regions/?(\.json)?$`, 
api.ReadHandler(region.GetRefType(), d.DB), auth.PrivLevelReadOnly, 
Authenticated, nil},
+               {1.1, http.MethodGet, `regions/{id}$`, 
api.ReadHandler(region.GetRefType(), d.DB), auth.PrivLevelReadOnly, 
Authenticated, nil},
+               {1.1, http.MethodPut, `regions/{id}$`, 
api.UpdateHandler(region.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
+               {1.1, http.MethodPost, `regions/?$`, 
api.CreateHandler(region.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
+               {1.1, http.MethodDelete, `regions/{id}$`, 
api.DeleteHandler(region.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
 
                //Server
-               {1.2, http.MethodGet, `servers/checks$`, 
handlerToFunc(proxyHandler), 0, NoAuth, []Middleware{}},
-               {1.2, http.MethodGet, `servers/details$`, 
handlerToFunc(proxyHandler), 0, NoAuth, []Middleware{}},
-               {1.2, http.MethodGet, `servers/status$`, 
handlerToFunc(proxyHandler), 0, NoAuth, []Middleware{}},
-               {1.2, http.MethodGet, `servers/totals$`, 
handlerToFunc(proxyHandler), 0, NoAuth, []Middleware{}},
+               {1.1, http.MethodGet, `servers/checks$`, 
handlerToFunc(proxyHandler), 0, NoAuth, []Middleware{}},
+               {1.1, http.MethodGet, `servers/details$`, 
handlerToFunc(proxyHandler), 0, NoAuth, []Middleware{}},
+               {1.1, http.MethodGet, `servers/status$`, 
handlerToFunc(proxyHandler), 0, NoAuth, []Middleware{}},
+               {1.1, http.MethodGet, `servers/totals$`, 
handlerToFunc(proxyHandler), 0, NoAuth, []Middleware{}},
 
                //Server: CRUD
-               {1.2, http.MethodGet, `servers/?(\.json)?$`, 
api.ReadHandler(server.GetRefType(), d.DB), auth.PrivLevelReadOnly, 
Authenticated, nil},
-               {1.2, http.MethodGet, `servers/{id}$`, 
api.ReadHandler(server.GetRefType(), d.DB), auth.PrivLevelReadOnly, 
Authenticated, nil},
-               {1.2, http.MethodPut, `servers/{id}$`, 
api.UpdateHandler(server.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
-               {1.2, http.MethodPost, `servers/?$`, 
api.CreateHandler(server.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
-               {1.2, http.MethodDelete, `servers/{id}$`, 
api.DeleteHandler(server.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
+               {1.1, http.MethodGet, `servers/?(\.json)?$`, 
api.ReadHandler(server.GetRefType(), d.DB), auth.PrivLevelReadOnly, 
Authenticated, nil},
+               {1.1, http.MethodGet, `servers/{id}$`, 
api.ReadHandler(server.GetRefType(), d.DB), auth.PrivLevelReadOnly, 
Authenticated, nil},
+               {1.1, http.MethodPut, `servers/{id}$`, 
api.UpdateHandler(server.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
+               {1.1, http.MethodPost, `servers/?$`, 
api.CreateHandler(server.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
+               {1.1, http.MethodDelete, `servers/{id}$`, 
api.DeleteHandler(server.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
 
                //Status: CRUD
-               {1.2, http.MethodGet, `statuses/?(\.json)?$`, 
api.ReadHandler(status.GetRefType(), d.DB), auth.PrivLevelReadOnly, 
Authenticated, nil},
-               {1.2, http.MethodGet, `statuses/{id}$`, 
api.ReadHandler(status.GetRefType(), d.DB), auth.PrivLevelReadOnly, 
Authenticated, nil},
-               {1.2, http.MethodPut, `statuses/{id}$`, 
api.UpdateHandler(status.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
-               {1.2, http.MethodPost, `statuses/?$`, 
api.CreateHandler(status.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
-               {1.2, http.MethodDelete, `statuses/{id}$`, 
api.DeleteHandler(status.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
+               {1.1, http.MethodGet, `statuses/?(\.json)?$`, 
api.ReadHandler(status.GetRefType(), d.DB), auth.PrivLevelReadOnly, 
Authenticated, nil},
+               {1.1, http.MethodGet, `statuses/{id}$`, 
api.ReadHandler(status.GetRefType(), d.DB), auth.PrivLevelReadOnly, 
Authenticated, nil},
+               {1.1, http.MethodPut, `statuses/{id}$`, 
api.UpdateHandler(status.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
+               {1.1, http.MethodPost, `statuses/?$`, 
api.CreateHandler(status.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
+               {1.1, http.MethodDelete, `statuses/{id}$`, 
api.DeleteHandler(status.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
 
                //System
-               {1.2, http.MethodGet, `system/info/?(\.json)?$`, 
systeminfo.Handler(d.DB), auth.PrivLevelReadOnly, Authenticated, nil},
+               {1.1, http.MethodGet, `system/info/?(\.json)?$`, 
systeminfo.Handler(d.DB), auth.PrivLevelReadOnly, Authenticated, nil},
 
                //Type: CRUD
-               {1.2, http.MethodGet, `types/?(\.json)?$`, 
api.ReadHandler(types.GetRefType(), d.DB), auth.PrivLevelReadOnly, 
Authenticated, nil},
-               {1.2, http.MethodGet, `types/{id}$`, 
api.ReadHandler(types.GetRefType(), d.DB), auth.PrivLevelReadOnly, 
Authenticated, nil},
-               {1.2, http.MethodPut, `types/{id}$`, 
api.UpdateHandler(types.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
-               {1.2, http.MethodPost, `types/?$`, 
api.CreateHandler(types.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
-               {1.2, http.MethodDelete, `types/{id}$`, 
api.DeleteHandler(types.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
-
-               // ************************************************** 1.3 
Routes 
*************************************************************************************
-               // 1.3 routes exist only in a Go. There is NO equivalent Perl 
route. They should conform with the API guidelines 
(https://cwiki.apache.org/confluence/display/TC/API+Guidelines).
+               {1.1, http.MethodGet, `types/?(\.json)?$`, 
api.ReadHandler(types.GetRefType(), d.DB), auth.PrivLevelReadOnly, 
Authenticated, nil},
+               {1.1, http.MethodGet, `types/{id}$`, 
api.ReadHandler(types.GetRefType(), d.DB), auth.PrivLevelReadOnly, 
Authenticated, nil},
+               {1.1, http.MethodPut, `types/{id}$`, 
api.UpdateHandler(types.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
+               {1.1, http.MethodPost, `types/?$`, 
api.CreateHandler(types.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
+               {1.1, http.MethodDelete, `types/{id}$`, 
api.DeleteHandler(types.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
 
                //About
                {1.3, http.MethodGet, `about/?(\.json)?$`, about.Handler(), 
auth.PrivLevelReadOnly, Authenticated, nil},
@@ -229,10 +226,10 @@ func Routes(d ServerData) ([]Route, []RawRoute, 
http.Handler, error) {
                {1.3, http.MethodPost, 
`deliveryservices-wip/hostname/{hostName}/sslkeys/add$`, 
addDeliveryServiceSSLKeysHandler(d.DB, d.Config), auth.PrivLevelAdmin, 
Authenticated, nil},
 
                //CRConfig
-               {1.2, http.MethodGet, `cdns/{cdn}/snapshot/?$`, 
crconfig.SnapshotGetHandler(d.DB, d.Config), crconfig.PrivLevel, Authenticated, 
nil},
-               {1.2, http.MethodGet, `cdns/{cdn}/snapshot/new/?$`, 
crconfig.Handler(d.DB, d.Config), crconfig.PrivLevel, Authenticated, nil},
-               {1.2, http.MethodPut, `cdns/{id}/snapshot/?$`, 
crconfig.SnapshotHandler(d.DB, d.Config), crconfig.PrivLevel, Authenticated, 
nil},
-               {1.2, http.MethodPut, `snapshot/{cdn}/?$`, 
crconfig.SnapshotHandler(d.DB, d.Config), crconfig.PrivLevel, Authenticated, 
nil},
+               {1.1, http.MethodGet, `cdns/{cdn}/snapshot/?$`, 
crconfig.SnapshotGetHandler(d.DB, d.Config), crconfig.PrivLevel, Authenticated, 
nil},
+               {1.1, http.MethodGet, `cdns/{cdn}/snapshot/new/?$`, 
crconfig.Handler(d.DB, d.Config), crconfig.PrivLevel, Authenticated, nil},
+               {1.1, http.MethodPut, `cdns/{id}/snapshot/?$`, 
crconfig.SnapshotHandler(d.DB, d.Config), crconfig.PrivLevel, Authenticated, 
nil},
+               {1.1, http.MethodPut, `snapshot/{cdn}/?$`, 
crconfig.SnapshotHandler(d.DB, d.Config), crconfig.PrivLevel, Authenticated, 
nil},
        }
 
        // rawRoutes are served at the root path. These should be almost 
exclusively old Perl pre-API routes, which have yet to be converted in all 
clients. New routes should be in the versioned API path.

-- 
To stop receiving notification emails like this one, please contact
mitchell...@apache.org.

Reply via email to