Skip to content

Commit

Permalink
Add required capabilities to delivery service structure (#7224)
Browse files Browse the repository at this point in the history
* initial commit

* fix unit test

* code review

* code review round 2

* fix unit test

* add allocation

* code review

* code review

* remove superfluous call to WriteHeader

* go fmt
  • Loading branch information
srijeet0406 authored Dec 14, 2022
1 parent 2310dda commit df422c9
Show file tree
Hide file tree
Showing 41 changed files with 760 additions and 660 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- [#7113](https://github.com/apache/trafficcontrol/pull/7113) *Traffic Portal* Minimize the Server Server Capability part of the *Traffic Servers* section of the Snapshot Diff

### Changed
- [#7224](https://github.com/apache/trafficcontrol/pull/7224) *Traffic Ops* Required Capabilities are now a part of the `DeliveryService` structure.
- [#7063](https://github.com/apache/trafficcontrol/pull/7063) *Traffic Ops* Python client now uses Traffic Ops API 4.1 by default.
- [#6981](https://github.com/apache/trafficcontrol/pull/6981) *Traffic Portal* Obscures sensitive text in Delivery Service "Raw Remap" fields, private SSL keys, "Header Rewrite" rules, and ILO interface passwords by default.
- [#7037](https://github.com/apache/trafficcontrol/pull/7037) *Traffic Router* Uses Traffic Ops API 4.0 by default
Expand Down
1 change: 0 additions & 1 deletion cache-config/testing/ort-tests/tcdata/todb.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,6 @@ func (r *TCData) Teardown(db *sql.DB) error {

sqlStmt := `
DELETE FROM api_capability;
DELETE FROM deliveryservices_required_capability;
DELETE FROM server_server_capability;
DELETE FROM server_capability;
DELETE FROM to_extension;
Expand Down
16 changes: 11 additions & 5 deletions docs/source/api/v4/deliveryservice_requests.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Request Structure
.. code-block:: http
:caption: Request Example
GET /api/4.0/deliveryservice_requests?status=draft HTTP/1.1
GET /api/4.1/deliveryservice_requests?status=draft HTTP/1.1
User-Agent: python-requests/2.22.0
Accept-Encoding: gzip, deflate
Accept: */*
Expand Down Expand Up @@ -163,6 +163,7 @@ The response is an array of representations of :term:`Delivery Service Requests`
"regional": false,
"regionalGeoBlocking": false,
"remapText": null,
"requiredCapabilities": [],
"routingName": "video",
"signed": false,
"sslKeyVersion": 1,
Expand Down Expand Up @@ -213,7 +214,7 @@ The request must be a well-formed representation of a :term:`Delivery Service Re
.. code-block:: http
:caption: Request Example
POST /api/4.0/deliveryservice_requests HTTP/1.1
POST /api/4.1/deliveryservice_requests HTTP/1.1
User-Agent: python-requests/2.22.0
Accept-Encoding: gzip, deflate
Accept: */*
Expand Down Expand Up @@ -280,6 +281,7 @@ The request must be a well-formed representation of a :term:`Delivery Service Re
"regional": false,
"regionalGeoBlocking": false,
"remapText": null,
"requiredCapabilities": [],
"routingName": "video",
"signed": false,
"sslKeyVersion": 1,
Expand Down Expand Up @@ -328,7 +330,7 @@ The response will be a representation of the created :term:`Delivery Service Req
Content-Encoding: gzip
Content-Type: application/json
Set-Cookie: mojolicious=...; Path=/; Expires=Mon, 24 Feb 2020 20:11:12 GMT; Max-Age=3600; HttpOnly
Location: /api/4.0/deliveryservice_requests/2
Location: /api/4.1/deliveryservice_requests/2
X-Server-Name: traffic_ops_golang/
Date: Mon, 24 Feb 2020 19:11:12 GMT
Content-Length: 901
Expand Down Expand Up @@ -405,6 +407,7 @@ The response will be a representation of the created :term:`Delivery Service Req
"regional": false,
"regionalGeoBlocking": false,
"remapText": null,
"requiredCapabilities": [],
"routingName": "video",
"signed": false,
"sslKeyVersion": 1,
Expand Down Expand Up @@ -490,6 +493,7 @@ The response will be a representation of the created :term:`Delivery Service Req
"regional": false,
"regionalGeoBlocking": false,
"remapText": null,
"requiredCapabilities": [],
"routingName": "video",
"signed": false,
"sslKeyVersion": 1,
Expand Down Expand Up @@ -550,7 +554,7 @@ The request body must be a representation of a :term:`Delivery Service Request`
.. code-block:: http
:caption: Request Example
PUT /api/4.0/deliveryservice_requests?id=1 HTTP/1.1
PUT /api/4.1/deliveryservice_requests?id=1 HTTP/1.1
User-Agent: python-requests/2.22.0
Accept-Encoding: gzip, deflate
Accept: */*
Expand Down Expand Up @@ -667,6 +671,7 @@ The response is a full representation of the edited :term:`Delivery Service Requ
"regional": false,
"regionalGeoBlocking": false,
"remapText": null,
"requiredCapabilities": [],
"routingName": "video",
"signed": false,
"sslKeyVersion": 1,
Expand Down Expand Up @@ -748,6 +753,7 @@ The response is a full representation of the edited :term:`Delivery Service Requ
"regional": false,
"regionalGeoBlocking": false,
"remapText": null,
"requiredCapabilities": [],
"routingName": "cdn",
"signed": false,
"sslKeyVersion": null,
Expand Down Expand Up @@ -800,7 +806,7 @@ Request Structure
.. code-block:: http
:caption: Request Example
DELETE /api/4.0/deliveryservice_requests?id=1 HTTP/1.1
DELETE /api/4.1/deliveryservice_requests?id=1 HTTP/1.1
User-Agent: python-requests/2.22.0
Accept-Encoding: gzip, deflate
Accept: */*
Expand Down
6 changes: 4 additions & 2 deletions docs/source/api/v4/deliveryservice_requests_id_assign.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Request Structure
.. code-block:: http
:caption: Request Example
GET /api/4.0/deliveryservice_requests/1/assign HTTP/1.1
GET /api/4.1/deliveryservice_requests/1/assign HTTP/1.1
User-Agent: python-requests/2.24.0
Accept-Encoding: gzip, deflate
Accept: */*
Expand Down Expand Up @@ -103,7 +103,7 @@ Request Structure
.. code-block:: http
:caption: Request Example
PUT /api/4.0/deliveryservice_requests/1/assign HTTP/1.1
PUT /api/4.1/deliveryservice_requests/1/assign HTTP/1.1
User-Agent: python-requests/2.24.0
Accept-Encoding: gzip, deflate
Accept: */*
Expand Down Expand Up @@ -198,6 +198,7 @@ The response contains a full representation of the newly assigned :term:`Deliver
"regional": false,
"regionalGeoBlocking": false,
"remapText": null,
"requiredCapabilities": [],
"routingName": "video",
"signed": false,
"sslKeyVersion": 1,
Expand Down Expand Up @@ -279,6 +280,7 @@ The response contains a full representation of the newly assigned :term:`Deliver
"regional": false,
"regionalGeoBlocking": false,
"remapText": null,
"requiredCapabilities": [],
"routingName": "cdn",
"signed": false,
"sslKeyVersion": null,
Expand Down
6 changes: 4 additions & 2 deletions docs/source/api/v4/deliveryservice_requests_id_status.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Request Structure
.. code-block:: http
:caption: Request Example
GET /api/4.0/deliveryservice_requests/1/status HTTP/1.1
GET /api/4.1/deliveryservice_requests/1/status HTTP/1.1
User-Agent: python-requests/2.24.0
Accept-Encoding: gzip, deflate
Accept: */*
Expand Down Expand Up @@ -98,7 +98,7 @@ Request Structure
.. code-block:: http
:caption: Request Example
PUT /api/4.0/deliveryservice_requests/1/status HTTP/1.1
PUT /api/4.1/deliveryservice_requests/1/status HTTP/1.1
User-Agent: python-requests/2.22.0
Accept-Encoding: gzip, deflate
Accept: */*
Expand Down Expand Up @@ -195,6 +195,7 @@ The response is a full representation of the modified :term:`DSR`.
"regional": false,
"regionalGeoBlocking": false,
"remapText": null,
"requiredCapabilities": [],
"routingName": "video",
"signed": false,
"sslKeyVersion": 1,
Expand Down Expand Up @@ -276,6 +277,7 @@ The response is a full representation of the modified :term:`DSR`.
"regional": false,
"regionalGeoBlocking": false,
"remapText": null,
"requiredCapabilities": [],
"routingName": "cdn",
"signed": false,
"sslKeyVersion": null,
Expand Down
21 changes: 18 additions & 3 deletions docs/source/api/v4/deliveryservices.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Request Structure
.. code-block:: http
:caption: Request Example
GET /api/4.0/deliveryservices?xmlId=demo2 HTTP/1.1
GET /api/4.1/deliveryservices?xmlId=demo2 HTTP/1.1
Host: trafficops.infra.ciab.test
User-Agent: python-requests/2.24.0
Accept-Encoding: gzip, deflate
Expand Down Expand Up @@ -148,6 +148,10 @@ Response Structure
:regional: A boolean value defining the :ref:`ds-regional` setting on this :term:`Delivery Service`
:regionalGeoBlocking: A boolean defining the :ref:`ds-regionalgeo` setting on this :term:`Delivery Service`
:remapText: :ref:`ds-raw-remap`
:requiredCapabilities: An array of the capabilities that this Delivery Service requires.

.. versionadded:: 4.1

:serviceCategory: The name of the :ref:`ds-service-category` with which the :term:`Delivery Service` is associated
: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`
Expand Down Expand Up @@ -250,6 +254,7 @@ Response Structure
"regional": false,
"regionalGeoBlocking": false,
"remapText": null,
"requiredCapabilities": [],
"routingName": "video",
"serviceCategory": null,
"signed": false,
Expand Down Expand Up @@ -328,6 +333,10 @@ Request Structure
:regional: A boolean value defining the :ref:`ds-regional` setting on this :term:`Delivery Service`
:regionalGeoBlocking: A boolean defining the :ref:`ds-regionalgeo` setting on this :term:`Delivery Service`
:remapText: :ref:`ds-raw-remap`
:requiredCapabilities: An array of the capabilities that this Delivery Service requires.

.. versionadded:: 4.1

:serviceCategory: The name of the :ref:`ds-service-category` with which the :term:`Delivery Service` is associated - or ``null`` if there is to be no such category
: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`
Expand All @@ -348,7 +357,7 @@ Request Structure
.. code-block:: http
:caption: Request Example
POST /api/4.0/deliveryservices HTTP/1.1
POST /api/4.1/deliveryservices HTTP/1.1
User-Agent: python-requests/2.24.0
Accept-Encoding: gzip, deflate
Accept: */*
Expand Down Expand Up @@ -407,6 +416,7 @@ Request Structure
"regexRemap": null,
"regional": false,
"regionalGeoBlocking": false,
"requiredCapabilities": [],
"routingName": "test",
"serviceCategory": null,
"signed": false,
Expand Down Expand Up @@ -495,6 +505,10 @@ Response Structure
:regional: A boolean value defining the :ref:`ds-regional` setting on this :term:`Delivery Service`
:regionalGeoBlocking: A boolean defining the :ref:`ds-regionalgeo` setting on this :term:`Delivery Service`
:remapText: :ref:`ds-raw-remap`
:requiredCapabilities: An array of the capabilities that this Delivery Service requires.

.. versionadded:: 4.1

:serviceCategory: The name of the :ref:`ds-service-category` with which the :term:`Delivery Service` is associated
: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`
Expand Down Expand Up @@ -522,7 +536,7 @@ Response Structure
Access-Control-Allow-Origin: *
Content-Encoding: gzip
Content-Type: application/json
Location: /api/4.0/deliveryservices?id=6
Location: /api/4.1/deliveryservices?id=6
Permissions-Policy: interest-cohort=()
Set-Cookie: mojolicious=...; Path=/; Expires=Mon, 07 Jun 2021 23:37:37 GMT; Max-Age=3600; HttpOnly
Vary: Accept-Encoding
Expand Down Expand Up @@ -606,6 +620,7 @@ Response Structure
"regional": false,
"regionalGeoBlocking": false,
"remapText": null,
"requiredCapabilities": [],
"routingName": "test",
"serviceCategory": null,
"signed": false,
Expand Down
14 changes: 12 additions & 2 deletions docs/source/api/v4/deliveryservices_id.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ Request Structure
:regional: A boolean value defining the :ref:`ds-regional` setting on this :term:`Delivery Service`
:regionalGeoBlocking: A boolean defining the :ref:`ds-regionalgeo` setting on this :term:`Delivery Service`
:remapText: :ref:`ds-raw-remap`
:requiredCapabilities: An array of the capabilities that this Delivery Service requires.

.. versionadded:: 4.1

:routingName: The :ref:`ds-routing-name` of this :term:`Delivery Service`

.. note:: If the Delivery Service has SSL Keys, then ``routingName`` is not allowed to change as that would invalidate the SSL Key
Expand All @@ -106,7 +110,7 @@ Request Structure
.. code-block:: http
:caption: Request Example
PUT /api/4.0/deliveryservices/6 HTTP/1.1
PUT /api/4.1/deliveryservices/6 HTTP/1.1
Host: trafficops.infra.ciab.test
User-Agent: python-requests/2.24.0
Accept-Encoding: gzip, deflate
Expand Down Expand Up @@ -165,6 +169,7 @@ Request Structure
"regexRemap": null,
"regional": false,
"regionalGeoBlocking": false,
"requiredCapabilities": [],
"routingName": "test",
"serviceCategory": null,
"signed": false,
Expand Down Expand Up @@ -249,6 +254,10 @@ Response Structure
:regexRemap: A :ref:`ds-regex-remap`
:regional: A boolean value defining the :ref:`ds-regional` setting on this :term:`Delivery Service`
:regionalGeoBlocking: A boolean defining the :ref:`ds-regionalgeo` setting on this :term:`Delivery Service`
:requiredCapabilities: An array of the capabilities that this Delivery Service requires.

.. versionadded:: 4.1

:remapText: :ref:`ds-raw-remap`
:serviceCategory: The name of the :ref:`ds-service-category` with which the :term:`Delivery Service` is associated
:signed: ``true`` if and only if ``signingAlgorithm`` is not ``null``, ``false`` otherwise
Expand Down Expand Up @@ -355,6 +364,7 @@ Response Structure
"regional": false,
"regionalGeoBlocking": false,
"remapText": null,
"requiredCapabilities": [],
"routingName": "test",
"serviceCategory": null,
"signed": false,
Expand Down Expand Up @@ -394,7 +404,7 @@ Request Structure
.. code-block:: http
:caption: Request Example
DELETE /api/4.0/deliveryservices/2 HTTP/1.1
DELETE /api/4.1/deliveryservices/2 HTTP/1.1
Host: trafficops.infra.ciab.test
User-Agent: curl/7.47.0
Accept: */*
Expand Down
3 changes: 3 additions & 0 deletions docs/source/api/v4/deliveryservices_required_capabilities.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
``deliveryservices_required_capabilities``
******************************************

.. deprecated:: 4.1
This endpoint will be removed in a future release, in favor of :ref:`ds-required-capabilities` being a part of :term:`Delivery Services`.

``GET``
=======
Gets all associations of :term:`Server Capability` to :term:`Delivery Services`.
Expand Down
5 changes: 5 additions & 0 deletions docs/source/api/v4/servers_id_deliveryservices.rst
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ Response Structure
:regional: A boolean value defining the :ref:`ds-regional` setting on this :term:`Delivery Service`
:regionalGeoBlocking: A boolean defining the :ref:`ds-regionalgeo` setting on this :term:`Delivery Service`
:remapText: :ref:`ds-raw-remap`
:requiredCapabilities: An array of the capabilities that this Delivery Service requires.

.. versionadded:: 4.1

: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`
:rangeSliceBlockSize: An integer that defines the byte block size for the ATS Slice Plugin. It can only and must be set if ``rangeRequestHandling`` is set to 3.
Expand Down Expand Up @@ -234,6 +238,7 @@ Response Structure
"regional": false,
"regionalGeoBlocking": false,
"remapText": null,
"requiredCapabilities": [],
"routingName": "cdn",
"serviceCategory": null,
"signed": false,
Expand Down
Loading

0 comments on commit df422c9

Please sign in to comment.