2024-02-05 15:29:45 +00:00
|
|
|
package libraries
|
|
|
|
|
2024-08-26 10:03:56 +00:00
|
|
|
import (
|
|
|
|
"fmt"
|
2024-02-05 15:29:45 +00:00
|
|
|
|
2024-08-26 10:03:56 +00:00
|
|
|
"github.com/databricks/databricks-sdk-go/service/compute"
|
|
|
|
)
|
|
|
|
|
|
|
|
func libraryPath(library *compute.Library) (string, error) {
|
2024-02-05 15:29:45 +00:00
|
|
|
if library.Whl != "" {
|
2024-08-26 10:03:56 +00:00
|
|
|
return library.Whl, nil
|
2024-02-05 15:29:45 +00:00
|
|
|
}
|
|
|
|
if library.Jar != "" {
|
2024-08-26 10:03:56 +00:00
|
|
|
return library.Jar, nil
|
2024-02-05 15:29:45 +00:00
|
|
|
}
|
|
|
|
if library.Egg != "" {
|
2024-08-26 10:03:56 +00:00
|
|
|
return library.Egg, nil
|
2024-02-05 15:29:45 +00:00
|
|
|
}
|
2024-08-21 10:03:56 +00:00
|
|
|
if library.Requirements != "" {
|
2024-08-26 10:03:56 +00:00
|
|
|
return library.Requirements, nil
|
2024-08-21 10:03:56 +00:00
|
|
|
}
|
2024-08-26 10:03:56 +00:00
|
|
|
|
|
|
|
return "", fmt.Errorf("not supported library type")
|
2024-02-05 15:29:45 +00:00
|
|
|
}
|