Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccessToken

func AccessToken(c context.Context, scopes ...string) (token string, expiry time.Time, err error)

    AccessToken generates an OAuth2 access token for the specified scopes on behalf of the current ServiceAccount.

    func AddFilters

    func AddFilters(c context.Context, filts ...Filter) context.Context

      AddFilters adds RawInterface filters to the context.

      func AppID

      func AppID(c context.Context) string

        AppID returns the current App ID.

        func Datacenter

        func Datacenter(c context.Context) string

          Datacenter returns the current datacenter.

          func DefaultVersionHostname

          func DefaultVersionHostname(c context.Context) string

            DefaultVersionHostname returns the default version hostname.

            func FullyQualifiedAppID

            func FullyQualifiedAppID(c context.Context) string

              FullyQualifiedAppID returns the fully-qualified App ID.

              func GetNamespace

              func GetNamespace(c context.Context) string

                GetNamespace returns the current namespace. If the current namespace is the default namespace, GetNamespace will return an empty string.

                func InstanceID

                func InstanceID(c context.Context) string

                  InstanceID returns the current instance ID.

                  func IsDevAppServer

                  func IsDevAppServer(c context.Context) bool

                    IsDevAppServer returns true if running on a development server.

                    func IsOverQuota

                    func IsOverQuota(c context.Context, err error) bool

                      IsOverQuota returns true if the supplied error is an over quota error.

                      func IsTimeoutError

                      func IsTimeoutError(c context.Context, err error) bool

                        IsTimeoutError returns true if the supplied error indicates a timeout.

                        func ModuleHostname

                        func ModuleHostname(c context.Context, module, version, instance string) (string, error)

                          ModuleHostname returns the hostname of a module instance.

                          func ModuleName

                          func ModuleName(c context.Context) string

                            ModuleName returns the current module name.

                            func MustNamespace

                            func MustNamespace(c context.Context, namespace string) context.Context

                              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

                              func Namespace(c context.Context, namespace string) (context.Context, error)

                                Namespace sets the current namespace. If the namespace is invalid or could not be set, an error will be returned.

                                func RequestID

                                func RequestID(c context.Context) string

                                  RequestID returns the current request ID.

                                  func ServerSoftware

                                  func ServerSoftware(c context.Context) string

                                    ServerSoftware returns the AppEngine release version.

                                    func ServiceAccount

                                    func ServiceAccount(c context.Context) (string, error)

                                      ServiceAccount returns the current service account name, in the form of an e-mail address.

                                      func Set

                                        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

                                        func SetFactory(c context.Context, gif Factory) context.Context

                                          SetFactory sets the function to produce RawInterface instances, as returned by the Get method.

                                          func SignBytes

                                          func SignBytes(c context.Context, bytes []byte) (keyName string, signature []byte, err error)

                                            SignBytes signs bytes using the application's unique private key.

                                            func TrimmedAppID

                                            func TrimmedAppID(c context.Context) string

                                              TrimmedAppID gets the 'appid' portion of "foo.com:appid". This form can occur if you use

                                              func VersionID

                                              func VersionID(c context.Context) string

                                                VersionID returns the version ID for the current application, in the form "X.Y".

                                                Types

                                                type Certificate

                                                type Certificate struct {
                                                	KeyName string
                                                	Data    []byte // PEM-encoded X.509 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

                                                        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

                                                            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

                                                              func GetTestable(c context.Context) Testable

                                                                GetTestable returns this Interface's Testing interface. Testing will return nil if testing is not supported in this implementation.

                                                                Directories

                                                                Path Synopsis
                                                                Package support provides Info-related support functionality.
                                                                Package support provides Info-related support functionality.