dewrich commented on a change in pull request #1940: TO golang -- adds
validation rules for ASNs, CDNs APIs
URL:
https://github.com/apache/incubator-trafficcontrol/pull/1940#discussion_r171349730
##########
File path: traffic_ops/traffic_ops_golang/cdn/cdns.go
##########
@@ -44,31 +47,53 @@ func GetRefType() *TOCDN {
}
//Implementation of the Identifier, Validator interface functions
-func (cdn *TOCDN) GetID() (int, bool) {
+func (cdn TOCDN) GetID() (int, bool) {
return cdn.ID, true
}
-func (cdn *TOCDN) GetAuditName() string {
+func (cdn TOCDN) GetAuditName() string {
return cdn.Name
}
-func (cdn *TOCDN) GetType() string {
+func (cdn TOCDN) GetType() string {
return "cdn"
}
func (cdn *TOCDN) SetID(i int) {
cdn.ID = i
}
-func (cdn *TOCDN) Validate(db *sqlx.DB) []error {
- errs := []error{}
- if len(cdn.Name) < 1 {
- errs = append(errs, errors.New(`CDN 'name' is required.`))
+func isValidCDNchar(r rune) bool {
Review comment:
Should this be in the `tovalidate` package like this?
https://github.com/apache/incubator-trafficcontrol/blob/master/traffic_ops/traffic_ops_golang/tovalidate/rules.go#L20
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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