code: func parseQuery(query *structs.PreparedQuery, enforceVersion8 bool) error {
  	// We skip a few fields:
  	// - ID is checked outside this fn.
  	// - Name is optional with no restrictions, except for uniqueness which
  	//   is checked for integrity during the transaction. We also make sure
  	//   names do not overlap with IDs, which is also checked during the
  	//   transaction. Otherwise, people could "steal" queries that they don't
  	//   have proper ACL rights to change.
  	// - Template is checked during the transaction since that's where we
  	//   compile it.
  
  	// Anonymous queries require a session or need to be part of a template.
  	if enforceVersion8 {
  		if query.Name == "" && query.Template.Type == "" && query.Session == "" {
  			return fmt.Errorf("Must be bound to a session")
  		}
  	}
  
  	// Token is checked when the query is executed, but we do make sure the
  	// user hasn't accidentally pasted-in the special redacted token name,
  	// which if we allowed in would be super hard to debug and understand.
  	if query.Token == redactedToken {
  		return fmt.Errorf("Bad Token '%s', it looks like a query definition with a redacted token was submitted", query.Token)
  	}
  
  	// Parse the service query sub-structure.
  	if err := parseService(&query.Service); err != nil {
  		return err
  	}
  
  	// Parse the DNS options sub-structure.
  	if err := parseDNS(&query.DNS); err != nil {
  		return err
  	}
  
  	return nil
  }
docs: // parseQuery makes sure the entries of a query are valid for a create or
  // update operation. Some of the fields are not checked or are partially
  // checked, as noted in the comments below. This also updates all the parsed
  // fields of the query.