code: func syncVMs(c context.Context, vms []*gce.Config) error {
  	// Fetch existing configs.
  	srv := getVMsServer(c)
  	rsp, err := srv.List(c, &gce.ListRequest{})
  	if err != nil {
  		return errors.Annotate(err, "failed to fetch VMs configs").Err()
  	}
  	// Track the revision of each config.
  	revs := make(map[string]string, len(rsp.Configs))
  	for _, v := range rsp.Configs {
  		revs[v.Prefix] = v.Revision
  	}
  	logging.Debugf(c, "fetched %d VMs configs", len(rsp.Configs))
  
  	// Update configs to new revisions.
  	ens := &gce.EnsureRequest{}
  	for _, v := range vms {
  		rev, ok := revs[v.Prefix]
  		delete(revs, v.Prefix)
  		if ok && rev == v.Revision {
  			continue
  		}
  		ens.Id = v.Prefix
  		ens.Config = v
  		if _, err := srv.Ensure(c, ens); err != nil {
  			return errors.Annotate(err, "failed to ensure VMs config %q", ens.Id).Err()
  		}
  	}
  
  	// Delete unreferenced configs.
  	del := &gce.DeleteRequest{}
  	for id := range revs {
  		del.Id = id
  		if _, err := srv.Delete(c, del); err != nil {
  			return errors.Annotate(err, "failed to delete VMs config %q", del.Id).Err()
  		}
  		logging.Debugf(c, "deleted VMs config %q", del.Id)
  	}
  	return nil
  }
docs: // syncVMs synchronizes the given validated VM configs.