The Google Cloud API allows developers to access a variety of Google Cloud services from their own applications. Services that can be accessed include Google Cloud Storage, Google Cloud Datastore, Google Cloud Functions, and Google Cloud Pub/Sub. With the Google Cloud API, developers can build a variety of applications that take advantage of Google Cloud services.
module.exports = defineComponent({
props: {
google_cloud: {
type: "app",
app: "google_cloud",
}
},
async run({steps, $}) {
// Required workaround to get the @google-cloud/storage package
// working correctly on Pipedream
require("@dylburger/umask")()
const { Storage } = require('@google-cloud/storage')
const key = JSON.parse(this.google_cloud.$auth.key_json)
// Creates a client from a Google service account key.
// See https://cloud.google.com/nodejs/docs/reference/storage/1.6.x/global#ClientConfig
const storage = new Storage({
projectId: key.project_id,
credentials: {
client_email: key.client_email,
private_key: key.private_key,
}
})
// Uncomment this section and rename for your bucket before running this code
// const bucketName = 'pipedream-test-bucket';
await storage.createBucket(bucketName)
console.log(`Bucket ${bucketName} created.`)
},
})
Inserts rows into a BigQuery table. See the docs and for an example here.
Gets Google Cloud Storage bucket metadata. See the docs.
Downloads an object from a Google Cloud Storage bucket, See the docs
Google Cloud uses API keys for authentication. When you connect your Google Cloud account, Pipedream securely stores the keys so you can easily authenticate to Google Cloud APIs in both code and no-code steps.
Create a service account in GCP and set the permissions you need for Pipedream workflows.
Download the key details in JSON format
Open the JSON in a text editor, and copy and paste its contents here.