prod

package
Version: v0.0.0-...-8b7da69 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2020 License: Apache-2.0 Imports: 34 Imported by: 2

Documentation

Overview

Package prod provides an implementation of services/* which backs to AppEngine Classic (Go version <=1.11).

Index

Constants

This section is empty.

Variables

View Source
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 Use

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

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

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.

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

Directories

Path Synopsis
Package constraints contains production datastore constraints.
Package constraints contains production datastore constraints.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto