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

ocket8888 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 22f523e  Deprecate GET servers id (#4505)
22f523e is described below

commit 22f523ef1a942780e2f5f6ae6f24c8030932bcf4
Author: Michael Hoppal <[email protected]>
AuthorDate: Wed Mar 18 14:55:52 2020 -0600

    Deprecate GET servers id (#4505)
    
    * Deprecate GET servers id
    
    * Fix docs build issue
---
 CHANGELOG.md                                       |   1 +
 docs/source/api/v1/servers_id.rst                  |   9 ++
 docs/source/api/v2/servers_id.rst                  | 175 +--------------------
 .../clients/python/trafficops/tosession.py         |  11 --
 traffic_ops/client/server.go                       |   2 +-
 traffic_ops/traffic_ops_golang/routing/routes.go   |   3 +-
 6 files changed, 14 insertions(+), 187 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 21ec6aa..871febb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -90,6 +90,7 @@ The format is based on [Keep a 
Changelog](http://keepachangelog.com/en/1.0.0/).
   - /riak/ping
   - /riak/stats
   - /servercheck/aadata
+  - /servers/:id (GET)
   - /servers/totals
   - /stats_summary/create
   - /to_extensions/:id/delete
diff --git a/docs/source/api/v1/servers_id.rst 
b/docs/source/api/v1/servers_id.rst
index bb3e715..1273227 100644
--- a/docs/source/api/v1/servers_id.rst
+++ b/docs/source/api/v1/servers_id.rst
@@ -21,6 +21,9 @@
 
 ``GET``
 =======
+.. deprecated:: ATCv4
+       Use the ``GET`` method of :ref:`to-api-v1-servers` with the query 
parameter ``id`` instead.
+
 Retrieves properties of a specific server.
 
 :Auth. Required: Yes
@@ -184,6 +187,12 @@ Response Structure
                        "xmppId": "mid",
                        "xmppPasswd": ""
                }
+       ],
+       "alerts": [
+               {
+                       "text": "This endpoint is deprecated, please use GET 
/servers with query parameter id instead",
+                       "level": "warning"
+               }
        ]}
 
 .. [1] For more information see the `Wikipedia page on Lights-Out management 
<https://en.wikipedia.org/wiki/Out-of-band_management>`_\ .
diff --git a/docs/source/api/v2/servers_id.rst 
b/docs/source/api/v2/servers_id.rst
index 6d4ce3c..de0666b 100644
--- a/docs/source/api/v2/servers_id.rst
+++ b/docs/source/api/v2/servers_id.rst
@@ -19,179 +19,6 @@
 ``servers/{{ID}}``
 ******************
 
-``GET``
-=======
-Retrieves properties of a specific server.
-
-:Auth. Required: Yes
-:Roles Required: None
-:Response Type:  Array
-
-Request Structure
------------------
-.. table:: Request Path Parameters
-
-       +------+---------------------------------------------+
-       | Name |                Description                  |
-       +======+=============================================+
-       | ID   | The integral, unique identifier of a server |
-       +------+---------------------------------------------+
-
-.. table:: Request Query Parameters
-
-       
+-----------+----------+---------------------------------------------------------------------------------------------------------------+
-       | Name      | Required | Description                                    
                                                               |
