1// Copyright 2014 Google Inc. All rights reserved. 2// Use of this source code is governed by the Apache 2.0 3// license that can be found in the LICENSE file. 4 5// Package file provides helper functions for using Google Cloud Storage. 6package file 7 8import ( 9 "fmt" 10 11 "golang.org/x/net/context" 12 13 "google.golang.org/appengine/internal" 14 aipb "google.golang.org/appengine/internal/app_identity" 15) 16 17// DefaultBucketName returns the name of this application's 18// default Google Cloud Storage bucket. 19func DefaultBucketName(c context.Context) (string, error) { 20 req := &aipb.GetDefaultGcsBucketNameRequest{} 21 res := &aipb.GetDefaultGcsBucketNameResponse{} 22 23 err := internal.Call(c, "app_identity_service", "GetDefaultGcsBucketName", req, res) 24 if err != nil { 25 return "", fmt.Errorf("file: no default bucket name returned in RPC response: %v", err) 26 } 27 return res.GetDefaultGcsBucketName(), nil 28} 29