[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 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)"]]