You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by ma...@apache.org on 2020/03/03 20:09:50 UTC

[trafficcontrol] branch master updated: Deprecate deliveryservices/:id (#4460)

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

mattjackson 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 c6d8625  Deprecate deliveryservices/:id (#4460)
c6d8625 is described below

commit c6d862566605f1610e46b0a6452ce6ba60c3f698
Author: Steve Hamrick <sh...@users.noreply.github.com>
AuthorDate: Tue Mar 3 13:09:42 2020 -0700

    Deprecate deliveryservices/:id (#4460)
    
    * Deprecate deliveryservices/:id
    
    * Fix changelog and method
    
    * More review fixes
---
 CHANGELOG.md                                       |   1 +
 docs/source/api/v1/deliveryservices_id.rst         |  10 +-
 docs/source/api/v2/deliveryservices_id.rst         | 223 ---------------------
 .../clients/python/trafficops/tosession.py         |  12 --
 traffic_ops/client/deliveryservice.go              |   4 +-
 traffic_ops/traffic_ops_golang/routing/routes.go   |   3 +-
 6 files changed, 11 insertions(+), 242 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0923b51..1f5a8d9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -54,6 +54,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
   - /deliveryservice_user
   - /deliveryservice_user/:dsId/:userId
   - /deliveryservices/{dsid}/regexes/{regexid} (GET)
+  - /deliveryservices/:id (GET)
   - /deliveryservices/:id/state
   - /divisions/:division_name/regions
   - /divisions/:id
diff --git a/docs/source/api/v1/deliveryservices_id.rst b/docs/source/api/v1/deliveryservices_id.rst
index ebb6127..baf628e 100644
--- a/docs/source/api/v1/deliveryservices_id.rst
+++ b/docs/source/api/v1/deliveryservices_id.rst
@@ -21,8 +21,8 @@
 
 ``GET``
 =======
-.. caution::
-	It's often much better to the ``id`` query parameter of a ``GET`` request to :ref:`to-api-v1-deliveryservices` instead.
+.. deprecated:: ATCv4
+	Use the ``GET`` method of :ref:`to-api-v1-deliveryservices` with the ``id`` query parameter.
 
 Retrieves a specific :term:`Delivery Service`
 
@@ -189,7 +189,11 @@ Response Structure
 	Date: Mon, 10 Jun 2019 13:43:48 GMT
 	Content-Length: 1500
 
-	{ "response": [{
+	{ "alerts": [{
+		"level": "warning",
+		"text": "This endpoint is deprecated, please use GET /deliveryservices with the query parameter id instead."
+	}],
+	"response": [{
 		"active": true,
 		"anonymousBlockingEnabled": false,
 		"cacheurl": null,
diff --git a/docs/source/api/v2/deliveryservices_id.rst b/docs/source/api/v2/deliveryservices_id.rst
index 62cc3e6..72f03f7 100644
--- a/docs/source/api/v2/deliveryservices_id.rst
+++ b/docs/source/api/v2/deliveryservices_id.rst
@@ -19,229 +19,6 @@
 ``deliveryservices/{{ID}}``
 ***************************
 
-``GET``
-=======
-.. caution::
-	It's often much better to the ``id`` query parameter of a ``GET`` request to :ref:`to-api-deliveryservices` instead.
-
-Retrieves a specific :term:`Delivery Service`
-
-:Auth. Required: Yes
-:Roles Required: None\ [#tenancy]_
-:Response Type:  Array
-
-Request Structure
------------------
-.. table:: Request Query Parameters
-
-	+-------------+----------+------------------------------------------------------------------------------------------------------------------------------------------------+
-	| Name        | Required | Description                                                                                                                                    |
-	+=============+==========+================================================================================================================================================+
-	| cdn         | no       | Show only the :term:`Delivery Services` belonging to the CDN identified by this integral, unique identifier                                    |
-	+-------------+----------+------------------------------------------------------------------------------------------------------------------------------------------------+
-	| logsEnabled | no       | If true, return only :term:`Delivery Services` with logging enabled, otherwise return only :term:`Delivery Services` with logging disabled     |
-	+-------------+----------+------------------------------------------------------------------------------------------------------------------------------------------------+
-	| profile     | no       | Return only :term:`Delivery Services` using the :term:`Profile` with this :ref:`profile-id`                                                    |
-	+-------------+----------+------------------------------------------------------------------------------------------------------------------------------------------------+
-	| tenant      | no       | Show only the :term:`Delivery Services` belonging to the :term:`Tenant` identified by this integral, unique identifier                         |
-	+-------------+----------+------------------------------------------------------------------------------------------------------------------------------------------------+
-	| type        | no       | Return only :term:`Delivery Services` of the :ref:`Delivery Service Type <ds-types>` identified by this integral, unique identifier            |
-	+-------------+----------+------------------------------------------------------------------------------------------------------------------------------------------------+
-	| 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``.                                 |
-	+-------------+----------+------------------------------------------------------------------------------------------------------------------------------------------------+
-
-.. table:: Request Path Parameters
-
-	+------+---------------------------------------------------------------------------------+
-	| Name | Description                                                                     |
-	+======+=================================================================================+
-	| ID   | The integral, unique identifier of the :term:`Delivery Service` to be retrieved |
-	+------+---------------------------------------------------------------------------------+
-
-
-Response Structure
-------------------
-:active:                   A boolean that defines :ref:`ds-active`.
-:anonymousBlockingEnabled: A boolean that defines :ref:`ds-anonymous-blocking`
-:cacheurl:                 A :ref:`ds-cacheurl`
-
-	.. deprecated:: ATCv3.0
-		This field has been deprecated in Traffic Control 3.x and is subject to removal in Traffic Control 4.x or later
-
-:ccrDnsTtl:                 The :ref:`ds-dns-ttl` - named "ccrDnsTtl" for legacy reasons
-:cdnId:                     The integral, unique identifier of the :ref:`ds-cdn` to which the :term:`Delivery Service` belongs
-:cdnName:                   Name of the :ref:`ds-cdn` to which the :term:`Delivery Service` belongs
-:checkPath:                 A :ref:`ds-check-path`
-:consistentHashRegex:       A :ref:`ds-consistent-hashing-regex`
-:consistentHashQueryParams: An array of :ref:`ds-consistent-hashing-qparams`
-:deepCachingType:           The :ref:`ds-deep-caching` setting for this :term:`Delivery Service`
-:displayName:               The :ref:`ds-display-name`
-:dnsBypassCname:            A :ref:`ds-dns-bypass-cname`
-:dnsBypassIp:               A :ref:`ds-dns-bypass-ip`
-:dnsBypassIp6:              A :ref:`ds-dns-bypass-ipv6`
-:dnsBypassTtl:              The :ref:`ds-dns-bypass-ttl`
-:dscp:                      A :ref:`ds-dscp` to be used within the :term:`Delivery Service`
-:ecsEnabled:                A boolean that defines the :ref:`ds-ecs` setting on this :term:`Delivery Service`
-:edgeHeaderRewrite:         A set of :ref:`ds-edge-header-rw-rules`
-:exampleURLs:               An array of :ref:`ds-example-urls`
-:fqPacingRate:              The :ref:`ds-fqpr`
-:geoLimit:                  An integer that defines the :ref:`ds-geo-limit`
-:geoLimitCountries:         A string containing a comma-separated list defining the :ref:`ds-geo-limit-countries`
-:geoLimitRedirectUrl:       A :ref:`ds-geo-limit-redirect-url`
-:geoProvider:               The :ref:`ds-geo-provider`
-:globalMaxMbps:             The :ref:`ds-global-max-mbps`
-:globalMaxTps:              The :ref:`ds-global-max-tps`
-:httpBypassFqdn:            A :ref:`ds-http-bypass-fqdn`
-:id:                        An integral, unique identifier for this :term:`Delivery Service`
-:infoUrl:                   An :ref:`ds-info-url`
-:initialDispersion:         The :ref:`ds-initial-dispersion`
-:ipv6RoutingEnabled:        A boolean that defines the :ref:`ds-ipv6-routing` setting on this :term:`Delivery Service`
-:lastUpdated:               The date and time at which this :term:`Delivery Service` was last updated, in :rfc:`3339` format
-:logsEnabled:               A boolean that defines the :ref:`ds-logs-enabled` setting on this :term:`Delivery Service`
-:longDesc:                  The :ref:`ds-longdesc` of this :term:`Delivery Service`
-:longDesc1:                 The :ref:`ds-longdesc2` of this :term:`Delivery Service`
-:longDesc2:                 The :ref:`ds-longdesc3` of this :term:`Delivery Service`
-:matchList:                 The :term:`Delivery Service`'s :ref:`ds-matchlist`
-
-	:pattern:   A regular expression - the use of this pattern is dependent on the ``type`` field (backslashes are escaped)
-	:setNumber: An integer that provides explicit ordering of :ref:`ds-matchlist` items - this is used as a priority ranking by Traffic Router, and is not guaranteed to correspond to the ordering of items in the array.
-	:type:      The type of match performed using ``pattern``.
-
-:maxDnsAnswers:        The :ref:`ds-max-dns-answers` allowed for this :term:`Delivery Service`
-:maxOriginConnections: The :ref:`ds-max-origin-connections`
-:midHeaderRewrite:     A set of :ref:`ds-mid-header-rw-rules`
-:missLat:              The :ref:`ds-geo-miss-default-latitude` used by this :term:`Delivery Service`
-:missLong:             The :ref:`ds-geo-miss-default-longitude` used by this :term:`Delivery Service`
-:multiSiteOrigin:      A boolean that defines the use of :ref:`ds-multi-site-origin` by this :term:`Delivery Service`
-:orgServerFqdn:        The :ref:`ds-origin-url`
-:originShield:         A :ref:`ds-origin-shield` string
-:profileDescription:   The :ref:`profile-description` of the :ref:`ds-profile` with which this :term:`Delivery Service` is associated
-:profileId:            The :ref:`profile-id` of the :ref:`ds-profile` with which this :term:`Delivery Service` is associated
-:profileName:          The :ref:`profile-name` of the :ref:`ds-profile` with which this :term:`Delivery Service` is associated
-:protocol:             An integral, unique identifier that corresponds to the :ref:`ds-protocol` used by this :term:`Delivery Service`
-:qstringIgnore:        An integral, unique identifier that corresponds to the :ref:`ds-qstring-handling` setting on this :term:`Delivery Service`
-:rangeRequestHandling: An integral, unique identifier that corresponds to the :ref:`ds-range-request-handling` setting on this :term:`Delivery Service`
-:regexRemap:           A :ref:`ds-regex-remap`
-:regionalGeoBlocking:  A boolean defining the :ref:`ds-regionalgeo` setting on this :term:`Delivery Service`
-:remapText:            :ref:`ds-raw-remap`
-:signed:               ``true`` if  and only if ``signingAlgorithm`` is not ``null``, ``false`` otherwise
-:signingAlgorithm:     Either a :ref:`ds-signing-algorithm` or ``null`` to indicate URL/URI signing is not implemented on this :term:`Delivery Service`
-:sslKeyVersion:        This integer indicates the :ref:`ds-ssl-key-version`
-:tenantId:             The integral, unique identifier of the :ref:`ds-tenant` who owns this :term:`Delivery Service`
-:trRequestHeaders:     If defined, this defines the :ref:`ds-tr-req-headers` used by Traffic Router for this :term:`Delivery Service`
-:trResponseHeaders:    If defined, this defines the :ref:`ds-tr-resp-headers` used by Traffic Router for this :term:`Delivery Service`
-:type:                 The :ref:`ds-types` of this :term:`Delivery Service`
-:typeId:               The integral, unique identifier of the :ref:`ds-types` of this :term:`Delivery Service`
-:xmlId:                This :term:`Delivery Service`'s :ref:`ds-xmlid`
-
-.. 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: SYwzDioAWWqHo6IDYpwUMVZBp9rHHqQLfqzysMYuPJPlDGIrjM2z3CO5/3621VOVUoBTFzGeA9V3wo4K2TjeDQ==
-	X-Server-Name: traffic_ops_golang/
-	Date: Mon, 10 Jun 2019 13:43:48 GMT
-	Content-Length: 1500
-
-	{ "response": [{
-		"active": true,
-		"anonymousBlockingEnabled": false,
-		"cacheurl": null,
-		"ccrDnsTtl": null,
-		"cdnId": 2,
-		"cdnName": "CDN-in-a-Box",
-		"checkPath": null,
-		"displayName": "Demo 1",
-		"dnsBypassCname": null,
-		"dnsBypassIp": null,
-		"dnsBypassIp6": null,
-		"dnsBypassTtl": null,
-		"dscp": 0,
-		"edgeHeaderRewrite": null,
-		"geoLimit": 0,
-		"geoLimitCountries": null,
-		"geoLimitRedirectURL": null,
-		"geoProvider": 0,
-		"globalMaxMbps": null,
-		"globalMaxTps": null,
-		"httpBypassFqdn": null,
-		"id": 1,
-		"infoUrl": null,
-		"initialDispersion": 1,
-		"ipv6RoutingEnabled": true,
-		"lastUpdated": "2019-06-10 13:05:19+00",
-		"logsEnabled": true,
-		"longDesc": "Apachecon North America 2018",
-		"longDesc1": null,
-		"longDesc2": null,
-		"matchList": [
-			{
-				"type": "HOST_REGEXP",
-				"setNumber": 0,
-				"pattern": ".*\\.demo1\\..*"
-			}
-		],
-		"maxDnsAnswers": null,
-		"midHeaderRewrite": null,
-		"missLat": 42,
-		"missLong": -88,
-		"multiSiteOrigin": false,
-		"originShield": null,
-		"orgServerFqdn": "http://origin.infra.ciab.test",
-		"profileDescription": null,
-		"profileId": null,
-		"profileName": null,
-		"protocol": 2,
-		"qstringIgnore": 0,
-		"rangeRequestHandling": 0,
-		"regexRemap": null,
-		"regionalGeoBlocking": false,
-		"remapText": null,
-		"routingName": "video",
-		"signed": false,
-		"sslKeyVersion": 1,
-		"tenantId": 1,
-		"type": "HTTP",
-		"typeId": 1,
-		"xmlId": "demo1",
-		"exampleURLs": [
-			"http://video.demo1.mycdn.ciab.test",
-			"https://video.demo1.mycdn.ciab.test"
-		],
-		"deepCachingType": "NEVER",
-		"fqPacingRate": null,
-		"signingAlgorithm": null,
-		"tenant": "root",
-		"trResponseHeaders": null,
-		"trRequestHeaders": null,
-		"consistentHashRegex": null,
-		"consistentHashQueryParams": [
-			"abc",
-			"pdq",
-			"xxx",
-			"zyx"
-		],
-		"maxOriginConnections": 0,
-		"ecsEnabled": false
-	}]}
-
-
 ``PUT``
 =======
 Allows users to edit an existing :term:`Delivery Service`.
diff --git a/traffic_control/clients/python/trafficops/tosession.py b/traffic_control/clients/python/trafficops/tosession.py
index 1d20a6f..e5123b7 100644
--- a/traffic_control/clients/python/trafficops/tosession.py
+++ b/traffic_control/clients/python/trafficops/tosession.py
@@ -699,18 +699,6 @@ class TOSession(RestApiSession):
 		:raises: Union[LoginError, OperationError]
 		"""
 
-	@api_request('get', 'deliveryservices/{delivery_service_id:d}', ('2.0',))
-	def get_deliveryservice_by_id(self, delivery_service_id=None):
-		"""
-		Retrieves a specific delivery service. If not admin / ops, delivery service must be assigned
-		to user.
-		:ref:`to-api-deliveryservices-id`
-		:param delivery_service_id: The delivery service Id
-		:type delivery_service_id: int
-		:rtype: Tuple[Dict[str, Any], requests.Response]
-		:raises: Union[LoginError, OperationError]
-		"""
-
 	@api_request('post', 'deliveryservices', ('2.0',))
 	def create_deliveryservice(self, data=None):
 		"""
diff --git a/traffic_ops/client/deliveryservice.go b/traffic_ops/client/deliveryservice.go
index bad38aa..129b548 100644
--- a/traffic_ops/client/deliveryservice.go
+++ b/traffic_ops/client/deliveryservice.go
@@ -147,7 +147,7 @@ func (to *Session) GetDeliveryServicesByServer(id int) ([]tc.DeliveryService, Re
 // Deprecated: Use GetDeliveryServiceNullable instead.
 func (to *Session) GetDeliveryService(id string) (*tc.DeliveryService, ReqInf, error) {
 	var data tc.DeliveryServicesResponse
-	reqInf, err := get(to, fmt.Sprintf(API_DELIVERY_SERVICE_ID, id), &data)
+	reqInf, err := get(to, API_DELIVERY_SERVICES + "?id=" + id, &data)
 	if err != nil {
 		return nil, reqInf, err
 	}
@@ -188,7 +188,7 @@ func (to *Session) GetDeliveryServiceNullable(id string) (*tc.DeliveryServiceNul
 	data := struct {
 		Response []tc.DeliveryServiceNullable `json:"response"`
 	}{}
-	reqInf, err := get(to, fmt.Sprintf(API_DELIVERY_SERVICE_ID, id), &data)
+	reqInf, err := get(to, API_DELIVERY_SERVICES+"?id="+id, &data)
 	if err != nil {
 		return nil, reqInf, err
 	}
diff --git a/traffic_ops/traffic_ops_golang/routing/routes.go b/traffic_ops/traffic_ops_golang/routing/routes.go
index 296c97d..5542f17 100644
--- a/traffic_ops/traffic_ops_golang/routing/routes.go
+++ b/traffic_ops/traffic_ops_golang/routing/routes.go
@@ -484,7 +484,6 @@ func Routes(d ServerData) ([]Route, []RawRoute, http.Handler, error) {
 
 		////DeliveryServices
 		{api.Version{2, 0}, http.MethodGet, `deliveryservices/?$`, api.ReadHandler(&deliveryservice.TODeliveryService{}), auth.PrivLevelReadOnly, Authenticated, nil, 2238317294, noPerlBypass},
-		{api.Version{2, 0}, http.MethodGet, `deliveryservices/{id}/?$`, api.ReadHandler(&deliveryservice.TODeliveryService{}), auth.PrivLevelReadOnly, Authenticated, nil, 244348195, noPerlBypass},
 		{api.Version{2, 0}, http.MethodPost, `deliveryservices/?$`, deliveryservice.CreateV15, auth.PrivLevelOperations, Authenticated, nil, 206431432, noPerlBypass},
 		{api.Version{2, 0}, http.MethodPut, `deliveryservices/{id}/?$`, deliveryservice.UpdateV15, auth.PrivLevelOperations, Authenticated, nil, 2766567527, noPerlBypass},
 		{api.Version{2, 0}, http.MethodPut, `deliveryservices/{id}/safe/?$`, deliveryservice.UpdateSafe, auth.PrivLevelOperations, Authenticated, nil, 247210931, perlBypass},
@@ -943,7 +942,7 @@ func Routes(d ServerData) ([]Route, []RawRoute, http.Handler, error) {
 
 		////DeliveryServices
 		{api.Version{1, 1}, http.MethodGet, `deliveryservices/?(\.json)?$`, api.ReadHandler(&deliveryservice.TODeliveryService{}), auth.PrivLevelReadOnly, Authenticated, nil, 1238317294, noPerlBypass},
-		{api.Version{1, 1}, http.MethodGet, `deliveryservices/{id}/?(\.json)?$`, api.ReadHandler(&deliveryservice.TODeliveryService{}), auth.PrivLevelReadOnly, Authenticated, nil, 444348195, noPerlBypass},
+		{api.Version{1, 1}, http.MethodGet, `deliveryservices/{id}/?(\.json)?$`, api.DeprecatedReadHandler(&deliveryservice.TODeliveryService{}, util.StrPtr("GET deliveryservices/ with the id query parameter")), auth.PrivLevelReadOnly, Authenticated, nil, 444348195, noPerlBypass},
 
 		{api.Version{1, 5}, http.MethodPost, `deliveryservices/?(\.json)?$`, deliveryservice.CreateV15, auth.PrivLevelOperations, Authenticated, nil, 506431432, noPerlBypass},
 		{api.Version{1, 4}, http.MethodPost, `deliveryservices/?(\.json)?$`, deliveryservice.CreateV14, auth.PrivLevelOperations, Authenticated, nil, 506431431, noPerlBypass},