Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(gae): add new region tags with "gae_storage_" prefix #5037

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/appengine/storage/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// Package gcsdemo is an example App Engine app using the Google Cloud Storage API.
package gcsdemo

//[START gae_storage_imports]
//[START imports]
import (
"bytes"
Expand All @@ -33,6 +34,7 @@ import (
)

//[END imports]
//[END gae_storage_imports]

func init() {
http.HandleFunc("/", handler)
Expand Down Expand Up @@ -67,6 +69,7 @@ func handler(w http.ResponseWriter, r *http.Request) {
return
}

//[START gae_storage_get_default_bucket]
//[START get_default_bucket]
Comment on lines +72 to 73

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

low

Consider adding a short comment explaining the purpose of dev_appserver.py --default_gcs_bucket_name GCS_BUCKET_NAME and how it helps when running the application locally.

Suggested change
//[START gae_storage_get_default_bucket]
//[START get_default_bucket]
//[START gae_storage_get_default_bucket]
//[START get_default_bucket]

// Use `dev_appserver.py --default_gcs_bucket_name GCS_BUCKET_NAME`
// when running locally.
Expand All @@ -75,6 +78,7 @@ func handler(w http.ResponseWriter, r *http.Request) {
log.Errorf(ctx, "failed to get default GCS bucket name: %v", err)
}
//[END get_default_bucket]
//[END gae_storage_get_default_bucket]

client, err := storage.NewClient(ctx)
if err != nil {
Expand Down Expand Up @@ -126,6 +130,7 @@ func handler(w http.ResponseWriter, r *http.Request) {
}
}

// [START gae_storage_write]
// [START write]
// createFile creates a file in Google Cloud Storage.
func (d *demo) createFile(fileName string) {
Expand Down Expand Up @@ -154,7 +159,9 @@ func (d *demo) createFile(fileName string) {
}

//[END write]
//[END gae_storage_write]

// [START gae_storage_read]
// [START read]
// readFile reads the named file in Google Cloud Storage.
func (d *demo) readFile(fileName string) {
Expand All @@ -181,7 +188,9 @@ func (d *demo) readFile(fileName string) {
}

//[END read]
//[END gae_storage_read]

// [START gae_storage_copy]
// [START copy]
// copyFile copies a file in Google Cloud Storage.
func (d *demo) copyFile(fileName string) {
Expand All @@ -199,6 +208,7 @@ func (d *demo) copyFile(fileName string) {
}

//[END copy]
//[END gae_storage_copy]

func (d *demo) dumpStats(obj *storage.ObjectAttrs) {
fmt.Fprintf(d.w, "(filename: /%v/%v, ", obj.Bucket, obj.Name)
Expand Down Expand Up @@ -239,6 +249,7 @@ func (d *demo) createListFiles() {
}
}

// [START gae_storage_list_bucket]
// [START list_bucket]
// listBucket lists the contents of a bucket in Google Cloud Storage.
func (d *demo) listBucket() {
Expand All @@ -260,6 +271,7 @@ func (d *demo) listBucket() {
}

//[END list_bucket]
//[END gae_storage_list_bucket]

func (d *demo) listDir(name, indent string) {
query := &storage.Query{Prefix: name, Delimiter: "/"}
Expand Down
Loading