vsphere/internal/virtualdevice/virtual_machine_disk_subresource.go
func diskLabelOrName(data map[string]interface{}) (string, error) {
	var label, name string
	if v, ok := data["label"]; ok && v != nil {
		label = v.(string)
	}
	if v, ok := data["name"]; ok && v != nil {
		name = v.(string)
	}
	if name != "" {
		name = path.Base(name)
	}

	log.Printf("[DEBUG] diskLabelOrName: label: %q name: %q", label, name)
	switch {
	case label == "" && name == "":
		return "", errors.New("disk label or name must be defined and cannot be computed")
	case label != "" && name != "":
		return "", errors.New("disk label and name cannot be defined at the same time")
	case label != "":
		log.Printf("[DEBUG] diskLabelOrName: Using defined label value %q", label)
		return label, nil
	}
	log.Printf("[DEBUG] diskLabelOrName: Using defined name value as fallback %q", name)
	return name, nil
}
func diskLabelOrName(data map[string]interface{}) (string, error) {
	var label, name string
	if v, ok := data["label"]; ok && v != nil {
		label = v.(string)
	}
	if v, ok := data["name"]; ok && v != nil {
		name = v.(string)
	}
	if name != "" {
		name = path.Base(name)
	}

	log.Printf("[DEBUG] diskLabelOrName: label: %q name: %q", label, name)
	switch {
	case label == "" && name == "":
		return "", errors.New("disk label or name must be defined and cannot be computed")
	case label != "" && name != "":
		return "", errors.New("disk label and name cannot be defined at the same time")
	case label != "":
		log.Printf("[DEBUG] diskLabelOrName: Using defined label value %q", label)
		return label, nil
	}
	log.Printf("[DEBUG] diskLabelOrName: Using defined name value as fallback %q", name)
	return name, nil
}
func diskLabelOrName ( data map [ string ] interface { } ) ( string , error ) { var label , name string if v , ok := data [ " " ] ; ok && v != nil { label = v . ( string ) } if v , ok := data [ " " ] ; ok && v != nil { name = v . ( string ) } if name != " " { name = path . Base ( name ) } log . Printf ( " " , label , name ) switch { case label == " " && name == " " : return " " , errors . New ( " " ) case label != " " && name != " " : return " " , errors . New ( " " ) case label != " " : log . Printf ( " " , label ) return label , nil } log . Printf ( " " , name ) return name , nil }
// diskLabelOrName is a helper method that returns the unique label for a disk
// - either its label or name. An error is returned if both are defined.
//
// TODO: This method will be removed in future releases.
diskLabelOrName is a helper method that returns the unique label for a disk - either its label or name . An error is returned if both are defined . TODO : This method will be removed in future releases .