Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Workflows veröffentlicht Connectors, um den Zugriff auf andereGoogle Cloud APIs in einem Workflow zu erleichtern und Ihre Workflows in diese Google Cloud Produkte zu integrieren. Beispielsweise können Sie Connectors verwenden, um Pub/Sub-Nachrichten zu veröffentlichen, Daten in einer Firestore-Datenbank zu lesen oder zu schreiben oder Authentifizierungsschlüssel aus Secret Manager abzurufen. Eine detaillierte Referenz zu den verfügbaren Connectors finden Sie in der Referenz zu Connectors.
Connectors vereinfachen den Aufruf von Diensten, da sie die Formatierung von Anfragen für Sie verarbeiten und Methoden und Argumente bereitstellen. Sie müssen also die Details einer Google Cloud API nicht kennen. Weitere Informationen zur Authentifizierung und zum Verhalten bei Wiederholungen und Vorgängen mit langer Laufzeit finden Sie unter Informationen zu Connectors.
Connector-Aufruf aufrufen
Ähnlich wie beim Aufrufen eines HTTP-Endpunkts sind für einen Connector-Aufruf die Felder call und args erforderlich. Sie können einen Zeitüberschreitungswert und eine Polling-Richtlinie mit dem connector_params-Block angeben:
CONNECTOR (erforderlich): Die Connectormethode im Format googleapis.gcp_service.version.resource.operation. Beispiel: googleapis.bigquery.v2.tables.get.
ARG und ARG_VALUE (erforderlich): Für jeden Connector-Aufruf sind unterschiedliche Argumente erforderlich.
KEY und KEY_VALUE (optional): Felder zur Bereitstellung einer Eingabe für die API.
Connectorspezifische Parameter (optional):
TIMEOUT_IN_SECONDS: Zeit in Sekunden.
Die End-to-End-Dauer, die der Connector-Aufruf ausgeführt werden darf, bevor eine Zeitlimitüberschreitungs-Ausnahme ausgelöst wird. Der Standardwert ist 1800. Dies sollte der Höchstwert für Connectormethoden sein, die keine zeitaufwendigen Vorgänge sind.
Andernfalls beträgt das maximale Zeitlimit für einen Connector-Aufruf bei Vorgängen mit langer Ausführungszeit 31536000 Sekunden (ein Jahr).
INITIAL_DELAY_IN_SECONDS: Parameter für die Abrufrichtlinie mit dem Standardwert 1.0. Gilt nur für Aufrufe von Vorgängen mit langer Ausführungszeit.
MULTIPLIER_VALUE: Parameter für die Abrufrichtlinie mit dem Standardwert 1.25. Gilt nur für Aufrufe von Vorgängen mit langer Ausführungszeit.
MAX_DELAY_IN_SECONDS: Parameter für die Abrufrichtlinie mit dem Standardwert 60.0. Gilt nur für Aufrufe von Vorgängen, die lange dauern.
SKIP_POLLING_SWITCH: Wenn dieser Wert auf True gesetzt ist, ist der Aufruf des Connectors nicht blockierend, wenn die ursprüngliche Anfrage zum Verwalten oder Aktualisieren der Ressource erfolgreich ist (in der Regel HTTP POST, HTTP UPDATE oder HTTP DELETE). Wenn die ursprüngliche Anfrage nicht erfolgreich ist, können Wiederholungsversuche erfolgen. Die Abfrage des Status (HTTP GET-Anfragen, die auf die ursprüngliche Anfrage folgen) wird für den Vorgang mit langer Ausführungszeit übersprungen, nachdem die ursprüngliche Anfrage abgeschlossen ist. Der Standardwert ist False.
OAUTH2_SCOPE: OAuth2-Bereiche, die an die Google API übergeben werden sollen. Kann ein String, eine Liste von Strings, ein durch Leerzeichen getrennter String oder ein durch Kommas getrennter String sein.
RESPONSE_VALUE (optional): Variablenname, in dem das Ergebnis eines Connector-Aufrufschritts gespeichert ist.
Beispiel
Im folgenden Workflow wird gezeigt, wie Sie sowohl den Cloud Storage API-Connector als auch den Cloud Translation API-Connector verwenden, um zwei Dateien ins Französische und Spanische zu übersetzen und die Ergebnisse in einem Cloud Storage-Bucket zu speichern.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-09-04 (UTC)."],[],[],null,["# Invoke a Google Cloud service using a connector\n\nWorkflows publishes connectors to make it easier to access other\nGoogle Cloud APIs within a workflow, and to integrate your workflows with\nthose Google Cloud products. For example, you can use connectors to\npublish Pub/Sub messages, read or write data to a Firestore\ndatabase, or retrieve authentication keys from Secret Manager. For a\ndetailed reference of available connectors, see the\n[Connectors reference](/workflows/docs/reference/googleapis#list_of_supported_connectors).\n\nConnectors simplify calling services because they handle the formatting of\nrequests for you, providing methods and arguments so that you don't need to know\nthe details of a Google Cloud API. To learn more about authentication,\nand behavior during retries and long-running operations, see\n[Understand connectors](/workflows/docs/connectors).\n| **Note:** API operations that are facilitated by Workflows connectors should not be confused with calling or invoking a Google Cloud service---such as Cloud Run functions or Cloud Run---which is done through an [HTTP request](/workflows/docs/http-requests).\n\nInvoke a connector call\n-----------------------\n\nSimilar to [invoking an HTTP endpoint](/workflows/docs/http-requests),\na connector call requires `call` and `args` fields. You can specify a timeout\nvalue and polling policy using the `connector_params` block: \n\n```yaml\n- STEP_NAME:\n call: CONNECTOR\n args:\n ARG: ARG_VALUE\n [...]\n body:\n KEY:KEY_VALUE\n [...]\n connector_params:\n timeout: TIMEOUT_IN_SECONDS\n polling_policy:\n initial_delay: INITIAL_DELAY_IN_SECONDS\n multiplier: MULTIPLIER_VALUE\n max_delay: MAX_DELAY_IN_SECONDS\n skip_polling: SKIP_POLLING_SWITCH \n scopes: \u003cvar translate=\"no\"\u003e \u003c/var\u003eOAUTH2_SCOPE \n result: RESPONSE_VALUE\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eSTEP_NAME\u003c/var\u003e: the name of the step.\n- \u003cvar translate=\"no\"\u003eCONNECTOR\u003c/var\u003e (required): the connector method in the form `googleapis.gcp_service.version.resource.operation`. For example, `googleapis.bigquery.v2.tables.get`.\n- \u003cvar translate=\"no\"\u003eARG\u003c/var\u003e and \u003cvar translate=\"no\"\u003eARG_VALUE\u003c/var\u003e (required): each connector call requires different arguments.\n- \u003cvar translate=\"no\"\u003eKEY\u003c/var\u003e and \u003cvar translate=\"no\"\u003eKEY_VALUE\u003c/var\u003e (optional): fields to supply input to the API.\n- Connector-specific parameters (optional):\n - \u003cvar translate=\"no\"\u003eTIMEOUT_IN_SECONDS\u003c/var\u003e: time in seconds. The end-to-end duration the connector call is allowed to run for before throwing a timeout exception. The default value is `1800` and this should be the maximum for connector methods that are not long-running operations. Otherwise, for long-running operations, the maximum timeout for a connector call is `31536000` seconds (one year).\n - \u003cvar translate=\"no\"\u003eINITIAL_DELAY_IN_SECONDS\u003c/var\u003e: polling policy parameter with a default value of `1.0`. Only applies to long-running operation calls.\n - \u003cvar translate=\"no\"\u003eMULTIPLIER_VALUE\u003c/var\u003e: polling policy parameter with a default value of `1.25`. Only applies to long-running operation calls.\n - \u003cvar translate=\"no\"\u003eMAX_DELAY_IN_SECONDS\u003c/var\u003e: polling policy parameter with a default value of `60.0`. Only applies to long-running operation calls.\n - \u003cvar translate=\"no\"\u003eSKIP_POLLING_SWITCH\u003c/var\u003e: if set to `True`, the connector invocation call is non-blocking if the initial request to manage or update the resource succeeds (usually `HTTP POST`, `HTTP UPDATE`, or `HTTP DELETE`). If the initial request is not successful, retries might occur. Polling of status (`HTTP GET` requests that follow the initial request) is skipped for the long-running operation after the initial request completes. The default value is `False`.\n - \u003cvar translate=\"no\"\u003eOAUTH2_SCOPE\u003c/var\u003e: OAuth2 scopes to pass to the Google API. Can be a string, list of strings, space-separated string, or comma-separated string.\n- \u003cvar translate=\"no\"\u003eRESPONSE_VALUE\u003c/var\u003e (optional): variable name where the result of a connector call invocation step is stored.\n\n### Example\n\nThe following workflow demonstrates using both the\n[Cloud Storage API connector](/workflows/docs/reference/googleapis/storage/Overview)\nand the\n[Cloud Translation API connector](/workflows/docs/reference/googleapis/translate/Overview)\nto translate two files to French and Spanish, saving the results in a\nCloud Storage bucket. \n\n main:\n steps:\n - init:\n assign:\n - projectId: ${sys.get_env(\"GOOGLE_CLOUD_PROJECT_ID\")}\n - location: ${sys.get_env(\"GOOGLE_CLOUD_LOCATION\")}\n - inputBucketName: ${projectId + \"-input-files\"}\n - outputBucketName: ${projectId + \"-output-files-\" + string(int(sys.now()))}\n - createOutputBucket:\n call: googleapis.storage.v1.buckets.insert\n args:\n project: ${projectId}\n body:\n name: ${outputBucketName}\n - batchTranslateText:\n call: googleapis.translate.v3beta1.projects.locations.batchTranslateText\n args:\n parent: ${\"projects/\" + projectId + \"/locations/\" + location}\n body:\n inputConfigs:\n gcsSource:\n inputUri: ${\"gs://\" + inputBucketName + \"/*\"}\n outputConfig:\n gcsDestination:\n outputUriPrefix: ${\"gs://\" + outputBucketName + \"/\"}\n sourceLanguageCode: \"en\"\n targetLanguageCodes: [\"es\", \"fr\"]\n result: batchTranslateTextResult\n\nWhat's next\n-----------\n\n- [Tutorial: Run a batch translation using the Cloud Translation connector](/workflows/docs/tutorials/translation-connector)"]]