Launch a Flex Template asynchronously

Demonstrates how to launch a Flex Template asynchronously.

Code sample

Node.js

/**
 * TODO(developer): Uncomment these variables before running the sample.
 */
/**
 *  Required. The ID of the Cloud Platform project that the job belongs to.
 */
// const projectId = 'abc123'
/**
 *  Required. Parameter to launch a job form Flex Template.
 */
// const launchParameter = {}
/**
 *  Required. The regional endpoint 
 *  (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) to
 *  which to direct the request. E.g., us-central1, us-west1.
 */
// const location = 'abc123'
/**
 *  If true, the request is validated but not actually executed.
 *  Defaults to false.
 */
// const validateOnly = true

// Imports the Dataflow library
const {FlexTemplatesServiceClient} = require('@google-cloud/dataflow').v1beta3;

// Instantiates a client
const dataflowClient = new FlexTemplatesServiceClient();

async function callLaunchFlexTemplate() {
  // Construct request
  const request = {
  };

  // Run request
  const response = await dataflowClient.launchFlexTemplate(request);
  console.log(response);
}

callLaunchFlexTemplate();

Python

from google.cloud import dataflow_v1beta3


async def sample_launch_flex_template():
    # Create a client
    client = dataflow_v1beta3.FlexTemplatesServiceAsyncClient()

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

    # Make the request
    response = await client.launch_flex_template(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.