fleet/ee/server/service/api_endpoints.go
Juan Fernandez 1bc32467a7
Implement GET /api/v1/fleet/rest_api (#42883)
**Related issue:** Resolves #42883 

Added a new premium GET /api/_version_/fleet/rest_api endpoint that
returns the contents of the embedded `api_endpoints.yml` artifact.
2026-04-10 11:12:38 -04:00

16 lines
500 B
Go

package service
import (
"context"
apiendpoints "github.com/fleetdm/fleet/v4/server/api_endpoints"
"github.com/fleetdm/fleet/v4/server/contexts/ctxerr"
"github.com/fleetdm/fleet/v4/server/fleet"
)
func (svc *Service) ListAPIEndpoints(ctx context.Context) ([]fleet.APIEndpoint, error) {
if err := svc.authz.Authorize(ctx, &fleet.APIEndpoint{}, fleet.ActionRead); err != nil {
return nil, ctxerr.Wrap(ctx, err, "authorize list API endpoints")
}
return apiendpoints.GetAPIEndpoints(), nil
}