Documentation ¶
Overview ¶
Package prod provides an implementation of infra/gae/libs/wrapper which backs to appengine.
Index ¶
- Variables
- func AEContext(c context.Context) context.Context
- func AEContextNoTxn(c context.Context) context.Context
- func Use(c context.Context, r *http.Request) context.Context
- func UseBackground(c context.Context) context.Context
- func UseRemote(inOutCtx *context.Context, host string, client *http.Client) (err error)
- Bugs
Constants ¶
This section is empty.
Variables ¶
var RemoteAPIScopes = []string{
"https://www.googleapis.com/auth/appengine.apis",
"https://www.googleapis.com/auth/userinfo.email",
"https://www.googleapis.com/auth/cloud.platform",
}
RemoteAPIScopes is the set of OAuth2 scopes needed for Remote API access.
Functions ¶
func AEContext ¶
AEContext retrieves the raw "google.golang.org/appengine" compatible Context.
It also transfers deadline of `c` to AE context, since deadline is used for RPCs. Doesn't transfer cancelation ability though (since it's ignored by GAE anyway).
func AEContextNoTxn ¶
AEContextNoTxn retrieves the raw "google.golang.org/appengine" compatible Context that's not part of a transaction.
func Use ¶
Use adds production implementations for all the gae services to the context.
The services added are:
- github.com/luci-go/common/logging
- github.com/tetrafolium/gae/service/datastore
- github.com/tetrafolium/gae/service/info
- github.com/tetrafolium/gae/service/mail
- github.com/tetrafolium/gae/service/memcache
- github.com/tetrafolium/gae/service/module
- github.com/tetrafolium/gae/service/taskqueue
- github.com/tetrafolium/gae/service/urlfetch
- github.com/tetrafolium/gae/service/user
These can be retrieved with the <service>.Get functions.
The implementations are all backed by the real appengine SDK functionality,
func UseBackground ¶
UseBackground is the same as Use except that it activates production implementations which aren't associated with any particular request.
This is only available on Managed VMs.
func UseRemote ¶
UseRemote is the same as Use, except that it lets you attach a context to a remote host using the Remote API feature. See the docs for the prerequisites.
docs: https://cloud.google.com/appengine/docs/go/tools/remoteapi
inOutCtx will be replaced with the new, derived context, if err is nil, otherwise it's unchanged and continues to be safe-to-use.
If client is nil, this will use create a new client, and will try to be clever about it:
If you're creating a remote context FROM AppEngine, this will use urlfetch.Transport. This can be used to allow app-to-app remote_api control.
If host starts with "localhost", this will create a regular http.Client with a cookiejar, and call the _ah/login API to log in as an admin with the user "admin@example.com".
Otherwise, it will create a Google OAuth2 client with the following scopes:
Types ¶
This section is empty.
Notes ¶
Bugs ¶
*datastore.Key objects have their AppID dropped when this package
converts them internally to use with the underlying datastore. In practice this shouldn't be much of an issue, since you normally have no control over the AppID field of a Key anyway (aside from deserializing one directly from a proto).