ocket8888 commented on code in PR #7733:
URL: https://github.com/apache/trafficcontrol/pull/7733#discussion_r1309188621
##########
lib/go-tc/origins.go:
##########
@@ -54,3 +56,75 @@ type Origin struct {
Tenant *string `json:"tenant" db:"tenant"`
TenantID *int `json:"tenantId" db:"tenant_id"`
}
+
+// OriginsResponseV5 is an alias for the latest minor version of the major
version 5.
+type OriginsResponseV5 = OriginsResponseV50
+
+// OriginsResponseV50 is a list of Origins as a response for APIv5.
+type OriginsResponseV50 struct {
+ Response []OriginV5 `json:"response"`
+ Alerts
+}
+
+// OriginDetailResponseV5 is an alias for the latest minor version of the
major version 5.
+type OriginDetailResponseV5 = OriginDetailResponseV50
+
+// OriginDetailResponseV50 is the JSON object returned for a single origin in
APIv5.
+type OriginDetailResponseV50 struct {
+ Response OriginV5 `json:"response"`
+ Alerts
+}
+
+// OriginV5 is an alias for the latest minor version of the major version 5.
+type OriginV5 = OriginV50
+
+// OriginV50 contains information relating to an Origin, in the latest minor
version APIv50.
+type OriginV50 struct {
+ Cachegroup *string `json:"cachegroup" db:"cachegroup"`
+ CachegroupID *int `json:"cachegroupId" db:"cachegroup_id"`
+ Coordinate *string `json:"coordinate" db:"coordinate"`
+ CoordinateID *int `json:"coordinateId" db:"coordinate_id"`
+ DeliveryService string `json:"deliveryService"
db:"deliveryservice"`
+ DeliveryServiceID int `json:"deliveryServiceId"
db:"deliveryservice_id"`
+ FQDN string `json:"fqdn" db:"fqdn"`
+ ID int `json:"id" db:"id"`
+ IP6Address *string `json:"ip6Address" db:"ip6_address"`
+ IPAddress *string `json:"ipAddress" db:"ip_address"`
+ IsPrimary bool `json:"isPrimary" db:"is_primary"`
+ LastUpdated time.Time `json:"lastUpdated" db:"last_updated"`
+ Name string `json:"name" db:"name"`
+ Port *int `json:"port" db:"port"`
+ Profile *string `json:"profile" db:"profile"`
+ ProfileID *int `json:"profileId" db:"profile_id"`
+ Protocol string `json:"protocol" db:"protocol"`
+ Tenant string `json:"tenant" db:"tenant"`
+ TenantID int `json:"tenantId" db:"tenant_id"`
+}
+
+// ToOriginV5 upgrades from Origin to APIv5
Review Comment:
GoDoc comment should end with punctuation.
##########
traffic_ops/testing/api/v5/origins_test.go:
##########
@@ -630,12 +633,14 @@ func GetOriginID(t *testing.T, name string) func() int {
assert.RequireNoError(t, err, "Get Origins Request failed with
error:", err)
assert.RequireEqual(t, 1, len(origins.Response), "Expected
response object length 1, but got %d", len(origins.Response))
assert.RequireNotNil(t, origins.Response[0].ID, "Expected ID to
not be nil.")
- return *origins.Response[0].ID
+ return origins.Response[0].ID
}
}
func CreateTestOrigins(t *testing.T) {
for _, origin := range testData.Origins {
+ origin.TenantID = GetTenantID(t, origin.Tenant)()
+ origin.DeliveryServiceID = GetDeliveryServiceId(t,
origin.DeliveryService)()
Review Comment:
with the changes you have made to the client, this should no longer be
necessary
--
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]