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

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


The following commit(s) were added to refs/heads/master by this push:
     new 233d314  Deprecate/remove `/capabilities` (#6433)
233d314 is described below

commit 233d314237b13ed7f0d29681d7fb8e318683fd14
Author: ocket8888 <[email protected]>
AuthorDate: Fri Jan 14 11:07:06 2022 -0700

    Deprecate/remove `/capabilities` (#6433)
    
    * Add deprecation notices to /api_capabilities and /capabilities
    
    Also removes /capabilities from API version 4
    
    * Remove v4 docs for /capabilities, add/consistent-ify deprecation notices
    
    * Fix docstring references
    
    * Remove Capabilities from TO API client
    
    * Update CHANGELOG
---
 CHANGELOG.md                                       |   3 +-
 docs/source/api/v2/capabilities.rst                |   1 +
 docs/source/api/v3/capabilities.rst                |   3 +-
 docs/source/api/v4/capabilities.rst                |  92 ------------
 .../clients/python/trafficops/tosession.py         |   4 +-
 traffic_ops/testing/api/v4/capabilities_test.go    | 160 ---------------------
 .../apicapability/api_capabilities.go              |  47 +++---
 .../capabilities/capabilities.go                   |  39 +++--
 traffic_ops/traffic_ops_golang/routing/routes.go   |   3 -
 traffic_ops/v4-client/capability.go                |  30 ----
 10 files changed, 56 insertions(+), 326 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 54753b1..8d5a30d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -53,12 +53,13 @@ The format is based on [Keep a 
Changelog](http://keepachangelog.com/en/1.0.0/).
 - [#6506](https://github.com/apache/trafficcontrol/pull/6506) - Updated 
`jackson-databind` and `jackson-annotations` Traffic Router dependencies to 
version 2.13.1
 
 ### Deprecated
-- Deprecated the endpoints and docs associated with `api_capability`.
+- Deprecated the endpoints and docs associated with `/api_capability` and 
`/capabilities`.
 - The use of a seelog configuration file to configure Traffic Stats logging is 
deprecated, and logging configuration should instead be present in the `logs` 
property of the Traffic Stats configuration file (refer to documentation for 
details).
 
 ### Removed
 - Removed the `user_role` table.
 - The `traffic_ops.sh` shell profile no longer sets `GOPATH` or adds its `bin` 
folder to the `PATH`
+- `/capabilities` removed from Traffic Ops API version 4.
 
 ## [6.0.2] - 2021-12-17
 ### Changed
diff --git a/docs/source/api/v2/capabilities.rst 
b/docs/source/api/v2/capabilities.rst
index 5dd11eb..fdec90c 100644
--- a/docs/source/api/v2/capabilities.rst
+++ b/docs/source/api/v2/capabilities.rst
@@ -18,6 +18,7 @@
 ****************
 ``capabilities``
 ****************
+.. deprecated:: 3.1
 
 ``GET``
 =======
diff --git a/docs/source/api/v3/capabilities.rst 
b/docs/source/api/v3/capabilities.rst
index 453e436..425c3e3 100644
--- a/docs/source/api/v3/capabilities.rst
+++ b/docs/source/api/v3/capabilities.rst
@@ -18,8 +18,7 @@
 ****************
 ``capabilities``
 ****************
-
-.. deprecated:: ATCv7.0
+.. deprecated:: 3.1
 
 ``GET``
 =======
diff --git a/docs/source/api/v4/capabilities.rst 
b/docs/source/api/v4/capabilities.rst
deleted file mode 100644
index f93b808..0000000
--- a/docs/source/api/v4/capabilities.rst
+++ /dev/null
@@ -1,92 +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.
-..
-
-.. _to-api-capabilities:
-
-****************
-``capabilities``
-****************
-
-``GET``
-=======
-Get all capabilities.
-
-:Auth. Required: Yes
-:Roles Required: None
-:Permissions Required: CAPABILITY:READ
-:Response Type:  Array
-
-Request Structure
------------------
-.. table:: Request Query Parameters
-
-       
+-----------+----------+---------------------------------------------------------------------------------------------------------------------+
-       | Name      | Required | Description                                    
                                                                     |
-       
+===========+==========+=====================================================================================================================+
-       | name      | no       | Return only the capability that has this name  
                                                                     |
-       
+-----------+----------+---------------------------------------------------------------------------------------------------------------------+
-       | orderby   | no       | Choose the ordering of the results - must be 
the name of one of the fields of the objects in the ``response`` array |
-       
+-----------+----------+---------------------------------------------------------------------------------------------------------------------+
-       | sortOrder | no       | Changes the order of sorting. Either ascending 
(default or "asc") or descending ("desc")                            |
-       
+-----------+----------+---------------------------------------------------------------------------------------------------------------------+
-       | limit     | no       | Choose the maximum number of results to return 
                                                                     |
-       
+-----------+----------+---------------------------------------------------------------------------------------------------------------------+
-       | offset    | no       | The number of results to skip before beginning 
to return results. Must use in conjunction with ``limit``            |
-       
+-----------+----------+---------------------------------------------------------------------------------------------------------------------+
-       | page      | no       | Return the n\ :sup:`th` page of results, where 
"n" is the value of this parameter, pages are ``limit`` long and the |
-       |           |          | first page is 1. If ``offset`` was defined, 
this query parameter has no effect. ``limit`` must be defined to make   |
-       |           |          | use of ``page``.                               
                                                                     |
-       
+-----------+----------+---------------------------------------------------------------------------------------------------------------------+
-
-
-.. code-block:: http
-       :caption: Request Example
-
-       GET /api/4.0/capabilities?name=test HTTP/1.1
-       Host: trafficops.infra.ciab.test
-       User-Agent: curl/7.47.0
-       Accept: */*
-       Cookie: mojolicious=...
-
-Response Structure
-------------------
-:name:        Name of the capability
-:description: Describes the permissions covered by the capability.
-:lastUpdated: Date and time of the last update made to this capability, in 
:ref:`non-rfc-datetime`
-
-.. code-block:: http
-       :caption: Response Example
-
-       HTTP/1.1 200 OK
-       Access-Control-Allow-Credentials: true
-       Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, 
Accept, Set-Cookie, Cookie
-       Access-Control-Allow-Methods: POST,GET,OPTIONS,PUT,DELETE
-       Access-Control-Allow-Origin: *
-       Content-Type: application/json
-       Vary: Accept-Encoding
-       Transfer-Encoding: chunked
-       Set-Cookie: mojolicious=...; Path=/; Expires=Mon, 18 Nov 2019 17:40:54 
GMT; Max-Age=3600; HttpOnly
-       Whole-Content-Sha512: 
c18+GtX2ZI8PoCSwuAzBhl+6w3vDpKQTa/cDJC0WHxdpguOL378KBxGWW5PCSyZfJUb7wPyOL5qKMn6NNTufhg==
-       X-Server-Name: traffic_ops_golang/
-       Date: Thu, 15 Aug 2019 17:20:20 GMT
-       Content-Length: 161
-
-       { "response": [
-               {
-                       "description": "This is only a test. If this were a 
real capability, it might do something",
-                       "lastUpdated": "2019-08-15 17:18:03+00",
-                       "name": "test"
-               }
-       ]}
diff --git a/traffic_control/clients/python/trafficops/tosession.py 
b/traffic_control/clients/python/trafficops/tosession.py
index c83389d..3ba7438 100644
--- a/traffic_control/clients/python/trafficops/tosession.py
+++ b/traffic_control/clients/python/trafficops/tosession.py
@@ -258,7 +258,7 @@ class TOSession(RestApiSession):
        def get_api_capabilities(self, query_params=None):
                """
                Get all API-capability mappings
-               :ref:`to-api-api_capabilities`
+               :ref:`to-api-v3-api_capabilities`
                :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], 
requests.Response]
                :raises: Union[LoginError, OperationError]
                """
@@ -434,7 +434,7 @@ class TOSession(RestApiSession):
        def get_capabilities(self, query_params=None):
                """
                Retrieves capabilities
-               :ref:`to-api-capabilities`
+               :ref:`to-api-v3-capabilities`
                :param query_params: See API page for more information on 
accepted parameters
                :type query_params: Dict[str, Any]
                :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], 
requests.Response]
diff --git a/traffic_ops/testing/api/v4/capabilities_test.go 
b/traffic_ops/testing/api/v4/capabilities_test.go
deleted file mode 100644
index b3f602f..0000000
--- a/traffic_ops/testing/api/v4/capabilities_test.go
+++ /dev/null
@@ -1,160 +0,0 @@
-package v4
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.
- */
-
-import (
-       "fmt"
-       "net/http"
-       "testing"
-       "time"
-
-       "github.com/apache/trafficcontrol/lib/go-rfc"
-       "github.com/apache/trafficcontrol/lib/go-tc"
-       client "github.com/apache/trafficcontrol/traffic_ops/v4-client"
-)
-
-// These capabilities are defined during the setup process in todb.go.
-// ANY TIME THOSE ARE CHANGED THIS MUST BE UPDATED.
-var staticCapabilities = []tc.Capability{
-       {
-               Name:        "all-read",
-               Description: "Full read access",
-       },
-       {
-               Name:        "all-write",
-               Description: "Full write access",
-       },
-       {
-               Name:        "cdn-read",
-               Description: "View CDN configuration",
-       },
-       {
-               Name:        "asns-read",
-               Description: "Read ASNs",
-       },
-       {
-               Name:        "asns-write",
-               Description: "Write ASNs",
-       },
-       {
-               Name:        "cache-groups-read",
-               Description: "Read CGs",
-       },
-}
-
-func TestCapabilities(t *testing.T) {
-       CreateTestCapabilities(t)
-       GetTestCapabilitiesIMS(t)
-       GetTestCapabilities(t)
-}
-
-func CreateTestCapabilities(t *testing.T) {
-       db, err := OpenConnection()
-       if err != nil {
-               t.Fatal("cannot open db")
-       }
-       defer db.Close()
-       dbInsertTemplate := `INSERT INTO capability (name, description) VALUES 
('%v', '%v');`
-
-       for _, c := range testData.Capabilities {
-               err = execSQL(db, fmt.Sprintf(dbInsertTemplate, c.Name, 
c.Description))
-               if err != nil {
-                       t.Errorf("could not create capability: %v", err)
-               }
-       }
-}
-
-func GetTestCapabilitiesIMS(t *testing.T) {
-       opts := client.NewRequestOptions()
-       futureTime := time.Now().AddDate(0, 0, 1)
-       time := futureTime.Format(time.RFC1123)
-       opts.Header.Set(rfc.IfModifiedSince, time)
-       testDataLen := len(testData.Capabilities) + len(staticCapabilities)
-       capMap := make(map[string]string, testDataLen)
-
-       for _, c := range testData.Capabilities {
-               opts.QueryParameters.Set("name", c.Name)
-               capMap[c.Name] = c.Description
-               _, reqInf, err := TOSession.GetCapabilities(opts)
-               if err != nil {
-                       t.Fatalf("Expected no error, but got %v", err.Error())
-               }
-               if reqInf.StatusCode != http.StatusNotModified {
-                       t.Fatalf("Expected 304 status code, got %v", 
reqInf.StatusCode)
-               }
-       }
-}
-
-func GetTestCapabilities(t *testing.T) {
-       testDataLen := len(testData.Capabilities) + len(staticCapabilities)
-       capMap := make(map[string]string, testDataLen)
-       opts := client.NewRequestOptions()
-
-       for _, c := range testData.Capabilities {
-               capMap[c.Name] = c.Description
-               opts.QueryParameters.Set("name", c.Name)
-               caps, _, err := TOSession.GetCapabilities(opts)
-               if err != nil {
-                       t.Errorf("could not get capability '%s': %v - alerts: 
%+v", c.Name, err, caps.Alerts)
-                       continue
-               }
-               if len(caps.Response) != 1 {
-                       t.Errorf("Expected exactly one capability named '%s' to 
exist, found: %d", c.Name, len(caps.Response))
-                       continue
-               }
-
-               cap := caps.Response[0]
-
-               if cap.Name != c.Name {
-                       t.Errorf("requested capacity '%s' but got a capacity 
with the name '%s'", c.Name, cap.Name)
-               }
-               if cap.Description != c.Description {
-                       t.Errorf("capacity '%s' has the wrong description, want 
'%s' but got '%s'", c.Name, c.Description, cap.Description)
-               }
-       }
-
-       // Hopefully this won't need to be done for much longer
-       for _, c := range staticCapabilities {
-               capMap[c.Name] = c.Description
-       }
-
-       caps, _, err := TOSession.GetCapabilities(client.RequestOptions{})
-       if err != nil {
-               t.Fatalf("could not get all capabilities: %v - alerts: %+v", 
err, caps.Alerts)
-       }
-       if len(caps.Response) != testDataLen {
-               t.Fatalf("response returned different number of capabilities 
than those that exist; got %d, want %d", len(caps.Response), testDataLen)
-       }
-
-       for _, c := range caps.Response {
-               if desc, ok := capMap[c.Name]; !ok {
-                       t.Errorf("capability '%s' found in response, but not in 
test data!", c.Name)
-               } else {
-                       if desc != c.Description {
-                               t.Errorf("capability '%s' has description '%s' 
in response, but had '%s' in the test data", c.Name, c.Description, desc)
-                       }
-                       delete(capMap, c.Name)
-               }
-       }
-
-       for c := range capMap {
-               t.Errorf("Capability '%s' existed in the test data but didn't 
appear in the response!", c)
-       }
-}
diff --git a/traffic_ops/traffic_ops_golang/apicapability/api_capabilities.go 
b/traffic_ops/traffic_ops_golang/apicapability/api_capabilities.go
index 74ec074..6b76959 100644
--- a/traffic_ops/traffic_ops_golang/apicapability/api_capabilities.go
+++ b/traffic_ops/traffic_ops_golang/apicapability/api_capabilities.go
@@ -6,17 +6,6 @@
 // have been fully removed.
 package apicapability
 
-import (
-       "fmt"
-       "net/http"
-
-       "github.com/apache/trafficcontrol/lib/go-tc"
-       "github.com/apache/trafficcontrol/lib/go-util"
-       "github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/api"
-       
"github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/dbhelpers"
-       "github.com/jmoiron/sqlx"
-)
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -36,6 +25,19 @@ import (
  * under the License.
  */
 
+import (
+       "fmt"
+       "net/http"
+
+       "github.com/apache/trafficcontrol/lib/go-log"
+       "github.com/apache/trafficcontrol/lib/go-tc"
+       "github.com/apache/trafficcontrol/lib/go-util"
+       "github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/api"
+       
"github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/dbhelpers"
+
+       "github.com/jmoiron/sqlx"
+)
+
 // GetAPICapabilitiesHandler implements an http handler that returns
 // API Capabilities. In the event a capability parameter is supplied,
 // it will return only those with an exact match.
@@ -43,30 +45,29 @@ import (
 func GetAPICapabilitiesHandler(w http.ResponseWriter, r *http.Request) {
        inf, userErr, sysErr, errCode := api.NewInfo(r, nil, nil)
        if userErr != nil || sysErr != nil {
-               api.HandleErr(w, r, inf.Tx.Tx, errCode, userErr, sysErr)
+               api.HandleDeprecatedErr(w, r, inf.Tx.Tx, errCode, userErr, 
sysErr, nil)
                return
        }
        defer inf.Close()
 
        results, errCode, usrErr, sysErr := getAPICapabilities(inf.Tx, 
inf.Params)
        if usrErr != nil || sysErr != nil {
-               api.HandleErr(w, r, inf.Tx.Tx, errCode, usrErr, sysErr)
+               api.HandleDeprecatedErr(w, r, inf.Tx.Tx, errCode, usrErr, 
sysErr, nil)
                return
        }
 
-       api.WriteResp(w, r, results)
-       return
+       api.WriteRespAlertObj(w, r, tc.WarnLevel, "This endpoint is deprecated, 
and will be removed in the future", results)
 }
 
 func getAPICapabilities(tx *sqlx.Tx, params map[string]string) 
([]tc.APICapability, int, error, error) {
        var err error
        selectQuery := `SELECT id, http_method, route, capability, last_updated 
FROM api_capability`
        queryParamsToQueryCols := map[string]dbhelpers.WhereColumnInfo{
-               "id":          dbhelpers.WhereColumnInfo{Column: "id", Checker: 
api.IsInt},
-               "capability":  dbhelpers.WhereColumnInfo{Column: "capability"},
-               "httpMethod":  dbhelpers.WhereColumnInfo{Column: "http_method"},
-               "route":       dbhelpers.WhereColumnInfo{Column: "route"},
-               "lastUpdated": dbhelpers.WhereColumnInfo{Column: 
"last_updated"},
+               "id":          {Column: "id", Checker: api.IsInt},
+               "capability":  {Column: "capability"},
+               "httpMethod":  {Column: "http_method"},
+               "route":       {Column: "route"},
+               "lastUpdated": {Column: "last_updated"},
        }
 
        where, orderBy, pagination, queryValues, errs :=
@@ -75,7 +76,7 @@ func getAPICapabilities(tx *sqlx.Tx, params 
map[string]string) ([]tc.APICapabili
        if len(errs) > 0 {
                err = util.JoinErrs(errs)
                return nil, http.StatusInternalServerError, nil, fmt.Errorf(
-                       "query exception: could not build api_capability query 
with params: %v, error: %v",
+                       "query exception: could not build api_capability query 
with params: %v, error: %w",
                        params,
                        err,
                )
@@ -88,7 +89,7 @@ func getAPICapabilities(tx *sqlx.Tx, params 
map[string]string) ([]tc.APICapabili
                usrErr, sysErr, errCode := api.ParseDBError(err)
                return nil, errCode, usrErr, sysErr
        }
-       defer rows.Close()
+       defer log.Close(rows, "closing APICapability rows")
 
        apiCaps := []tc.APICapability{}
        for rows.Next() {
@@ -102,7 +103,7 @@ func getAPICapabilities(tx *sqlx.Tx, params 
map[string]string) ([]tc.APICapabili
                )
                if err != nil {
                        return nil, http.StatusInternalServerError, nil, 
fmt.Errorf(
-                               "api capability read: scanning: %v", err,
+                               "api capability read: scanning: %w", err,
                        )
                }
                apiCaps = append(apiCaps, ac)
diff --git a/traffic_ops/traffic_ops_golang/capabilities/capabilities.go 
b/traffic_ops/traffic_ops_golang/capabilities/capabilities.go
index 705517f..49f8bea 100644
--- a/traffic_ops/traffic_ops_golang/capabilities/capabilities.go
+++ b/traffic_ops/traffic_ops_golang/capabilities/capabilities.go
@@ -1,3 +1,9 @@
+// Package capabilities contains logic and handlers for the /capabilities API
+// endpoint.
+//
+// Deprecated: "Capabilities" (now called Permissions) are no longer handled
+// this way, and this package should be removed once API versions that use it
+// have been fully removed.
 package capabilities
 
 /*
@@ -21,9 +27,11 @@ package capabilities
 
 import (
        "database/sql"
+       "errors"
        "fmt"
        "net/http"
 
+       "github.com/apache/trafficcontrol/lib/go-log"
        "github.com/apache/trafficcontrol/lib/go-tc"
        "github.com/apache/trafficcontrol/lib/go-util"
        "github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/api"
@@ -37,49 +45,54 @@ SELECT description,
 FROM capability
 `
 
+// Read handles GET requests to /capabilities.
+//
+// Deprecated: "Capabilities" (now called Permissions) are no longer handled
+// this way, and this package should be removed once API versions that use it
+// have been fully removed.
 func Read(w http.ResponseWriter, r *http.Request) {
        inf, sysErr, userErr, errCode := api.NewInfo(r, nil, nil)
        tx := inf.Tx.Tx
        if userErr != nil || sysErr != nil {
-               api.HandleErr(w, r, tx, errCode, userErr, sysErr)
+               api.HandleDeprecatedErr(w, r, tx, errCode, userErr, sysErr, nil)
                return
        }
        defer inf.Close()
 
        cols := map[string]dbhelpers.WhereColumnInfo{
-               "name": dbhelpers.WhereColumnInfo{Column: "capability.name"},
+               "name": {Column: "capability.name"},
        }
 
        where, orderBy, pagination, queryValues, errs := 
dbhelpers.BuildWhereAndOrderByAndPagination(inf.Params, cols)
        if len(errs) > 0 {
                errCode = http.StatusBadRequest
                userErr = util.JoinErrs(errs)
-               api.HandleErr(w, r, tx, errCode, userErr, nil)
+               api.HandleDeprecatedErr(w, r, tx, errCode, userErr, nil, nil)
                return
        }
 
        query := readQuery + where + orderBy + pagination
        rows, err := inf.Tx.NamedQuery(query, queryValues)
-       if err != nil && err != sql.ErrNoRows {
+       if err != nil && errors.Is(err, sql.ErrNoRows) {
                errCode = http.StatusInternalServerError
-               sysErr = fmt.Errorf("querying capabilities: %v", err)
-               api.HandleErr(w, r, tx, errCode, nil, sysErr)
+               sysErr = fmt.Errorf("querying capabilities: %w", err)
+               api.HandleDeprecatedErr(w, r, tx, errCode, nil, sysErr, nil)
                return
        }
-       defer rows.Close()
+       defer log.Close(rows, "closing Capabilities rows")
 
        caps := []tc.Capability{}
        for rows.Next() {
-               cap := tc.Capability{}
-               if err := rows.Scan(&cap.Description, &cap.LastUpdated, 
&cap.Name); err != nil {
+               var capability tc.Capability
+               if err := rows.Scan(&capability.Description, 
&capability.LastUpdated, &capability.Name); err != nil {
                        errCode = http.StatusInternalServerError
-                       sysErr = fmt.Errorf("Parsing database response: %v", 
err)
-                       api.HandleErr(w, r, tx, errCode, nil, sysErr)
+                       sysErr = fmt.Errorf("parsing database response: %w", 
err)
+                       api.HandleDeprecatedErr(w, r, tx, errCode, nil, sysErr, 
nil)
                        return
                }
 
-               caps = append(caps, cap)
+               caps = append(caps, capability)
        }
 
-       api.WriteResp(w, r, caps)
+       api.WriteRespAlertObj(w, r, tc.WarnLevel, "This endpoint is deprecated, 
and will be removed in the future", caps)
 }
diff --git a/traffic_ops/traffic_ops_golang/routing/routes.go 
b/traffic_ops/traffic_ops_golang/routing/routes.go
index 710220d..85a407e 100644
--- a/traffic_ops/traffic_ops_golang/routing/routes.go
+++ b/traffic_ops/traffic_ops_golang/routing/routes.go
@@ -178,9 +178,6 @@ func Routes(d ServerData) ([]Route, http.Handler, error) {
                {api.Version{Major: 4, Minor: 0}, http.MethodPost, 
`cachegroups/{id}/queue_update$`, cachegroup.QueueUpdates, 
auth.PrivLevelOperations, []string{"CACHE-GROUP:READ", "CDN:READ", 
"SERVER:READ", "SERVER:QUEUE"}, Authenticated, nil, 40716441103},
                {api.Version{Major: 4, Minor: 0}, http.MethodPost, 
`cachegroups/{id}/deliveryservices/?$`, cachegroup.DSPostHandlerV40, 
auth.PrivLevelOperations, []string{"CACHE-GROUP:UPDATE", 
"DELIVERY-SERVICE:UPDATE", "CACHE-GROUP:READ", "DELIVERY-SERVICE:READ"}, 
Authenticated, nil, 45202404313},
 
-               //Capabilities
-               {api.Version{Major: 4, Minor: 0}, http.MethodGet, 
`capabilities/?$`, capabilities.Read, auth.PrivLevelReadOnly, 
[]string{"CAPABILITY:READ"}, Authenticated, nil, 40081353},
-
                //CDN
                {api.Version{Major: 4, Minor: 0}, http.MethodGet, 
`cdns/name/{name}/sslkeys/?$`, cdn.GetSSLKeys, auth.PrivLevelAdmin, 
[]string{"DS-SECURITY-KEY:READ", "CDN:READ", "DELIVERY-SERVICE:READ"}, 
Authenticated, nil, 42785817723},
 
diff --git a/traffic_ops/v4-client/capability.go 
b/traffic_ops/v4-client/capability.go
deleted file mode 100644
index 03d3fe3..0000000
--- a/traffic_ops/v4-client/capability.go
+++ /dev/null
@@ -1,30 +0,0 @@
-package client
-
-/*
- * 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.
- */
-
-import (
-       "github.com/apache/trafficcontrol/lib/go-tc"
-       "github.com/apache/trafficcontrol/traffic_ops/toclientlib"
-)
-
-// apiCapabilities is the API version-relative path for the /capabilities API 
endpoint.
-const apiCapabilities = "/capabilities"
-
-// GetCapabilities retrieves capabilities.
-func (to *Session) GetCapabilities(opts RequestOptions) 
(tc.CapabilitiesResponse, toclientlib.ReqInf, error) {
-       var data tc.CapabilitiesResponse
-       reqInf, err := to.get(apiCapabilities, opts, &data)
-       return data, reqInf, err
-}

Reply via email to