ocket8888 commented on a change in pull request #4018: Add deliveryservice server capability docs URL: https://github.com/apache/trafficcontrol/pull/4018#discussion_r338591745
########## File path: docs/source/api/deliveryservice_server_capabilities.rst ########## @@ -0,0 +1,222 @@ +.. +.. +.. 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-deliveryservice-server-capabilities: + +*************************************** +``deliveryservice_server_capabilities`` +*************************************** + +.. versionadded:: 1.4 + +``GET`` +======= +Gets all associations of Server Capabilities to :term:`Delivery Services` + +:Auth. Required: Yes +:Roles Required: None +:Response Type: Array + +Request Structure +----------------- +.. table:: Request Query Parameters + + +-------------------+----------+---------------------------------------------------------------------------------------------------------------+ + | Name | Required | Description | + +===================+==========+===============================================================================================================+ + | deliveryServiceID | no | Filter associated Server Capabilities by :term:`Delivery Service` ID | + +-------------------+----------+---------------------------------------------------------------------------------------------------------------+ + | xmlID | no | Filter associated Server Capabilities by :term:`Delivery Service` :ref:`ds-xmlid` | + +-------------------+----------+---------------------------------------------------------------------------------------------------------------+ + | serverCapability | no | Filter associated Server Capabilities by Server Capability | + +-------------------+----------+---------------------------------------------------------------------------------------------------------------+ + | 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/1.4/deliveryservice_server_capabilities HTTP/1.1 + Host: trafficops.infra.ciab.test + User-Agent: curl/7.47.0 + Accept: */* + Cookie: mojolicious=... + +Response Structure +------------------ +:deliveryServiceID: The :term:`Delivery Service`'s ID +:xmlID: The :term:`Delivery Service`'s :ref:`ds-xmlid` +:lastUpdated: The date and time at which this association between the :term:`Delivery Service` and the Server Capability was last updated, in an ISO-like format +:serverCapability: The Server Capability's name + +.. 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,DELETE + Access-Control-Allow-Origin: * + Content-Type: application/json + Set-Cookie: mojolicious=...; Path=/; HttpOnly + Whole-Content-Sha512: UFO3/jcBFmFZM7CsrsIwTfPc5v8gUiXqJm6BNp1boPb4EQBnWNXZh/DbBwhMAOJoeqDImoDlrLnrVjQGO4AooA== + X-Server-Name: traffic_ops_golang/ + Date: Mon, 07 Oct 2019 22:15:11 GMT + Content-Length: 396 + + { + "response": [ + { + "deliveryServiceID": 1, + "lastUpdated": "2019-10-07 22:05:31+00", + "serverCapability": "ram", + "xmlId": "example_ds-1" + }, + { + "deliveryServiceID": 2, + "lastUpdated": "2019-10-07 22:05:31+00", + "serverCapability": "disk", + "xmlId": "example_ds-2 Review comment: It's typically pretty easy to copy/paste from something like [the `toaccess` scripts](https://traffic-control-cdn.readthedocs.io/en/latest/tools/toaccess.html) that come bundled with the Python client. There's also a bash script (`infrastructure/cdn-in-a-box/traffic_ops/to-access.sh`) that provides more or less the same behavior - it was originally designed to make the automated setup of CiaB easier, and it was what the `toaccess` scripts were actually based on, but tons of people use the functions therein for manual requests. Ultimately, though, it doesn't matter where you get the examples, just so long as they're accurate - at least with regard to request URI, request/response bodies, Content-Type and response codes. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services