mirror of
https://github.com/cirruslabs/orchard.git
synced 2026-09-30 03:51:43 +02:00
Support startup/shutdown scripts (#33)
* Support `startup`/`shutdown` scripts Fixes #26 * Fixed Go modules after rebase * Fixes after rebase
This commit is contained in:
@@ -103,3 +103,22 @@ func (service *VMsService) PortForward(ctx context.Context, name string, port ui
|
||||
return service.client.wsRequest(ctx, fmt.Sprintf("vms/%s/port-forward", name),
|
||||
map[string]string{"port": strconv.FormatUint(uint64(port), 10)})
|
||||
}
|
||||
|
||||
func (service *VMsService) StreamEvents(name string) *EventStreamer {
|
||||
return NewEventStreamer(service.client, fmt.Sprintf("vms/%s/events", name))
|
||||
}
|
||||
|
||||
func (service *VMsService) Logs(ctx context.Context, name string) (lines []string, err error) {
|
||||
var events []v1.Event
|
||||
err = service.client.request(ctx, http.MethodGet, fmt.Sprintf("vms/%s/events", name),
|
||||
nil, &events, nil)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
for _, event := range events {
|
||||
if event.Kind == v1.EventKindLogLine {
|
||||
lines = append(lines, event.Payload)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user