2026-04-07 14:40:39 +00:00
|
|
|
package service
|
|
|
|
|
|
|
|
|
|
import (
|
2026-04-10 15:12:38 +00:00
|
|
|
"context"
|
2026-04-07 14:40:39 +00:00
|
|
|
|
2026-04-10 15:12:38 +00:00
|
|
|
"github.com/fleetdm/fleet/v4/server/fleet"
|
2026-04-07 14:40:39 +00:00
|
|
|
)
|
|
|
|
|
|
2026-04-10 15:12:38 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// List API endpoints
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////
|
2026-04-07 14:40:39 +00:00
|
|
|
|
2026-04-10 15:12:38 +00:00
|
|
|
type listAPIEndpointsRequest struct{}
|
2026-04-07 14:40:39 +00:00
|
|
|
|
2026-04-10 15:12:38 +00:00
|
|
|
type listAPIEndpointsResponse struct {
|
|
|
|
|
APIEndpoints []fleet.APIEndpoint `json:"api_endpoints"`
|
|
|
|
|
Err error `json:"error,omitempty"`
|
2026-04-07 14:40:39 +00:00
|
|
|
}
|
|
|
|
|
|
2026-04-10 15:12:38 +00:00
|
|
|
func (r listAPIEndpointsResponse) Error() error { return r.Err }
|
2026-04-07 14:40:39 +00:00
|
|
|
|
2026-04-10 15:12:38 +00:00
|
|
|
func listAPIEndpointsEndpoint(ctx context.Context, request any, svc fleet.Service) (fleet.Errorer, error) {
|
|
|
|
|
endpoints, err := svc.ListAPIEndpoints(ctx)
|
|
|
|
|
return listAPIEndpointsResponse{
|
|
|
|
|
APIEndpoints: endpoints,
|
|
|
|
|
Err: err,
|
|
|
|
|
}, nil
|
2026-04-07 14:40:39 +00:00
|
|
|
}
|
|
|
|
|
|
2026-04-10 15:12:38 +00:00
|
|
|
func (svc *Service) ListAPIEndpoints(ctx context.Context) ([]fleet.APIEndpoint, error) {
|
|
|
|
|
// skipauth: No authorization check, this is a premium feature only
|
|
|
|
|
svc.authz.SkipAuthorization(ctx)
|
|
|
|
|
return nil, fleet.ErrMissingLicense
|
2026-04-07 14:40:39 +00:00
|
|
|
}
|