Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove /servers/details from APIv4 #6819

Merged
merged 6 commits into from
May 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Traffic Monitor: Add support for `access.log` to TM.
- Added functionality for login to provide a Bearer token and for that token to be later used for authorization.
- [Traffic Ops] Added support for backend configurations so that Traffic Ops can act as a reverse proxy for these services [#6754](https://github.com/apache/trafficcontrol/pull/6754).
- Added functionality for CDN locks, so that they can be shared amongst a list of specified usernames.
- Added functionality for CDN locks, so that they can be shared amongst a list of specified usernames.
- [Traffic Ops | Traffic Go Clients | T3C] Add additional timestamp fields to server for queuing and dequeueing config and revalidate updates.
- Added layered profile feature to 4.0 for `GET` /servers/, `POST` /servers/, `PUT` /servers/{id} and `DELETE` /servers/{id}.
- Added a Traffic Ops endpoint and Traffic Portal page to view all CDNi configuration update requests and approve or deny.
- Added layered profile feature to 4.0 for `GET` /servers/details.
- Added layered profile feature to 4.0 for `GET` /deliveryservices/{id}/servers/ and /deliveryservices/{id}/servers/eligible.

### Fixed
Expand Down Expand Up @@ -56,6 +55,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Replace `forever` with `pm2` for process management of the traffic portal node server to remediate security issues.
- Removed the Traffic Monitor `peer_polling_protocol` option. Traffic Monitor now just uses hostnames to request peer states, which can be handled via IPv4 or IPv6 depending on the underlying IP version in use.
- Dropped CentOS 8 support
- The `/servers/details` endpoint of the Traffic Ops API has been dropped in version 4.0, and marked deprecated in earlier versions.

### Changed
- [#6654](https://github.com/apache/trafficcontrol/issues/6654) Traffic Monitor now uses the TO API 4.0 by default and falls back to 3.1
Expand Down
3 changes: 3 additions & 0 deletions docs/source/api/v3/servers_details.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
*******************
Retrieves details of :ref:`tp-configure-servers`.

.. deprecated:: 3.1
This endpoint has been removed from the latest version of the API, and clients are advised to use :ref:`to-api-v3-servers` instead.


``GET``
=======
Expand Down
192 changes: 0 additions & 192 deletions docs/source/api/v4/servers_details.rst

This file was deleted.

7 changes: 5 additions & 2 deletions traffic_control/clients/python/trafficops/tosession.py
Original file line number Diff line number Diff line change
Expand Up @@ -1648,13 +1648,16 @@ def get_server_delivery_services(self, server_id=None):
:raises: Union[LoginError, OperationError]
"""

@api_request('get', 'servers/details?hostName={name}', ('3.0','4.0',))
@api_request('get', 'servers/details?hostName={name}', ('3.0',))
def get_server_details(self, name=None):
"""
Get servers/details
:ref:`to-api-servers-details`
:ref:`to-api-v3-servers-details`
:rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response]
:raises: Union[LoginError, OperationError]

.. deprecated:: 3.0
The endpoint this represents has been removed from APIv4 and clients should use get_servers instead.
"""

@api_request('post', 'servercheck', ('3.0',))
Expand Down
33 changes: 0 additions & 33 deletions traffic_ops/testing/api/v4/servers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ func TestServers(t *testing.T) {
header.Set(rfc.IfUnmodifiedSince, time)
UpdateTestServers(t)
UpdateTestServersWithHeaders(t, header)
GetTestServersDetails(t)
GetTestServers(t)
GetTestServersIMSAfterChange(t, header)
GetTestServersQueryParameters(t)
Expand Down Expand Up @@ -657,38 +656,6 @@ func GetTestServers(t *testing.T) {
}
}

func GetTestServersDetails(t *testing.T) {
opts := client.NewRequestOptions()
for _, server := range testData.Servers {
if server.HostName == nil {
t.Errorf("found server with nil hostname: %+v", server)
continue
}
opts.QueryParameters.Set("hostName", *server.HostName)
resp, _, err := TOSession.GetServersDetails(opts)
if err != nil {
t.Errorf("cannot get Server Details: %v - alerts: %+v", err, resp.Alerts)
}
if len(resp.Response) == 0 {
t.Fatal("no servers in response, quitting")
}
if len(resp.Response[0].ServerInterfaces) == 0 {
t.Fatalf("no interfaces to check, quitting")
}
if len(server.Interfaces) == 0 {
t.Fatalf("no interfaces to check, quitting")
}

// just check the first interface for noe
if resp.Response[0].ServerInterfaces[0].RouterHostName != server.Interfaces[0].RouterHostName {
t.Errorf("expected router host name to be %s, but got %s", server.Interfaces[0].RouterHostName, resp.Response[0].ServerInterfaces[0].RouterHostName)
}
if resp.Response[0].ServerInterfaces[0].RouterPortName != server.Interfaces[0].RouterPortName {
t.Errorf("expected router port to be %s, but got %s", server.Interfaces[0].RouterPortName, resp.Response[0].ServerInterfaces[0].RouterPortName)
}
}
}

func GetTestServersQueryParameters(t *testing.T) {
dses, _, err := TOSession.GetDeliveryServices(client.RequestOptions{QueryParameters: url.Values{"xmlId": []string{"ds1"}}})
if err != nil {
Expand Down
3 changes: 0 additions & 3 deletions traffic_ops/traffic_ops_golang/routing/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,6 @@ func Routes(d ServerData) ([]Route, http.Handler, error) {
{Version: api.Version{Major: 4, Minor: 0}, Method: http.MethodGet, Path: `servercheck/extensions$`, Handler: extensions.Get, RequiredPrivLevel: auth.PrivLevelReadOnly, RequiredPermissions: []string{"SERVER-CHECK:READ", "SERVER:READ"}, Authenticated: Authenticated, Middlewares: nil, ID: 4834985993},
{Version: api.Version{Major: 4, Minor: 0}, Method: http.MethodDelete, Path: `servercheck/extensions/{id}$`, Handler: extensions.Delete, RequiredPrivLevel: auth.PrivLevelReadOnly, RequiredPermissions: []string{"SERVER-CHECK:DELETE", "SERVER-CHECK:READ", "SERVER:READ"}, Authenticated: Authenticated, Middlewares: nil, ID: 4804982993},

//Server Details
{Version: api.Version{Major: 4, Minor: 0}, Method: http.MethodGet, Path: `servers/details/?$`, Handler: server.GetDetailParamHandler, RequiredPrivLevel: auth.PrivLevelReadOnly, RequiredPermissions: []string{"SERVER:READ", "DELIVERY-SERVICE:READ", "CDN:READ", "PHYSICAL-LOCATION:READ", "CACHE-GROUP:READ", "TYPE:READ", "PROFILE:READ"}, Authenticated: Authenticated, Middlewares: nil, ID: 42612647143},

//Server status
{Version: api.Version{Major: 4, Minor: 0}, Method: http.MethodPut, Path: `servers/{id}/status$`, Handler: server.UpdateStatusHandler, RequiredPrivLevel: auth.PrivLevelOperations, RequiredPermissions: []string{"SERVER:UPDATE", "SERVER:READ", "STATUS:READ"}, Authenticated: Authenticated, Middlewares: nil, ID: 4766638513},
{Version: api.Version{Major: 4, Minor: 0}, Method: http.MethodPost, Path: `servers/{id}/queue_update$`, Handler: server.QueueUpdateHandler, RequiredPrivLevel: auth.PrivLevelOperations, RequiredPermissions: []string{"SERVER:QUEUE", "SERVER:READ"}, Authenticated: Authenticated, Middlewares: nil, ID: 41894713},
Expand Down
Loading