golang-samples

module
Version: v0.0.0-...-3b29460 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 29, 2020 License: Apache-2.0

README

Google Cloud Platform Go Samples

Kokoro Build Status

This repository holds sample code written in Go that demonstrates the Google Cloud Platform.

Some samples have accompanying guides on cloud.google.com. See respective README files for details.

Depending on samples

Copy any code you need from this repository into your own project.

Warning: Do not depend directly on the samples in this repo. Breaking changes may be made at any time without warning.

Contributing changes

Entirely new samples are not accepted. Bug fixes are welcome, either as pull requests or as GitHub issues.

See CONTRIBUTING.md for details on how to contribute.

Licensing

Code in this repository is licensed under the Apache 2.0. See LICENSE.

Directories

Path Synopsis
appengine
go11x/tasks/create_task
Command create_task constructs and adds a task to an App Engine Queue.
Command create_task constructs and adds a task to an App Engine Queue.
appengine_flexible
analytics
Sample analytics demonstrates Google Analytics calls from App Engine flexible environment.
Sample analytics demonstrates Google Analytics calls from App Engine flexible environment.
cloudsql
Sample cloudsql demonstrates usage of Cloud SQL from App Engine flexible environment.
Sample cloudsql demonstrates usage of Cloud SQL from App Engine flexible environment.
cloudsql_postgres
Sample cloudsql demonstrates usage of Cloud SQL from App Engine flexible environment.
Sample cloudsql demonstrates usage of Cloud SQL from App Engine flexible environment.
datastore
Sample datastore demonstrates use of the cloud.google.com/go/datastore package from App Engine flexible.
Sample datastore demonstrates use of the cloud.google.com/go/datastore package from App Engine flexible.
helloworld
Sample helloworld is a basic App Engine flexible app.
Sample helloworld is a basic App Engine flexible app.
memcache
Sample memcache demonstrates use of a memcached client from App Engine flexible environment.
Sample memcache demonstrates use of a memcached client from App Engine flexible environment.
pubsub
Sample pubsub demonstrates use of the cloud.google.com/go/pubsub package from App Engine flexible environment.
Sample pubsub demonstrates use of the cloud.google.com/go/pubsub package from App Engine flexible environment.
redis
Sample redis demonstrates use of a redis client from App Engine flexible environment.
Sample redis demonstrates use of a redis client from App Engine flexible environment.
static_files
Package static demonstrates a static file handler for App Engine flexible environment.
Package static demonstrates a static file handler for App Engine flexible environment.
storage
Sample storage demonstrates use of the cloud.google.com/go/storage package from App Engine flexible environment.
Sample storage demonstrates use of the cloud.google.com/go/storage package from App Engine flexible environment.
websockets
Sample websockets demonstrates an App Engine Flexible app.
Sample websockets demonstrates an App Engine Flexible app.
asset
quickstart/batch-get-assets-history
Sample asset-quickstart batch-gets assets history.
Sample asset-quickstart batch-gets assets history.
quickstart/create-feed
Sample create-feed create feed.
Sample create-feed create feed.
quickstart/delete-feed
Sample delete-feed delete feed.
Sample delete-feed delete feed.
quickstart/export-assets
Sample asset-quickstart exports assets to given path.
Sample asset-quickstart exports assets to given path.
quickstart/export-assets-bigquery
Sample asset-quickstart exports assets to given bigquery table.
Sample asset-quickstart exports assets to given bigquery table.
quickstart/get-feed
Sample get-feed get feed.
Sample get-feed get feed.
quickstart/list-feeds
Sample list-feeds list feeds.
Sample list-feeds list feeds.
quickstart/search-all-iam-policies
Sample search-all-iam-policies searches all IAM policies within the given scope.
Sample search-all-iam-policies searches all IAM policies within the given scope.
quickstart/search-all-resources
Sample search-all-resources searches all resources within the given scope.
Sample search-all-resources searches all resources within the given scope.
quickstart/update-feed
Sample update-feed update feed.
Sample update-feed update feed.
Package authsnippets contains Google Cloud authentication snippets.
Package authsnippets contains Google Cloud authentication snippets.
overview
Package overview contains Google Cloud authentication overview snippets.
Package overview contains Google Cloud authentication overview snippets.
Package automl contains samples for Google Cloud AutoML API.
Package automl contains samples for Google Cloud AutoML API.
language/entity_extraction
Package automl contains samples for Google Cloud AutoML API v1.
Package automl contains samples for Google Cloud AutoML API v1.
language/sentiment_analysis
Package automl contains samples for Google Cloud AutoML API v1.
Package automl contains samples for Google Cloud AutoML API v1.
language/text_classification
Package automl contains samples for Google Cloud AutoML API v1.
Package automl contains samples for Google Cloud AutoML API v1.
translate
Package automl contains samples for Google Cloud AutoML API v1.
Package automl contains samples for Google Cloud AutoML API v1.
vision/classification
Package automl contains samples for Google Cloud AutoML API v1.
Package automl contains samples for Google Cloud AutoML API v1.
vision/object_detection
Package automl contains samples for Google Cloud AutoML API v1.
Package automl contains samples for Google Cloud AutoML API v1.
bigquery
bigquery_connection_quickstart
The bigquery_connection_quickstart application demonstrates basic usage of the BigQuery connection API.
The bigquery_connection_quickstart application demonstrates basic usage of the BigQuery connection API.
bigquery_datatransfer_quickstart
Sample bigquery-quickstart creates a Google BigQuery dataset.
Sample bigquery-quickstart creates a Google BigQuery dataset.
bigquery_quickstart
Sample bigquery-quickstart creates a Google BigQuery dataset.
Sample bigquery-quickstart creates a Google BigQuery dataset.
bigquery_reservation_quickstart
The bigquery_reservation_quickstart application demonstrates usage of the BigQuery reservation API by enumerating some of the resources that can be associated with a cloud project.
The bigquery_reservation_quickstart application demonstrates usage of the BigQuery reservation API by enumerating some of the resources that can be associated with a cloud project.
bigquery_storage_quickstart
The bigquery_storage_quickstart application demonstrates usage of the BigQuery Storage read API.
The bigquery_storage_quickstart application demonstrates usage of the BigQuery Storage read API.
simpleapp
Command simpleapp queries the Stack Overflow public dataset in Google BigQuery.
Command simpleapp queries the Stack Overflow public dataset in Google BigQuery.
syncquery
Command syncquery queries a Google BigQuery dataset.
Command syncquery queries a Google BigQuery dataset.
bigtable
filters
Package filters contains snippets related to reading data from Cloud Bigtable with various filters.
Package filters contains snippets related to reading data from Cloud Bigtable with various filters.
helloworld
Hello world is a sample program demonstrating use of the Bigtable client library to perform basic CRUD operations
Hello world is a sample program demonstrating use of the Bigtable client library to perform basic CRUD operations
quickstart
Quickstart is a sample program demonstrating use of the Cloud Bigtable client library to read a row from an existing table.
Quickstart is a sample program demonstrating use of the Cloud Bigtable client library to read a row from an existing table.
reads
Package reads contains snippets related to reading data from Cloud Bigtable.
Package reads contains snippets related to reading data from Cloud Bigtable.
search
Search is a sample web server that uses Cloud Bigtable as the storage layer for a simple document-storage and full-text-search service.
Search is a sample web server that uses Cloud Bigtable as the storage layer for a simple document-storage and full-text-search service.
usercounter
User counter is a program that tracks how often a user has visited the index page.
User counter is a program that tracks how often a user has visited the index page.
writes
Package writes contains snippets related to writing to Cloud Bigtable.
Package writes contains snippets related to writing to Cloud Bigtable.
cdn
signedcookies
Package signedcookie creates a signed URL for a Cloud CDN endpoint with the given key.
Package signedcookie creates a signed URL for a Cloud CDN endpoint with the given key.
signedurls
Package signedurl creates a signed URL for a Cloud CDN endpoint with the given key.
Package signedurl creates a signed URL for a Cloud CDN endpoint with the given key.
container
listclusters
Command listclusters lists all clusters and their node pools for a given project and zone.
Command listclusters lists all clusters and their node pools for a given project and zone.
container_registry
Package dataproc shows how you can use the Cloud Dataproc Client library to manage Cloud Dataproc clusters.
Package dataproc shows how you can use the Cloud Dataproc Client library to manage Cloud Dataproc clusters.
quickstart
This quickstart shows how you can use the Cloud Dataproc Client library to create a Cloud Dataproc cluster, submit a PySpark job to the cluster, wait for the job to finish and finally delete the cluster.
This quickstart shows how you can use the Cloud Dataproc Client library to create a Cloud Dataproc cluster, submit a PySpark job to the cluster, wait for the job to finish and finally delete the cluster.
datastore
datastore_quickstart
Sample datastore-quickstart fetches an entity from Google Cloud Datastore.
Sample datastore-quickstart fetches an entity from Google Cloud Datastore.
tasks
A simple command-line task list manager to demonstrate using the cloud.google.com/go/datastore package.
A simple command-line task list manager to demonstrate using the cloud.google.com/go/datastore package.
dialogflow
dlp
quickstart
The quickstart program is an example of using the Data Loss Prevention API.
The quickstart program is an example of using the Data Loss Prevention API.
docs
appengine/cloudsql
Sample cloudsql demonstrates connection to a Cloud SQL instance from App Engine standard.
Sample cloudsql demonstrates connection to a Cloud SQL instance from App Engine standard.
appengine/logs
This sample gets the app displays 5 log Records at a time, including all AppLogs, with a Next link to let the user page through the results using the Record's Offset property.
This sample gets the app displays 5 log Records at a time, including all AppLogs, with a Next link to let the user page through the results using the Record's Offset property.
appengine/mail/mailjet
Sample mailjet is a demonstration on sending an e-mail from App Engine standard environment.
Sample mailjet is a demonstration on sending an e-mail from App Engine standard environment.
appengine/storage
Package gcsdemo is an example App Engine app using the Google Cloud Storage API.
Package gcsdemo is an example App Engine app using the Google Cloud Storage API.
error-reporting/fluent
Sample fluent demonstrates integration of fluent and Cloud Error reporting.
Sample fluent demonstrates integration of fluent and Cloud Error reporting.
sql/listinstances
Sample listinstances lists the Cloud SQL instances for a given project ID.
Sample listinstances lists the Cloud SQL instances for a given project ID.
endpoints
getting-started
Sample endpoints demonstrates a Cloud Endpoints API.
Sample endpoints demonstrates a Cloud Endpoints API.
getting-started-grpc/helloworld
Package helloworld is a generated protocol buffer package.
Package helloworld is a generated protocol buffer package.
getting-started/client
Command client performs authenticated requests against an Endpoints API server.
Command client performs authenticated requests against an Endpoints API server.
errorreporting
errorreporting_quickstart
Sample errorreporting_quickstart contains is a quickstart example for the Google Cloud Error Reporting API.
Sample errorreporting_quickstart contains is a quickstart example for the Google Cloud Error Reporting API.
firestore
firestore_quickstart
Sample firestore_quickstart demonstrates how to connect to Firestore, and add and list documents.
Sample firestore_quickstart demonstrates how to connect to Firestore, and add and list documents.
firestore_snippets
Command firestore_snippets contains runnable snippet code for Cloud Spanner.
Command firestore_snippets contains runnable snippet code for Cloud Spanner.
functions
console_snippets/firebase_remote_config
Package p contains a Cloud Function that processes Firebase Remote Config events.
Package p contains a Cloud Function that processes Firebase Remote Config events.
console_snippets/gcs
Package p contains a Google Cloud Storage Cloud Function.
Package p contains a Google Cloud Storage Cloud Function.
console_snippets/http
Package p contains an HTTP Cloud Function.
Package p contains an HTTP Cloud Function.
console_snippets/pubsub
Package p contains a Pub/Sub Cloud Function.
Package p contains a Pub/Sub Cloud Function.
firebase
Package firebase contains a Firestore Cloud Function.
Package firebase contains a Firestore Cloud Function.
http
Package http provides a set of HTTP Cloud Functions samples.
Package http provides a set of HTTP Cloud Functions samples.
security
Package security contains samples for securely calling functions.
Package security contains samples for securely calling functions.
getting-started
helloworld
Sample helloworld is a basic App Engine flexible app.
Sample helloworld is a basic App Engine flexible app.
Package snippets contains samples for the Healthcare API.
Package snippets contains samples for the Healthcare API.
iam
quickstart
The quickstart command is an example of using the Cloud IAM Roles API.
The quickstart command is an example of using the Cloud IAM Roles API.
Package iap contains Identity-Aware Proxy samples.
Package iap contains Identity-Aware Proxy samples.
iot
manager
Command manager lets you manage Cloud IoT Core devices and registries.
Command manager lets you manage Cloud IoT Core devices and registries.
iotkit
helloworld
Program helloworld is a tiny program that blinks "Hello gopher!" on a Grove LCD RGB Backlight display connected to a BeagleBone.
Program helloworld is a tiny program that blinks "Hello gopher!" on a Grove LCD RGB Backlight display connected to a BeagleBone.
helloworld/display
Package display is a driver for Grove LCD RGB backlight display.
Package display is a driver for Grove LCD RGB backlight display.
jobs
v3/quickstart
Command quickstart is an example of using the Google Cloud Talent Solution API.
Command quickstart is an example of using the Google Cloud Talent Solution API.
kms
quickstart
Sample quickstart is a basic program that uses Cloud KMS.
Sample quickstart is a basic program that uses Cloud KMS.
language
analyze
Command analyze performs sentiment, entity, entity sentiment, and syntax analysis on a string of text via the Cloud Natural Language API.
Command analyze performs sentiment, entity, entity sentiment, and syntax analysis on a string of text via the Cloud Natural Language API.
language_quickstart
Sample language-quickstart uses the Google Cloud Natural API to analyze the sentiment of "Hello, world!".
Sample language-quickstart uses the Google Cloud Natural API to analyze the sentiment of "Hello, world!".
logging
exportlogs
Sample exportlogs lists, creates, updates, and deletes log sinks.
Sample exportlogs lists, creates, updates, and deletes log sinks.
logging_quickstart
Sample logging-quickstart writes a log entry to Stackdriver Logging.
Sample logging-quickstart writes a log entry to Stackdriver Logging.
simplelog
Sample simplelog writes some entries, lists them, then deletes the log.
Sample simplelog writes some entries, lists them, then deletes the log.
stdlogging
Sample stdlogging writes log.Logger logs to the Stackdriver Logging.
Sample stdlogging writes log.Logger logs to the Stackdriver Logging.
memorystore
redis
Command redis is a basic app that connects to a managed Redis instance.
Command redis is a basic app that connects to a managed Redis instance.
monitoring
alert
Package alert demonstrates interacting with the monitoring and alerting API.
Package alert demonstrates interacting with the monitoring and alerting API.
custommetric
Package custommetric contains custom metric samples.
Package custommetric contains custom metric samples.
irm
Package snippets contains IRM samples.
Package snippets contains IRM samples.
monitoring_quickstart
Sample monitoring-quickstart writes a data point to Stackdriver Monitoring.
Sample monitoring-quickstart writes a data point to Stackdriver Monitoring.
snippets
Package snippets contains examples of using the monitoring API.
Package snippets contains examples of using the monitoring API.
uptime
Package uptime contains samples of uptime checks.
Package uptime contains samples of uptime checks.
opencensus
metrics_quickstart
metrics_quickstart is an example of exporting a custom metric from OpenCensus to Stackdriver.
metrics_quickstart is an example of exporting a custom metric from OpenCensus to Stackdriver.
opencensus_spanner_quickstart
Sample opencensus_spanner_quickstart contains a sample application that uses Google Spanner Go client, and reports metrics and traces for the outgoing requests.
Sample opencensus_spanner_quickstart contains a sample application that uses Google Spanner Go client, and reports metrics and traces for the outgoing requests.
profiler
appengine
appengine is an example of starting cloud.google.com/go/profiler on App Engine.
appengine is an example of starting cloud.google.com/go/profiler on App Engine.
hotapp
Sample hotapp is a synthetic application that exhibits different types of profiling hotspots: CPU, heap allocations, thread contention.
Sample hotapp is a synthetic application that exhibits different types of profiling hotspots: CPU, heap allocations, thread contention.
hotmid
Sample hotmid is an application that simulates multiple calls to a library function made via different call paths.
Sample hotmid is an application that simulates multiple calls to a library function made via different call paths.
profiler_quickstart
Sample profiler_quickstart simulates a CPU-intensive workload for profiler.
Sample profiler_quickstart simulates a CPU-intensive workload for profiler.
snippets
snippets is an example of starting cloud.google.com/go/profiler.
snippets is an example of starting cloud.google.com/go/profiler.
pubsub
pubsub_quickstart
Sample pubsub-quickstart creates a Google Cloud Pub/Sub topic.
Sample pubsub-quickstart creates a Google Cloud Pub/Sub topic.
run
authentication
Package authentication contains the authentication samples for Cloud Run.
Package authentication contains the authentication samples for Cloud Run.
Package secretmanager contains samples for Secret Manager which securely stores and provides access to API keys, passwords, certificates, and other sensitive data.
Package secretmanager contains samples for Secret Manager which securely stores and provides access to API keys, passwords, certificates, and other sensitive data.
quickstart
Sample quickstart is a basic program that uses Secret Manager.
Sample quickstart is a basic program that uses Secret Manager.
securitycenter
assets
Package assets contains example snippets for working with CSCC Assets.
Package assets contains example snippets for working with CSCC Assets.
findings
Pacakge findings contains example snippets for working with findings and their parent resource "sources".
Pacakge findings contains example snippets for working with findings and their parent resource "sources".
notifications
Package notifications contains example snippets for working with notification configs and their notifications.
Package notifications contains example snippets for working with notification configs and their notifications.
settings
Package settings contains snippets for working with CSCC organization settings.
Package settings contains snippets for working with CSCC organization settings.
quickstart
Sample quickstart is a program that uses Cloud Service Directory create.
Sample quickstart is a program that uses Cloud Service Directory create.
spanner
spanner_arrays
Sample spanner_arrays is a demonstration program which queries Google's Cloud Spanner and returns results containing arrays.
Sample spanner_arrays is a demonstration program which queries Google's Cloud Spanner and returns results containing arrays.
spanner_leaderboard
Command spanner_leaderboard contains runnable snippet code for Cloud Spanner.
Command spanner_leaderboard contains runnable snippet code for Cloud Spanner.
spanner_quickstart
Sample spanner_quickstart is a basic program that uses Cloud Spanner.
Sample spanner_quickstart is a basic program that uses Cloud Spanner.
speech
caption
Command caption sends audio data to the Google Speech API and prints its transcript.
Command caption sends audio data to the Google Speech API and prints its transcript.
captionasync
Command captionasync sends audio data to the Google Speech API and prints its transcript.
Command captionasync sends audio data to the Google Speech API and prints its transcript.
livecaption
Command livecaption pipes the stdin audio data to Google Speech API and outputs the transcript.
Command livecaption pipes the stdin audio data to Google Speech API and outputs the transcript.
snippets
Package snippets contains speech examples.
Package snippets contains speech examples.
speech_quickstart
Sample speech-quickstart uses the Google Cloud Speech API to transcribe audio.
Sample speech-quickstart uses the Google Cloud Speech API to transcribe audio.
wordoffset
Command wordoffset sends audio data to the Google Speech API and prints word offset information.
Command wordoffset sends audio data to the Google Speech API and prints word offset information.
storage
acl
Package acl contains samples for configuring ACLs for Storage buckets and objects.
Package acl contains samples for configuring ACLs for Storage buckets and objects.
buckets
Package buckets contains samples for creating/listing/deleting buckets using the Google Storage API.
Package buckets contains samples for creating/listing/deleting buckets using the Google Storage API.
gcsupload
gcsupload is a CLI to upload a file to Google Cloud Storage.
gcsupload is a CLI to upload a file to Google Cloud Storage.
objects
Package objects contains samples for creating/moving/deleting and tweaking Storage objects.
Package objects contains samples for creating/moving/deleting and tweaking Storage objects.
s3_sdk
Package s3sdk lists GCS buckets using the S3 SDK using interoperability mode.
Package s3sdk lists GCS buckets using the S3 SDK using interoperability mode.
storage_quickstart
Sample storage-quickstart creates a Google Cloud Storage bucket.
Sample storage-quickstart creates a Google Cloud Storage bucket.
Command createHTTPtask constructs and adds a task to a Cloud Tasks Queue.
Command createHTTPtask constructs and adds a task to a Cloud Tasks Queue.
token
package token constructs a request to Cloud Tasks API.
package token constructs a request to Cloud Tasks API.
testing
gimmeproj
Command gimmeproj provides access to a pool of projects.
Command gimmeproj provides access to a pool of projects.
sampletests
The sampletests command adds the region tags tested by each test to the XML properties of that test case.
The sampletests command adds the region tags tested by each test to the XML properties of that test case.
sampletests/fakesamples
Package hello is used only for testing.
Package hello is used only for testing.
texttospeech
list_voices
The list_voices command lists the available Text-to-Speech voices.
The list_voices command lists the available Text-to-Speech voices.
quickstart
Command quickstart generates an audio file with the content "Hello, World!".
Command quickstart generates an audio file with the content "Hello, World!".
synthesize_file
The synthesize_file command converts a plain text or SSML file to an audio file.
The synthesize_file command converts a plain text or SSML file to an audio file.
synthesize_speech
Package snippets contains speech examples.
Package snippets contains speech examples.
synthesize_text
The synthesize_text command converts plain text or SSML content to an audio file.
The synthesize_text command converts plain text or SSML content to an audio file.
trace
trace_quickstart
Sample trace_quickstart traces incoming and outgoing requests.
Sample trace_quickstart traces incoming and outgoing requests.
trace_snippets
Package snippets contains Stackdriver trace samples.
Package snippets contains Stackdriver trace samples.
translate_quickstart
Sample translate-quickstart translates "Hello, world!" into Russian.
Sample translate-quickstart translates "Hello, world!" into Russian.
v3
Package v3 contains samples for Google Cloud Translation API v3.
Package v3 contains samples for Google Cloud Translation API v3.
videointelligence
annotate
Package annotate contains speech examples.
Package annotate contains speech examples.
video_analyze
Command video_analyze uses the Google Cloud Video Intelligence API to analyze a video.
Command video_analyze uses the Google Cloud Video Intelligence API to analyze a video.
video_quickstart
Sample video_quickstart uses the Google Cloud Video Intelligence API to label a video.
Sample video_quickstart uses the Google Cloud Video Intelligence API to label a video.
vision
detect
Command detect uses the Vision API's label detection capabilities to find a label based on an image's content.
Command detect uses the Vision API's label detection capabilities to find a label based on an image's content.
label
Command label uses the Vision API's label detection capabilities to find a label based on an image's content.
Command label uses the Vision API's label detection capabilities to find a label based on an image's content.
product_search
Package productsearch contains samples for Google Cloud Vision API Product Search.
Package productsearch contains samples for Google Cloud Vision API Product Search.
vision_quickstart
Sample vision-quickstart uses the Google Cloud Vision API to label an image.
Sample vision-quickstart uses the Google Cloud Vision API to label an image.
internal
aeintegrate
Package aeintegrate facilitates end-to-end testing against the production Google App Engine.
Package aeintegrate facilitates end-to-end testing against the production Google App Engine.
cleanaeversions
Command cleaneversions deletes App Engine versions for a given project, service and/or version ID filter.
Command cleaneversions deletes App Engine versions for a given project, service and/or version ID filter.
cloudrunci
Package cloudrunci facilitates end-to-end testing against the production Cloud Run.
Package cloudrunci facilitates end-to-end testing against the production Cloud Run.
testutil
Package testutil provides test helpers for the golang-samples repo.
Package testutil provides test helpers for the golang-samples repo.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL