23 lines
598 B
Go
23 lines
598 B
Go
package common
|
|
|
|
import (
|
|
garmErrors "github.com/cloudbase/garm-provider-common/errors"
|
|
commonParams "github.com/cloudbase/garm-provider-common/params"
|
|
"github.com/cloudbase/garm/runner/providers/util"
|
|
)
|
|
|
|
func ValidateResult(inst commonParams.ProviderInstance) error {
|
|
if inst.ProviderID == "" {
|
|
return garmErrors.NewProviderError("missing provider ID")
|
|
}
|
|
|
|
if inst.Name == "" {
|
|
return garmErrors.NewProviderError("missing instance name")
|
|
}
|
|
|
|
if !util.IsValidProviderStatus(inst.Status) {
|
|
return garmErrors.NewProviderError("invalid status returned (%s)", inst.Status)
|
|
}
|
|
|
|
return nil
|
|
}
|