add endpoint to manually trigger inventory collection
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2026-01-15 16:37:58 +11:00
parent e5e5be37a3
commit 2ea0f937c5
6 changed files with 204 additions and 2 deletions

View File

@@ -3,7 +3,6 @@ package vcenter
import (
"context"
"fmt"
"log"
"log/slog"
"net/url"
"path"
@@ -58,10 +57,19 @@ func New(logger *slog.Logger, creds *VcenterLogin) *Vcenter {
}
func (v *Vcenter) Login(vUrl string) error {
if v == nil {
return fmt.Errorf("vcenter is nil")
}
if strings.TrimSpace(vUrl) == "" {
return fmt.Errorf("vcenter URL is empty")
}
if v.credentials == nil {
return fmt.Errorf("vcenter credentials are nil")
}
// Connect to vCenter
u, err := soap.ParseURL(vUrl)
if err != nil {
log.Fatalf("Error parsing vCenter URL: %s", err)
return fmt.Errorf("error parsing vCenter URL: %w", err)
}
v.Vurl = vUrl