gae: go.chromium.org/gae/impl/prod Index | Files | Directories

package prod

import "go.chromium.org/gae/impl/prod"

Package prod provides an implementation of infra/gae/libs/wrapper which backs to appengine.

Index

Package Files

context.go context_vm.go datastore_key.go devserver.go doc.go info.go logger.go mail.go memcache.go module.go raw_datastore.go raw_datastore_type_converter.go taskqueue.go urlfetch.go user.go

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.

func Use Uses

func Use(c context.Context, r *http.Request) context.Context

Use adds production implementations for all the gae services to the context. The implementations are all backed by the real appengine SDK functionality.

The services added are:

- github.com/luci-go/common/logging
- go.chromium.org/gae/service/datastore
- go.chromium.org/gae/service/info
- go.chromium.org/gae/service/mail
- go.chromium.org/gae/service/memcache
- go.chromium.org/gae/service/module
- go.chromium.org/gae/service/taskqueue
- go.chromium.org/gae/service/urlfetch
- go.chromium.org/gae/service/user

These can be retrieved with the <service>.Get functions.

It is important to note that this DOES NOT install the AppEngine SDK into the supplied Context. In general, using the raw AppEngine SDK to access a service that is covered by luci/gae is dangerous, leading to a number of potential pitfalls including inconsistent transaction management and data corruption.

Users who wish to access the raw AppEngine SDK must derive their own AppEngine Context at their own risk.

func UseBackground Uses

func UseBackground(c context.Context) context.Context

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.

It is important to note that this DOES NOT install the AppEngine SDK into the supplied Context. See the warning in Use for more information.

func UseRemote Uses

func UseRemote(inOutCtx *context.Context, host string, client *http.Client) (err error)

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:
    - "https://www.googleapis.com/auth/appengine.apis"
    - "https://www.googleapis.com/auth/userinfo.email"
    - "https://www.googleapis.com/auth/cloud.platform"

It is important to note that this DOES NOT install the AppEngine SDK into the supplied Context. See the warning in Use for more information.

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).

Directories

PathSynopsis
constraintsPackage constraints contains production datastore constraints.

Package prod imports 34 packages (graph) and is imported by 2 packages. Updated 2018-08-15. Refresh now. Tools for package owners.