heya! i’m really enjoying pulumi so far - i am loo...
# getting-started
f
heya! i’m really enjoying pulumi so far - i am looking to attach to a stream using the Golang API. The Progress stream and Event stream look like the most promising. My goal is to have a series of updates available for users that show the progress of their resources being created. I’m getting good feed from EventStream with the following code:
Copy code
opts := []optup.Option{
		optup.EventStreams(eventStream.Ch),
		optup.ProgressStreams(progressStream),
	}

	// Create a stack (this will create a project if it doesn't exist)
	stack, err := auto.UpsertStackInlineSource(
		ctx,
		stackName,
		projectName,
		runProgram,
	)
	_, err = stack.Up(ctx, opts...)
However, when i look at events in the channel (below), it looks like everything is untyped. Is there a standard function/pattern for typing all the events coming out, so i can use native functions on them? (e.g. “The Public IP address is currently being created…“)
Copy code
go func() {
		collect := []events.EngineEvent{}
		eventFilePath := "/tmp/event.log"
		f, err := os.Create(eventFilePath)
		if err != nil {
			fmt.Println(err)
			return
		}
		for d := range eventStream.Ch {
			_, err = fmt.Fprintln(f, d)
			collect = append(collect, d)
			if err != nil {
				fmt.Println(err)
				f.Close()
				eventStream.Close()
				return
			}
		}
		spew.Dump(collect)
		err = f.Close()
		if err != nil {
			fmt.Println(err)
			eventStream.Close()
			return
		}
		eventStream.Close()
	}()