gae: go.chromium.org/gae/service/info Index | Files | Directories

package info

import "go.chromium.org/gae/service/info"

Index

Package Files

context.go interface.go types.go

func AccessToken Uses

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 Uses

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

AddFilters adds RawInterface filters to the context.

func AppID Uses

func AppID(c context.Context) string

AppID returns the current App ID.

func Datacenter Uses

func Datacenter(c context.Context) string

Datacenter returns the current datacenter.

func DefaultVersionHostname Uses

func DefaultVersionHostname(c context.Context) string

DefaultVersionHostname returns the default version hostname.

func FullyQualifiedAppID Uses

func FullyQualifiedAppID(c context.Context) string

FullyQualifiedAppID returns the fully-qualified App ID.

func GetNamespace Uses

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 Uses

func InstanceID(c context.Context) string

InstanceID returns the current instance ID.

func IsDevAppServer Uses

func IsDevAppServer(c context.Context) bool

IsDevAppServer returns true if running on a development server.

func IsOverQuota Uses

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

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

func IsTimeoutError Uses

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

IsTimeoutError returns true if the supplied error indicates a timeout.

func ModuleHostname Uses

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

ModuleHostname returns the hostname of a module instance.

func ModuleName Uses

func ModuleName(c context.Context) string

ModuleName returns the current module name.

func MustNamespace Uses

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 Uses

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 Uses

func RequestID(c context.Context) string

RequestID returns the current request ID.

func ServerSoftware Uses

func ServerSoftware(c context.Context) string

ServerSoftware returns the AppEngine release version.

func ServiceAccount Uses

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

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

func Set Uses

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 Uses

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 Uses

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 Uses

func TrimmedAppID(c context.Context) string

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

func VersionID Uses

func VersionID(c context.Context) string

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

type Certificate Uses

type Certificate struct {
    KeyName string
    Data    []byte // PEM-encoded X.509 certificate
}

Certificate represents a public certificate for the app.

func PublicCertificates Uses

func PublicCertificates(c context.Context) ([]Certificate, error)

PublicCertificates retrieves the public certificates of the app.

type Factory Uses

type Factory func(context.Context) RawInterface

Factory is the function signature for factory methods compatible with SetFactory.

type Filter Uses

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 Uses

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 Uses

func Raw(c context.Context) RawInterface

Raw returns the current filtered RawInterface installed in the Context.

type Testable Uses

type Testable interface {
    SetVersionID(string) context.Context
    SetRequestID(string) context.Context
}

Testable is an additional set of functions for testing instrumentation.

func GetTestable Uses

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

PathSynopsis
supportPackage support provides Info-related support functionality.

Package info imports 3 packages (graph) and is imported by 98 packages. Updated 2018-09-15. Refresh now. Tools for package owners.