This repository contains some starter Cloud Functions and Cloud Run templates
for Cloud Code for VS Code for different languages. Each template includes
minimal starter code for HTTP or CloudEvent triggered Cloud Functions or Cloud
Run services that use the recommended libraries (CloudEvents
SDK and Google CloudEvents
libraries) for each language.
They also includes lightweight gcloud
based scripts to quickly test services
locally, deploy to the cloud, and test in the cloud.
Cloud Code comes with some default Cloud Run and Cloud Functions templates (hosted in cloud-code-samples repo) but they're limited:
- Only four languages are supported (Node.js, Python, Go, and Java) in Cloud Functions templates and deployment. I’ve especially missed the NET support.
- Templates for Cloud Run and Cloud Functions are only for HTTP triggered services. No templates for event triggered services.
- Testing only works against deployed HTTP triggered services. No testing support for locally running services or event triggered services.
You can use these templates in standalone Cloud Code for VS Code or the Cloud Code in the editor of Cloud Shell in the browser.
To use these templates as starter projects:
- Click on
Cloud Code
in VS Code. - Select
New Application
->Custom Application
->Import Sample from Repo
- Point to this repository.
- Choose a template as a starter project and follow the instructions in the
README.md
of the template.
.NET:
- .NET: Cloud Functions - hello-http - An HTTP triggered .NET Cloud Functions template.
- .NET: Cloud Functions - hello-gcs - A Cloud Storage triggered .NET Cloud Functions template.
- .NET: Cloud Functions - hello-pubsub - A Pub/Sub triggered .NET Cloud Functions template.
- .NET: Cloud Functions - hello-auditlog - An AuditLog triggered .NET Cloud Functions template.
Java:
- Java: Cloud Functions - hello-http - An HTTP triggered Java Cloud Functions template.
- Java: Cloud Functions - hello-gcs - A Cloud Storage triggered Java Cloud Functions template.
- Java: Cloud Functions - hello-pubsub - A Pub/Sub triggered Java Cloud Functions template.
- Java: Cloud Functions - hello-auditlog - An AuditLog triggered Java Cloud Functions template.
Node.js:
- Node.js: Cloud Functions - hello-http - An HTTP triggered Node.js Cloud Functions template.
- Node.js: Cloud Functions - hello-gcs - A Cloud Storage triggered Node.js Cloud Functions template.
- Node.js: Cloud Functions - hello-pubsub - A Pub/Sub triggered Node.js Cloud Functions template.
- Node.js: Cloud Functions - hello-auditlog - An AuditLog triggered Node.js Cloud Functions template.
Python:
- Python: Cloud Functions - hello-http - An HTTP triggered Python Cloud Functions template.
- Python: Cloud Functions - hello-gcs - A Cloud Storage triggered Python Cloud Functions template.
- Python: Cloud Functions - hello-pubsub - A Pub/Sub triggered Python Cloud Functions template.
- Python: Cloud Functions - hello-auditlog - An AuditLog triggered Python Cloud Functions template.
.NET:
- .NET: Cloud Run - hello-http - An HTTP triggered .NET Cloud Run template.
- .NET: Cloud Run - hello-gcs - A Cloud Storage triggered .NET Cloud Run template.
- .NET: Cloud Run - hello-pubsub - A Pub/Sub triggered .NET Cloud Run template.
- .NET: Cloud Run - hello-auditlog - An AuditLog triggered .NET Cloud Run template.
Java:
- Java: Cloud Run - hello-http - An HTTP triggered Java Cloud Run template.
- Java: Cloud Run - hello-gcs - A Cloud Storage triggered Java Cloud Run template.
- Java: Cloud Run - hello-pubsub - A Pub/Sub triggered Java Cloud Run template.
- Java: Cloud Run - hello-auditlog - An AuditLog triggered Java Cloud Run template.
Node.js:
- Node.js: Cloud Run - hello-http - An HTTP triggered Node.js Cloud Run template.
- Node.js: Cloud Run - hello-gcs - A Cloud Storage triggered Node.js Cloud Run template.
- Node.js: Cloud Run - hello-pubsub - A Pub/Sub triggered Node.js Cloud Run template.
- Node.js: Cloud Run - hello-auditlog - An AuditLog triggered Node.js Cloud Run template.
Python:
- Python: Cloud Run - hello-http - An HTTP triggered Python Cloud Run template.
- Python: Cloud Run - hello-gcs - A Cloud Storage triggered Python Cloud Run template.
- Python: Cloud Run - hello-pubsub - A Pub/Sub triggered Python Cloud Run template.
- Python: Cloud Run - hello-auditlog - An AuditLog triggered Python Cloud Run template.
This is not an official Google product.