Get a template

Demonstrates how to get metadata and runtime metadata about 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.GetTemplateRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/dataflow/v1beta3#GetTemplateRequest.
	}
	resp, err := c.GetTemplate(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

Python

from google.cloud import dataflow_v1beta3


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

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

    # Make the request
    response = client.get_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::GetTemplateRequest.new

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

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

What's next

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