Documentation ¶
Index ¶
- func AccessToken(c context.Context, scopes ...string) (token string, expiry time.Time, err error)
- func AddFilters(c context.Context, filts ...Filter) context.Context
- func AppID(c context.Context) string
- func Datacenter(c context.Context) string
- func DefaultVersionHostname(c context.Context) string
- func FullyQualifiedAppID(c context.Context) string
- func GetNamespace(c context.Context) string
- func InstanceID(c context.Context) string
- func IsDevAppServer(c context.Context) bool
- func IsOverQuota(c context.Context, err error) bool
- func IsTimeoutError(c context.Context, err error) bool
- func ModuleHostname(c context.Context, module, version, instance string) (string, error)
- func ModuleName(c context.Context) string
- func MustNamespace(c context.Context, namespace string) context.Context
- func Namespace(c context.Context, namespace string) (context.Context, error)
- func RequestID(c context.Context) string
- func ServerSoftware(c context.Context) string
- func ServiceAccount(c context.Context) (string, error)
- func Set(c context.Context, gi RawInterface) context.Context
- func SetFactory(c context.Context, gif Factory) context.Context
- func SignBytes(c context.Context, bytes []byte) (keyName string, signature []byte, err error)
- func TrimmedAppID(c context.Context) string
- func VersionID(c context.Context) string
- type Certificate
- type Factory
- type Filter
- type RawInterface
- type Testable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AccessToken ¶
AccessToken generates an OAuth2 access token for the specified scopes on behalf of the current ServiceAccount.
func AddFilters ¶
AddFilters adds RawInterface filters to the context.
func Datacenter ¶
Datacenter returns the current datacenter.
func DefaultVersionHostname ¶
DefaultVersionHostname returns the default version hostname.
func FullyQualifiedAppID ¶
FullyQualifiedAppID returns the fully-qualified App ID.
func GetNamespace ¶
GetNamespace returns the current namespace. If the current namespace is the default namespace, GetNamespace will return an empty string.
func InstanceID ¶
InstanceID returns the current instance ID.
func IsDevAppServer ¶
IsDevAppServer returns true if running on a development server.
func IsOverQuota ¶
IsOverQuota returns true if the supplied error is an over quota error.
func IsTimeoutError ¶
IsTimeoutError returns true if the supplied error indicates a timeout.
func ModuleHostname ¶
ModuleHostname returns the hostname of a module instance.
func ModuleName ¶
ModuleName returns the current module name.
func MustNamespace ¶
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}$
func Namespace ¶
Namespace sets the current namespace. If the namespace is invalid or could not be set, an error will be returned.
func ServerSoftware ¶
ServerSoftware returns the AppEngine release version.
func ServiceAccount ¶
ServiceAccount returns the current service account name, in the form of an e-mail address.
func Set ¶
func Set(c context.Context, gi RawInterface) context.Context
Set sets the current RawInterface object in the context. Useful for testing with a quick mock. This is just a shorthand SetFactory invocation to set a factory which always returns the same object.
func SetFactory ¶
SetFactory sets the function to produce RawInterface instances, as returned by the Get method.
func TrimmedAppID ¶
TrimmedAppID gets the 'appid' portion of "foo.com:appid". This form can occur if you use
Types ¶
type Certificate ¶
Certificate represents a public certificate for the app.
func PublicCertificates ¶
func PublicCertificates(c context.Context) ([]Certificate, error)
PublicCertificates retrieves the public certificates of the app.
type Factory ¶
type Factory func(context.Context) RawInterface
Factory is the function signature for factory methods compatible with SetFactory.
type Filter ¶
type Filter func(context.Context, RawInterface) RawInterface
Filter is the function signature for a filter GI implementation. It gets the current GI implementation, and returns a new GI implementation backed by the one passed in.
type RawInterface ¶
type RawInterface interface { AppID() string FullyQualifiedAppID() string GetNamespace() string Datacenter() string DefaultVersionHostname() string InstanceID() string IsDevAppServer() bool IsOverQuota(err error) bool IsTimeoutError(err error) bool ModuleHostname(module, version, instance string) (string, error) ModuleName() string RequestID() string ServerSoftware() string ServiceAccount() (string, error) VersionID() string Namespace(namespace string) (context.Context, error) AccessToken(scopes ...string) (token string, expiry time.Time, err error) PublicCertificates() ([]Certificate, error) SignBytes(bytes []byte) (keyName string, signature []byte, err error) // Testable returns this RawInterface's Testing interface. Testing will // return nil if testing is not supported in this implementation. GetTestable() Testable }
RawInterface is the interface for all of the package methods which normally would be in the 'appengine' package.
func Raw ¶
func Raw(c context.Context) RawInterface
Raw returns the current filtered RawInterface installed in the Context.
type Testable ¶
type Testable interface { SetVersionID(string) context.Context SetRequestID(string) context.Context }
Testable is an additional set of functions for testing instrumentation.
func GetTestable ¶
GetTestable returns this Interface's Testing interface. Testing will return nil if testing is not supported in this implementation.