Class v1beta3.TemplatesServiceClient (3.0.2)

Provides a method to create Cloud Dataflow jobs from templates. v1beta3

Package

@google-cloud/dataflow

Constructors

(constructor)(opts, gaxInstance)

constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);

Construct an instance of TemplatesServiceClient.

Parameters
NameDescription
opts ClientOptions
gaxInstance typeof gax | typeof fallback

: loaded instance of google-gax. Useful if you need to avoid loading the default gRPC version and want to use the fallback HTTP implementation. Load only fallback version and pass it to the constructor: ``` const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC const client = new TemplatesServiceClient({fallback: true}, gax); ```

Properties

apiEndpoint

static get apiEndpoint(): string;

The DNS address for this API service - same as servicePath(), exists for compatibility reasons.

auth

auth: gax.GoogleAuth;

descriptors

descriptors: Descriptors;

innerApiCalls

innerApiCalls: {
        [name: string]: Function;
    };

port

static get port(): number;

The port for this API service.

scopes

static get scopes(): string[];

The scopes needed to make gRPC calls for every method defined in this service.

servicePath

static get servicePath(): string;

The DNS address for this API service.

templatesServiceStub

templatesServiceStub?: Promise<{
        [name: string]: Function;
    }>;

warn

warn: (code: string, message: string, warnType?: string) => void;

Methods

close()

close(): Promise<void>;

Terminate the gRPC channel and close the client.

The client will no longer be usable and all future behavior is undefined.

Returns
TypeDescription
Promise<void>

{Promise} A promise that resolves when the client is closed.

createJobFromTemplate(request, options)

createJobFromTemplate(request?: protos.google.dataflow.v1beta3.ICreateJobFromTemplateRequest, options?: CallOptions): Promise<[
        protos.google.dataflow.v1beta3.IJob,
        protos.google.dataflow.v1beta3.ICreateJobFromTemplateRequest | undefined,
        {} | undefined
    ]>;

Creates a Cloud Dataflow job from a template.

Parameters
NameDescription
request ICreateJobFromTemplateRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.dataflow.v1beta3.IJob, protos.google.dataflow.v1beta3.ICreateJobFromTemplateRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing Job. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * 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. The job name to use for the created job.
   */
  // const jobName = 'abc123'
  /**
   *  Required. A Cloud Storage path to the template from which to
   *  create the job.
   *  Must be a valid Cloud Storage URL, beginning with `gs://`.
   */
  // const gcsPath = 'abc123'
  /**
   *  The runtime parameters to pass to the job.
   */
  // const parameters = [1,2,3,4]
  /**
   *  The runtime environment for the job.
   */
  // const environment = {}
  /**
   *  The regional endpoint 
   *  (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) to
   *  which to direct the request.
   */
  // const location = 'abc123'

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

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

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

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

  callCreateJobFromTemplate();

createJobFromTemplate(request, options, callback)

