You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2021/02/17 23:40:46 UTC

[GitHub] [trafficcontrol] ocket8888 commented on a change in pull request #5179: Adds the ability to create a CDN-level notification via TP/TO API

ocket8888 commented on a change in pull request #5179:
URL: https://github.com/apache/trafficcontrol/pull/5179#discussion_r578021619



##########
File path: docs/source/api/v4/cdns_id_notification.rst
##########
@@ -0,0 +1,123 @@
+..
+..
+.. 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-cdns-id-notification:
+
+****************************
+``cdns/{{ID}}/notification``

Review comment:
       Also, instead of ID did you consider using the Name instead? It's just much easier for humans to use

##########
File path: docs/source/api/v4/cdns_id_notification.rst
##########
@@ -0,0 +1,123 @@
+..
+..
+.. 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-cdns-id-notification:
+
+****************************
+``cdns/{{ID}}/notification``
+****************************
+
+``POST``
+========
+Create a notification for a specific CDN.
+
+:Auth. Required: Yes
+:Roles Required: "admin" or "operations"
+:Response Type:  Object
+
+Request Structure
+-----------------
+.. table:: Request Path Parameters
+
+	+------+-------------------------------------------------------------------------------+
+	| Name | Description                                                                   |
+	+======+===============================================================================+
+	| ID   | The integral, unique identifier for the CDN on which to create a notification.|
+	+------+-------------------------------------------------------------------------------+
+
+:notification: The content of the CDN notification
+
+.. code-block:: http
+	:caption: Request Example
+
+	POST /api/4.0/cdns/2/notification HTTP/1.1
+	Host: trafficops.infra.ciab.test
+	User-Agent: curl/7.47.0
+	Accept: */*
+	Cookie: mojolicious=...
+	Content-Length: 19
+	Content-Type: application/json
+
+	{"notification": "No changes to Traffic Ops over the weekend."}
+
+Response Structure
+------------------
+:cdnId:			The integral, unique identifier for the CDN on which :term:`Queue Updates` was performed or cleared
+:notification:	The notification added to the CDN
+:username:		The username of the user responsible for creating the CDN notification
+
+.. 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: rBpFfrrP+9IFkwsRloEM+v+I8MuBZDXqFu+WUTGtRGypnAn2gHooPoNQRyVvJGjyIQrLXLvqjEtve+lH2Tj4uw==
+	X-Server-Name: traffic_ops_golang/
+	Date: Wed, 14 Nov 2018 21:02:07 GMT
+	Content-Length: 41
+
+	{ "response": {
+		"cdnId": 2,

Review comment:
       I have to know the CDN ID to call this endpoint, I'm not sure I need this in the response

##########
File path: docs/source/api/v4/cdns_id_notification.rst
##########
@@ -0,0 +1,123 @@
+..
+..
+.. 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-cdns-id-notification:
+
+****************************
+``cdns/{{ID}}/notification``

Review comment:
       Can you not GET the notification?
   
   From [the API guidelines](https://traffic-control-cdn.readthedocs.io/en/latest/development/api_guidelines.html#get):
   
   > _"All endpoints dealing with the manipulation or fetching representations of “Traffic Control Objects” MUST support this method."_




----------------------------------------------------------------
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:
users@infra.apache.org