vsphere/internal/helper/computeresource/compute_resource_helper.go
func EnvironmentBrowserFromReference(client *govmomi.Client, ref types.ManagedObjectReference) (*envbrowse.EnvironmentBrowser, error) {
	cr, err := BaseFromReference(client, ref)
	if err != nil {
		return nil, err
	}
	props, err := BaseProperties(cr)
	if err != nil {
		return nil, err
	}
	if props.EnvironmentBrowser == nil {
		return nil, fmt.Errorf(
			"compute resource %q is missing an Environment Browser. Check host, cluster, and vSphere license health of all associated resources and try again",
			cr,
		)
	}
	return envbrowse.NewEnvironmentBrowser(client.Client, *props.EnvironmentBrowser), nil
}
func EnvironmentBrowserFromReference(client *govmomi.Client, ref types.ManagedObjectReference) (*envbrowse.EnvironmentBrowser, error) {
	cr, err := BaseFromReference(client, ref)
	if err != nil {
		return nil, err
	}
	props, err := BaseProperties(cr)
	if err != nil {
		return nil, err
	}
	if props.EnvironmentBrowser == nil {
		return nil, fmt.Errorf(
			"compute resource %q is missing an Environment Browser. Check host, cluster, and vSphere license health of all associated resources and try again",
			cr,
		)
	}
	return envbrowse.NewEnvironmentBrowser(client.Client, *props.EnvironmentBrowser), nil
}
// EnvironmentBrowserFromReference loads an environment browser for the
// specific compute resource reference. The reference can be either a
// standalone host or cluster.
//
// As an added safety feature if the compute resource properties come back with
// an unset environmentBrowser attribute, this function will return an error.
// This is to protect against cases where this may come up such as licensing
// issues or clusters without hosts.