createJobFromTemplate(request: protos.google.dataflow.v1beta3.ICreateJobFromTemplateRequest, options: CallOptions, callback: Callback<protos.google.dataflow.v1beta3.IJob, protos.google.dataflow.v1beta3.ICreateJobFromTemplateRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request ICreateJobFromTemplateRequest
options CallOptions
callback Callback<protos.google.dataflow.v1beta3.IJob, protos.google.dataflow.v1beta3.ICreateJobFromTemplateRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

createJobFromTemplate(request, callback)

createJobFromTemplate(request: protos.google.dataflow.v1beta3.ICreateJobFromTemplateRequest, callback: Callback<protos.google.dataflow.v1beta3.IJob, protos.google.dataflow.v1beta3.ICreateJobFromTemplateRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request ICreateJobFromTemplateRequest
callback Callback<protos.google.dataflow.v1beta3.IJob, protos.google.dataflow.v1beta3.ICreateJobFromTemplateRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getProjectId()

getProjectId(): Promise<string>;
Returns
TypeDescription
Promise<string>

getProjectId(callback)

getProjectId(callback: Callback<string, undefined, undefined>): void;
Parameter
NameDescription
callback Callback<string, undefined, undefined>
Returns
TypeDescription
void

getTemplate(request, options)

getTemplate(request?: protos.google.dataflow.v1beta3.IGetTemplateRequest, options?: CallOptions): Promise<[
        protos.google.dataflow.v1beta3.IGetTemplateResponse,
        protos.google.dataflow.v1beta3.IGetTemplateRequest | undefined,
        {} | undefined
    ]>;

Get the template associated with a template.

Parameters
NameDescription
request IGetTemplateRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.dataflow.v1beta3.IGetTemplateResponse, protos.google.dataflow.v1beta3.IGetTemplateRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * 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. A Cloud Storage path to the template from which to
   *  create the job.
   *  Must be valid Cloud Storage URL, beginning with 'gs://'.
   */
  // const gcsPath = 'abc123'
  /**
   *  The view to retrieve. Defaults to METADATA_ONLY.
   */
  // const view = {}
  /**
   *  The regional endpoint 
   *  (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) to
   *  which to direct the request.
   */
  // const location = 'abc123'

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

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

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

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

  callGetTemplate();

getTemplate(request, options, callback)

getTemplate(request: protos.google.dataflow.v1beta3.IGetTemplateRequest, options: CallOptions, callback: Callback<protos.google.dataflow.v1beta3.IGetTemplateResponse, protos.google.dataflow.v1beta3.IGetTemplateRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IGetTemplateRequest
options CallOptions
callback Callback<protos.google.dataflow.v1beta3.IGetTemplateResponse, protos.google.dataflow.v1beta3.IGetTemplateRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getTemplate(request, callback)

getTemplate(request: protos.google.dataflow.v1beta3.IGetTemplateRequest, callback: Callback<protos.google.dataflow.v1beta3.IGetTemplateResponse, protos.google.dataflow.v1beta3.IGetTemplateRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IGetTemplateRequest
callback Callback<protos.google.dataflow.v1beta3.IGetTemplateResponse, protos.google.dataflow.v1beta3.IGetTemplateRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

initialize()

initialize(): Promise<{
        [name: string]: Function;
    }>;

Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.

You can await on this method if you want to make sure the client is initialized.

Returns
TypeDescription
Promise<{ [name: string]: Function; }>

{Promise} A promise that resolves to an authenticated service stub.

launchTemplate(request, options)

launchTemplate(request?: protos.google.dataflow.v1beta3.ILaunchTemplateRequest, options?: CallOptions): Promise<[
        protos.google.dataflow.v1beta3.ILaunchTemplateResponse,
        protos.google.dataflow.v1beta3.ILaunchTemplateRequest | undefined,
        {} | undefined
    ]>;

Launch a template.

Parameters
NameDescription
request ILaunchTemplateRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.dataflow.v1beta3.ILaunchTemplateResponse, protos.google.dataflow.v1beta3.ILaunchTemplateRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing LaunchTemplateResponse. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * 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'
  /**
   *  If true, the request is validated but not actually executed.
   *  Defaults to false.
   */
  // const validateOnly = true
  /**
   *  A Cloud Storage path to the template from which to create
   *  the job.
   *  Must be valid Cloud Storage URL, beginning with 'gs://'.
   */
  // const gcsPath = 'abc123'
  /**
   *  Params for launching a dynamic template.
   */
  // const dynamicTemplate = {}
  /**
   *  The parameters of the template to launch. This should be part of the
   *  body of the POST request.
   */
  // const launchParameters = {}
  /**
   *  The regional endpoint 
   *  (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) to
   *  which to direct the request.
   */
  // const location = 'abc123'

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

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

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

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

  callLaunchTemplate();

launchTemplate(request, options, callback)

launchTemplate(request: protos.google.dataflow.v1beta3.ILaunchTemplateRequest, options: CallOptions, callback: Callback<protos.google.dataflow.v1beta3.ILaunchTemplateResponse, protos.google.dataflow.v1beta3.ILaunchTemplateRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request ILaunchTemplateRequest
options CallOptions
callback Callback<protos.google.dataflow.v1beta3.ILaunchTemplateResponse, protos.google.dataflow.v1beta3.ILaunchTemplateRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

launchTemplate(request, callback)

launchTemplate(request: protos.google.dataflow.v1beta3.ILaunchTemplateRequest, callback: Callback<protos.google.dataflow.v1beta3.ILaunchTemplateResponse, protos.google.dataflow.v1beta3.ILaunchTemplateRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request ILaunchTemplateRequest
callback Callback<protos.google.dataflow.v1beta3.ILaunchTemplateResponse, protos.google.dataflow.v1beta3.ILaunchTemplateRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void