-
Notifications
You must be signed in to change notification settings - Fork 13
/
work_pools.go
51 lines (44 loc) · 1.9 KB
/
work_pools.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package api
import (
"context"
"github.com/google/uuid"
)
// WorkPoolsClient is a client for working with work pools.
type WorkPoolsClient interface {
Create(ctx context.Context, data WorkPoolCreate) (*WorkPool, error)
List(ctx context.Context, filter WorkPoolFilter) ([]*WorkPool, error)
Get(ctx context.Context, name string) (*WorkPool, error)
Update(ctx context.Context, name string, data WorkPoolUpdate) error
Delete(ctx context.Context, name string) error
}
// WorkPool is a representation of a work pool.
type WorkPool struct {
BaseModel
Name string `json:"name"`
Description *string `json:"description"`
Type string `json:"type"`
BaseJobTemplate map[string]interface{} `json:"base_job_template"`
IsPaused bool `json:"is_paused"`
ConcurrencyLimit *int64 `json:"concurrency_limit"`
DefaultQueueID uuid.UUID `json:"default_queue_id"`
}
// WorkPoolCreate is a subset of WorkPool used when creating pools.
type WorkPoolCreate struct {
Name string `json:"name"`
Description *string `json:"description"`
Type string `json:"type"`
BaseJobTemplate map[string]interface{} `json:"base_job_template"`
IsPaused bool `json:"is_paused"`
ConcurrencyLimit *int64 `json:"concurrency_limit"`
}
// WorkPoolUpdate is a subset of WorkPool used when updating pools.
type WorkPoolUpdate struct {
Description *string `json:"description"`
IsPaused *bool `json:"is_paused"`
BaseJobTemplate map[string]interface{} `json:"base_job_template"`
ConcurrencyLimit *int64 `json:"concurrency_limit"`
}
// WorkPoolFilter defines filters when searching for work pools.
type WorkPoolFilter struct {
Any []uuid.UUID `json:"any_"`
}