Update a workflow

Updates a workflow using Go.

Code sample

Go

Before trying this sample, follow the Go setup instructions in the Workflows quickstart using client libraries. For more information, see the Workflows Go API reference documentation.


package main

import (
	"context"

	workflows "cloud.google.com/go/workflows/apiv1beta"
	workflowspb "google.golang.org/genproto/googleapis/cloud/workflows/v1beta"
)

func main() {
	ctx := context.Background()
	c, err := workflows.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &workflowspb.UpdateWorkflowRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/workflows/v1beta#UpdateWorkflowRequest.
	}
	op, err := c.UpdateWorkflow(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	resp, err := op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

What's next

To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.