provider/vsphere/vsphere_discover.go
func tagByName(ctx context.Context, client *tags.RestClient, name, categoryID string) (string, error) {
	tids, err := client.GetTagByNameForCategory(ctx, name, categoryID)
	if err != nil {
		return "", fmt.Errorf("could not get tag for name %q: %s", name, err)
	}

	if len(tids) < 1 {
		return "", fmt.Errorf("tag name %q not found in category ID %q", name, categoryID)
	}
	if len(tids) > 1 {
		// This situation is very similar to the one in tagCategoryByName. The API
		// docs even say that tags need to be unique in categories, yet
		// GetTagByNameForCategory still returns multiple results.
		return "", fmt.Errorf("multiple tags with name %q found", name)
	}

	logger.Printf("[DEBUG] Tag ID is %q", tids[0].ID)
	return tids[0].ID, nil
}
func tagByName(ctx context.Context, client *tags.RestClient, name, categoryID string) (string, error) {
	tids, err := client.GetTagByNameForCategory(ctx, name, categoryID)
	if err != nil {
		return "", fmt.Errorf("could not get tag for name %q: %s", name, err)
	}

	if len(tids) < 1 {
		return "", fmt.Errorf("tag name %q not found in category ID %q", name, categoryID)
	}
	if len(tids) > 1 {
		// This situation is very similar to the one in tagCategoryByName. The API
		// docs even say that tags need to be unique in categories, yet
		// GetTagByNameForCategory still returns multiple results.
		return "", fmt.Errorf("multiple tags with name %q found", name)
	}

	logger.Printf("[DEBUG] Tag ID is %q", tids[0].ID)
	return tids[0].ID, nil
}
// tagByName converts a tag name into its ID.