package main import ( "context" "github.com/hyperhq/hyper-api/go/hyper" "github.com/hyperhq/hyper-engine" ) func main() { // create a new client client, err := hyper.NewClient(context.Background()) if err != nil { panic(err) } // create a new engine job job, err := engine.NewJob(client, engine.JobConfig{}) if err != nil { panic(err) } // start the job if err := job.Start(); err != nil { panic(err) } // wait for the job to complete if err := job.Wait(); err != nil { panic(err) } }
package main import ( "context" "github.com/hyperhq/hyper-api/go/hyper" "github.com/hyperhq/hyper-engine" ) func main() { // create a new client client, err := hyper.NewClient(context.Background()) if err != nil { panic(err) } // get a list of existing engine jobs jobs, err := engine.ListJobs(client) if err != nil { panic(err) } // print the list of jobs for _, job := range jobs { fmt.Println(job.ID, job.Status) } }This example shows how to retrieve a list of existing engine jobs on the Hyper platform using the `engine.ListJobs` method. The method takes in a Hyper client as a parameter and returns a slice of `Job` structs that contain information on each job's ID and status. These details can be used to manage and monitor engine jobs.