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



##########
File path: lib/go-tc/servers.go
##########
@@ -49,6 +64,157 @@ type ServersV1DetailResponse struct {
        Alerts
 }
 
+// ServerIpAddress is the data associated with a server's interface's IP 
address.
+type ServerIpAddress struct {
+       Address        string  `json:"address" db:"address"`
+       Gateway        *string `json:"gateway" db:"gateway"`
+       ServiceAddress bool    `json:"serviceAddress" db:"service_address"`
+}
+
+// ServerInterfaceInfo is the data associated with a server's interface.
+type ServerInterfaceInfo struct {
+       IPAddresses  []ServerIpAddress `json:"ipAddresses" db:"ip_addresses"`
+       MaxBandwidth *uint64           `json:"maxBandwidth" db:"max_bandwidth"`
+       Monitor      bool              `json:"monitor" db:"monitor"`
+       MTU          *uint64           `json:"mtu" db:"mtu"`
+       Name         string            `json:"name" db:"name"`
+}
+
+// Value implements the driver.Valuer interface
+// marshals struct to json to pass back as a json.RawMessage
+func (sii *ServerInterfaceInfo) Value() (driver.Value, error) {
+       b, err := json.Marshal(sii)
+       return b, err
+}
+
+// Scan implements the sql.Scanner interface
+// expects json.RawMessage and unmarshals to a deliveryservice struct
+func (sii *ServerInterfaceInfo) Scan(src interface{}) error {
+       b, ok := src.([]byte)
+       if !ok {
+               return fmt.Errorf("expected deliveryservice in byte array form; 
got %T", src)
+       }
+
+       return json.Unmarshal([]byte(b), sii)
+}
+
+// LegacyInterfaceDetails is the details for interfaces on servers for API v1 
and v2.
+type LegacyInterfaceDetails struct {
+       InterfaceMtu  *int    `json:"interfaceMtu" db:"interface_mtu"`

Review comment:
       It should, but it can't be for backward-compatibility. This isn't a new 
property, it's moved from the old struct.




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