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

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

commit cf8e88264bd901c5fad03106ffdec0177b8687da
Author: Dewayne Richardson <dewr...@apache.org>
AuthorDate: Thu Feb 22 13:18:15 2018 -0700

    refactored to support TO Client versioning with packages
    
    added initial cachegroups API test and added v13 package
    
    fixed conflicts
    
    added cachegroup type to fixtures
    
    temporarily removed to allow to compile
    
    updated to use the CRUD interface
    
    moved the status_test to v13 dir
    
    copied from branch
    
    moved package line up
---
 lib/go-tc/cachegroups.go                           |   1 +
 traffic_ops/client/cdn.go                          |  16 +-
 traffic_ops/client/{ => v13}/asn.go                |   2 +-
 .../client/{status.go => v13/cachegroup.go}        |  50 +--
 traffic_ops/client/{ => v13}/cdn.go                |  46 +--
 .../client/{ => v13}/deliveryservice_requests.go   |   2 +-
 traffic_ops/client/{ => v13}/division.go           |   2 +-
 traffic_ops/client/{ => v13}/region.go             |   2 +-
 traffic_ops/client/v13/session.go                  | 354 +++++++++++++++++++++
 traffic_ops/client/{ => v13}/status.go             |   2 +-
 traffic_ops/testing/api/towrap/towrap.go           |  38 ---
 traffic_ops/testing/api/v13/division_test.go       |   2 +
 .../v13/{division_test.go => divisions_test.go}    |   0
 traffic_ops/testing/api/v13/region_test.go         |  14 +-
 .../api/v13/{region_test.go => regions_test.go}    |   0
 traffic_ops/testing/api/v13/tc-fixtures.json       |  20 +-
 traffic_ops/testing/api/v13/traffic_control.go     |   2 +-
 traffic_ops/testing/api/v13/traffic_ops_test.go    |  22 +-
 traffic_ops/traffic_ops_golang/routes.go           |  32 +-
 19 files changed, 455 insertions(+), 152 deletions(-)

