Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1153)

Unified Diff: service/info/interface.go

Issue 2062613002: Add TrimmedAppID to info service. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/gae@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: service/info/interface.go
diff --git a/service/info/interface.go b/service/info/interface.go
index 13bad8992324b3f49329be7b4e72f0a37d768a2b..d35b9329b0268521237ef585a98a68e1cc1e0d5e 100644
--- a/service/info/interface.go
+++ b/service/info/interface.go
@@ -10,9 +10,9 @@ import (
"golang.org/x/net/context"
)
-// Interface is the interface for all of the package methods which normally
+// RawInterface is the interface for all of the package methods which normally
// would be in the 'appengine' package.
-type Interface interface {
+type RawInterface interface {
AppID() string
FullyQualifiedAppID() string
GetNamespace() (string, bool)
@@ -31,7 +31,6 @@ type Interface interface {
VersionID() string
Namespace(namespace string) (context.Context, error)
- MustNamespace(namespace string) context.Context
AccessToken(scopes ...string) (token string, expiry time.Time, err error)
PublicCertificates() ([]Certificate, error)
@@ -42,6 +41,25 @@ type Interface interface {
Testable() Testable
}
+// Interface is the interface for all of the package methods which normally
+// would be in the 'appengine' package. This version adds a couple helper
+// functions on top of the RawInterface.
+type Interface interface {
+ RawInterface
+
+ // TrimmedAppID gets the 'appid' portion of "foo.com:appid". This form can
+ // occur if you use
+ TrimmedAppID() string
+
+ // MustNamespace is the same as Namespace, but will panic if there's an error.
+ // Since an error can only occur if namespace doesn't match the a regex this
+ // is valid to use if the namespace you're using is statically known, or known
+ // to conform to the regex. The regex in question is:
+ //
+ // ^[0-9A-Za-z._-]{0,100}$
+ MustNamespace(namespace string) context.Context
+}
+
// Testable is an additional set of functions for testing instrumentation.
type Testable interface {
SetVersionID(string) context.Context
« no previous file with comments | « service/info/context.go ('k') | service/info/wrapper.go » ('j') | service/info/wrapper.go » ('J')

Powered by Google App Engine
This is Rietveld 408576698