Launch a template

Demonstrates how to launch a template.

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.NewTemplatesClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

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

Python

from google.cloud import dataflow_v1beta3


def sample_launch_template():
    # Create a client
    client = dataflow_v1beta3.TemplatesServiceClient()

    # Initialize request argument(s)
    request = dataflow_v1beta3.LaunchTemplateRequest(
        gcs_path="gcs_path_value",
    )

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

    # Handle the response
    print(response)

Ruby

require "google/cloud/dataflow/v1beta3"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Dataflow::V1beta3::TemplatesService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dataflow::V1beta3::LaunchTemplateRequest.new

# Call the launch_template method.
result = client.launch_template request

# The returned object is of type Google::Cloud::Dataflow::V1beta3::LaunchTemplateResponse.
p result

What's next

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