Ausführung erstellen

Erstellt eine Workflow-Ausführung.

Codebeispiel

Node.js

Bevor Sie dieses Beispiel ausprobieren, folgen Sie der Node.js-Einrichtungsanleitung in der Workflows-Kurzanleitung zur Verwendung von Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Workflows Node.js API.

Richten Sie die Standardanmeldedaten für Anwendungen ein, um sich bei Workflows zu authentifizieren. Weitere Informationen finden Sie unter Authentifizierung für eine lokale Entwicklungsumgebung einrichten.

const {ExecutionsClient} = require('@google-cloud/workflows');
const client = new ExecutionsClient();

async function createExecution(projectId, location, name) {
  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  // const projectId = 'my-project';
  // const location = 'us-central1';
  // const name = 'my-test-workflow';

  const [resp] = await client.createExecution({
    parent: client.workflowPath(projectId, location, name),
  });
  console.info(`name: ${resp.name}`);
}

createExecution(projectId, location, name).catch(err => {
  console.error(err.message);
  process.exitCode = 1;
});

Node.js

Bevor Sie dieses Beispiel ausprobieren, folgen Sie der Anleitung für die Einrichtung von Node.js in der Workflows-Kurzanleitung zur Verwendung von Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Workflows Node.js API.

Richten Sie die Standardanmeldedaten für Anwendungen ein, um sich bei Workflows zu authentifizieren. Weitere Informationen finden Sie unter Authentifizierung für eine lokale Entwicklungsumgebung einrichten.

import {ExecutionsClient} from '@google-cloud/workflows';
const client: ExecutionsClient = new ExecutionsClient();

async function createExecution(
  projectId: string,
  location: string,
  name: string
) {
  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  // const projectId = 'my-project';
  // const location = 'us-central1';
  // const name = 'my-test-workflow';

  const [resp] = await client.createExecution({
    parent: client.workflowPath(projectId, location, name),
  });
  console.info(`name: ${resp.name}`);
}

createExecution(projectId, location, name).catch((err: Error) => {
  console.error(err.message);
  process.exitCode = 1;
});

Weitere Informationen

Wenn Sie nach Codebeispielen für andere Google Cloud -Produkte suchen und filtern möchten, können Sie den Google Cloud -Beispielbrowser verwenden.