Documentation
¶
Index ¶
Constants ¶
View Source
const CTJSON string = "application/json"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JobPage ¶ added in v0.4.0
type JobPage struct {
Offset uint64 `json:"offset"`
Limit uint64 `json:"limit"`
Total uint64 `json:"total"`
Jobs []JobSummary `json:"jobs"`
}
type JobRequest ¶ added in v0.4.0
type JobResponse ¶ added in v0.4.0
type JobSummary ¶ added in v0.4.0
type PageMetadata ¶
type Proplet ¶ added in v0.5.0
type Proplet struct {
ID string `json:"id"`
Name string `json:"name"`
TaskCount uint64 `json:"task_count"`
Alive bool `json:"alive"`
LastAliveAt *time.Time `json:"last_alive_at,omitempty"`
}
Proplet is the SDK-facing shape of a proplet. It intentionally differs from proplet.Proplet: it exposes CreatedAt (surfaced by the list endpoint) and omits AliveHistory and Metadata, which are internal fields not needed by SDK callers. Keep in sync with the manager list response when fields change.
type PropletPage ¶ added in v0.5.0
type PropletPage struct {
Offset uint64 `json:"offset"`
Limit uint64 `json:"limit"`
Total uint64 `json:"total"`
Proplets []Proplet `json:"proplets"`
}
PropletPage mirrors the manager list response. Uses the SDK Proplet type rather than proplet.PropletPage to match the fields declared above.
type SDK ¶
type SDK interface {
// CreateTask creates a new task.
//
// example:
// task := sdk.Task{
// Name: "John Doe"
// }
// task, _ := sdk.CreateTask(task)
// fmt.Println(task)
CreateTask(task Task) (Task, error)
// GetTask gets a task by id.
//
// example:
// task, _ := sdk.GetTask("b1d10738-c5d7-4ff1-8f4d-b9328ce6f040")
// fmt.Println(task)
GetTask(id string) (Task, error)
// ListTasks lists tasks with optional metadata filtering.
//
// example:
// taskPage, _ := sdk.ListTasks(sdk.PageMetadata{Offset: 0, Limit: 10})
// fmt.Println(taskPage)
ListTasks(pm PageMetadata) (TaskPage, error)
// UpdateTask updates a task.
//
// example:
// task := sdk.Task{
// Name: "John Doe"
// }
// task, _ := sdk.UpdateTask(task)
// fmt.Println(task)
UpdateTask(task Task) (Task, error)
// DeleteTask deletes a task.
//
// example:
// task, _ := sdk.DeleteTask("b1d10738-c5d7-4ff1-8f4d-b9328ce6f040")
// fmt.Println(task)
DeleteTask(id string) error
// StartTask starts a task.
//
// example:
// task, _ := sdk.StartTask("b1d10738-c5d7-4ff1-8f4d-b9328ce6f040")
// fmt.Println(task)
StartTask(id string) error
// StopTask stops a task.
//
// example:
// task, _ := sdk.StopTask("b1d10738-c5d7-4ff1-8f4d-b9328ce6f040")
// fmt.Println(task)
StopTask(id string) error
// CreateJob creates a new job with multiple tasks.
//
// example:
// req := sdk.JobRequest{
// Name: "my-job",
// Tasks: []sdk.Task{...},
// ExecutionMode: "parallel",
// }
// job, _ := sdk.CreateJob(req)
CreateJob(req JobRequest) (JobResponse, error)
// GetJob gets a job by id.
//
// example:
// job, _ := sdk.GetJob("b1d10738-c5d7-4ff1-8f4d-b9328ce6f040")
GetJob(jobID string) (JobResponse, error)
// ListJobs lists jobs with optional status filter.
// Status can be "pending", "running", "completed", "failed", or "" (all).
//
// example:
// jobPage, _ := sdk.ListJobs(0, 10, "")
// jobPage, _ := sdk.ListJobs(0, 10, "running")
ListJobs(offset uint64, limit uint64, status string) (JobPage, error)
// StartJob starts a job.
//
// example:
// _ := sdk.StartJob("b1d10738-c5d7-4ff1-8f4d-b9328ce6f040")
StartJob(jobID string) error
// StopJob stops a job.
//
// example:
// _ := sdk.StopJob("b1d10738-c5d7-4ff1-8f4d-b9328ce6f040")
StopJob(jobID string) error
// GetPropletAliveHistory returns the paginated heartbeat history for a proplet.
//
// example:
// page, _ := sdk.GetPropletAliveHistory("b1d10738-c5d7-4ff1-8f4d-b9328ce6f040", 0, 10)
// fmt.Println(page)
GetPropletAliveHistory(id string, offset, limit uint64) (proplet.PropletAliveHistoryPage, error)
// ListProplets returns a paginated list of proplets, optionally filtered by status.
//
// example:
// page, _ := sdk.ListProplets(0, 10, "")
// fmt.Println(page)
ListProplets(offset, limit uint64, status string) (PropletPage, error)
// GetPropletSDF returns the SDF description of a proplet.
//
// example:
// doc, _ := sdk.GetPropletSDF("b1d10738-c5d7-4ff1-8f4d-b9328ce6f040")
// fmt.Println(doc)
GetPropletSDF(id string) (sdf.Document, error)
// DeleteProplet deletes a proplet by id.
//
// example:
// err := sdk.DeleteProplet("b1d10738-c5d7-4ff1-8f4d-b9328ce6f040")
// fmt.Println(err)
DeleteProplet(id string) error
}
type Task ¶
type Task struct {
ID string `json:"id,omitempty"`
Name string `json:"name"`
Kind string `json:"kind,omitempty"`
State uint8 `json:"state,omitempty"`
Mode string `json:"mode,omitempty"`
ImageURL string `json:"image_url,omitempty"`
JobID string `json:"job_id,omitempty"`
CLIArgs []string `json:"cli_args,omitempty"`
Env map[string]string `json:"env,omitempty"`
StartTime time.Time `json:"start_time"`
FinishTime time.Time `json:"finish_time"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Results any `json:"results,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.