mirror of
https://github.com/datarhei/core.git
synced 2025-10-05 16:07:07 +08:00

For the API endpoint /v3/process two new query parameter are introduced in order to list only processes that match a pattern for the id and the reference: idpattern and refpattern. The pattern is a glob pattern. If patterns for both are given, the results will be intersected. If you use other query parameters such as id or reference, they will be applied after the result of the pattern matching.
41 lines
892 B
Go
41 lines
892 B
Go
package resolver
|
|
|
|
// This file will be automatically regenerated based on the schema, any resolver implementations
|
|
// will be copied through when generating and any unknown code will be moved to the end.
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/datarhei/core/v16/http/graph/models"
|
|
)
|
|
|
|
func (r *queryResolver) Processes(ctx context.Context) ([]*models.Process, error) {
|
|
ids := r.Restream.GetProcessIDs("", "")
|
|
|
|
procs := []*models.Process{}
|
|
|
|
for _, id := range ids {
|
|
p, err := r.getProcess(id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
procs = append(procs, p)
|
|
}
|
|
|
|
return procs, nil
|
|
}
|
|
|
|
func (r *queryResolver) Process(ctx context.Context, id string) (*models.Process, error) {
|
|
return r.getProcess(id)
|
|
}
|
|
|
|
func (r *queryResolver) Probe(ctx context.Context, id string) (*models.Probe, error) {
|
|
probe := r.Restream.Probe(id)
|
|
|
|
p := &models.Probe{}
|
|
p.UnmarshalRestream(probe)
|
|
|
|
return p, nil
|
|
}
|