WatchEvents
Streams events for all projects, runners, environments, tasks, and services based on the specified scope.
Use this method to:
- Monitor resource changes in real-time
- Track system events
- Receive notifications
The scope parameter determines which events to watch:
- Organization scope (default): Watch all organization-wide events including projects, runners and environments. Task and service events are not included. Use by setting organization=true or omitting the scope.
- Environment scope: Watch events for a specific environment, including its tasks, task executions, and services. Use by setting environment_id to the UUID of the environment to watch.
ParametersExpand Collapse
body EventWatchParams
Environment scope produces events for the environment itself, all tasks, task executions, and services associated with that environment.
Organization scope produces events for all projects, runners and environments the caller can see within their organization. No task, task execution or service events are produed.
ResourceTypeFilters param.Field[[]EventWatchParamsResourceTypeFilter]OptionalFilters to limit which events are delivered on organization-scoped streams.
When empty, all events for the scope are delivered.
When populated, only events matching at least one filter entry are forwarded.
Not supported for environment-scoped streams; setting this field returns an error.
Filters to limit which events are delivered on organization-scoped streams. When empty, all events for the scope are delivered. When populated, only events matching at least one filter entry are forwarded. Not supported for environment-scoped streams; setting this field returns an error.
If non-empty, only events where the resource was created by one of these user IDs are delivered. Skipped for DELETE operations (creator info is unavailable after deletion). Events with no creator information are skipped when this filter is set (fail-closed).
If non-empty, only events for these specific resource IDs are delivered.
The resource type to filter for.
The resource type to filter for.
ReturnsExpand Collapse
type EventWatchResponse struct{…}
WatchEvents
package main
import (
"context"
"fmt"
"github.com/gitpod-io/gitpod-sdk-go"
"github.com/gitpod-io/gitpod-sdk-go/option"
)
func main() {
client := gitpod.NewClient(
option.WithBearerToken("My Bearer Token"),
)
stream := client.Events.WatchStreaming(context.TODO(), gitpod.EventWatchParams{
})
for stream.Next() {
fmt.Printf("%+v\n", stream.Current())
}
err := stream.Err()
if err != nil {
panic(err.Error())
}
}