Füge Modelle für Flows, FlowRuns, TaskRuns, WorkPools, WorkQueues, Deployments, Variablen, FlowRunStates, Logs, und Blocks samt zugehöriger Unmarshal-Logik und Zeitfeld-Unterstützung hinzu; ergänze Tests für die FlowRunStates-Service-Methoden.
This commit is contained in:
26
pkg/client/task_workers.go
Normal file
26
pkg/client/task_workers.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"git.schultes.dev/schultesdev/prefect-go/pkg/models"
|
||||
)
|
||||
|
||||
// TaskWorkersService handles operations related to task workers.
|
||||
type TaskWorkersService struct {
|
||||
client *Client
|
||||
}
|
||||
|
||||
// List retrieves task workers matching the filter.
|
||||
func (s *TaskWorkersService) List(ctx context.Context, filter *models.TaskWorkerFilter) ([]models.TaskWorkerResponse, error) {
|
||||
if filter == nil {
|
||||
filter = &models.TaskWorkerFilter{}
|
||||
}
|
||||
|
||||
var workers []models.TaskWorkerResponse
|
||||
if err := s.client.post(ctx, "/task_workers/filter", filter, &workers); err != nil {
|
||||
return nil, fmt.Errorf("failed to list task workers: %w", err)
|
||||
}
|
||||
return workers, nil
|
||||
}
|
||||
Reference in New Issue
Block a user