func readTagsForResource(client *tags.RestClient, obj object.Reference, d *schema.ResourceData) error {
	log.Printf("[DEBUG] Reading tags for object %q", obj.Reference().Value)
	objID := obj.Reference().Value
	objType, err := tagTypeForObject(obj)
	if err != nil {
		return err
	}
	ctx, cancel := context.WithTimeout(context.Background(), defaultAPITimeout)
	defer cancel()
	ids, err := client.ListAttachedTags(ctx, objID, objType)
	log.Printf("[DEBUG] Tags for object %q: %s", objID, strings.Join(ids, ","))
	if err != nil {
		return err
	}
	if err := d.Set(vSphereTagAttributeKey, ids); err != nil {
		return fmt.Errorf("error saving tag IDs to resource data: %s", err)
	}
	return nil
}
func readTagsForResource(client *tags.RestClient, obj object.Reference, d *schema.ResourceData) error {
	log.Printf("[DEBUG] Reading tags for object %q", obj.Reference().Value)
	objID := obj.Reference().Value
	objType, err := tagTypeForObject(obj)
	if err != nil {
		return err
	}
	ctx, cancel := context.WithTimeout(context.Background(), defaultAPITimeout)
	defer cancel()
	ids, err := client.ListAttachedTags(ctx, objID, objType)
	log.Printf("[DEBUG] Tags for object %q: %s", objID, strings.Join(ids, ","))
	if err != nil {
		return err
	}
	if err := d.Set(vSphereTagAttributeKey, ids); err != nil {
		return fmt.Errorf("error saving tag IDs to resource data: %s", err)
	}
	return nil
}
func readTagsForResource ( client * tags . RestClient , obj object . Reference , d * schema . ResourceData ) error { log . Printf ( " " , obj . Reference ( ) . Value ) objID := obj . Reference ( ) . Value objType , err := tagTypeForObject ( obj ) if err != nil { return err } ctx , cancel := context . WithTimeout ( context . Background ( ) , defaultAPITimeout ) defer cancel ( ) ids , err := client . ListAttachedTags ( ctx , objID , objType ) log . Printf ( " " , objID , strings . Join ( ids , " " ) ) if err != nil { return err } if err := d . Set ( vSphereTagAttributeKey , ids ) ; err != nil { return fmt . Errorf ( " " , err ) } return nil }
// readTagsForResource reads the tags for a given reference and saves the list
// in the supplied ResourceData. It returns an error if there was an issue
// reading the tags.
readTagsForResource reads the tags for a given reference and saves the list in the supplied ResourceData . It returns an error if there was an issue reading the tags .