-       
+===========+==========+===============================================================================================================+
-       | 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/2.0/servers?id=10 HTTP/1.1
-       Host: trafficops.infra.ciab.test
-       User-Agent: curl/7.47.0
-       Accept: */*
-       Cookie: mojolicious=...
-
-Response Structure
-------------------
-:cachegroup:     A string that is the :ref:`name of the Cache Group 
<cache-group-name>` to which the server belongs
-:cachegroupId:   An integer that is the :ref:`ID of the Cache Group 
<cache-group-id>` to which the server belongs
-:cdnId:          The integral, unique identifier of the CDN to which the 
server belongs
-:cdnName:        Name of the CDN to which the server belongs
-:domainName:     The domain part of the server's Fully Qualified Domain Name 
(FQDN)
-:guid:           An identifier used to uniquely identify the server
-
-       .. note:: This is a legacy key which only still exists for 
compatibility reasons - it should always be ``null``
-
-:hostName:       The (short) hostname of the server
-:httpsPort:      The port on which the server listens for incoming HTTPS 
connections/requests
-:id:             An integral, unique identifier for this server
-:iloIpAddress:   The IPv4 address of the server's Integrated Lights-Out (ILO) 
service\ [1]_
-:iloIpGateway:   The IPv4 gateway address of the server's ILO service\ [1]_
-:iloIpNetmask:   The IPv4 subnet mask of the server's ILO service\ [1]_
-:iloPassword:    The password of the of the server's ILO service user\ [1]_ - 
displays as simply ``******`` if the currently logged-in user does not have the 
'admin' or 'operations' role(s)
-:iloUsername:    The user name for the server's ILO service\ [1]_
-:interfaceMtu:   The Maximum Transmission Unit (MTU) to configured on 
``interfaceName``
-:interfaceName:  The name of the primary network interface used by the server
-:ip6Address:     The IPv6 address and subnet mask of ``interfaceName``
-:ip6IsService:   A boolean value which if ``true`` indicates that the IPv6 
address will be used for routing content.
-:ip6Gateway:     The IPv6 address of the gateway used by ``interfaceName``
-:ipAddress:      The IPv4 address of ``interfaceName``
-:ipIsService:    A boolean value which if ``true`` indicates that the IPv4 
address will be used for routing content.
-:ipGateway:      The IPv4 address of the gateway used by ``interfaceName``
-:ipNetmask:      The IPv4 subnet mask used by ``interfaceName``
-:lastUpdated:    The date and time at which this server description was last 
modified
-:mgmtIpAddress:  The IPv4 address of some network interface on the server used 
for 'management'
-:mgmtIpGateway:  The IPv4 address of a gateway used by some network interface 
on the server used for 'management'
-:mgmtIpNetmask:  The IPv4 subnet mask used by some network interface on the 
server used for 'management'
-:offlineReason:  A user-entered reason why the server is in ADMIN_DOWN or 
OFFLINE status
-:physLocation:   The name of the physical location where the server resides
-:physLocationId: An integral, unique identifier for the physical location 
where the server resides
-:profile:        The :ref:`profile-name` of the :term:`Profile` used by this 
server
-:profileDesc:    A :ref:`profile-description` of the :term:`Profile` used by 
this server
-:profileId:      The :ref:`profile-id` the :term:`Profile` used by this server
-:revalPending:   A boolean value which, if ``true`` indicates that this server 
has pending content invalidation/revalidation
-:rack:           A string indicating "server rack" location
-:routerHostName: The human-readable name of the router responsible for 
reaching this server
-:routerPortName: The human-readable name of the port used by the router 
responsible for reaching this server
-:status:         The status of the server
-
-       .. seealso:: :ref:`health-proto`
-
-:statusId: The integral, unique identifier of the status of this server
-
-       .. seealso:: :ref:`health-proto`
-
-:tcpPort: The port on which this server listens for incoming TCP connections
-
-       .. note:: This is typically thought of as synonymous with "HTTP port", 
as the port specified by ``httpsPort`` may also be used for incoming TCP 
connections.
-
-:type:       The name of the 'type' of this server
-:typeId:     The integral, unique identifier of the 'type' of this server
-:updPending: A boolean value which, if ``true``, indicates that the server has 
updates of some kind pending, typically to be acted upon by Traffic Ops ORT
-:xmppId:     An identifier to be used in XMPP communications with the server - 
in nearly all cases this will be the same as ``hostName``
-:xmppPasswd: The password used in XMPP communications with the server
-
-.. 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
-       Set-Cookie: mojolicious=...; Path=/; Expires=Mon, 18 Nov 2019 17:40:54 
GMT; Max-Age=3600; HttpOnly
-       Whole-Content-Sha512: 
WyapQctUIhjzEALka5QbBiZRZ58Mlc6MJSwjBeGyJS2UzbL3W6lN/4kvAZtPrP4qMWQBWz6JjbF7Y5lNRASUmQ==
-       X-Server-Name: traffic_ops_golang/
-       Date: Mon, 10 Dec 2018 16:40:01 GMT
-       Content-Length: 939
-
-       { "response": [
-               {
-                       "cachegroup": "CDN_in_a_Box_Mid",
-                       "cachegroupId": 6,
-                       "cdnId": 2,
-                       "cdnName": "CDN-in-a-Box",
-                       "domainName": "infra.ciab.test",
-                       "guid": null,
-                       "hostName": "mid",
-                       "httpsPort": 443,
-                       "id": 10,
-                       "iloIpAddress": "",
-                       "iloIpGateway": "",
-                       "iloIpNetmask": "",
-                       "iloPassword": "",
-                       "iloUsername": "",
-                       "interfaceMtu": 1500,
-                       "interfaceName": "eth0",
-                       "ip6Address": "fc01:9400:1000:8::120",
-                       "ip6Gateway": "fc01:9400:1000:8::1",
-                       "ipAddress": "172.16.239.120",
-                       "ipGateway": "172.16.239.1",
-                       "ipNetmask": "255.255.255.0",
-                       "lastUpdated": "2018-12-05 18:45:05+00",
-                       "mgmtIpAddress": "",
-                       "mgmtIpGateway": "",
-                       "mgmtIpNetmask": "",
-                       "offlineReason": "",
-                       "physLocation": "Apachecon North America 2018",
-                       "physLocationId": 1,
-                       "profile": "ATS_MID_TIER_CACHE",
-                       "profileDesc": "Mid Cache - Apache Traffic Server",
-                       "profileId": 10,
-                       "rack": "",
-                       "revalPending": false,
-                       "routerHostName": "",
-                       "routerPortName": "",
-                       "status": "REPORTED",
-                       "statusId": 3,
-                       "tcpPort": 80,
-                       "type": "MID",
-                       "typeId": 12,
-                       "updPending": false,
-                       "xmppId": "mid",
-                       "xmppPasswd": "",
-                       "ipIsService": true,
-                       "ip6IsService": true
-               }
-       ]}
-
-.. [1] For more information see the `Wikipedia page on Lights-Out management 
<https://en.wikipedia.org/wiki/Out-of-band_management>`_\ .
-
 ``PUT``
 =======
 Allow user to edit a server.
@@ -478,3 +305,5 @@ Response Structure
                        "level": "success"
                }
        ]}
+
+.. [1] For more information see the `Wikipedia page on Lights-Out management 
<https://en.wikipedia.org/wiki/Out-of-band_management>`_\ .
diff --git a/traffic_control/clients/python/trafficops/tosession.py 
b/traffic_control/clients/python/trafficops/tosession.py
index 8e01c57..82ff492 100644
--- a/traffic_control/clients/python/trafficops/tosession.py
+++ b/traffic_control/clients/python/trafficops/tosession.py
@@ -1640,17 +1640,6 @@ class TOSession(RestApiSession):
                :raises: Union[LoginError, OperationError]
                """
 
-       @api_request('get', 'servers/{server_id:d}', ('2.0',))
-       def get_server_by_id(self, server_id=None):
-               """
-               Get Server by Server ID
-               :ref:`to-api-servers-id`
-               :param server_id: The server id to retrieve
-               :type server_id: int
-               :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], 
requests.Response]
-               :raises: Union[LoginError, OperationError]
-               """
-
        @api_request('get', 'servers/{server_id:d}/deliveryservices', ('2.0',))
        def get_server_delivery_services(self, server_id=None):
                """
diff --git a/traffic_ops/client/server.go b/traffic_ops/client/server.go
index 6127d87..90c6f60 100644
--- a/traffic_ops/client/server.go
+++ b/traffic_ops/client/server.go
@@ -152,7 +152,7 @@ func (to *Session) GetServers() ([]tc.Server, ReqInf, 
error) {
 
 // GetServerByID GETs a Server by the Server ID.
 func (to *Session) GetServerByID(id int) ([]tc.Server, ReqInf, error) {
-       route := fmt.Sprintf("%s/%d", API_SERVERS, id)
+       route := fmt.Sprintf("%s?id=%d", API_SERVERS, id)
        resp, remoteAddr, err := to.request(http.MethodGet, route, nil)
        reqInf := ReqInf{CacheHitStatus: CacheHitStatusMiss, RemoteAddr: 
remoteAddr}
        if err != nil {
diff --git a/traffic_ops/traffic_ops_golang/routing/routes.go 
b/traffic_ops/traffic_ops_golang/routing/routes.go
index 6f4b1b1..222731c 100644
--- a/traffic_ops/traffic_ops_golang/routing/routes.go
+++ b/traffic_ops/traffic_ops_golang/routing/routes.go
@@ -313,7 +313,6 @@ func Routes(d ServerData) ([]Route, []RawRoute, 
http.Handler, error) {
 
                //Server: CRUD
                {api.Version{2, 0}, http.MethodGet, `servers/?$`, 
api.ReadHandler(&server.TOServer{}), auth.PrivLevelReadOnly, Authenticated, 
nil, 2720959285, noPerlBypass},
-               {api.Version{2, 0}, http.MethodGet, `servers/{id}$`, 
api.ReadHandler(&server.TOServer{}), auth.PrivLevelReadOnly, Authenticated, 
nil, 2543122028, noPerlBypass},
                {api.Version{2, 0}, http.MethodPut, `servers/{id}$`, 
api.UpdateHandler(&server.TOServer{}), auth.PrivLevelOperations, Authenticated, 
nil, 258634103, noPerlBypass},
                {api.Version{2, 0}, http.MethodPost, `servers/?$`, 
api.CreateHandler(&server.TOServer{}), auth.PrivLevelOperations, Authenticated, 
nil, 2225558061, noPerlBypass},
                {api.Version{2, 0}, http.MethodDelete, `servers/{id}$`, 
api.DeleteHandler(&server.TOServer{}), auth.PrivLevelOperations, Authenticated, 
nil, 292322233, noPerlBypass},
@@ -719,7 +718,7 @@ func Routes(d ServerData) ([]Route, []RawRoute, 
http.Handler, error) {
 
                //Server: CRUD
                {api.Version{1, 1}, http.MethodGet, `servers/?(\.json)?$`, 
api.ReadHandler(&server.TOServer{}), auth.PrivLevelReadOnly, Authenticated, 
nil, 1720959285, noPerlBypass},
-               {api.Version{1, 1}, http.MethodGet, `servers/{id}$`, 
api.ReadHandler(&server.TOServer{}), auth.PrivLevelReadOnly, Authenticated, 
nil, 1543122028, noPerlBypass},
+               {api.Version{1, 1}, http.MethodGet, `servers/{id}$`, 
api.DeprecatedReadHandler(&server.TOServer{}, util.StrPtr("GET /servers with 
query parameter id")), auth.PrivLevelReadOnly, Authenticated, nil, 1543122028, 
noPerlBypass},
                {api.Version{1, 1}, http.MethodPut, `servers/{id}$`, 
api.UpdateHandler(&server.TOServer{}), auth.PrivLevelOperations, Authenticated, 
nil, 958634103, noPerlBypass},
                {api.Version{1, 1}, http.MethodPost, `servers/?$`, 
api.CreateHandler(&server.TOServer{}), auth.PrivLevelOperations, Authenticated, 
nil, 2025558061, noPerlBypass},
                {api.Version{1, 1}, http.MethodDelete, `servers/{id}$`, 
api.DeleteHandler(&server.TOServer{}), auth.PrivLevelOperations, Authenticated, 
nil, 192322233, noPerlBypass},

Reply via email to