Comienza a usar las bibliotecas cliente de Cloud para la API de Workflows
Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Muestra cómo comenzar a usar las bibliotecas cliente de Cloud para Workflows.
Explora más
Para obtener documentación en la que se incluye esta muestra de código, consulta lo siguiente:
Muestra de código
Salvo que se indique lo contrario, el contenido de esta página está sujeto a la licencia Atribución 4.0 de Creative Commons, y los ejemplos de código están sujetos a la licencia Apache 2.0. Para obtener más información, consulta las políticas del sitio de Google Developers. Java es una marca registrada de Oracle o sus afiliados.
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Información o código de muestra incorrectos","incorrectInformationOrSampleCode","thumb-down"],["Faltan la información o los ejemplos que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],[],[],[],null,["Demonstrates getting started with the Cloud Client Libraries for Workflows.\n\nExplore further\n\n\nFor detailed documentation that includes this code sample, see the following:\n\n- [Workflows client libraries](/workflows/docs/reference/libraries)\n\nCode sample \n\nC++\n\n\nBefore trying this sample, follow the C++ setup instructions in the\n[Workflows quickstart using\nclient libraries](/workflows/docs/quickstart-client-libraries).\n\n\nTo authenticate to Workflows, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n #include \"google/cloud/workflows/v1/workflows_client.h\"\n #include \"google/cloud/location.h\"\n #include \u003ciostream\u003e\n\n int main(int argc, char* argv[]) try {\n if (argc != 3) {\n std::cerr \u003c\u003c \"Usage: \" \u003c\u003c argv[0] \u003c\u003c \" project-id location-id\\n\";\n return 1;\n }\n\n auto const location = google::cloud::Location(argv[1], argv[2]);\n\n namespace workflows = ::google::cloud::workflows_v1;\n auto client =\n workflows::WorkflowsClient(workflows::MakeWorkflowsConnection());\n\n for (auto w : client.ListWorkflows(location.FullName())) {\n if (!w) throw std::move(w).status();\n std::cout \u003c\u003c w-\u003eDebugString() \u003c\u003c \"\\n\";\n }\n\n return 0;\n } catch (google::cloud::Status const& status) {\n std::cerr \u003c\u003c \"google::cloud::Status thrown: \" \u003c\u003c status \u003c\u003c \"\\n\";\n return 1;\n }\n\nNode.js\n\n\nBefore trying this sample, follow the Node.js setup instructions in the\n[Workflows quickstart using\nclient libraries](/workflows/docs/quickstart-client-libraries).\n\n\nFor more information, see the\n[Workflows Node.js API\nreference documentation](https://googleapis.dev/nodejs/workflows/latest/).\n\n\nTo authenticate to Workflows, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n const {WorkflowsClient} = require('@google-cloud/workflows');\n const client = new WorkflowsClient();\n\n /**\n * TODO(developer): Uncomment these variables before running the sample.\n */\n // const projectId = 'my-project';\n // const location = 'us-central1';\n\n async function listWorkflows(projectId, location) {\n const [workflows] = await client.listWorkflows({\n parent: client.locationPath(projectId, location),\n });\n for (const workflow of workflows) {\n console.info(`name: ${workflow.name}`);\n }\n }\n\n listWorkflows(projectId, location).catch(err =\u003e {\n console.error(err.message);\n process.exitCode = 1;\n });\n\nNode.js\n\n\nBefore trying this sample, follow the Node.js setup instructions in the\n[Workflows quickstart using\nclient libraries](/workflows/docs/quickstart-client-libraries).\n\n\nFor more information, see the\n[Workflows Node.js API\nreference documentation](https://googleapis.dev/nodejs/workflows/latest/).\n\n\nTo authenticate to Workflows, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n import {WorkflowsClient} from '@google-cloud/workflows';\n const client = new WorkflowsClient();\n\n /**\n * TODO(developer): Uncomment these variables before running the sample.\n */\n // const projectId = 'my-project';\n // const location = 'us-central1';\n\n async function listWorkflows(projectId: string, location: string) {\n const [workflows] = await client.listWorkflows({\n parent: client.locationPath(projectId, location),\n });\n for (const workflow of workflows) {\n console.info(`name: ${workflow.name}`);\n }\n }\n\n listWorkflows(projectId, location).catch((err: Error) =\u003e {\n console.error(err.message);\n process.exitCode = 1;\n });\n\nWhat's next\n\n\nTo search and filter code samples for other Google Cloud products, see the\n[Google Cloud sample browser](/docs/samples?product=workflows)."]]