ocket8888 commented on a change in pull request #4015: Rewrite /federations to
Go - POST/PUT/DELETE
URL: https://github.com/apache/trafficcontrol/pull/4015#discussion_r339834661
##########
File path: lib/go-tc/federation.go
##########
@@ -67,36 +80,85 @@ type FederationMapping struct {
TTL int `json:"ttl"`
}
-// AllFederation is the JSON object returned by /api/1.x/federations?all
-type AllFederation struct {
- Mappings []AllFederationMapping `json:"mappings"`
- DeliveryService DeliveryServiceName `json:"deliveryService"`
+// AllDeliveryServiceFederationsMapping is a structure that contains
identifying information for a
+// Delivery Service as well as any and all Federation Resolver mapping
assigned to it (or all those
+// getting assigned to it).
+type AllDeliveryServiceFederationsMapping struct {
+ Mappings []FederationResolverMapping `json:"mappings"`
+ DeliveryService DeliveryServiceName `json:"deliveryService"`
}
-func (a AllFederation) IsAllFederations() bool { return true }
+// IsAllFederations implements the IAllFederation interface. Always returns
true.
+func (a AllDeliveryServiceFederationsMapping) IsAllFederations() bool { return
true }
// AllFederation is the JSON object returned by
/api/1.x/federations?all&cdnName=my-cdn-name
type AllFederationCDN struct {
CDNName *CDNName `json:"cdnName"`
}
+// IsAllFederations implements the IAllFederation interface. Always returns
true.
func (a AllFederationCDN) IsAllFederations() bool { return true }
-type AllFederationMapping struct {
- TTL *int `json:"ttl"`
- CName *string `json:"cname"`
+type ResolverMapping struct {
Resolve4 []string `json:"resolve4,omitempty"`
Resolve6 []string `json:"resolve6,omitempty"`
}
+func (r *ResolverMapping) Validate(tx *sql.Tx) error {
+ errs := []error{}
+ for _, res := range r.Resolve4 {
Review comment:
They do but it doesn't cover CIDRs
----------------------------------------------------------------
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]
With regards,
Apache Git Services