Update the state of an existing job

Demonstrates how to update the state of an existing job.

Code sample

Go


package main

import (
	"context"

	dataflow "cloud.google.com/go/dataflow/apiv1beta3"
	dataflowpb "google.golang.org/genproto/googleapis/dataflow/v1beta3"
)

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

	req := &dataflowpb.UpdateJobRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/dataflow/v1beta3#UpdateJobRequest.
	}
	resp, err := c.UpdateJob(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

Python

from google.cloud import dataflow_v1beta3


def sample_update_job():
    # Create a client
    client = dataflow_v1beta3.JobsV1Beta3Client()

    # Initialize request argument(s)
    request = dataflow_v1beta3.UpdateJobRequest(
    )

    # Make the request
    response = client.update_job(request=request)

    # Handle the response
    print(response)

What's next

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