| OLD | NEW | 
|---|
| 1 // Copyright 2015 The LUCI Authors. All rights reserved. | 1 // Copyright 2015 The LUCI Authors. All rights reserved. | 
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 | 
| 3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. | 
| 4 | 4 | 
| 5 package info | 5 package info | 
| 6 | 6 | 
| 7 import ( | 7 import ( | 
| 8         "time" | 8         "time" | 
| 9 | 9 | 
| 10         "golang.org/x/net/context" | 10         "golang.org/x/net/context" | 
| 11 ) | 11 ) | 
| 12 | 12 | 
| 13 // Interface is the interface for all of the package methods which normally | 13 // RawInterface is the interface for all of the package methods which normally | 
| 14 // would be in the 'appengine' package. | 14 // would be in the 'appengine' package. | 
| 15 type Interface interface { | 15 type RawInterface interface { | 
| 16         AppID() string | 16         AppID() string | 
| 17         FullyQualifiedAppID() string | 17         FullyQualifiedAppID() string | 
| 18         GetNamespace() (string, bool) | 18         GetNamespace() (string, bool) | 
| 19 | 19 | 
| 20         Datacenter() string | 20         Datacenter() string | 
| 21         DefaultVersionHostname() string | 21         DefaultVersionHostname() string | 
| 22         InstanceID() string | 22         InstanceID() string | 
| 23         IsDevAppServer() bool | 23         IsDevAppServer() bool | 
| 24         IsOverQuota(err error) bool | 24         IsOverQuota(err error) bool | 
| 25         IsTimeoutError(err error) bool | 25         IsTimeoutError(err error) bool | 
| 26         ModuleHostname(module, version, instance string) (string, error) | 26         ModuleHostname(module, version, instance string) (string, error) | 
| 27         ModuleName() string | 27         ModuleName() string | 
| 28         RequestID() string | 28         RequestID() string | 
| 29         ServerSoftware() string | 29         ServerSoftware() string | 
| 30         ServiceAccount() (string, error) | 30         ServiceAccount() (string, error) | 
| 31         VersionID() string | 31         VersionID() string | 
| 32 | 32 | 
| 33         Namespace(namespace string) (context.Context, error) | 33         Namespace(namespace string) (context.Context, error) | 
| 34         MustNamespace(namespace string) context.Context |  | 
| 35 | 34 | 
| 36         AccessToken(scopes ...string) (token string, expiry time.Time, err error
    ) | 35         AccessToken(scopes ...string) (token string, expiry time.Time, err error
    ) | 
| 37         PublicCertificates() ([]Certificate, error) | 36         PublicCertificates() ([]Certificate, error) | 
| 38         SignBytes(bytes []byte) (keyName string, signature []byte, err error) | 37         SignBytes(bytes []byte) (keyName string, signature []byte, err error) | 
| 39 | 38 | 
| 40         // Testable returns this Interface's Testable interface. Testing will re
    turn | 39         // Testable returns this Interface's Testable interface. Testing will re
    turn | 
| 41         // nil if testing is not supported in this implementation. | 40         // nil if testing is not supported in this implementation. | 
| 42         Testable() Testable | 41         Testable() Testable | 
| 43 } | 42 } | 
| 44 | 43 | 
|  | 44 // Interface is the interface for all of the package methods which normally | 
|  | 45 // would be in the 'appengine' package. This version adds a couple helper | 
|  | 46 // functions on top of the RawInterface. | 
|  | 47 type Interface interface { | 
|  | 48         RawInterface | 
|  | 49 | 
|  | 50         // TrimmedAppID gets the 'appid' portion of "foo.com:appid". This form c
    an | 
|  | 51         // occur if you use | 
|  | 52         TrimmedAppID() string | 
|  | 53 | 
|  | 54         // MustNamespace is the same as Namespace, but will panic if there's an 
    error. | 
|  | 55         // Since an error can only occur if namespace doesn't match the a regex 
    this | 
|  | 56         // is valid to use if the namespace you're using is statically known, or
     known | 
|  | 57         // to conform to the regex. The regex in question is: | 
|  | 58         // | 
|  | 59         //   ^[0-9A-Za-z._-]{0,100}$ | 
|  | 60         MustNamespace(namespace string) context.Context | 
|  | 61 } | 
|  | 62 | 
| 45 // Testable is an additional set of functions for testing instrumentation. | 63 // Testable is an additional set of functions for testing instrumentation. | 
| 46 type Testable interface { | 64 type Testable interface { | 
| 47         SetVersionID(string) context.Context | 65         SetVersionID(string) context.Context | 
| 48         SetRequestID(string) context.Context | 66         SetRequestID(string) context.Context | 
| 49 } | 67 } | 
| OLD | NEW | 
|---|