### Quickstart Guide Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-api-apikeys/samples/README.md A quickstart guide to get started with the API Keys Node.js library. Run this command to execute the sample. ```javascript node packages/google-api-apikeys/samples/quickstart.js ``` -------------------------------- ### Quickstart Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-chronicle/samples/README.md A basic example to get started with the Google Cloud Chronicle client library. It demonstrates initial setup and a simple operation. ```javascript node packages/google-cloud-chronicle/samples/quickstart.js ``` -------------------------------- ### Quickstart Sample Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-vpcaccess/samples/README.md This is a quickstart sample for using the VPC Access client library. It provides a basic example to get you started. Ensure you have followed the setup instructions in the 'Using the client library' section. ```javascript async function main() { // Imports the Google Cloud client library const { VpcAccessServiceClient } = require('@google-cloud/vpc-access'); // Instantiates a client const vpcAccessServiceClient = new VpcAccessServiceClient(); // TODO(developer): set your project ID and location before running the sample const projectId = 'your-project-id'; const location = 'us-central1'; const formattedParent = `projects/${projectId}/locations/${location}`; console.log('Listing VPC Access connectors...'); const [connectors] = await vpcAccessServiceClient.listConnectors({ parent: formattedParent, }); if (connectors.length === 0) { console.log('No connectors found.'); return; } console.log('VPC Access connectors:'); connectors.forEach(connector => { console.log(`- ${connector.name}`); }); } main().catch(err => { console.error('ERROR:', err); process.exitCode = 1; }); ``` -------------------------------- ### Quickstart Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-domains/samples/README.md This is a quickstart guide to get you started with the Google Cloud Domains Node.js client library. It demonstrates basic usage and setup. ```javascript node packages/google-cloud-domains/samples/quickstart.js ``` -------------------------------- ### Quickstart - Node.js Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-vmwareengine/samples/README.md A basic quickstart example for using the VMware Engine client library. This sample helps you get started with basic operations. ```javascript /** * This sample demonstrates how to list VMware Engine private clouds. * * @param {string} projectId Your Google Cloud project ID. * @param {string} location The location of the private clouds. */ async function listPrivateClouds(projectId, location) { const {VmwareEngineClient} = require('@google-cloud/vmwareengine'); // Create a new client const client = new VmwareEngineClient(); // Construct the parent resource name. const parent = `projects/${projectId}/locations/${location}`; try { const [response] = await client.listPrivateClouds({parent: parent}); console.log('Private clouds found:'); response.forEach(privateCloud => { console.log(privateCloud.name); }); } catch (err) { console.error('Error listing private clouds:', err); } } // TODO(developer): uncomment these variables before running the sample // const projectId = 'your-project-id'; // const location = 'your-location'; // listPrivateClouds(projectId, location); ``` -------------------------------- ### Quickstart - Node.js Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-oslogin/samples/README.md A basic example to get started with the OS Login API. This sample provides a foundational usage pattern. ```javascript const {OsLoginServiceClient} = require('@google-cloud/os-login'); const client = new OsLoginServiceClient(); async function main() { // TODO(developer): Uncomment these variables before running the sample // const projectId = 'your-project-id'; // const username = 'your-username'; // Construct the user resource name const userResourceName = `users/${username}`; // Example: List SSH public keys for a user const [sshKeys] = await client.listSshPublicKeys({ parent: userResourceName, }); console.log('SSH Public Keys:'); sshKeys.forEach(key => { console.log(`- ${key.name}: ${key.fingerprint}`); }); // Example: Get a specific SSH public key if (sshKeys.length > 0) { const keyName = sshKeys[0].name; const [sshPublicKey] = await client.getSshPublicKey({ name: keyName, }); console.log(` Details for ${keyName}:`); console.log(` Key: ${sshPublicKey.key}`); console.log(` Fingerprint: ${sshPublicKey.fingerprint}`); } } main().catch(err => { console.error('Error running quickstart:', err); }); ``` -------------------------------- ### Quickstart: GKE Connect Gateway Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-gkeconnect-gateway/samples/README.md A quickstart example to get you started with the GKE Connect Gateway client library. This sample shows basic usage and setup. ```javascript const {GatewayServiceClient} = require('@google-cloud/gke-connect-gateway'); // TODO(developer): uncomment these variables before running the sample. // const projectId = 'my-project-id'; // const location = 'us-central1'; async function quickstart() { const gatewayServiceClient = new GatewayServiceClient(); // Example of listing gateways (replace with your specific needs) const parent = `projects/${projectId}/locations/${location}`; const [gateways] = await gatewayServiceClient.listGateways({parent: parent}); console.log('Gateways:'); for (const gateway of gateways) { console.log(gateway.name); } } quickstart().catch(console.error); ``` -------------------------------- ### Quickstart Example (Node.js) Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-maps-solar/samples/README.md A basic example to get you started with the Google Maps Solar API using Node.js. This sample covers essential setup and a simple API call. ```javascript node packages/google-maps-solar/samples/quickstart.js ``` -------------------------------- ### Quickstart Example Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/README.md A basic example demonstrating how to initialize the TPU client and perform a simple operation. This is a good starting point for new users. ```javascript const {TpuClient} = require('@google-cloud/tpu'); async function main() { // Instantiates a client const client = new TpuClient(); // TODO(developer): Set these variables before running the sample. // const projectId = 'my-project'; // const location = 'us-central1-a'; // const node_id = 'my-node'; // Construct the fully qualified location path to search for // const parent = `projects/${projectId}/locations/${location}`; // Example: List TPU nodes in a project and location // const [response] = await client.listNodes({parent}); // console.log('TPU nodes:', response); console.log('Quickstart example executed. Uncomment and set variables to run actual API calls.'); } main().catch(console.error); ``` -------------------------------- ### Quickstart Guide Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-ads-admanager/samples/README.md A quickstart guide to help you get started with the Google Ads Ad Manager API. Run this sample using `node packages/google-ads-admanager/samples/quickstart.js`. ```javascript node packages/google-ads-admanager/samples/quickstart.js ``` -------------------------------- ### Dialogflow Quickstart Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/README.md This is a quickstart guide for using the Dialogflow Node.js client library. It provides a basic example to get you started. ```javascript /** * TODO(developer): Uncomment these variables before running the sample. */ // const projectId = 'YOUR_PROJECT_ID'; // const sessionId = 'YOUR_SESSION_ID'; // const query = 'Hello'; // Imports the Google Cloud client library const {SessionsClient} = require('@google-cloud/dialogflow'); async function quickstart(projectId, sessionId, query) { // A unique identifier for the given session const sessionPath = SessionsClient.projectAgentSessionPath(projectId, sessionId); console.log('Session path: ' + sessionPath); // The text query request. const request = { session: sessionPath, queryInput: { text: { text: query, languageCode: 'en-US', }, }, }; // Send request and log response from the session client. const responses = await sessionClient.detectIntent(request); console.log('Detected intent'); const result = responses[0].queryResult; console.log(` Query: ${result.queryText}`); for (const intent of result.intentDetectionConfidence) { console.log(` Intent: ${intent.intent.displayName} (${intent.confidence}) `); } console.log(` Default fallback intent: ${result.intent.displayName} `); console.log(` Response: ${result.fulfillmentText} `); } const sessionClient = new SessionsClient(); quickstart(projectId, sessionId, query).catch(console.error); ``` -------------------------------- ### Quickstart for App Connectors Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-beyondcorp-appconnectors/samples/README.md A basic quickstart example to get started with the App Connectors client library. This sample assumes you have set up authentication. ```javascript const {AppConnectorsServiceClient} = require('@google-cloud/beyondcorp-appconnectors'); // Instantiates a client const client = new AppConnectorsServiceClient(); async function main() { // TODO(developer): Uncomment these variables before running the sample // const projectId = 'your-project-id'; // const location = 'your-location'; // const connectorId = 'your-connector-id'; const request = { // parent: client.locationPath(projectId, location), }; // Lists App Connectors, as an example const [connectors] = await client.listAppConnectors(request); console.log('App Connectors:'); connectors.forEach(connector => { console.log(connector.name); }); } main().catch(console.error); ``` -------------------------------- ### Quickstart Sample Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-maintenance-api/samples/README.md View the source code for the quickstart guide. Ensure you have installed the necessary npm packages and are in the 'samples' directory. ```javascript node packages/google-cloud-maintenance-api/samples/quickstart.js ``` -------------------------------- ### Quickstart Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datacatalog-lineage/samples/README.md A basic example demonstrating how to initialize the client and perform a simple operation. This is a good starting point for understanding the library's usage. ```javascript /** * This quickstart is a placeholder and requires you to fill in the actual API calls. * Please refer to the specific API documentation for examples. */ // Import the client library const {LineageClient} = require('@google-cloud/datacatalog-lineage'); // TODO(developer): Set these variables before running the sample. // const projectId = 'your-project-id'; // const location = 'your-location'; // Creates a client const lineageClient = new LineageClient(); async function quickstart() { // TODO(developer): Implement your desired API calls here. // For example, to list locations: // const [locations] = await lineageClient.listLocations({name: `projects/${projectId}`}); // console.log('Locations:'); // locations.forEach(location => console.log(location.locationId)); console.log('Quickstart finished. Please implement API calls.'); } quickstart().catch(err => { console.error('ERROR:', err); process.exitCode = 1; }); ``` -------------------------------- ### Quickstart Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-streetview-publish/samples/README.md A basic example to get started with the Street View Publish API. It demonstrates the fundamental setup and a common use case. ```javascript /** * This sample demonstrates how to use the Street View Publish API to upload a photo. * * For more information, see the API documentation: * https://developers.google.com/street-view/publish/v1/reference/rest/v1/accounts.photos/create */ // [START streetviewpublish_quickstart] // Imports the Google Cloud client library const {StreetViewPublishServiceClient} = require('@google-cloud/streetview-publish'); // TODO(developer): Set these environment variables or replace with your values. const projectId = process.env.GOOGLE_CLOUD_PROJECT; async function quickstart() { // Instantiates a client const streetViewPublishServiceClient = new StreetViewPublishServiceClient(); // TODO(developer): Set the path to your photo file. const filePath = 'path/to/your/photo.jpg'; // TODO(developer): Set the pose information for the photo. // See https://developers.google.com/streetview/publish/docs/creating_photos#photo_pose const pose = { altitude: 26.0, latitude: 37.419097, longitude: -122.080187, pitch: 10.0, roll: 0.0, yaw: 0.0, }; // TODO(developer): Set the upload URL. // See https://developers.google.com/streetview/publish/docs/uploading_photos#upload_url const uploadUrl = 'YOUR_UPLOAD_URL'; // Construct the request const request = { parent: `accounts/${streetViewPublishServiceClient.getProjectId()} /locations/.*`, // Replace with your account ID if not using the default project photo: { pose: pose, }, // TODO(developer): Set the upload URL. // uploadUrl: uploadUrl, }; try { // Creates a photo const [photo] = await streetViewPublishServiceClient.createPhoto(request); console.log('Photo created:', photo.name); // Uploads the photo data const fs = require('fs'); const fileStream = fs.createReadStream(filePath); await streetViewPublishServiceClient.batch_update_photos({ // TODO(developer): Set the upload URL. // uploadUrl: uploadUrl, contents: fileStream, }); console.log('Photo data uploaded.'); // Updates the photo metadata const updateMask = { paths: ['pose.altitude', 'pose.latitude', 'pose.longitude', 'pose.pitch', 'pose.roll', 'pose.yaw'], }; const [updatedPhoto] = await streetViewPublishServiceClient.updatePhoto({ photo: { name: photo.name, pose: pose, }, updateMask: updateMask, }); console.log('Photo metadata updated:', updatedPhoto.name); return updatedPhoto; } catch (err) { console.error('ERROR:', err); } } quickstart(); // [END streetviewpublish_quickstart] ``` -------------------------------- ### Quickstart - Node.js Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-shopping-merchant-lfp/samples/README.md A basic example to get started with the LFP Store Service. Run this sample using `node packages/google-shopping-merchant-lfp/samples/quickstart.js`. ```javascript /** * This quickstart application demonstrates how to list LFP stores for a given account. * * Prerequisites: * - You have a Google Cloud project with the Shopping Merchant API enabled. * - You have authenticated using Application Default Credentials (ADC). * See https://cloud.google.com/docs/authentication-adc * * Usage: * `node quickstart.js ` */ async function main(accountId) { // Imports the Google Cloud client library const { LfpStoreServiceClient } = require('@google-cloud/shopping-merchant-lfp'); // Instantiates a client const client = new LfpStoreServiceClient(); async function listStores() { const parent = client.accountPath(accountId); const request = { parent, }; console.log(`Listing LFP stores for account: ${accountId}`); // Executes the list lfp stores call const [response] = await client.listLfpStores(request); if (response.length === 0) { console.log('No LFP stores found.'); return; } console.log('LFP Stores:'); response.forEach(store => { console.log(`- Name: ${store.storeName}`); console.log(` Merchant ID: ${store.merchantId}`); console.log(` Country: ${store.country}`); }); } await listStores(); } // Get account ID from command line arguments const args = process.argv.slice(2); if (args.length !== 1) { console.error('Usage: node quickstart.js '); process.exit(1); } main(args[0]).catch(err => { console.error('Error running quickstart:', err); process.exit(1); }); ``` -------------------------------- ### Quickstart for Google Cloud Managed Kafka Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-managedkafka/samples/README.md This is a quickstart guide to get you started with Google Cloud Managed Kafka using Node.js. It provides a basic example of how to initialize the client and perform a simple operation. ```javascript /** * This quickstart application demonstrates how to initialize the ManagedKafkaClient * and perform a basic operation. Replace placeholder values with your actual project details. */ // Import the client library const {ManagedKafkaClient} = require('@google-cloud/managedkafka'); async function quickstart() { // Instantiates a client const client = new ManagedKafkaClient(); // TODO(developer): Set these variables before running the sample. const projectId = 'your-project-id'; const location = 'us-central1'; // e.g., 'us-central1' const clusterId = 'your-cluster-id'; // Example: List clusters (replace with a specific operation if needed) try { const [clusters] = await client.listClusters({parent: client.locationPath(projectId, location)}); console.log('Managed Kafka Clusters:'); clusters.forEach(cluster => console.log(cluster.name)); console.log('Quickstart finished successfully.'); } catch (err) { console.error('ERROR:', err); } } quickstart(); ``` -------------------------------- ### Quickstart for Google Cloud Monitoring Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/README.md A basic quickstart example to get started with the Google Cloud Monitoring client library for Node.js. ```javascript /** * This quickstart module demonstrates how to list uptime check configurations * for a project. * * Replace "YOUR_PROJECT_ID" with your project ID. */ // [START monitoring_quickstart] // Imports the Google Cloud client library const {UptimeCheckServiceClient} = require('@google-cloud/monitoring').v3; async function quickstart() { // Creates a client const uptimeCheckServiceClient = new UptimeCheckServiceClient(); // TODO(developer): uncomment these variables before running the sample // const projectId = 'YOUR_PROJECT_ID'; const request = { parent: `projects/${projectId}`, }; // Lists uptime check configurations for the project const [uptimeChecks] = await uptimeCheckServiceClient.listUptimeChecks(request); console.log('Uptime checks:'); uptimeChecks.forEach(uptimeCheck => console.log(uptimeCheck.name)); } quickstart(); // [END monitoring_quickstart] ``` -------------------------------- ### Quickstart for Access Context Manager Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-identity-accesscontextmanager/samples/README.md A basic example to get started with the Access Context Manager client library. This typically involves listing access policies. ```javascript /** * This sample demonstrates how to list the Access Context Manager access policies. * * @param {string} parent The parent resource to list policies for. * Example: 'organizations/12345' */ async function listAccessPolicies(parent) { // Imports the Google Cloud client library const {AccessContextManagerClient} = require('@google-cloud/access-context-manager'); // Instantiates a client const accessContextManagerClient = new AccessContextManagerClient(); const request = { parent: parent, }; // Executes the async operation const [response] = await accessContextManagerClient.listAccessPolicies(request); console.log('Access policies:'); for (const policy of response) { console.log(`- ${policy.name} (${policy.title})`); } } // TODO(developer): set to your organization ID before running the sample // listAccessPolicies('organizations/12345').catch(err => { // console.error(err); // process.exitCode = 1; // }); ``` -------------------------------- ### Quickstart - Node.js Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-apigateway/samples/README.md A quickstart guide to using the API Gateway client library. This sample typically covers basic setup and a common operation. ```javascript async function main() { // This is a placeholder for the actual quickstart code. // Please refer to the official documentation for the complete quickstart example. console.log('Quickstart sample placeholder.'); } main().catch(console.error); ``` -------------------------------- ### Quickstart Node.js Sample Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-policysimulator/samples/README.md This is a quickstart sample for using the Google Cloud Policy Simulator Node.js client library. It provides a basic example of how to get started. ```javascript /** * This sample demonstrates how to create a replay and list its results. * * Before running: * 1. Enable the API by visiting https://console.cloud.google.com/apis/library/policysimulator.googleapis.com * 2. Make sure that billing is enabled for your project. * 3. Set up authentication. See https://cloud.google.com/docs/authentication-setup#providing-credentials-default * * @param {string} projectId Your Google Cloud project ID */ async function main(projectId = 'your-project-id') { // Imports the Google Cloud client library const {SimulatorClient} = require('@google-cloud/policy-simulator'); // Instantiates a client const client = new SimulatorClient(); const parent = `projects/${projectId}/policies/my-policy` const replay = { policyBindingDeltas: [ { action: 'ADD', policyBinding: { role: 'roles/viewer', members: ['user:test@example.com'], }, }, ], }; console.log('Creating replay...'); const [operation] = await client.createReplay({parent, replay}); const [response] = await operation.promise(); console.log('Created replay:'); console.log(response); const replayName = response.name; console.log('Listing replay results...'); // Use the paginator for this API method. const [replayResults] = await client.listReplayResultsAsync({parent: replayName}); console.log('Replay results:'); for (const replayResult of replayResults) { console.log(replayResult); } } main().catch(err => { console.error(err); process.exitCode = 1; }); ``` -------------------------------- ### Quickstart Sample Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring-dashboard/README.md A basic example to get started with the Google Cloud Monitoring Dashboards client library. This sample typically involves initializing the client and performing a simple operation like listing dashboards. ```javascript /** * TODO(developer): * 1. Set your Google Cloud project ID. * 2. Enable the Cloud Monitoring API and the Cloud Monitoring Dashboards API. * 3. Make sure that the user account or service account you are using has the necessary permissions. */ async function main(projectId = 'your-project-id') { // Imports the Google Cloud client library const {DashboardsServiceClient} = require('@google-cloud/monitoring-dashboard'); // Instantiates a client const client = new DashboardsServiceClient(); async function listDashboards() { const request = { parent: `projects/${projectId}`, }; // Lists dashboards const [dashboards] = await client.listDashboards(request); console.log('Dashboards:'); dashboards.forEach(dashboard => console.log(dashboard.name)); } listDashboards(); } main().catch(console.error); ``` -------------------------------- ### Dataproc Quickstart Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dataproc/samples/README.md A basic example demonstrating how to initialize the Dataproc client and perform a simple operation. This is useful for verifying your setup. ```javascript const {WorkflowTemplateServiceClient} = require('@google-cloud/dataproc'); async function main() { // Instantiates a client const client = new WorkflowTemplateServiceClient(); // TODO(developer): Set these variables before running the sample. // const projectId = await WorkflowTemplateServiceClient.getProjectId(); // const location = 'global'; // const workflowTemplate = 'your-template-name'; // const name = client.workflowTemplatePath(projectId, location, workflowTemplate); // const response = await client.getWorkflowTemplate({name: name}); // console.log('Workflow template details:', response); console.log('Quickstart sample executed. Uncomment and configure variables to run a Dataproc operation.'); } main().catch(console.error); ``` -------------------------------- ### Quickstart Example Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-container/samples/README.md This sample provides a basic quickstart for using the Google Container Node.js library. It's a good starting point for understanding the library's core functionality. ```javascript node packages/google-container/samples/quickstart.js ``` -------------------------------- ### Quickstart Node.js Sample Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-billing-budgets/samples/README.md A basic example to get started with the Google Cloud Billing Budgets API. This sample provides a foundational understanding. ```javascript node packages/google-cloud-billing-budgets/samples/quickstart.js ``` -------------------------------- ### Quickstart - Node.js Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-ids/samples/README.md A basic quickstart example for Cloud IDS. This sample provides a starting point for using the Cloud IDS client library. ```javascript const ids = require('@google-cloud/ids'); async function main() { const client = new ids.V1Client(); // TODO(developer): Uncomment these variables before running the sample. // const projectId = 'my-project-id'; // const location = 'global'; const parent = client.locationPath(projectId, location); const request = { parent, }; const [response] = await client.listEndpoints(request); console.log('Endpoints:'); for (const endpoint of response) { console.log(endpoint); } } main().catch(err => { console.error(err); process.exitCode = 1; }); ``` -------------------------------- ### Quickstart Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-bigquery-datapolicies/samples/README.md A quickstart guide to get you started with the BigQuery Data Policies API. Run this sample using `node packages/google-cloud-bigquery-datapolicies/samples/quickstart.js`. ```javascript /** * This sample demonstrates how to list data policies in a project. * * @param {string} projectId Your Google Cloud project ID. */ async function main(projectId) { // Imports the Google Cloud Data Policy library const {DataPolicyServiceClient} = require('@google-cloud/bigquery-datapolicies'); // Instantiates a client const client = new DataPolicyServiceClient(); // Construct the parent resource name. const parent = `projects/${projectId}`; try { const [dataPolicies] = await client.listDataPolicies({ parent, }); console.log('Data policies:'); if (dataPolicies.length === 0) { console.log('No data policies found.'); return; } dataPolicies.forEach(dataPolicy => { console.log(`- ${dataPolicy.name}`); }); } catch (err) { console.error('Error listing data policies:', err); } } // Example usage: // Replace with your project ID // main('your-project-id').catch(console.error); ``` -------------------------------- ### Quickstart Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms-inventory/samples/README.md A quickstart guide to get started with the KMS Inventory API Node.js samples. Follow the usage instructions to run the sample. ```javascript node packages/google-cloud-kms-inventory/samples/quickstart.js ``` -------------------------------- ### Quickstart for BigQuery Data Exchange Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-bigquery-dataexchange/samples/README.md A basic quickstart example to get started with the BigQuery Data Exchange client library. This sample provides a foundational example for common operations. ```javascript async function main() { // Imports the Google Cloud client library const { AnalyticsHubServiceClient } = require("@google-cloud/bigquery-dataexchange"); // TODO(developer): Uncomment these variables before running the sample. // const projectId = "your-project-id"; // const location = "us-central1"; // const dataExchangeId = "data-exchange-id"; // const listingId = "listing-id"; // Creates a client const client = new AnalyticsHubServiceClient(); // Construct the resource name for the data exchange and listing const dataExchangeName = client.dataExchangePath(projectId, location, dataExchangeId); const listingName = client.listingPath(projectId, location, dataExchangeId, listingId); console.log("Data Exchange Name:", dataExchangeName); console.log("Listing Name:", listingName); // Example of listing data exchanges (replace with actual calls for other operations) // const [dataExchanges] = await client.listDataExchanges({ parent: `projects/${projectId}/locations/${location}` }); // console.log("Data Exchanges:", dataExchanges); } main().catch(console.error); ``` -------------------------------- ### Quickstart - Service Directory Node.js Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-servicedirectory/samples/README.md A basic quickstart example for Service Directory. This sample requires the Service Directory client library to be installed and authenticated. ```javascript /** * TODO(developer): Uncomment these constants before running the sample. */ // const projectId = 'my-project-id'; // const locationId = 'my-location'; // const namespaceId = 'my-namespace'; // const serviceId = 'my-service'; // const endpointId = 'my-endpoint'; // Imports the Google Cloud Service Directory library const {RegistrationServiceClient} = require('@google-cloud/service-directory'); // Instantiates a client const registrationServiceClient = new RegistrationServiceClient(); async function quickstart() { const name = registrationServiceClient.namespacePath( projectId, locationId, namespaceId ); const service = { name: registrationServiceClient.servicePath( projectId, locationId, namespaceId, serviceId ), metadata: { endpoints: [ { name: registrationServiceClient.endpointPath( projectId, locationId, namespaceId, serviceId, endpointId ), port: 8080, }, ], }, }; const request = { parent: name, service, }; // Creates a service const [response] = await registrationServiceClient.createService(request); console.log('Created service:', response); } quickstart(); ``` -------------------------------- ### Quickstart for Policy Troubleshooter IAM Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-policytroubleshooter-iam/samples/README.md This quickstart sample provides a basic example of how to use the Policy Troubleshooter IAM client library. Follow the setup instructions in the 'Before you begin' section to install dependencies and authenticate. ```javascript node packages/google-cloud-policytroubleshooter-iam/samples/quickstart.js ``` -------------------------------- ### Google Cloud Lustre Quickstart Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-lustre/samples/README.md A basic quickstart guide for using the Google Cloud Lustre client library. This sample helps you get started with basic operations. ```javascript /** * This sample demonstrates how to list Lustre instances in a project. * * @param {string} projectId Your Google Cloud project ID */ async function main(projectId) { // Imports the Google Cloud client library const {FileServiceClient} = require('@google-cloud/lustre'); // Instantiates a client const client = new FileServiceClient(); // Construct the parent resource name const parent = `projects/${projectId}/locations/-`; // Lists instances const [instances] = await client.listInstances({ parent, }); console.log('Lustre instances:'); instances.forEach(instance => { console.log(instance.name); }); } main(...process.argv.slice(2)).catch(err => { console.error(err); process.exitCode = 1; }); ``` -------------------------------- ### Quickstart for Order Tracking Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-shopping-merchant-ordertracking/samples/README.md This is a quickstart sample to get you started with the Order Tracking API. It provides a basic example of how to use the library. ```javascript node packages/google-shopping-merchant-ordertracking/samples/quickstart.js ``` -------------------------------- ### Quickstart for Google Cloud Quotas Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-api-cloudquotas/samples/README.md A basic quickstart example to demonstrate the initial setup and usage of the Google Cloud Quotas client library. ```javascript /** * This sample demonstrates how to list quota information for a project. * * Replace "your-project-id" with your Google Cloud project ID. */ async function main(projectId = "your-project-id") { // Imports the Google Cloud client library const {QuotaInfoClient} = require('@google-cloud/quotas'); // Instantiates a client const client = new QuotaInfoClient(); // Construct the project name const projectName = `projects/${projectId}`; // Lists quota information for the project const [response] = await client.listQuotaInfo({parent: projectName}); console.log("Quota Info:"); for (const quotaInfo of response) { console.log(`- ${quotaInfo.name}: ${quotaInfo.value.value}`); } } main().catch(console.error); ``` -------------------------------- ### Quickstart Node.js Sample Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-identity-accesscontextmanager/samples/README.md This sample provides a quickstart guide for using the Access Context Manager API with Node.js. Ensure you have followed the client library setup instructions before running. ```javascript node packages/google-identity-accesscontextmanager/samples/quickstart.js ``` -------------------------------- ### Memcache Quickstart Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-memcache/samples/README.md A basic example demonstrating how to initialize the Memcache client and perform a simple operation. This is a good starting point for new users. ```javascript /** * This sample demonstrates how to create a client for the Google Cloud Memcache API. * * For more information, see https://cloud.google.com/memorystore/docs/memcached/reference/rest */ // [START memcache_quickstart] // Imports the Google Cloud client library const {CloudMemcacheClient} = require('@google-cloud/memcache'); // TODO(developer): Set your Google Cloud project ID. // const projectId = 'your-project-id'; // Instantiates a client const memcacheClient = new CloudMemcacheClient(); async function quickstart() { console.log('Quickstart: Using Cloud Memcache client'); // You can list instances in a specific location: // const [instances] = await memcacheClient.listInstances({ // parent: `projects/${projectId}/locations/us-central1`, // }); // console.log('Instances:', instances); } quickstart().catch(console.error); // [END memcache_quickstart] ``` -------------------------------- ### Quickstart Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-shopping-merchant-issueresolution/samples/README.md This is a quickstart sample to help you get started with the Google Shopping Merchant Issueresolution API. It provides a basic example of how to integrate the API into your project. ```javascript node packages/google-shopping-merchant-issueresolution/samples/quickstart.js ``` -------------------------------- ### Route Optimization: Quickstart (Node.js) Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-maps-routeoptimization/samples/README.md A quickstart guide to get you running with the Route Optimization API using Node.js. Follow the 'Using the client library' instructions and run 'npm install' in the 'samples' directory. ```javascript node packages/google-maps-routeoptimization/samples/quickstart.js ``` -------------------------------- ### Quickstart Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-bigquery-reservation/samples/README.md A quickstart sample to get started with BigQuery reservations. Run this sample using `node packages/google-cloud-bigquery-reservation/samples/quickstart.js`. ```javascript /** * TODO(developer): Uncomment these variables before running the sample. */ // const location = 'us-central1'; // e.g., us-central1 // const projectId = 'your-project-id'; // Imports the Google Cloud client library const {ReservationServiceClient} = require('@google-cloud/bigquery-reservation'); // Creates a client const reservationServiceClient = new ReservationServiceClient(); async function quickstart() { const parent = `projects/${projectId}/locations/${location}`; // Lists reservations. const [reservations] = await reservationServiceClient.listReservations({ parent, }); console.log('Reservations:'); reservations.forEach(reservation => console.log(reservation.name)); } quickstart(); ``` -------------------------------- ### Quickstart for BigQuery Connection Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-bigquery-connection/samples/README.md A basic example demonstrating how to initialize the BigQuery Connection client. This is a starting point for using the library. ```javascript /** * This sample demonstrates how to initialize the BigQuery Connection client. */ // [START bigquery_connection_quickstart] const {ConnectionServiceClient} = require('@google-cloud/bigquery-connection'); // Instantiates a client const connectionServiceClient = new ConnectionServiceClient(); async function quickstart() { // You can use the client to make requests to the BigQuery Connection API. // For example, to list connections: // const [connections] = await connectionServiceClient.listConnections({ // parent: connectionServiceClient.locationPath('your-project-id', 'us-central1'), // }); // console.log('Connections:', connections); console.log('BigQuery Connection client initialized.'); } quickstart(); // [END bigquery_connection_quickstart] ``` -------------------------------- ### Quickstart for Client Connectors Services Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-beyondcorp-clientconnectorservices/samples/README.md This quickstart sample provides a basic example of how to use the Client Connectors Services client library. It's a good starting point for understanding the API. ```javascript /** * This sample demonstrates how to call the ClientConnectorServicesService API. * * For more information, see: * https://cloud.google.com/beyondcorp/docs/reference/rest */ async function main() { // Imports the Google Cloud client library const { ClientConnectorServicesServiceClient, } = require('@google-cloud/beyondcorp-clientconnectorservices'); // Instantiates a client const client = new ClientConnectorServicesServiceClient(); // TODO(developer): uncomment these variables before running the sample // const name = 'projects/my-project/locations/my-location/clientConnectorServices/my-client-connector-service'; // Construct the request const request = { name, }; // Run request const response = await client.getClientConnectorService(request); console.log('Client connector service: %s', response.name); } main().catch(console.error); ``` -------------------------------- ### Quickstart for Web Security Scanner Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-websecurityscanner/samples/README.md A basic example to get started with the Web Security Scanner client library. This sample typically sets up the client and might perform a simple operation. ```javascript const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner'); // Instantiates a client const webSecurityScannerClient = new WebSecurityScannerClient(); async function main() { // Example usage: List scan configurations // Replace 'projects/your-project-id' with your actual project ID const parent = 'projects/your-project-id'; const [scanConfigs] = await webSecurityScannerClient.listScanConfigs({ parent, }); console.log('Scan configurations:'); scanConfigs.forEach(config => console.log(config.name)); } main().catch(err => { console.error(err); process.exitCode = 1; }); ``` -------------------------------- ### Quickstart: Google Cloud Batch Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-batch/samples/README.md This is a basic quickstart example for using Google Cloud Batch with Node.js. It demonstrates the initial setup and a simple operation. The `google-cloud-batch` package is necessary. ```javascript /** * This quickstart example demonstrates how to create a simple job. * * Replace the following variables with your own values: * project - Project ID of your Google Cloud project * location - Region of your Google Cloud project (e.g., "us-central1") * jobName - A unique name for your job */ async function main(project, location, jobName) { // Imports the Google Cloud client library const {BatchServiceClient} = require('@google-cloud/batch'); // Instantiates a client const batchClient = new BatchServiceClient(); async function runQuickstart() { // Construct the fully qualified location path. const parent = batchClient.locationPath(project, location); // Construct the fully qualified job path. const jobPath = batchClient.jobPath(project, location, jobName); console.log(`Creating job: ${jobPath}`); // Construct the job resource. const job = { name: jobPath, taskGroups: [ { taskCount: 1, parallelism: 1, taskSpec: { runnables: [ { executable: { imageUri: 'gcr.io/google-cloud-batch/examples/hello-world:latest', }, }, ], }, }, ], allocationPolicy: { instances: [ { policy: { instanceType: 'e2-standard-2', }, }, ], }, }; // Create the job. const [operation] = await batchClient.createJob({ parent, job, jobId: jobName, }); console.log('Job created. Waiting for operation to complete...'); // Wait for the operation to complete. await operation.promise(); console.log('Job finished.'); } await runQuickstart(); } main(...).catch(err => { console.error(err); process.exitCode = 1; }); ``` -------------------------------- ### Quickstart Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/README.md Information on how to get started with the Dialogflow API. ```APIDOC ## Quickstart This section provides guidance on how to quickly set up and start using the Google Cloud Dialogflow API. It typically includes steps for authentication, client library setup, and making your first API call. ``` -------------------------------- ### Quickstart for Node.js Media Translation Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-mediatranslation/samples/README.md This quickstart sample provides a basic example of using the Cloud Media Translation API with Node.js. Before running, navigate to the samples directory and run 'npm install'. ```javascript node packages/google-cloud-mediatranslation/samples/quickstart.js ``` -------------------------------- ### Private Catalog: Quickstart (Node.js) Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-privatecatalog/samples/README.md Provides a quickstart guide to using the Private Catalog API with Node.js. Follow the 'Before you begin' section for setup instructions. ```javascript node packages/google-cloud-privatecatalog/samples/quickstart.js ``` -------------------------------- ### Quickstart Example Source: https://github.com/googleapis/google-cloud-node/blob/main/core/packages/gcp-metadata/README.md A basic example demonstrating how to check metadata server availability and fetch instance and project metadata. ```javascript const gcpMetadata = require('gcp-metadata'); async function quickstart() { // check to see if this code can access a metadata server const isAvailable = await gcpMetadata.isAvailable(); console.log(`Is available: ${isAvailable}`); // Instance and Project level metadata will only be available if // running inside of a Google Cloud compute environment such as // Cloud Functions, App Engine, Kubernetes Engine, or Compute Engine. // To learn more about the differences between instance and project // level metadata, see: // https://cloud.google.com/compute/docs/storing-retrieving-metadata#project-instance-metadata if (isAvailable) { // grab all top level metadata from the service const instanceMetadata = await gcpMetadata.instance(); console.log('Instance metadata:'); console.log(instanceMetadata); // get all project level metadata const projectMetadata = await gcpMetadata.project(); console.log('Project metadata:'); console.log(projectMetadata); } } quickstart(); ``` -------------------------------- ### Service Control API Quickstart Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-api-servicecontrol/samples/README.md This sample provides a quickstart guide to using the Google API Service Control client library. Ensure you have followed the setup instructions in the 'Before you begin' section. ```javascript node packages/google-api-servicecontrol/samples/quickstart.js ``` -------------------------------- ### Quickstart for Merchant Notifications Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-shopping-merchant-notifications/samples/README.md This is a quickstart guide to help you get started with the Merchant Notifications API. It provides a basic example to set up and use the API. ```javascript node packages/google-shopping-merchant-notifications/samples/quickstart.js ``` -------------------------------- ### Quickstart Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-licensemanager/samples/README.md A basic quickstart example for the License Manager client library. This sample is intended to be run directly from the command line. ```javascript /** * This quickstart example demonstrates how to initialize the License Manager client * and perform a basic operation (though no specific operation is called here). * * To run this sample: * 1. Make sure you have Node.js installed. * 2. Install the Google Cloud client library: * npm install @google-cloud/licensemanager * 3. Set up authentication. See https://cloud.google.com/docs/authentication-setup * * Then, run the script: * node packages/google-cloud-licensemanager/samples/quickstart.js */ // Import the client library const {LicenseManagerServiceClient} = require('@google-cloud/licensemanager'); // Instantiates a client const client = new LicenseManagerServiceClient(); async function main() { // This is a placeholder. Replace with actual API calls as needed. console.log('Google Cloud License Manager client initialized.'); // Example: List configurations (replace with actual parameters) // const [configurations] = await client.listConfigurations({ // parent: 'projects/YOUR_PROJECT_ID/locations/YOUR_LOCATION', // }); // console.log('Configurations:', configurations); } main().catch(console.error); ``` -------------------------------- ### Device Streaming Quickstart Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-devicestreaming/samples/README.md A quickstart guide to get you started with the Google Cloud Device Streaming API. Ensure you have Node.js and the necessary libraries installed. ```javascript /** * TODO(developer): Uncomment these variables before running the sample. */ // const projectId = "your-project-id"; // const location = "us-central1"; // const deviceId = "your-device-id"; // const sessionId = "your-session-id"; // Imports the Google Cloud client library const {DeviceStreamClient} = require('@google-cloud/devicestreaming'); async function quickstart() { // Instantiates a client const client = new DeviceStreamClient(); const name = client.deviceSessionPath( projectId, location, deviceId, sessionId ); // Build the request const request = { name: name, }; // Make the request const [response] = await client.getDeviceSession(request); console.log(`Device session: ${response.name}`); console.log(`Device state: ${response.deviceState.state}`); console.log(`Session state: ${response.sessionState}`); } quickstart().catch(console.error); ``` -------------------------------- ### Quickstart for VM Migration Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-vmmigration/samples/README.md A basic example demonstrating how to initialize the VM Migration client. ```javascript /** * This sample demonstrates how to initialize the VmMigrationServiceClient. */ async function quickstart() { // Imports the Google Cloud client library const {VmMigrationServiceClient} = require('@google-cloud/vm-migration'); // Instantiates a client const client = new VmMigrationServiceClient(); // TODO(developer): set your project id // const projectId = "your-project-id"; // const location = "us-central1"; // Construct the fully qualified location path // const locationPath = client.locationPath(projectId, location); console.log('Quickstart complete. Client initialized.'); } quickstart(); ``` -------------------------------- ### Quickstart Guide Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-shopping-merchant-accounts/samples/README.md This sample provides a quickstart guide for using the google-shopping-merchant-accounts library. Run this command to execute the sample. ```javascript node packages/google-shopping-merchant-accounts/samples/quickstart.js ``` -------------------------------- ### Dialogflow CX Quickstart Source: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow-cx/samples/README.md A basic example demonstrating how to initialize and use the Dialogflow CX client library. This is a starting point for building Dialogflow CX applications. ```javascript /** * TODO(developer): * 1. Set your Google Cloud project ID. * 2. Set the location ID of your agent. * 3. Set the agent ID of your agent. * 4. Set the session ID for the conversation. * 5. Set the query text for the user's input. */ async function main() { // Imports the Google Cloud client library const {SessionsClient} = require('@google-cloud/dialogflow-cx'); // TODO(developer): Uncomment these variables before running the sample // const projectId = 'your-project-id'; // const locationId = 'your-location-id'; // const agentId = 'your-agent-id'; // const sessionId = 'your-session-id'; // const query = 'Hello'; // A unique identifier for the given session const sessionPath = SessionsClient.projectLocationAgentSessionPath( projectId, locationId, agentId, sessionId ); // Create a new session client const client = new SessionsClient(); // Prepare the request for detectIntent const request = { session: sessionPath, queryInput: { text: { text: query, }, languageCode: 'en-US', }, }; // Send the request to Dialogflow const [response] = await client.detectIntent(request); console.log('Detected intent:', response.queryResult.intent.displayName); console.log('Response text:', response.queryResult.responseMessages[0].text.text[0]); } main().catch(console.error); ```