code: func (s SearchIndex) FindByDnsName(ctx context.Context, dc *Datacenter, dnsName string, vmSearch bool) (Reference, error) {
  	req := types.FindByDnsName{
  		This:     s.Reference(),
  		DnsName:  dnsName,
  		VmSearch: vmSearch,
  	}
  	if dc != nil {
  		ref := dc.Reference()
  		req.Datacenter = &ref
  	}
  
  	res, err := methods.FindByDnsName(ctx, s.c, &req)
  	if err != nil {
  		return nil, err
  	}
  
  	if res.Returnval == nil {
  		return nil, nil
  	}
  	return NewReference(s.c, *res.Returnval), nil
  }
docs: // FindByDnsName finds a virtual machine or host by DNS name.