22 lines
527 B
Go
22 lines
527 B
Go
package api
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/tigorlazuardi/bluemage/go/gen/models"
|
|
"github.com/tigorlazuardi/bluemage/go/pkg/errs"
|
|
"github.com/tigorlazuardi/bluemage/go/pkg/log"
|
|
)
|
|
|
|
func (api *API) DevicesExist(ctx context.Context, slug string) (exists bool, err error) {
|
|
ctx, coll := log.WithQueryCollector(ctx)
|
|
exists, err = models.DeviceExists(ctx, api.Executor, slug)
|
|
if err != nil {
|
|
return exists, errs.Wrapw(err, "failed to check device existence",
|
|
"slug", slug,
|
|
"query", coll,
|
|
)
|
|
}
|
|
return exists, nil
|
|
}
|