https://github.com/kitasuke/cloud-functions-in-go
Sample projects from this book https://booth.pm/en/items/1306074
https://github.com/kitasuke/cloud-functions-in-go
Last synced: 8 months ago
JSON representation
Sample projects from this book https://booth.pm/en/items/1306074
- Host: GitHub
- URL: https://github.com/kitasuke/cloud-functions-in-go
- Owner: kitasuke
- License: mit
- Created: 2019-06-01T03:42:09.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-06-01T06:30:42.000Z (about 7 years ago)
- Last Synced: 2024-12-27T09:25:55.767Z (over 1 year ago)
- Language: Go
- Homepage:
- Size: 3.91 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Cloud-Functions-in-Go
sample projects
# Cloud Functions
## How to deploy Functions
```
$ gcloud functions deploy FUNC-NAME --runtime go111 --trigger-http
```
# Storage
## How to create Storage bucket
```
$ gsutil mb -c nearline gs://BUCKET-NAME
```
## How to deploy Functions for the Storage
```
$ gcloud functions deploy FUNC-NAME --runtime go111 \
--trigger-resource BUCKET-NAME \
--trigger-event google.storage.object.finalize
```
## How to upload files to the Storage
```
$ touch empty.txt && gsutil cp empty.txt gs://BUCKET-NAME
```
## How to show logs
```
$ gcloud beta functions logs read --limit 50
```
# Pub/Sub
## How to create Topic
```
$ gcloud pubsub topics create TOPIC-NAME
```
## How to deploy Functions for PubSub
```
$ gcloud functions deploy FUNC-NAME --runtime go111 --trigger-topic TOPIC-NAME
```
## How to publish topic to PubSub
```
$ gcloud pubsub topics publish TOPIC-NAME \
--message '{"name": "foo"}'
```
## How to show logs
```
$ gcloud beta functions logs read --limit 50
```
# Storage
## How to deploy with env file
```
$ gcloud functions deploy TriggerHTTPBucket --runtime go111 \
--trigger-http --env-vars-file .env.yaml
```
# BigQuery
## How to create table
```
$ bq mk TABLE-NAME
```
```
$ bq mk --table TABLE-NAME.TABLE-NAMe TABLE-NAME.json
```