func (r *FileWatchRule) Validate() error {

	if err := elemental.ValidateMaximumLength("path", r.Path, 128, false); err != nil {
		return err
	}

	if len(r.Permissions) > 4 {
		err := elemental.NewError("Validation Error", "Invalid Permissions", "elemental", http.StatusUnprocessableEntity)
		err.Data = map[string]string{"attribute": "path"}
		return err
	}

	if len(r.Permissions) == 0 {
		r.Permissions = []AuditFilePermissions{AuditFilePermissionsRead, AuditFilePermissionsWrite, AuditFilePermissionsExecute, AuditFilePermissionsAttribute}
	}

	for _, p := range r.Permissions {
		if err := p.Validate("permissions"); err != nil {
			return err
		}
	}

	return nil
}
// Validate validates the filewathc rule.
Validate validates the filewathc rule.
// Validate validates the filewathc rule .
func (r *FileWatchRule) Validate() error {
	if err := elemental.ValidateMaximumLength("path", r.Path, 128, false); err != nil {
		return err
	}
	if len(r.Permissions) > 4 {
		err := elemental.NewError("Validation Error", "Invalid Permissions", "elemental", http.StatusUnprocessableEntity)
		err.Data = map[string]string{"attribute": "path"}
		return err
	}
	if len(r.Permissions) == 0 {
		r.Permissions = []AuditFilePermissions{AuditFilePermissionsRead, AuditFilePermissionsWrite, AuditFilePermissionsExecute, AuditFilePermissionsAttribute}
	}
	for _, p := range r.Permissions {
		if err := p.Validate("permissions"); err != nil {
			return err
		}
	}
	return nil
}
func ( r * FileWatchRule ) Validate ( ) error { if err := elemental . ValidateMaximumLength ( " " , r . Path , 128 , false ) ; err != nil { return err } if len ( r . Permissions ) > 4 { err := elemental . NewError ( " " , " " , " " , http . StatusUnprocessableEntity ) err . Data = map [ string ] string { " " : " " } return err } if len ( r . Permissions ) == 0 { r . Permissions = [ ] AuditFilePermissions { AuditFilePermissionsRead , AuditFilePermissionsWrite , AuditFilePermissionsExecute , AuditFilePermissionsAttribute } } for _ , p := range r . Permissions { if err := p . Validate ( " " ) ; err != nil { return err } } return nil }
Validate validates the filewathc rule.
Validate validates the filewathc rule .