diff --git a/lib/go-tc/cachegroups.go b/lib/go-tc/cachegroups.go
index 8591c5d..7e6c1f8 100644
--- a/lib/go-tc/cachegroups.go
+++ b/lib/go-tc/cachegroups.go
@@ -26,6 +26,7 @@ type CacheGroupsResponse struct {
 
 // CacheGroup contains information about a given Cachegroup in Traffic Ops.
 type CacheGroup struct {
+       ID          int     `json:"id"`
        Name        string  `json:"name"`
        ShortName   string  `json:"shortName"`
        Latitude    float64 `json:"latitude"`
diff --git a/traffic_ops/client/cdn.go b/traffic_ops/client/cdn.go
index 6bf2d93..d9e20e7 100644
--- a/traffic_ops/client/cdn.go
+++ b/traffic_ops/client/cdn.go
@@ -25,7 +25,7 @@ import (
 )
 
 const (
-       API_v2_CDNs = "/api/1.2/cdns"
+       API_v12_CDNs = "/api/1.2/cdns"
 )
 
 // Create a CDN
@@ -37,7 +37,7 @@ func (to *Session) CreateCDN(cdn tc.CDN) (tc.Alerts, ReqInf, 
error) {
        if err != nil {
                return tc.Alerts{}, reqInf, err
        }
-       resp, remoteAddr, err := to.request(http.MethodPost, API_v2_CDNs, 
reqBody)
+       resp, remoteAddr, err := to.request(http.MethodPost, API_v12_CDNs, 
reqBody)
        if err != nil {
                return tc.Alerts{}, reqInf, err
        }
@@ -56,7 +56,7 @@ func (to *Session) UpdateCDNByID(id int, cdn tc.CDN) 
(tc.Alerts, ReqInf, error)
        if err != nil {
                return tc.Alerts{}, reqInf, err
        }
-       route := fmt.Sprintf("%s/%d", API_v2_CDNs, id)
+       route := fmt.Sprintf("%s/%d", API_v12_CDNs, id)
        resp, remoteAddr, err := to.request(http.MethodPut, route, reqBody)
        if err != nil {
                return tc.Alerts{}, reqInf, err
@@ -69,7 +69,7 @@ func (to *Session) UpdateCDNByID(id int, cdn tc.CDN) 
(tc.Alerts, ReqInf, error)
 
 // Returns a list of CDNs
 func (to *Session) GetCDNs() ([]tc.CDN, ReqInf, error) {
-       resp, remoteAddr, err := to.request(http.MethodGet, API_v2_CDNs, nil)
+       resp, remoteAddr, err := to.request(http.MethodGet, API_v12_CDNs, nil)
        reqInf := ReqInf{CacheHitStatus: CacheHitStatusMiss, RemoteAddr: 
remoteAddr}
        if err != nil {
                return nil, reqInf, err
@@ -83,7 +83,7 @@ func (to *Session) GetCDNs() ([]tc.CDN, ReqInf, error) {
 
 // GET a CDN by the CDN id
 func (to *Session) GetCDNByID(id int) ([]tc.CDN, ReqInf, error) {
-       route := fmt.Sprintf("%s/%d", API_v2_CDNs, id)
+       route := fmt.Sprintf("%s/%d", API_v12_CDNs, id)
        resp, remoteAddr, err := to.request(http.MethodGet, route, nil)
        reqInf := ReqInf{CacheHitStatus: CacheHitStatusMiss, RemoteAddr: 
remoteAddr}
        if err != nil {
@@ -101,7 +101,7 @@ func (to *Session) GetCDNByID(id int) ([]tc.CDN, ReqInf, 
error) {
 
 // GET a CDN by the CDN name
 func (to *Session) GetCDNByName(name string) ([]tc.CDN, ReqInf, error) {
-       url := fmt.Sprintf("%s/name/%s", API_v2_CDNs, name)
+       url := fmt.Sprintf("%s/name/%s", API_v12_CDNs, name)
        resp, remoteAddr, err := to.request(http.MethodGet, url, nil)
        reqInf := ReqInf{CacheHitStatus: CacheHitStatusMiss, RemoteAddr: 
remoteAddr}
        if err != nil {
@@ -119,7 +119,7 @@ func (to *Session) GetCDNByName(name string) ([]tc.CDN, 
ReqInf, error) {
 
 // DELETE a CDN by ID
 func (to *Session) DeleteCDNByID(id int) (tc.Alerts, ReqInf, error) {
-       route := fmt.Sprintf("%s/%d", API_v2_CDNs, id)
+       route := fmt.Sprintf("%s/%d", API_v12_CDNs, id)
        resp, remoteAddr, err := to.request(http.MethodDelete, route, nil)
        reqInf := ReqInf{CacheHitStatus: CacheHitStatusMiss, RemoteAddr: 
remoteAddr}
        if err != nil {
@@ -132,7 +132,7 @@ func (to *Session) DeleteCDNByID(id int) (tc.Alerts, 
ReqInf, error) {
 }
 
 func (to *Session) GetCDNSSLKeys(name string) ([]tc.CDNSSLKeys, ReqInf, error) 
{
-       url := fmt.Sprintf("%s/name/%s/sslkeys", API_v2_CDNs, name)
+       url := fmt.Sprintf("%s/name/%s/sslkeys", API_v12_CDNs, name)
        resp, remoteAddr, err := to.request(http.MethodGet, url, nil)
        reqInf := ReqInf{CacheHitStatus: CacheHitStatusMiss, RemoteAddr: 
remoteAddr}
        if err != nil {
diff --git a/traffic_ops/client/asn.go b/traffic_ops/client/v13/asn.go
similarity index 99%
rename from traffic_ops/client/asn.go
rename to traffic_ops/client/v13/asn.go
index fefeeae..1e65ef2 100644
--- a/traffic_ops/client/asn.go
+++ b/traffic_ops/client/v13/asn.go
@@ -13,7 +13,7 @@
    limitations under the License.
 */
 
-package client
+package v13
 
 import (
        "encoding/json"
diff --git a/traffic_ops/client/status.go b/traffic_ops/client/v13/cachegroup.go
similarity index 67%
copy from traffic_ops/client/status.go
copy to traffic_ops/client/v13/cachegroup.go
index 1145d86..2203ffb 100644
--- a/traffic_ops/client/status.go
+++ b/traffic_ops/client/v13/cachegroup.go
@@ -13,7 +13,7 @@
    limitations under the License.
 */
 
-package client
+package v13
 
 import (
        "encoding/json"
@@ -25,19 +25,19 @@ import (
 )
 
 const (
-       API_v13_STATUSES = "/api/1.3/statuses"
+       API_v13_CacheGroups = "/api/1.3/cachegroups"
 )
 
-// Create a Status
-func (to *Session) CreateStatus(status tc.Status) (tc.Alerts, ReqInf, error) {
+// Create a CacheGroup
+func (to *Session) CreateCacheGroup(cachegroup tc.CacheGroup) (tc.Alerts, 
ReqInf, error) {
 
        var remoteAddr net.Addr
-       reqBody, err := json.Marshal(status)
+       reqBody, err := json.Marshal(cachegroup)
        reqInf := ReqInf{CacheHitStatus: CacheHitStatusMiss, RemoteAddr: 
remoteAddr}
        if err != nil {
                return tc.Alerts{}, reqInf, err
        }
-       resp, remoteAddr, err := to.request(http.MethodPost, API_v13_STATUSES, 
reqBody)
+       resp, remoteAddr, err := to.request(http.MethodPost, 
API_v13_CacheGroups, reqBody)
        if err != nil {
                return tc.Alerts{}, reqInf, err
        }
@@ -47,16 +47,16 @@ func (to *Session) CreateStatus(status tc.Status) 
(tc.Alerts, ReqInf, error) {
        return alerts, reqInf, nil
 }
 
-// Update a Status by ID
-func (to *Session) UpdateStatusByID(id int, status tc.Status) (tc.Alerts, 
ReqInf, error) {
+// Update a CacheGroup by ID
+func (to *Session) UpdateCacheGroupByID(id int, cachegroup tc.CacheGroup) 
(tc.Alerts, ReqInf, error) {
 
        var remoteAddr net.Addr
-       reqBody, err := json.Marshal(status)
+       reqBody, err := json.Marshal(cachegroup)
        reqInf := ReqInf{CacheHitStatus: CacheHitStatusMiss, RemoteAddr: 
remoteAddr}
        if err != nil {
                return tc.Alerts{}, reqInf, err
        }
-       route := fmt.Sprintf("%s/%d", API_v13_STATUSES, id)
+       route := fmt.Sprintf("%s/%d", API_v13_CacheGroups, id)
        resp, remoteAddr, err := to.request(http.MethodPut, route, reqBody)
        if err != nil {
                return tc.Alerts{}, reqInf, err
@@ -67,23 +67,23 @@ func (to *Session) UpdateStatusByID(id int, status 
tc.Status) (tc.Alerts, ReqInf
        return alerts, reqInf, nil
 }
 
-// Returns a list of Statuses
-func (to *Session) GetStatuses() ([]tc.Status, ReqInf, error) {
-       resp, remoteAddr, err := to.request(http.MethodGet, API_v13_STATUSES, 
nil)
+// Returns a list of CacheGroups
+func (to *Session) GetCacheGroups() ([]tc.CacheGroup, ReqInf, error) {
+       resp, remoteAddr, err := to.request(http.MethodGet, 
API_v13_CacheGroups, nil)
        reqInf := ReqInf{CacheHitStatus: CacheHitStatusMiss, RemoteAddr: 
remoteAddr}
        if err != nil {
                return nil, reqInf, err
        }
        defer resp.Body.Close()
 
-       var data tc.StatusesResponse
+       var data tc.CacheGroupsResponse
        err = json.NewDecoder(resp.Body).Decode(&data)
        return data.Response, reqInf, nil
 }
 
-// GET a Status by the Status id
-func (to *Session) GetStatusByID(id int) ([]tc.Status, ReqInf, error) {
-       route := fmt.Sprintf("%s/%d", API_v13_STATUSES, id)
+// GET a CacheGroup by the CacheGroup id
+func (to *Session) GetCacheGroupByID(id int) ([]tc.CacheGroup, ReqInf, error) {
+       route := fmt.Sprintf("%s/%d", API_v13_CacheGroups, id)
        resp, remoteAddr, err := to.request(http.MethodGet, route, nil)
        reqInf := ReqInf{CacheHitStatus: CacheHitStatusMiss, RemoteAddr: 
remoteAddr}
        if err != nil {
@@ -91,7 +91,7 @@ func (to *Session) GetStatusByID(id int) ([]tc.Status, 
ReqInf, error) {
        }
        defer resp.Body.Close()
 
-       var data tc.StatusesResponse
+       var data tc.CacheGroupsResponse
        if err := json.NewDecoder(resp.Body).Decode(&data); err != nil {
                return nil, reqInf, err
        }
@@ -99,9 +99,9 @@ func (to *Session) GetStatusByID(id int) ([]tc.Status, 
ReqInf, error) {
        return data.Response, reqInf, nil
 }
 
-// GET a Status by the Status name
-func (to *Session) GetStatusByName(name string) ([]tc.Status, ReqInf, error) {
-       url := fmt.Sprintf("%s?name=%s", API_v13_STATUSES, name)
+// GET a CacheGroup by the CacheGroup name
+func (to *Session) GetCacheGroupByName(name string) ([]tc.CacheGroup, ReqInf, 
error) {
+       url := fmt.Sprintf("%s/name/%s", API_v13_CacheGroups, name)
        resp, remoteAddr, err := to.request(http.MethodGet, url, nil)
        reqInf := ReqInf{CacheHitStatus: CacheHitStatusMiss, RemoteAddr: 
remoteAddr}
        if err != nil {
@@ -109,7 +109,7 @@ func (to *Session) GetStatusByName(name string) 
([]tc.Status, ReqInf, error) {
        }
        defer resp.Body.Close()
 
-       var data tc.StatusesResponse
+       var data tc.CacheGroupsResponse
        if err := json.NewDecoder(resp.Body).Decode(&data); err != nil {
                return nil, reqInf, err
        }
@@ -117,9 +117,9 @@ func (to *Session) GetStatusByName(name string) 
([]tc.Status, ReqInf, error) {
        return data.Response, reqInf, nil
 }
 
-// DELETE a Status by id
-func (to *Session) DeleteStatusByID(id int) (tc.Alerts, ReqInf, error) {
-       route := fmt.Sprintf("%s/%d", API_v13_STATUSES, id)
+// DELETE a CacheGroup by ID
+func (to *Session) DeleteCacheGroupByID(id int) (tc.Alerts, ReqInf, error) {
+       route := fmt.Sprintf("%s/%d", API_v13_CacheGroups, id)
        resp, remoteAddr, err := to.request(http.MethodDelete, route, nil)
        reqInf := ReqInf{CacheHitStatus: CacheHitStatusMiss, RemoteAddr: 
remoteAddr}
        if err != nil {
diff --git a/traffic_ops/client/cdn.go b/traffic_ops/client/v13/cdn.go
similarity index 77%
copy from traffic_ops/client/cdn.go
copy to traffic_ops/client/v13/cdn.go
index 6bf2d93..2396c35 100644
--- a/traffic_ops/client/cdn.go
+++ b/traffic_ops/client/v13/cdn.go
@@ -13,7 +13,7 @@
    limitations under the License.
 */
 
-package client
+package v13
 
 import (
        "encoding/json"
@@ -25,7 +25,7 @@ import (
 )
 
 const (
-       API_v2_CDNs = "/api/1.2/cdns"
+       API_v13_CDNs = "/api/1.3/cdns"
 )
 
 // Create a CDN
@@ -37,7 +37,7 @@ func (to *Session) CreateCDN(cdn tc.CDN) (tc.Alerts, ReqInf, 
error) {
        if err != nil {
                return tc.Alerts{}, reqInf, err
        }
-       resp, remoteAddr, err := to.request(http.MethodPost, API_v2_CDNs, 
reqBody)
+       resp, remoteAddr, err := to.request(http.MethodPost, API_v13_CDNs, 
reqBody)
        if err != nil {
                return tc.Alerts{}, reqInf, err
        }
@@ -56,7 +56,7 @@ func (to *Session) UpdateCDNByID(id int, cdn tc.CDN) 
(tc.Alerts, ReqInf, error)
        if err != nil {
                return tc.Alerts{}, reqInf, err
        }
-       route := fmt.Sprintf("%s/%d", API_v2_CDNs, id)
+       route := fmt.Sprintf("%s/%d", API_v13_CDNs, id)
        resp, remoteAddr, err := to.request(http.MethodPut, route, reqBody)
        if err != nil {
                return tc.Alerts{}, reqInf, err
@@ -69,7 +69,7 @@ func (to *Session) UpdateCDNByID(id int, cdn tc.CDN) 
(tc.Alerts, ReqInf, error)
 
 // Returns a list of CDNs
 func (to *Session) GetCDNs() ([]tc.CDN, ReqInf, error) {
-       resp, remoteAddr, err := to.request(http.MethodGet, API_v2_CDNs, nil)
+       resp, remoteAddr, err := to.request(http.MethodGet, API_v13_CDNs, nil)
        reqInf := ReqInf{CacheHitStatus: CacheHitStatusMiss, RemoteAddr: 
remoteAddr}
        if err != nil {
                return nil, reqInf, err
@@ -81,9 +81,9 @@ func (to *Session) GetCDNs() ([]tc.CDN, ReqInf, error) {
        return data.Response, reqInf, nil
 }
 
-// GET a CDN by the CDN id
+// GET a CDN by the CDN ID
 func (to *Session) GetCDNByID(id int) ([]tc.CDN, ReqInf, error) {
-       route := fmt.Sprintf("%s/%d", API_v2_CDNs, id)
+       route := fmt.Sprintf("%s/%d", API_v13_CDNs, id)
        resp, remoteAddr, err := to.request(http.MethodGet, route, nil)
        reqInf := ReqInf{CacheHitStatus: CacheHitStatusMiss, RemoteAddr: 
remoteAddr}
        if err != nil {
@@ -101,7 +101,7 @@ func (to *Session) GetCDNByID(id int) ([]tc.CDN, ReqInf, 
error) {
 
 // GET a CDN by the CDN name
 func (to *Session) GetCDNByName(name string) ([]tc.CDN, ReqInf, error) {
-       url := fmt.Sprintf("%s/name/%s", API_v2_CDNs, name)
+       url := fmt.Sprintf("%s/name/%s", API_v13_CDNs, name)
        resp, remoteAddr, err := to.request(http.MethodGet, url, nil)
        reqInf := ReqInf{CacheHitStatus: CacheHitStatusMiss, RemoteAddr: 
remoteAddr}
        if err != nil {
@@ -119,7 +119,7 @@ func (to *Session) GetCDNByName(name string) ([]tc.CDN, 
ReqInf, error) {
 
 // DELETE a CDN by ID
 func (to *Session) DeleteCDNByID(id int) (tc.Alerts, ReqInf, error) {
-       route := fmt.Sprintf("%s/%d", API_v2_CDNs, id)
+       route := fmt.Sprintf("%s/%d", API_v13_CDNs, id)
        resp, remoteAddr, err := to.request(http.MethodDelete, route, nil)
        reqInf := ReqInf{CacheHitStatus: CacheHitStatusMiss, RemoteAddr: 
remoteAddr}
        if err != nil {
@@ -132,7 +132,7 @@ func (to *Session) DeleteCDNByID(id int) (tc.Alerts, 
ReqInf, error) {
 }
 
 func (to *Session) GetCDNSSLKeys(name string) ([]tc.CDNSSLKeys, ReqInf, error) 
{
-       url := fmt.Sprintf("%s/name/%s/sslkeys", API_v2_CDNs, name)
+       url := fmt.Sprintf("%s/name/%s/sslkeys", API_v13_CDNs, name)
        resp, remoteAddr, err := to.request(http.MethodGet, url, nil)
        reqInf := ReqInf{CacheHitStatus: CacheHitStatusMiss, RemoteAddr: 
remoteAddr}
        if err != nil {
@@ -147,29 +147,3 @@ func (to *Session) GetCDNSSLKeys(name string) 
([]tc.CDNSSLKeys, ReqInf, error) {
 
        return data.Response, reqInf, nil
 }
-
-// Deprecated: use GetCDNs.
-func (to *Session) CDNs() ([]tc.CDN, error) {
-       cdns, _, err := to.GetCDNs()
-       return cdns, err
-}
-
-// CDNName gets an array of CDNs
-// Deprecated: use GetCDNByName
-func (to *Session) CDNName(name string) ([]tc.CDN, error) {
-       n, _, err := to.GetCDNByName(name)
-       return n, err
-}
-
-// CDNName gets an array of CDNs
-// Deprecated: use GetCDNByName
-func (to *Session) GetCDNName(name string) ([]tc.CDN, error) {
-       n, _, err := to.GetCDNByName(name)
-       return n, err
-}
-
-// Deprecated: use GetCDNSSLKeys
-func (to *Session) CDNSSLKeys(name string) ([]tc.CDNSSLKeys, error) {
-       ks, _, err := to.GetCDNSSLKeys(name)
-       return ks, err
-}
diff --git a/traffic_ops/client/deliveryservice_requests.go 
b/traffic_ops/client/v13/deliveryservice_requests.go
similarity index 99%
rename from traffic_ops/client/deliveryservice_requests.go
rename to traffic_ops/client/v13/deliveryservice_requests.go
index bd77b48..2bf3bec 100644
--- a/traffic_ops/client/deliveryservice_requests.go
+++ b/traffic_ops/client/v13/deliveryservice_requests.go
@@ -13,7 +13,7 @@
    limitations under the License.
 */
 
-package client
+package v13
 
 import (
        "encoding/json"
diff --git a/traffic_ops/client/division.go b/traffic_ops/client/v13/division.go
similarity index 99%
rename from traffic_ops/client/division.go
rename to traffic_ops/client/v13/division.go
index 617ff51..063cfe0 100644
--- a/traffic_ops/client/division.go
+++ b/traffic_ops/client/v13/division.go
@@ -13,7 +13,7 @@
    limitations under the License.
 */
 
-package client
+package v13
 
 import (
        "encoding/json"
diff --git a/traffic_ops/client/region.go b/traffic_ops/client/v13/region.go
similarity index 99%
rename from traffic_ops/client/region.go
rename to traffic_ops/client/v13/region.go
index f3e39f1..2864d12 100644
--- a/traffic_ops/client/region.go
+++ b/traffic_ops/client/v13/region.go
@@ -13,7 +13,7 @@
    limitations under the License.
 */
 
-package client
+package v13
 
 import (
        "encoding/json"
diff --git a/traffic_ops/client/v13/session.go 
b/traffic_ops/client/v13/session.go
new file mode 100644
index 0000000..c117d82
--- /dev/null
+++ b/traffic_ops/client/v13/session.go
@@ -0,0 +1,354 @@
+/*
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+*/
+
+package v13
+
+import (
+       "bytes"
+       "crypto/tls"
+       "encoding/json"
+       "errors"
+       "fmt"
+       "io/ioutil"
+       "net"
+       "net/http"
+       "net/http/cookiejar"
+       "net/http/httptrace"
+       "strconv"
+       "strings"
+       "sync"
+       "time"
+
+       tc "github.com/apache/incubator-trafficcontrol/lib/go-tc"
+
+       "golang.org/x/net/publicsuffix"
+)
+
+// Session ...
+type Session struct {
+       UserName     string
+       Password     string
+       URL          string
+       Client       *http.Client
+       cache        map[string]CacheEntry
+       cacheMutex   *sync.RWMutex
+       useCache     bool
+       UserAgentStr string
+}
+
+func NewSession(user, password, url, userAgent string, client *http.Client, 
useCache bool) *Session {
+       return &Session{
+               UserName:     user,
+               Password:     password,
+               URL:          url,
+               Client:       client,
+               cache:        map[string]CacheEntry{},
+               cacheMutex:   &sync.RWMutex{},
+               useCache:     useCache,
+               UserAgentStr: userAgent,
+       }
+}
+
+const DefaultTimeout = time.Second * time.Duration(30)
+
+// HTTPError is returned on Update Session failure.
+type HTTPError struct {
+       HTTPStatusCode int
+       HTTPStatus     string
+       URL            string
+       Body           string
+}
+
+// Error implements the error interface for our customer error type.
+func (e *HTTPError) Error() string {
+       return fmt.Sprintf("%s[%d] - Error requesting Traffic Ops %s %s", 
e.HTTPStatus, e.HTTPStatusCode, e.URL, e.Body)
+}
+
+// CacheEntry ...
+type CacheEntry struct {
+       Entered    int64
+       Bytes      []byte
+       RemoteAddr net.Addr
+}
+
+// TODO JvD
+const tmPollingInterval = 60
+
+// loginCreds gathers login credentials for Traffic Ops.
+func loginCreds(toUser string, toPasswd string) ([]byte, error) {
+       credentials := tc.UserCredentials{
+               Username: toUser,
+               Password: toPasswd,
+       }
+
+       js, err := json.Marshal(credentials)
+       if err != nil {
+               err := fmt.Errorf("Error creating login json: %v", err)
+               return nil, err
+       }
+       return js, nil
+}
+
+// Deprecated: Login is deprecated, use LoginWithAgent instead. The `Login` 
function with its present signature will be removed in the next version and 
replaced with `Login(toURL string, toUser string, toPasswd string, insecure 
bool, userAgent string)`. The `LoginWithAgent` function will be removed the 
version after that.
+func Login(toURL string, toUser string, toPasswd string, insecure bool) 
(*Session, error) {
+       s, _, err := LoginWithAgent(toURL, toUser, toPasswd, insecure, 
"traffic-ops-client", false, DefaultTimeout)
+       return s, err
+}
+
+// login tries to log in to Traffic Ops, and set the auth cookie in the 
Session. Returns the IP address of the remote Traffic Ops.
+func (to *Session) login() (net.Addr, error) {
+       credentials, err := loginCreds(to.UserName, to.Password)
+       if err != nil {
+               return nil, errors.New("creating login credentials: " + 
err.Error())
+       }
+
+       path := "/api/1.2/user/login"
+       resp, remoteAddr, err := to.rawRequest("POST", path, credentials)
+       resp, remoteAddr, err = to.ErrUnlessOK(resp, remoteAddr, err, path)
+       if err != nil {
+               return remoteAddr, errors.New("requesting: " + err.Error())
+       }
+       defer resp.Body.Close()
+
+       var alerts tc.Alerts
+       if err := json.NewDecoder(resp.Body).Decode(&alerts); err != nil {
+               return remoteAddr, errors.New("decoding response JSON: " + 
err.Error())
+       }
+
+       success := false
+       for _, alert := range alerts.Alerts {
+               if alert.Level == "success" && alert.Text == "Successfully 
logged in." {
+                       success = true
+                       break
+               }
+       }
+
+       if !success {
+               return remoteAddr, fmt.Errorf("Login failed, alerts string: 
%+v", alerts)
+       }
+
+       return remoteAddr, nil
+}
+
+// Login to traffic_ops, the response should set the cookie for this session
+// automatically. Start with
+//     to := traffic_ops.Login("user", "passwd", true)
+// subsequent calls like to.GetData("datadeliveryservice") will be 
authenticated.
+// Returns the logged in client, the remote address of Traffic Ops which was 
translated and used to log in, and any error. If the error is not nil, the 
remote address may or may not be nil, depending whether the error occurred 
before the login request.
+func LoginWithAgent(toURL string, toUser string, toPasswd string, insecure 
bool, userAgent string, useCache bool, requestTimeout time.Duration) (*Session, 
net.Addr, error) {
+       options := cookiejar.Options{
+               PublicSuffixList: publicsuffix.List,
+       }
+
+       jar, err := cookiejar.New(&options)
+       if err != nil {
+               return nil, nil, err
+       }
+
+       to := NewSession(toUser, toPasswd, toURL, userAgent, &http.Client{
+               Timeout: requestTimeout,
+               Transport: &http.Transport{
+                       TLSClientConfig: &tls.Config{InsecureSkipVerify: 
insecure},
+               },
+               Jar: jar,
+       }, useCache)
+
+       remoteAddr, err := to.login()
+       if err != nil {
+               return nil, remoteAddr, errors.New("logging in: " + err.Error())
+       }
+       return to, remoteAddr, nil
+}
+
+// ErrUnlessOk returns nil and an error if the given Response's status code is 
anything but 200 OK. This includes reading the Response.Body and Closing it. 
Otherwise, the given response and error are returned unchanged.
+func (to *Session) ErrUnlessOK(resp *http.Response, remoteAddr net.Addr, err 
error, path string) (*http.Response, net.Addr, error) {
+       if err != nil {
+               return resp, remoteAddr, err
+       }
+       if resp.StatusCode == http.StatusOK {
+               return resp, remoteAddr, err
+       }
+
+       defer resp.Body.Close()
+       body, readErr := ioutil.ReadAll(resp.Body)
+       if readErr != nil {
+               return nil, remoteAddr, readErr
+       }
+       return nil, remoteAddr, errors.New(resp.Status + "[" + 
strconv.Itoa(resp.StatusCode) + "] - Error requesting Traffic Ops " + 
to.getURL(path) + " " + string(body))
+}
+
+func (to *Session) getURL(path string) string { return to.URL + path }
+
+// request performs the HTTP request to Traffic Ops, trying to refresh the 
cookie if an Unauthorized or Forbidden code is received. It only tries once. If 
the login fails, the original Unauthorized/Forbidden response is returned. If 
the login succeeds and the subsequent re-request fails, the re-request's 
response is returned even if it's another Unauthorized/Forbidden.
+func (to *Session) request(method, path string, body []byte) (*http.Response, 
net.Addr, error) {
+       r, remoteAddr, err := to.rawRequest(method, path, body)
+       if err != nil {
+               return r, remoteAddr, err
+       }
+       if r.StatusCode != http.StatusUnauthorized && r.StatusCode != 
http.StatusForbidden {
+               return to.ErrUnlessOK(r, remoteAddr, err, path)
+       }
+       if _, lerr := to.login(); lerr != nil {
+               return to.ErrUnlessOK(r, remoteAddr, err, path) // if 
re-logging-in fails, return the original request's response
+       }
+
+       // return second request, even if it's another Unauthorized or 
Forbidden.
+       r, remoteAddr, err = to.rawRequest(method, path, body)
+       return to.ErrUnlessOK(r, remoteAddr, err, path)
+}
+
+// rawRequest performs the actual HTTP request to Traffic Ops, simply, without 
trying to refresh the cookie if an Unauthorized code is returned.
+func (to *Session) rawRequest(method, path string, body []byte) 
(*http.Response, net.Addr, error) {
+       url := to.getURL(path)
+
+       var req *http.Request
+       var err error
+       remoteAddr := net.Addr(nil)
+
+       if body != nil {
+               req, err = http.NewRequest(method, url, bytes.NewBuffer(body))
+               if err != nil {
+                       return nil, remoteAddr, err
+               }
+               req.Header.Set("Content-Type", "application/json")
+       } else {
+               req, err = http.NewRequest(method, url, nil)
+               if err != nil {
+                       return nil, remoteAddr, err
+               }
+       }
+
+       trace := &httptrace.ClientTrace{
+               GotConn: func(connInfo httptrace.GotConnInfo) {
+                       remoteAddr = connInfo.Conn.RemoteAddr()
+               },
+       }
+       req = req.WithContext(httptrace.WithClientTrace(req.Context(), trace))
+
+       req.Header.Set("User-Agent", to.UserAgentStr)
+
+       resp, err := to.Client.Do(req)
+       if err != nil {
+               return nil, remoteAddr, err
+       }
+
+       return resp, remoteAddr, nil
+}
+
+type ReqInf struct {
+       CacheHitStatus CacheHitStatus
+       RemoteAddr     net.Addr
+}
+
+type CacheHitStatus string
+
+const CacheHitStatusHit = CacheHitStatus("hit")
+const CacheHitStatusExpired = CacheHitStatus("expired")
+const CacheHitStatusMiss = CacheHitStatus("miss")
+const CacheHitStatusInvalid = CacheHitStatus("")
+
+func (s CacheHitStatus) String() string {
+       return string(s)
+}
+
+func StringToCacheHitStatus(s string) CacheHitStatus {
+       s = strings.ToLower(s)
+       switch s {
+       case "hit":
+               return CacheHitStatusHit
+       case "expired":
+               return CacheHitStatusExpired
+       case "miss":
+               return CacheHitStatusMiss
+       default:
+               return CacheHitStatusInvalid
+       }
+}
+
+// setCache Sets the given cache key and value. This is threadsafe for 
multiple goroutines.
+func (to *Session) setCache(path string, entry CacheEntry) {
+       if !to.useCache {
+               return
+       }
+       to.cacheMutex.Lock()
+       defer to.cacheMutex.Unlock()
+       to.cache[path] = entry
+}
+
+// getCache gets the cache value at the given key, or false if it doesn't 
exist. This is threadsafe for multiple goroutines.
+func (to *Session) getCache(path string) (CacheEntry, bool) {
+       to.cacheMutex.RLock()
+       defer to.cacheMutex.RUnlock()
+       cacheEntry, ok := to.cache[path]
+       return cacheEntry, ok
+}
+
+//if cacheEntry, ok := to.Cache[path]; ok {
+
+// getBytesWithTTL gets the path, and caches in the session. Returns bytes 
from the cache, if found and the TTL isn't expired. Otherwise, gets it and 
store it in cache
+func (to *Session) getBytesWithTTL(path string, ttl int64) ([]byte, ReqInf, 
error) {
+       var body []byte
+       var err error
+       var cacheHitStatus CacheHitStatus
+       var remoteAddr net.Addr
+
+       getFresh := false
+       if cacheEntry, ok := to.getCache(path); ok {
+               if cacheEntry.Entered > time.Now().Unix()-ttl {
+                       cacheHitStatus = CacheHitStatusHit
+                       body = cacheEntry.Bytes
+                       remoteAddr = cacheEntry.RemoteAddr
+               } else {
+                       cacheHitStatus = CacheHitStatusExpired
+                       getFresh = true
+               }
+       } else {
+               cacheHitStatus = CacheHitStatusMiss
+               getFresh = true
+       }
+
+       if getFresh {
+               body, remoteAddr, err = to.getBytes(path)
+               if err != nil {
+                       return nil, ReqInf{CacheHitStatus: 
CacheHitStatusInvalid, RemoteAddr: remoteAddr}, err
+               }
+
+               newEntry := CacheEntry{
+                       Entered:    time.Now().Unix(),
+                       Bytes:      body,
+                       RemoteAddr: remoteAddr,
+               }
+               to.setCache(path, newEntry)
+       }
+
+       return body, ReqInf{CacheHitStatus: cacheHitStatus, RemoteAddr: 
remoteAddr}, nil
+}
+
+// GetBytes - get []bytes array for a certain path on the to session.
+// returns the raw body, the remote address the Traffic Ops URL resolved to, 
or any error. If the error is not nil, the RemoteAddr may or may not be nil, 
depending whether the error occurred before the request was executed.
+func (to *Session) getBytes(path string) ([]byte, net.Addr, error) {
+       resp, remoteAddr, err := to.request("GET", path, nil)
+       if err != nil {
+               return nil, remoteAddr, err
+       }
+       defer resp.Body.Close()
+
+       body, err := ioutil.ReadAll(resp.Body)
+       if err != nil {
+               return nil, remoteAddr, err
+       }
+
+       return body, remoteAddr, nil
+}
diff --git a/traffic_ops/client/status.go b/traffic_ops/client/v13/status.go
similarity index 99%
rename from traffic_ops/client/status.go
rename to traffic_ops/client/v13/status.go
index 1145d86..8081b71 100644
--- a/traffic_ops/client/status.go
+++ b/traffic_ops/client/v13/status.go
@@ -13,7 +13,7 @@
    limitations under the License.
 */
 
-package client
+package v13
 
 import (
        "encoding/json"
diff --git a/traffic_ops/testing/api/towrap/towrap.go 
b/traffic_ops/testing/api/towrap/towrap.go
deleted file mode 100644
index d374284..0000000
--- a/traffic_ops/testing/api/towrap/towrap.go
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
-
-   http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
-*/
-
-package towrap
-
-import (
-       "net"
-       "time"
-
-       "github.com/apache/incubator-trafficcontrol/traffic_ops/client"
-       to "github.com/apache/incubator-trafficcontrol/traffic_ops/client"
-       
"github.com/apache/incubator-trafficcontrol/traffic_ops/testing/api/config"
-)
-
-func SetupSession(cfg config.Config, toURL string, toUser string, toPass 
string) (*client.Session, net.Addr, error) {
-       var err error
-       var session *client.Session
-       var netAddr net.Addr
-       toReqTimeout := time.Second * 
time.Duration(cfg.Default.Session.TimeoutInSecs)
-       session, netAddr, err = to.LoginWithAgent(toURL, toUser, toPass, true, 
"to-api-client-tests", true, toReqTimeout)
-       if err != nil {
-               return nil, nil, err
-       }
-
-       return session, netAddr, err
-}
diff --git a/traffic_ops/testing/api/v13/division_test.go 
b/traffic_ops/testing/api/v13/division_test.go
index 954fe7f..aa72293 100644
--- a/traffic_ops/testing/api/v13/division_test.go
+++ b/traffic_ops/testing/api/v13/division_test.go
@@ -16,6 +16,7 @@ package v13
 */
 
 import (
+       "fmt"
        "testing"
 
        "github.com/apache/incubator-trafficcontrol/lib/go-log"
@@ -33,6 +34,7 @@ func TestDivisions(t *testing.T) {
 
 func CreateTestDivisions(t *testing.T) {
        for _, division := range testData.Divisions {
+               fmt.Printf("division ---> %v\n", division)
                resp, _, err := TOSession.CreateDivision(division)
                log.Debugln("Response: ", resp)
                if err != nil {
diff --git a/traffic_ops/testing/api/v13/division_test.go 
b/traffic_ops/testing/api/v13/divisions_test.go
similarity index 100%
copy from traffic_ops/testing/api/v13/division_test.go
copy to traffic_ops/testing/api/v13/divisions_test.go
diff --git a/traffic_ops/testing/api/v13/region_test.go 
b/traffic_ops/testing/api/v13/region_test.go
index 4d3397a..7eaba11 100644
--- a/traffic_ops/testing/api/v13/region_test.go
+++ b/traffic_ops/testing/api/v13/region_test.go
@@ -16,6 +16,7 @@ package v13
 */
 
 import (
+       "fmt"
        "testing"
 
        "github.com/apache/incubator-trafficcontrol/lib/go-log"
@@ -24,8 +25,6 @@ import (
 
 func TestRegions(t *testing.T) {
 
-       CreateTestDivisions(t)
-
        CreateTestRegions(t)
        UpdateTestRegions(t)
        GetTestRegions(t)
@@ -34,17 +33,8 @@ func TestRegions(t *testing.T) {
 }
 
 func CreateTestRegions(t *testing.T) {
-
-       // Retrieve the Division by name so we can get the ID
-       division := testData.Divisions[0]
-       resp, _, err := TOSession.GetDivisionByName(division.Name)
-       if err != nil {
-               t.Errorf("cannot GET Division by name: %v - %v\n", 
division.Name, err)
-       }
-       respDivision := resp[0]
-
        for _, region := range testData.Regions {
-               region.Division = respDivision.ID
+               fmt.Printf("region ---> %v\n", region)
                resp, _, err := TOSession.CreateRegion(region)
                log.Debugln("Response: ", resp)
                if err != nil {
diff --git a/traffic_ops/testing/api/v13/region_test.go 
b/traffic_ops/testing/api/v13/regions_test.go
similarity index 100%
copy from traffic_ops/testing/api/v13/region_test.go
copy to traffic_ops/testing/api/v13/regions_test.go
diff --git a/traffic_ops/testing/api/v13/tc-fixtures.json 
b/traffic_ops/testing/api/v13/tc-fixtures.json
index 617de72..ef993e4 100644
--- a/traffic_ops/testing/api/v13/tc-fixtures.json
+++ b/traffic_ops/testing/api/v13/tc-fixtures.json
@@ -1,12 +1,12 @@
 {
     "asns": [
         {
-            "cachegroupName": "cachegroup1",
-            "name": "asn1"
+            "cachegroupName": "mid-northeast-group",
+            "asn": 8888
         },
         {
-            "cachegroupName": "cachegroup2",
-            "name": "asn2"
+            "cachegroupName": "edge_cg4",
+            "asn": 9999
         }
     ],
     "cachegroups": [
@@ -14,13 +14,15 @@
             "latitude": 0,
             "longitude": 0,
             "name": "parentCacheGroup",
-            "parentCacheGroupName": null
+            "parentCacheGroupName": null,
+            "type": "EDGE"
         },
         {
             "latitude": 0,
             "longitude": 0,
             "name": "secondaryCacheGroup",
-            "parentCacheGroupName": null
+            "parentCacheGroupName": null,
+            "type": "EDGE"
         },
         {
             "latitude": 0,
@@ -28,7 +30,8 @@
             "name": "cachegroup1",
             "parentCacheGroupName": "parentCacheGroup",
             "secondaryCacheGroupName": "parentCacheGroup",
-            "shortName": "cg1"
+            "shortName": "cg1",
+            "type": "MID"
         },
         {
             "latitude": 24.1234,
@@ -36,7 +39,8 @@
             "name": "cachegroup2",
             "parentCacheGroupName": "secondaryCacheGroup",
             "secondaryCacheGroupName": "secondaryCacheGroup",
-            "shortName": "cg2"
+            "shortName": "cg2",
+            "type": "MID"
         }
     ],
     "cdns": [
diff --git a/traffic_ops/testing/api/v13/traffic_control.go 
b/traffic_ops/testing/api/v13/traffic_control.go
index af6637d..a1f4c88 100644
--- a/traffic_ops/testing/api/v13/traffic_control.go
+++ b/traffic_ops/testing/api/v13/traffic_control.go
@@ -21,7 +21,7 @@ import tcapi 
"github.com/apache/incubator-trafficcontrol/lib/go-tc"
 type TrafficControl struct {
        ASNs                    []tcapi.ASN                    `json:"asns"`
        CDNs                    []tcapi.CDN                    `json:"cdns"`
-       Cachegroups             []tcapi.CacheGroup             
`json:"cachegroups"`
+       CacheGroups             []tcapi.CacheGroup             
`json:"cachegroups"`
        DeliveryServiceRequests []tcapi.DeliveryServiceRequest 
`json:"deliveryServiceRequests"`
        DeliveryServices        []tcapi.DeliveryService        
`json:"deliveryservices"`
        Divisions               []tcapi.Division               
`json:"divisions"`
diff --git a/traffic_ops/testing/api/v13/traffic_ops_test.go 
b/traffic_ops/testing/api/v13/traffic_ops_test.go
index 4800836..68fa773 100644
--- a/traffic_ops/testing/api/v13/traffic_ops_test.go
+++ b/traffic_ops/testing/api/v13/traffic_ops_test.go
@@ -19,19 +19,20 @@ import (
        "database/sql"
        "flag"
        "fmt"
+       "net"
        "os"
        "testing"
+       "time"
 
        "github.com/apache/incubator-trafficcontrol/lib/go-log"
-       to "github.com/apache/incubator-trafficcontrol/traffic_ops/client"
+       "github.com/apache/incubator-trafficcontrol/traffic_ops/client/v13"
        
"github.com/apache/incubator-trafficcontrol/traffic_ops/testing/api/config"
        
"github.com/apache/incubator-trafficcontrol/traffic_ops/testing/api/todb"
-       
"github.com/apache/incubator-trafficcontrol/traffic_ops/testing/api/towrap"
        _ "github.com/lib/pq"
 )
 
 var (
-       TOSession *to.Session
+       TOSession *v13.Session
        cfg       config.Config
        testData  TrafficControl
 )
@@ -84,7 +85,7 @@ func TestMain(m *testing.M) {
                os.Exit(1)
        }
 
-       TOSession, _, err = towrap.SetupSession(cfg, cfg.TrafficOps.URL, 
cfg.TrafficOps.User, cfg.TrafficOps.UserPassword)
+       TOSession, _, err = SetupSession(cfg, cfg.TrafficOps.URL, 
cfg.TrafficOps.User, cfg.TrafficOps.UserPassword)
        if err != nil {
                fmt.Printf("\nError logging into TOURL: %s TOUser: %s/%s - 
%v\n", cfg.TrafficOps.URL, cfg.TrafficOps.User, cfg.TrafficOps.UserPassword, 
err)
                os.Exit(1)
@@ -95,3 +96,16 @@ func TestMain(m *testing.M) {
        os.Exit(rc)
 
 }
+
+func SetupSession(cfg config.Config, toURL string, toUser string, toPass 
string) (*v13.Session, net.Addr, error) {
+       var err error
+       var session *v13.Session
+       var netAddr net.Addr
+       toReqTimeout := time.Second * 
time.Duration(cfg.Default.Session.TimeoutInSecs)
+       session, netAddr, err = v13.LoginWithAgent(toURL, toUser, toPass, true, 
"to-api-v13-client-tests", true, toReqTimeout)
+       if err != nil {
+               return nil, nil, err
+       }
+
+       return session, netAddr, err
+}
diff --git a/traffic_ops/traffic_ops_golang/routes.go 
b/traffic_ops/traffic_ops_golang/routes.go
index 8c847bb..c3450bf 100644
--- a/traffic_ops/traffic_ops_golang/routes.go
+++ b/traffic_ops/traffic_ops_golang/routes.go
@@ -59,13 +59,7 @@ func Routes(d ServerData) ([]Route, http.Handler, error) {
        proxyHandler := rootHandler(d)
 
        routes := []Route{
-               //ASNs
-               {1.3, http.MethodGet, `asns/?(\.json)?$`, 
api.ReadHandler(asn.GetRefType(), d.DB), auth.PrivLevelReadOnly, Authenticated, 
nil},
-               {1.3, http.MethodGet, `asns/{id}$`, 
api.ReadHandler(asn.GetRefType(), d.DB), auth.PrivLevelReadOnly, Authenticated, 
nil},
-               {1.3, http.MethodPut, `asns/{id}$`, 
api.UpdateHandler(asn.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
-               {1.3, http.MethodPost, `asns/?$`, 
api.CreateHandler(asn.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
-               {1.3, http.MethodDelete, `asns/{id}$`, 
api.DeleteHandler(asn.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
-
+               // Proxied routes
                //CDNs
                // explicitly passed to legacy system until fully implemented.  
Auth handled by legacy system.
                {1.2, http.MethodGet, `cdns/capacity$`, 
handlerToFunc(proxyHandler), 0, NoAuth, []Middleware{}},
@@ -75,8 +69,23 @@ func Routes(d ServerData) ([]Route, http.Handler, error) {
                {1.2, http.MethodGet, `cdns/health$`, 
handlerToFunc(proxyHandler), 0, NoAuth, []Middleware{}},
                {1.2, http.MethodGet, `cdns/routing$`, 
handlerToFunc(proxyHandler), 0, NoAuth, []Middleware{}},
 
+               //Servers
+               // explicitly passed to legacy system until fully implemented.  
Auth handled by legacy system.
+               {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{}},
+
+               //Monitoring
                {1.2, http.MethodGet, 
`cdns/{name}/configs/monitoring(\.json)?$`, monitoringHandler(d.DB), 
auth.PrivLevelReadOnly, Authenticated, nil},
 
+               //ASNs
+               {1.3, http.MethodGet, `asns/?(\.json)?$`, 
api.ReadHandler(asn.GetRefType(), d.DB), auth.PrivLevelReadOnly, Authenticated, 
nil},
+               {1.3, http.MethodGet, `asns/{id}$`, 
api.ReadHandler(asn.GetRefType(), d.DB), auth.PrivLevelReadOnly, Authenticated, 
nil},
+               {1.3, http.MethodPut, `asns/{id}$`, 
api.UpdateHandler(asn.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
+               {1.3, http.MethodPost, `asns/?$`, 
api.CreateHandler(asn.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
+               {1.3, http.MethodDelete, `asns/{id}$`, 
api.DeleteHandler(asn.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
+
                //CDN generic handlers:
                {1.3, http.MethodGet, `cdns/?(\.json)?$`, 
api.ReadHandler(cdn.GetRefType(), d.DB), auth.PrivLevelReadOnly, Authenticated, 
nil},
                {1.3, http.MethodGet, `cdns/{id}$`, 
api.ReadHandler(cdn.GetRefType(), d.DB), auth.PrivLevelReadOnly, Authenticated, 
nil},
@@ -113,7 +122,7 @@ func Routes(d ServerData) ([]Route, http.Handler, error) {
                {1.3, http.MethodDelete, `statuses/{id}$`, 
api.DeleteHandler(status.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
 
                //Divisions
-               {1.2, http.MethodGet, `divisions/?(\.json)?$`, 
api.ReadHandler(division.GetRefType(), d.DB), auth.PrivLevelReadOnly, 
Authenticated, nil},
+               {1.3, http.MethodGet, `divisions/?(\.json)?$`, 
api.ReadHandler(division.GetRefType(), d.DB), auth.PrivLevelReadOnly, 
Authenticated, nil},
                {1.3, http.MethodGet, `divisions/{id}$`, 
api.ReadHandler(division.GetRefType(), d.DB), auth.PrivLevelReadOnly, 
Authenticated, nil},
                {1.3, http.MethodPost, `divisions/?$`, 
api.CreateHandler(division.GetRefType(), d.DB), auth.PrivLevelOperations, 
Authenticated, nil},
 
@@ -130,13 +139,6 @@ func Routes(d ServerData) ([]Route, http.Handler, error) {
                //Parameters
                {1.3, http.MethodGet, `parameters/?(\.json)?$`, 
parametersHandler(d.DB), auth.PrivLevelReadOnly, Authenticated, nil},
 
-               //Servers
-               // explicitly passed to legacy system until fully implemented.  
Auth handled by legacy system.
-               {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.2, http.MethodGet, `servers/?(\.json)?$`, 
serversHandler(d.DB), auth.PrivLevelReadOnly, Authenticated, nil},
                {1.2, http.MethodGet, `servers/{id}$`, serversHandler(d.DB), 
auth.PrivLevelReadOnly, Authenticated, nil},
                {1.2, http.MethodPost, `servers/{id}/deliveryservices$`, 
assignDeliveryServicesToServerHandler(d.DB), auth.PrivLevelOperations, 
Authenticated, nil},

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

Reply via email to