fleet/server/service/client_compat.go
Lucas Manuel Rodriguez 0b8c29198b
Make orbit and Fleet Desktop not depend on server/service/ packages (#42231)
Resolves #40396.

No changes file because there should be no user visible changes.

## Testing

- [x] QA'd all new/changed functionality manually

## fleetd/orbit/Fleet Desktop

- [x] Verified compatibility with the latest released version of Fleet
(see [Must
rule](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/workflows/fleetd-development-and-release-strategy.md))
- [X] Verified that fleetd runs on macOS, Linux and Windows
- [X] Verified auto-update works from the released version of component
to the new version (see [tools/tuf/test](../tools/tuf/test/README.md))
2026-03-26 10:59:42 -03:00

71 lines
1.8 KiB
Go

package service
import (
"io"
"github.com/fleetdm/fleet/v4/client"
)
// Type aliases for base client types (backward compat)
type (
baseClient = client.BaseClient
HTTPClient = client.HTTPClient
BodyHandler = client.BodyHandler
FileResponse = client.FileResponse
)
var (
NewBaseClient = client.NewBaseClient
newBaseClient = client.NewBaseClient
)
// Error variable aliases
var (
ErrUnauthenticated = client.ErrUnauthenticated
ErrPasswordResetRequired = client.ErrPasswordResetRequired
ErrMissingLicense = client.ErrMissingLicense
ErrEndUserAuthRequired = client.ErrEndUserAuthRequired
)
// Error type aliases
type (
SetupAlreadyErr = client.SetupAlreadyErr
NotFoundErr = client.NotFoundErrIface
ConflictErr = client.ConflictErr
notFoundErr = client.NotFoundErr
StatusCodeErr = client.StatusCodeErr
)
func isNotFoundErr(err error) bool { return client.IsNotFoundErr(err) }
func IsNotFoundErr(err error) bool { return client.IsNotFoundErr(err) }
func extractServerErrorText(body io.Reader) string {
return client.ExtractServerErrorText(body)
}
func extractServerErrorNameReason(body io.Reader) (string, string) {
return client.ExtractServerErrorNameReason(body)
}
func extractServerErrorNameReasons(body io.Reader) ([]string, []string) {
return client.ExtractServerErrorNameReasons(body)
}
// setupAlreadyErr and notSetupErr
type (
setupAlreadyErr = client.SetupAlreadyError
notSetupErr = client.NotSetupError
NotSetupErr = client.NotSetupErr
)
// conflictErr
type conflictErr = client.ConflictError
// serverError is used for JSON parsing in extractServerErrMsg (in client_trigger.go).
type serverError struct {
Message string `json:"message"`
Errors []struct {
Name string `json:"name"`
Reason string `json:"reason"`
} `json:"errors"`
}