ocket8888 commented on code in PR #7660:
URL: https://github.com/apache/trafficcontrol/pull/7660#discussion_r1279438075


##########
lib/go-tc/deliveryservice_servers.go:
##########
@@ -205,6 +205,26 @@ type DSServerResponseV40 struct {
 // API version 4.
 type DSServerResponseV4 = DSServerResponseV40
 
+// DSServerV5 is an alias for the latest minor version of the major version 5.
+type DSServerV5 = DSServerV50
+
+// DSServerV50 contains information for a Delivery Service Server.
+type DSServerV50 struct {
+       DSServerBase
+       LastUpdated      *time.Time                `json:"lastUpdated" 
db:"last_updated"`
+       ProfileNames     []string                  `json:"profileNames" 
db:"profile_name"`
+       ServerInterfaces *[]ServerInterfaceInfoV40 `json:"interfaces" 
db:"interfaces"`
+}

Review Comment:
   `DSServerBase` includes a `LastUpdated` field of a different type than the 
one described here, which could be confusing. Also I don't really want to start 
keeping track of everything added after some arbitrary date separately from 
everything else. Also also, `DSServerV50` now includes properties it doesn't 
have, for example: `ProfileDesc` (playground showing this happening: 
https://go.dev/play/p/WWwNPqJAyS3). You _could_ write an entire custom JSON 
marshaling and unmarshaling method pair, or you could just embed the non-DSS 
portion of the server as a ServerV50 - which will encode with RFC3339 
timestamps - and make your type into a thin wrapper around that with the 
additional information provided by "Delivery Service Servers".



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to