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



##########
File path: lib/go-tc/cdn_notification.go
##########
@@ -0,0 +1,58 @@
+package tc
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+
+import (
+       "database/sql"
+
+       "github.com/apache/trafficcontrol/lib/go-tc/tovalidate"
+       "github.com/apache/trafficcontrol/lib/go-util"
+
+       "github.com/go-ozzo/ozzo-validation"
+)
+
+// CDNNotificationsResponse is a list of CDN notifications as a response.
+type CDNNotificationsResponse struct {
+       Response []CDNNotification `json:"response"`
+       Alerts
+}
+
+// CDNNotificationRequest encodes the request data for the POST
+// cdn_notifications endpoint.
+type CDNNotificationRequest struct {
+       CDN          string `json:"cdn"`
+       Notification string `json:"notification"`
+}
+
+// CDNNotification is a notification created for a specific CDN
+type CDNNotification struct {
+       CDN          *string    `json:"cdn" db:"cdn"`
+       LastUpdated  *TimeNoMod `json:"lastUpdated" db:"last_updated"`

Review comment:
       The intention was for you to not be able to modify the `last_updated` 
time manually with a `POST` or `PUT`, but that's only a problem if you read 
into the entire struct and then use `sqlx.QueryRowx` to dump a struct's 
properties into a values row. But since you're using plain `sql.QueryRow` and 
have `CDNNotificationRequest` it's not going to cause any issues.
   
   I believe the proprietary format is meant to mirror Perl's returned 
date/time format, which wasn't RFC3339 for whatever reason.




----------------------------------------------------------------
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:
[email protected]


Reply via email to